QEMU always configures a VGA card. If no video card is included in the libvirt XML, it is neccessary to explicitly turn off the default using -vga none * src/qemu/qemu_conf.c: Pass -vga none if no video card is configured * tests/qemuargv2xmltest.c, tests/qemuxml2argvtest.c: Test for handling -vga none. * tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args, tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml: Test data files --- src/qemu/qemu_conf.c | 25 +++++++++++++------ tests/qemuargv2xmltest.c | 1 + .../qemuxml2argv-nographics-vga.args | 1 + .../qemuxml2argv-nographics-vga.xml | 24 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b87b170..bb6e90f 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -89,8 +89,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "std", "cirrus", "vmware", - NULL, /* no arg needed for xen */ - NULL /* don't support vbox */); + "", /* no arg needed for xen */ + "" /* don't support vbox */); #define PROC_MOUNT_BUF_LEN 255 @@ -3447,7 +3447,7 @@ int qemudBuildCommandLine(virConnectPtr conn, /* nothing - vga has no effect on Xen pvfb */ } else { const char *vgastr = qemuVideoTypeToString(def->videos[0]->type); - if (!vgastr) { + if (!vgastr || STREQ(vgastr, "")) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, _("video type %s is not supported with QEMU"), virDomainVideoTypeToString(def->videos[0]->type)); @@ -3480,6 +3480,13 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + } else { + /* If we have -device, then we set -nodefault already */ + if (!(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) && + (qemuCmdFlags & QEMUD_CMD_FLAG_VGA)) { + ADD_ARG_LIT("-vga"); + ADD_ARG_LIT("none"); + } } /* Add sound hardware */ @@ -5017,11 +5024,13 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn, video = VIR_DOMAIN_VIDEO_TYPE_VGA; } else if (STREQ(arg, "-vga")) { WANT_VALUE(); - video = qemuVideoTypeFromString(val); - if (video < 0) { - qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - _("unknown video adapter type '%s'"), val); - goto error; + if (STRNEQ(val, "none")) { + video = qemuVideoTypeFromString(val); + if (video < 0) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + _("unknown video adapter type '%s'"), val); + goto error; + } } } else if (STREQ(arg, "-cpu")) { WANT_VALUE(); diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 7f62bac..8326c57 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -185,6 +185,7 @@ mymain(int argc, char **argv) DO_TEST("graphics-sdl", 0); DO_TEST("graphics-sdl-fullscreen", 0); + DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA); DO_TEST("input-usbmouse", 0); DO_TEST("input-usbtablet", 0); /* Can't rountrip xenner arch */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args new file mode 100644 index 0000000..b8f10bb --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args @@ -0,0 +1 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vga none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml new file mode 100644 index 0000000..533ea59 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml @@ -0,0 +1,24 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219200</memory> + <currentMemory>219200</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</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2a2387e..41e5749 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -252,6 +252,7 @@ mymain(int argc, char **argv) DO_TEST("graphics-sdl", 0); DO_TEST("graphics-sdl-fullscreen", 0); + DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA); DO_TEST("input-usbmouse", 0); DO_TEST("input-usbtablet", 0); DO_TEST("input-xen", QEMUD_CMD_FLAG_DOMID); -- 1.6.5.2 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list