mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-19 11:30:24 +00:00
Fix nil err cause nbd fail to mount
This commit is contained in:
parent
027331c186
commit
1e8fa38879
@ -176,13 +176,14 @@ func getnbdDevicePath(nbdPath, imgPath string, count int) (string, error) {
|
|||||||
// rbd-nbd map pool/image ...
|
// rbd-nbd map pool/image ...
|
||||||
if len(cmdlineArgs) < 3 || cmdlineArgs[0] != rbdTonbd || cmdlineArgs[1] != "map" {
|
if len(cmdlineArgs) < 3 || cmdlineArgs[0] != rbdTonbd || cmdlineArgs[1] != "map" {
|
||||||
klog.V(4).Infof("nbd device %s is not used by rbd", nbdPath)
|
klog.V(4).Infof("nbd device %s is not used by rbd", nbdPath)
|
||||||
return "", err
|
return "", fmt.Errorf("nbd device %s is not used by rbd", nbdPath)
|
||||||
|
|
||||||
}
|
}
|
||||||
if cmdlineArgs[2] != imgPath {
|
if cmdlineArgs[2] != imgPath {
|
||||||
klog.V(4).Infof("rbd-nbd device %s did not match expected image path: %s with path found: %s",
|
klog.V(4).Infof("rbd-nbd device %s did not match expected image path: %s with path found: %s",
|
||||||
nbdPath, imgPath, cmdlineArgs[2])
|
nbdPath, imgPath, cmdlineArgs[2])
|
||||||
return "", err
|
return "", fmt.Errorf("rbd-nbd device %s did not match expected image path: %s with path found: %s",
|
||||||
|
nbdPath, imgPath, cmdlineArgs[2])
|
||||||
}
|
}
|
||||||
devicePath := path.Join("/dev", "nbd"+strconv.Itoa(count))
|
devicePath := path.Join("/dev", "nbd"+strconv.Itoa(count))
|
||||||
if _, err := os.Lstat(devicePath); err != nil {
|
if _, err := os.Lstat(devicePath); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user