mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #13677 from swordqiu/hotfix/qj-server-inherit-image-vdi-property
fix: server inherit the vdi_protocol of image property
This commit is contained in:
@@ -61,6 +61,7 @@ type ImageOptionalOptions struct {
|
||||
NetDriver string `help:"Preferred network driver" choices:"virtio|e1000|vmxnet3"`
|
||||
DisableUsbKbd bool `help:"Disable usb keyboard on this image(for hypervisor kvm)"`
|
||||
BootMode string `help:"UEFI support" choices:"UEFI|BIOS"`
|
||||
VdiProtocol string `help:"VDI protocol" choices:"vnc|spice"`
|
||||
}
|
||||
|
||||
func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDict, args ImageOptionalOptions) error {
|
||||
@@ -146,6 +147,9 @@ func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDi
|
||||
} else if args.BootMode == "BIOS" {
|
||||
params.Add(jsonutils.JSONFalse, "properties", "uefi_support")
|
||||
}
|
||||
if len(args.VdiProtocol) > 0 {
|
||||
params.Add(jsonutils.NewString(args.VdiProtocol), "properties", "vdi_protocol")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ const (
|
||||
IMAGE_PARTITION_TYPE = "partition_type"
|
||||
IMAGE_INSTALLED_CLOUDINIT = "installed_cloud_init"
|
||||
IMAGE_DISABLE_USB_KBD = "disable_usb_kbd"
|
||||
IMAGE_VDI_PROTOCOL = "vdi_protocol"
|
||||
|
||||
IMAGE_STATUS_UPDATING = "updating"
|
||||
)
|
||||
|
||||
@@ -1332,6 +1332,9 @@ func (manager *SGuestManager) validateCreateData(
|
||||
}
|
||||
input.DisableUsbKbd = imgProperties[imageapi.IMAGE_DISABLE_USB_KBD] == "true"
|
||||
|
||||
if vdi, ok := imgProperties[imageapi.IMAGE_VDI_PROTOCOL]; ok && len(vdi) > 0 {
|
||||
input.Vdi = vdi
|
||||
}
|
||||
osType := input.OsType
|
||||
osProf, err = osprofile.GetOSProfileFromImageProperties(imgProperties, hypervisor)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user