Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Adding a fallback for device name when rbd map does not return device…
Browse files Browse the repository at this point in the history
… but no error.
  • Loading branch information
Damian Martinez committed Jun 3, 2016
1 parent abb84bd commit b386e95
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,13 @@ func (d *cephRBDVolumeDriver) goceph_renameRBDImage(pool, name, newname string)

// mapImage will map the RBD Image to a kernel device
func (d *cephRBDVolumeDriver) mapImage(pool, imagename string) (string, error) {
return d.rbdsh(pool, "map", imagename)
device, err := d.rbdsh(pool, "map", imagename)
// NOTE: ubuntu rbd map seems to not return device. if no error, assume "default" /dev/rbd/<pool>/<image> device
if device == "" && err == nil {
device = fmt.Sprintf("/dev/rbd/%s/%s", pool, imagename)
}

return device, err
}

// unmapImageDevice will release the mapped kernel device
Expand Down

0 comments on commit b386e95

Please sign in to comment.