fix(esxi): Fix GetDriver and add driver log for vdisk.

In GetDriver, return 'name' directly if driverMap is empty.
This commit is contained in:
rainzm
2020-05-15 20:38:45 +08:00
parent 33184357bf
commit 81ffd582f6
2 changed files with 6 additions and 2 deletions

View File

@@ -795,7 +795,8 @@ func (self *SHost) DoCreateVM(ctx context.Context, ds *SDatastore, params SCreat
index = ideIdx % 2
ideIdx += 1
}
log.Debugf("size: %d, image path: %s, uuid: %s, index: %d, ctrlKey: %d", size, imagePath, uuid, index, ctrlKey)
log.Debugf("size: %d, image path: %s, uuid: %s, index: %d, ctrlKey: %d, driver: %s.", size, imagePath, uuid,
index, ctrlKey, disk.Driver)
spec := addDevSpec(NewDiskDev(size, imagePath, uuid, int32(index), 2000, int32(ctrlKey)))
spec.FileOperation = "create"
deviceChange = append(deviceChange, spec)

View File

@@ -270,7 +270,10 @@ func (disk *SVirtualDisk) GetDriver() string {
controller := disk.vm.getVdev(disk.getControllerKey())
name := controller.GetDriver()
name = strings.Replace(name, "controller", "", -1)
return driverMap[name]
if driver, ok := driverMap[name]; ok {
return driver
}
return name
}
func (disk *SVirtualDisk) GetCacheMode() string {