fix(hostdeployer): Umount VDDKDisk when IRootFsDriver is nil

This commit is contained in:
Rain
2020-01-16 21:19:16 +08:00
parent 3e9915523f
commit ea1e9c75fa
+7 -1
View File
@@ -140,7 +140,8 @@ func (vd *VDDKDisk) Disconnect() bool {
}
func (vd *VDDKDisk) MountRootfs() fsdriver.IRootFsDriver {
if err := vd.Mount(); err == nil {
var err error
if err = vd.Mount(); err == nil {
for _, mntPath := range vd.PartDirs {
part := newVDDKPartition(mntPath)
if fs := guestfs.DetectRootFs(part); fs != nil {
@@ -149,6 +150,11 @@ func (vd *VDDKDisk) MountRootfs() fsdriver.IRootFsDriver {
}
}
}
if err != nil {
log.Errorf("VDDKDisk Mount failed: %s", err)
}
// something is wrong
vd.UmountRootfs(nil)
return nil
}