提交 e579f530 编写于 作者: J Jonathon Jongsma 提交者: Ján Tomko

qemu: add 'bochs' video display type

Update schema and configuration to allow specifying new video type of
'bochs'. Add implementation and tests for qemu.
Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 086c19d6
...@@ -6990,8 +6990,9 @@ qemu-kvm -net nic,model=? /dev/null ...@@ -6990,8 +6990,9 @@ qemu-kvm -net nic,model=? /dev/null
attribute which takes the value "vga", "cirrus", "vmvga", "xen", attribute which takes the value "vga", "cirrus", "vmvga", "xen",
"vbox", "qxl" (<span class="since">since 0.8.6</span>), "vbox", "qxl" (<span class="since">since 0.8.6</span>),
"virtio" (<span class="since">since 1.3.0</span>), "virtio" (<span class="since">since 1.3.0</span>),
"gop" (<span class="since">since 3.2.0</span>), or "gop" (<span class="since">since 3.2.0</span>),
"none" (<span class="since">since 4.6.0</span>) "none" (<span class="since">since 4.6.0</span>, or "bochs"
(<span class="since">since 5.6.0</span>)
depending on the hypervisor features available. depending on the hypervisor features available.
The purpose of the type <code>none</code> is to instruct libvirt not The purpose of the type <code>none</code> is to instruct libvirt not
to add a default video device in the guest (see the paragraph above). to add a default video device in the guest (see the paragraph above).
......
...@@ -3584,6 +3584,7 @@ ...@@ -3584,6 +3584,7 @@
<value>virtio</value> <value>virtio</value>
<value>gop</value> <value>gop</value>
<value>none</value> <value>none</value>
<value>bochs</value>
</choice> </choice>
</attribute> </attribute>
<group> <group>
......
...@@ -738,6 +738,7 @@ VIR_ENUM_IMPL(virDomainVideo, ...@@ -738,6 +738,7 @@ VIR_ENUM_IMPL(virDomainVideo,
"virtio", "virtio",
"gop", "gop",
"none", "none",
"bochs",
); );
VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_ENUM_IMPL(virDomainVideoVGAConf,
...@@ -15166,6 +15167,9 @@ virDomainVideoDefaultRAM(const virDomainDef *def, ...@@ -15166,6 +15167,9 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
return 16 * 1024; return 16 * 1024;
break; break;
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
return 16 * 1024;
case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_XEN:
/* Original Xen PVFB hardcoded to 4 MB */ /* Original Xen PVFB hardcoded to 4 MB */
return 4 * 1024; return 4 * 1024;
......
...@@ -1385,6 +1385,7 @@ typedef enum { ...@@ -1385,6 +1385,7 @@ typedef enum {
VIR_DOMAIN_VIDEO_TYPE_VIRTIO, VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
VIR_DOMAIN_VIDEO_TYPE_GOP, VIR_DOMAIN_VIDEO_TYPE_GOP,
VIR_DOMAIN_VIDEO_TYPE_NONE, VIR_DOMAIN_VIDEO_TYPE_NONE,
VIR_DOMAIN_VIDEO_TYPE_BOCHS,
VIR_DOMAIN_VIDEO_TYPE_LAST VIR_DOMAIN_VIDEO_TYPE_LAST
} virDomainVideoType; } virDomainVideoType;
......
...@@ -111,6 +111,7 @@ VIR_ENUM_IMPL(qemuVideo, ...@@ -111,6 +111,7 @@ VIR_ENUM_IMPL(qemuVideo,
"", /* no need for virtio */ "", /* no need for virtio */
"" /* don't support gop */, "" /* don't support gop */,
"" /* 'none' doesn't make sense here */, "" /* 'none' doesn't make sense here */,
"bochs-display",
); );
VIR_ENUM_DECL(qemuDeviceVideo); VIR_ENUM_DECL(qemuDeviceVideo);
...@@ -128,6 +129,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo, ...@@ -128,6 +129,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo,
"virtio-vga", "virtio-vga",
"" /* don't support gop */, "" /* don't support gop */,
"" /* 'none' doesn't make sense here */, "" /* 'none' doesn't make sense here */,
"bochs-display",
); );
VIR_ENUM_DECL(qemuDeviceVideoSecondary); VIR_ENUM_DECL(qemuDeviceVideoSecondary);
...@@ -145,6 +147,7 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, ...@@ -145,6 +147,7 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary,
"virtio-gpu", "virtio-gpu",
"" /* don't support gop */, "" /* don't support gop */,
"" /* 'none' doesn't make sense here */, "" /* 'none' doesn't make sense here */,
"" /* no secondary device for bochs */,
); );
VIR_ENUM_DECL(qemuSoundCodec); VIR_ENUM_DECL(qemuSoundCodec);
...@@ -4754,6 +4757,9 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, ...@@ -4754,6 +4757,9 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM))) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM))) {
if (video->vram) if (video->vram)
virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024); virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024);
} else if (video->type == VIR_DOMAIN_VIDEO_TYPE_BOCHS) {
if (video->vram)
virBufferAsprintf(&buf, ",vgamem=%uk", video->vram);
} }
if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)
......
...@@ -4960,6 +4960,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) ...@@ -4960,6 +4960,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
case VIR_DOMAIN_VIDEO_TYPE_VMVGA: case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
case VIR_DOMAIN_VIDEO_TYPE_QXL: case VIR_DOMAIN_VIDEO_TYPE_QXL:
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
case VIR_DOMAIN_VIDEO_TYPE_LAST: case VIR_DOMAIN_VIDEO_TYPE_LAST:
break; break;
} }
......
...@@ -931,6 +931,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, ...@@ -931,6 +931,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
return pciFlags; return pciFlags;
case VIR_DOMAIN_VIDEO_TYPE_BOCHS:
return pcieFlags;
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
case VIR_DOMAIN_VIDEO_TYPE_GOP: case VIR_DOMAIN_VIDEO_TYPE_GOP:
case VIR_DOMAIN_VIDEO_TYPE_NONE: case VIR_DOMAIN_VIDEO_TYPE_NONE:
......
LC_ALL=C \
PATH=/bin \
HOME=/tmp/lib/domain--1-QEMUGuest1 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-i686 \
-name guest=QEMUGuest1,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,\
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-m 1024 \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-boot strict=on \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\
id=drive-ide0-0-0,cache=none \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1,\
write-cache=on \
-device bochs-display,id=video0,vgamem=16384k,bus=pci.0,addr=0x2 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-i686</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
<video>
<model type='bochs' vram='16384' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
</domain>
...@@ -2028,6 +2028,7 @@ mymain(void) ...@@ -2028,6 +2028,7 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_VGA, QEMU_CAPS_DEVICE_VIRTIO_VGA,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS); QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
DO_TEST_CAPS_LATEST("video-bochs-display-device");
DO_TEST("video-none-device", DO_TEST("video-none-device",
QEMU_CAPS_VNC); QEMU_CAPS_VNC);
DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE); DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册