mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-29 17:50:23 +00:00
Merge pull request #506 from Madhu-1/unmap
unmap rbd volume if we fail to get devicepath
This commit is contained in:
commit
fde2a666ef
@ -284,6 +284,11 @@ func createPath(volOpt *rbdVolume, cr *util.Credentials) (string, error) {
|
||||
}
|
||||
devicePath, found := waitForPath(volOpt.Pool, image, 10, useNBD)
|
||||
if !found {
|
||||
output, err := execCommand(cmdName, []string{
|
||||
"unmap", imagePath, "--id", cr.ID, "-m", volOpt.Monitors, "--keyfile=" + cr.KeyFile})
|
||||
if err != nil {
|
||||
klog.Warningf("rbd: unmap error %v, rbd output: %s", err, string(output))
|
||||
}
|
||||
return "", fmt.Errorf("could not map image %s, Timeout after 10s", imagePath)
|
||||
}
|
||||
return devicePath, nil
|
||||
|
Loading…
Reference in New Issue
Block a user