提交 33a97578 编写于 作者: P Pavel Mores 提交者: Cole Robinson

qemu: the actual change of default video devide type selection algorithm

If a graphics device was added to XML that had no video device, libvirt
automatically added a video device which was always of type 'cirrus' on
x86_64, even if the underlying qemu didn't support cirrus.

This patch refines a bit the decision about the type of the video device.
Based on QEMU capabilities, cirrus is still preferred but only added if
QEMU supports it, otherwise VGA is used if supported by QEMU.  There is now
no fallback as libvirt only aspires to generate a basic working config and
leaves anything more specific up to higher-level management tools.
Reviewed-by: NCole Robinson <crobinso@redhat.com>
Signed-off-by: NPavel Mores <pmores@redhat.com>
上级 4a067e70
...@@ -7881,25 +7881,32 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net, ...@@ -7881,25 +7881,32 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net,
static int static int
qemuDomainDefaultVideoDevice(const virDomainDef *def) qemuDomainDefaultVideoDevice(const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{ {
if (ARCH_IS_PPC64(def->os.arch)) if (ARCH_IS_PPC64(def->os.arch)) {
return VIR_DOMAIN_VIDEO_TYPE_VGA; return VIR_DOMAIN_VIDEO_TYPE_VGA;
else if (qemuDomainIsARMVirt(def) || } else if (qemuDomainIsARMVirt(def) ||
qemuDomainIsRISCVVirt(def) || qemuDomainIsRISCVVirt(def) ||
ARCH_IS_S390(def->os.arch)) ARCH_IS_S390(def->os.arch)) {
return VIR_DOMAIN_VIDEO_TYPE_VIRTIO; return VIR_DOMAIN_VIDEO_TYPE_VIRTIO;
else } else {
return VIR_DOMAIN_VIDEO_TYPE_CIRRUS; if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA))
return VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA))
return VIR_DOMAIN_VIDEO_TYPE_VGA;
return VIR_DOMAIN_VIDEO_TYPE_DEFAULT;
}
} }
static int static int
qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video, qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video,
const virDomainDef *def) const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{ {
if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT)
video->type = qemuDomainDefaultVideoDevice(def); video->type = qemuDomainDefaultVideoDevice(def, qemuCaps);
if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL && if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
!video->vgamem) { !video->vgamem) {
...@@ -7993,7 +8000,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, ...@@ -7993,7 +8000,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
break; break;
case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_VIDEO:
ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def); ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qemuCaps);
break; break;
case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_PANIC:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册