]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Pass -vga none if no video card specified
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 21 Dec 2009 22:38:05 +0000 (22:38 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 18 Jan 2010 13:55:57 +0000 (13:55 +0000)
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
tests/qemuargv2xmltest.c
tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index b68a8a4c0eb928b84506e01929cc24ed04f4d691..3321fbf5e2f0776a6cd1d7cd12af6f2fc4b26e70 100644 (file)
@@ -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
 
@@ -3448,7 +3448,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));
@@ -3481,6 +3481,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 */
@@ -5018,11 +5025,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();
index 7f62baccc0d87a08009aa76f067ce432447cf24f..8326c57560eae943dd1d5c491a94bde1065a8e99 100644 (file)
@@ -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 (file)
index 0000000..b8f10bb
--- /dev/null
@@ -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 (file)
index 0000000..533ea59
--- /dev/null
@@ -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>
index 2a2387ed266549d2e014d51d34fa590fa1afaf3e..41e5749fb094bb91af8697747049f06ef61f19c3 100644 (file)
@@ -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);