Pass -vga none if no video card specified

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
This commit is contained in:
Daniel P. Berrange 2009-12-21 22:38:05 +00:00
parent 4f6c999006
commit febc591683
5 changed files with 44 additions and 8 deletions

View File

@ -89,8 +89,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"std", "std",
"cirrus", "cirrus",
"vmware", "vmware",
NULL, /* no arg needed for xen */ "", /* no arg needed for xen */
NULL /* don't support vbox */); "" /* don't support vbox */);
#define PROC_MOUNT_BUF_LEN 255 #define PROC_MOUNT_BUF_LEN 255
@ -3448,7 +3448,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
/* nothing - vga has no effect on Xen pvfb */ /* nothing - vga has no effect on Xen pvfb */
} else { } else {
const char *vgastr = qemuVideoTypeToString(def->videos[0]->type); const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
if (!vgastr) { if (!vgastr || STREQ(vgastr, "")) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("video type %s is not supported with QEMU"), _("video type %s is not supported with QEMU"),
virDomainVideoTypeToString(def->videos[0]->type)); virDomainVideoTypeToString(def->videos[0]->type));
@ -3481,6 +3481,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
goto error; 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 */ /* Add sound hardware */
@ -5018,11 +5025,13 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
video = VIR_DOMAIN_VIDEO_TYPE_VGA; video = VIR_DOMAIN_VIDEO_TYPE_VGA;
} else if (STREQ(arg, "-vga")) { } else if (STREQ(arg, "-vga")) {
WANT_VALUE(); WANT_VALUE();
video = qemuVideoTypeFromString(val); if (STRNEQ(val, "none")) {
if (video < 0) { video = qemuVideoTypeFromString(val);
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, if (video < 0) {
_("unknown video adapter type '%s'"), val); qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
goto error; _("unknown video adapter type '%s'"), val);
goto error;
}
} }
} else if (STREQ(arg, "-cpu")) { } else if (STREQ(arg, "-cpu")) {
WANT_VALUE(); WANT_VALUE();

View File

@ -185,6 +185,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl", 0); DO_TEST("graphics-sdl", 0);
DO_TEST("graphics-sdl-fullscreen", 0); DO_TEST("graphics-sdl-fullscreen", 0);
DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA);
DO_TEST("input-usbmouse", 0); DO_TEST("input-usbmouse", 0);
DO_TEST("input-usbtablet", 0); DO_TEST("input-usbtablet", 0);
/* Can't rountrip xenner arch */ /* Can't rountrip xenner arch */

View File

@ -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

View File

@ -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>

View File

@ -252,6 +252,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl", 0); DO_TEST("graphics-sdl", 0);
DO_TEST("graphics-sdl-fullscreen", 0); DO_TEST("graphics-sdl-fullscreen", 0);
DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA);
DO_TEST("input-usbmouse", 0); DO_TEST("input-usbmouse", 0);
DO_TEST("input-usbtablet", 0); DO_TEST("input-usbtablet", 0);
DO_TEST("input-xen", QEMUD_CMD_FLAG_DOMID); DO_TEST("input-xen", QEMUD_CMD_FLAG_DOMID);