remove post validation of rbd device

once we map the rbd image on a node
we will get the device name its mapped
in the map output itself,no need to
check the devicepath post rbd  mapping

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-08-06 12:16:56 +05:30 committed by mergify[bot]
parent 0063727199
commit 7c2fb6187a

View File

@ -269,10 +269,8 @@ func createPath(volOpt *rbdVolume, cr *util.Credentials) (string, error) {
klog.V(5).Infof("rbd: map mon %s", volOpt.Monitors) klog.V(5).Infof("rbd: map mon %s", volOpt.Monitors)
useNBD := false
cmdName := rbd cmdName := rbd
if volOpt.Mounter == rbdTonbd && hasNBD { if volOpt.Mounter == rbdTonbd && hasNBD {
useNBD = true
cmdName = rbdTonbd cmdName = rbdTonbd
} }
@ -282,15 +280,7 @@ func createPath(volOpt *rbdVolume, cr *util.Credentials) (string, error) {
klog.Warningf("rbd: map error %v, rbd output: %s", err, string(output)) klog.Warningf("rbd: map error %v, rbd output: %s", err, string(output))
return "", fmt.Errorf("rbd: map failed %v, rbd output: %s", err, string(output)) return "", fmt.Errorf("rbd: map failed %v, rbd output: %s", err, string(output))
} }
devicePath, found := waitForPath(volOpt.Pool, image, 10, useNBD) devicePath := strings.TrimSuffix(string(output), "\n")
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 return devicePath, nil
} }