diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 7c3f826be171..4c3fc56b6843 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -332,7 +332,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv private static final String KVMCLOCK = "kvmclock"; private static final String HYPERVCLOCK = "hypervclock"; private static final String WINDOWS = "Windows"; - private static final String X86_DEFAULT_VIDEO_MODEL = "vga"; + private static final VideoDef.VideoModel X86_DEFAULT_VIDEO_MODEL = VideoDef.VideoModel.VGA; private static final int X86_DEFAULT_VIDEO_RAM_KIB = 32768; private static final String Q35 = "q35"; private static final String PTY = "pty"; @@ -3352,26 +3352,35 @@ protected ConsoleDef createConsoleDef() { protected VideoDef createVideoDef(VirtualMachineTO vmTO) { Map details = vmTO.getDetails(); - String videoHw = this.videoHw; + VideoDef.VideoModel videoModel = VideoDef.VideoModel.fromString(this.videoHw); + if (videoModel == null && StringUtils.isNotBlank(this.videoHw)) { + LOGGER.warn("Ignoring unsupported video model '{}' from {}", this.videoHw, AgentProperties.VM_VIDEO_HARDWARE.getName()); + } int videoRam = this.videoRam; if (details != null) { if (details.containsKey(VmDetailConstants.VIDEO_HARDWARE)) { - videoHw = details.get(VmDetailConstants.VIDEO_HARDWARE); + String requested = details.get(VmDetailConstants.VIDEO_HARDWARE); + VideoDef.VideoModel requestedModel = VideoDef.VideoModel.fromString(requested); + if (requestedModel != null) { + videoModel = requestedModel; + } else { + LOGGER.warn("Ignoring unsupported {} '{}' of VM {}", VmDetailConstants.VIDEO_HARDWARE, requested, vmTO.getName()); + } } if (details.containsKey(VmDetailConstants.VIDEO_RAM)) { String value = details.get(VmDetailConstants.VIDEO_RAM); videoRam = NumbersUtil.parseInt(value, videoRam); } } - if (StringUtils.isBlank(videoHw) && isGuestX86(vmTO)) { + if (videoModel == null && isGuestX86(vmTO)) { // With no