diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 1afa29f811..8ce64e1970 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -1848,7 +1848,7 @@ func (manager *SGuestManager) validateCreateData( input.Machine = api.VM_MACHINE_TYPE_Q35 } - if imageDiskFormat != "iso" { + if imageDiskFormat != imageapi.IMAGE_DISK_FORMAT_ISO { var imgSupportUEFI *bool var imgSupportBIOS *bool if desc, ok := imgProperties[imageapi.IMAGE_UEFI_SUPPORT]; ok { @@ -1886,6 +1886,15 @@ func (manager *SGuestManager) validateCreateData( input.Bios = "BIOS" } } + } else { + if input.Bios == "" { + // if ISO support uefi and not specified boot mode + // set default boot mode uefi + if desc, ok := imgProperties[imageapi.IMAGE_UEFI_SUPPORT]; ok && desc == "true" { + input.Bios = "UEFI" + } + } + } if len(imgProperties) == 0 { diff --git a/pkg/image/models/image_ceph_cache_storages.go b/pkg/image/models/image_ceph_cache_storages.go index 9b2e7f1c34..0e2e09e6fb 100644 --- a/pkg/image/models/image_ceph_cache_storages.go +++ b/pkg/image/models/image_ceph_cache_storages.go @@ -32,8 +32,9 @@ func GetRegionCephStorages() (map[string]*computeapi.RbdStorageConf, error) { q := struct { Scope string `json:"scope"` StorageType string `json:"storage_type"` + Brand string `json:"brand"` }{ - "system", computeapi.STORAGE_RBD, + "system", computeapi.STORAGE_RBD, computeapi.ONECLOUD_BRAND_ONECLOUD, } res, err := compute.Storages.List(auth.GetAdminSession(context.Background(), options.Options.Region), jsonutils.Marshal(q))