mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
cephfs/volume: fixed incorrect path for unmountAndRemove
This commit is contained in:
parent
5ee0751c31
commit
9cd0786569
@ -71,9 +71,7 @@ func createVolume(volOptions *volumeOptions, adminCr *credentials, volID volumeI
|
|||||||
return fmt.Errorf("error mounting ceph root: %v", err)
|
return fmt.Errorf("error mounting ceph root: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer unmountAndRemove(cephRoot)
|
||||||
umountAndRemove(cephRoot)
|
|
||||||
}()
|
|
||||||
|
|
||||||
volOptions.RootPath = getVolumeRootPathCeph(volID)
|
volOptions.RootPath = getVolumeRootPathCeph(volID)
|
||||||
localVolRoot := getCephRootVolumePathLocal(volID)
|
localVolRoot := getCephRootVolumePathLocal(volID)
|
||||||
@ -123,9 +121,7 @@ func purgeVolume(volID volumeID, adminCr *credentials, volOptions *volumeOptions
|
|||||||
return fmt.Errorf("error mounting ceph root: %v", err)
|
return fmt.Errorf("error mounting ceph root: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer unmountAndRemove(cephRoot)
|
||||||
umountAndRemove(volRoot)
|
|
||||||
}()
|
|
||||||
|
|
||||||
if err := os.Rename(volRoot, volRootDeleting); err != nil {
|
if err := os.Rename(volRoot, volRootDeleting); err != nil {
|
||||||
return fmt.Errorf("coudln't mark volume %s for deletion: %v", volID, err)
|
return fmt.Errorf("coudln't mark volume %s for deletion: %v", volID, err)
|
||||||
@ -138,7 +134,7 @@ func purgeVolume(volID volumeID, adminCr *credentials, volOptions *volumeOptions
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func umountAndRemove(mountPoint string) {
|
func unmountAndRemove(mountPoint string) {
|
||||||
var err error
|
var err error
|
||||||
if err = unmountVolume(mountPoint); err != nil {
|
if err = unmountVolume(mountPoint); err != nil {
|
||||||
klog.Errorf("failed to unmount %s with error %s", mountPoint, err)
|
klog.Errorf("failed to unmount %s with error %s", mountPoint, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user