Check if path exists before performing unmount

This commit is contained in:
rkouj
2017-01-11 14:27:22 -08:00
parent 330c922706
commit 32766e3b6d
9 changed files with 76 additions and 23 deletions

View File

@@ -413,6 +413,12 @@ func (c *rbdUnmounter) TearDown() error {
}
func (c *rbdUnmounter) TearDownAt(dir string) error {
if pathExists, pathErr := volutil.PathExists(dir); pathErr != nil {
return fmt.Errorf("Error checking if path exists: %v", pathErr)
} else if !pathExists {
glog.Warningf("Warning: Unmount skipped because path does not exist: %v", dir)
return nil
}
return diskTearDown(c.manager, *c, dir, c.mounter)
}