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 47db06ef4d
commit 9cb95cfc0a
2 changed files with 6 additions and 2 deletions

View File

@@ -756,7 +756,8 @@ func (self *SHost) DoCreateVM(ctx context.Context, ds *SDatastore, data *jsonuti
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

@@ -268,7 +268,10 @@ func (disk *SVirtualDisk) GetDriver() string {
"lsilogic": "scsi",
"lsilogicsas": "scsi",
}
return mapping[name]
if driver, ok := mapping[name]; ok {
return driver
}
return name
}
func (disk *SVirtualDisk) GetCacheMode() string {