diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index bbb4a3f3d6..afa6b3e696 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -78,6 +78,15 @@ VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAIN_DISK_CACHE_LAST,
"writethrough",
"writeback");
+VIR_ENUM_DECL(qemuVideo)
+
+VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
+ "std",
+ "cirrus",
+ "vmware",
+ NULL, /* no arg needed for xen */
+ NULL /* don't support vbox */);
+
int qemudLoadDriverConfig(struct qemud_driver *driver,
const char *filename) {
@@ -455,6 +464,8 @@ static unsigned int qemudComputeCmdFlags(const char *help,
if (strstr(help, "format="))
flags |= QEMUD_CMD_FLAG_DRIVE_FORMAT;
}
+ if (strstr(help, "-vga") && !strstr(help, "-std-vga"))
+ flags |= QEMUD_CMD_FLAG_VGA;
if (strstr(help, "boot=on"))
flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
if (version >= 9000)
@@ -1530,6 +1541,53 @@ int qemudBuildCommandLine(virConnectPtr conn,
ADD_ARG_LIT("-full-screen");
}
+ if (def->nvideos) {
+ if (def->nvideos > 1) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("only one video card is currentely supported"));
+ goto error;
+ }
+
+ if (qemuCmdFlags & QEMUD_CMD_FLAG_VGA) {
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) {
+ /* nothing - vga has no effect on Xen pvfb */
+ } else {
+ const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
+ if (!vgastr) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("video type %s is not supported with QEMU"),
+ virDomainVideoTypeToString(def->videos[0]->type));
+ goto error;
+ }
+
+ ADD_ARG_LIT("-vga");
+ ADD_ARG_LIT(vgastr);
+ }
+ } else {
+
+ switch (def->videos[0]->type) {
+ case VIR_DOMAIN_VIDEO_TYPE_VGA:
+ ADD_ARG_LIT("-std-vga");
+ break;
+
+ case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+ ADD_ARG_LIT("-vmwarevga");
+ break;
+
+ case VIR_DOMAIN_VIDEO_TYPE_XEN:
+ case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+ /* No special args - this is the default */
+ break;
+
+ default:
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("video type %s is not supported with QEMU"),
+ virDomainVideoTypeToString(def->videos[0]->type));
+ goto error;
+ }
+ }
+ }
+
/* Add sound hardware */
if (def->nsounds) {
int size = 100;
@@ -2425,6 +2483,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
char *path;
int nnics = 0;
const char **nics = NULL;
+ int video = VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
if (!progargv[0]) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
@@ -2802,6 +2861,18 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
def->os.bootloader = strdup(val);
if (!def->os.bootloader)
goto no_memory;
+ } else if (STREQ(arg, "-vmwarevga")) {
+ video = VIR_DOMAIN_VIDEO_TYPE_VMVGA;
+ } else if (STREQ(arg, "-std-vga")) {
+ 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;
+ }
} else if (STREQ(arg, "-domid")) {
WANT_VALUE();
/* ignore, generted on the fly */
@@ -2856,6 +2927,24 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
def->graphics[def->ngraphics++] = sdl;
}
+ if (def->ngraphics) {
+ virDomainVideoDefPtr vid;
+ if (VIR_ALLOC(vid) < 0)
+ goto no_memory;
+ if (def->virtType == VIR_DOMAIN_VIRT_XEN)
+ vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN;
+ else
+ vid->type = video;
+ vid->vram = virDomainVideoDefaultRAM(def, vid->type);
+ vid->heads = 1;
+
+ if (VIR_REALLOC_N(def->videos, def->nvideos+1) < 0) {
+ virDomainVideoDefFree(vid);
+ goto no_memory;
+ }
+ def->videos[def->nvideos++] = vid;
+ }
+
VIR_FREE(nics);
if (!def->name) {
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index c0ed46dd97..9065821668 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -57,6 +57,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 = (1 << 12), /* Is the cache= flag wanting new v2 values */
QEMUD_CMD_FLAG_KVM = (1 << 13), /* Whether KVM is compiled in */
QEMUD_CMD_FLAG_DRIVE_FORMAT = (1 << 14), /* Is -drive format= avail */
+ QEMUD_CMD_FLAG_VGA = (1 << 15), /* Is -vga avail */
};
/* Main driver state */
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index bf8a293f0f..73eae542df 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -89,11 +89,67 @@ mymain(int argc, char **argv)
ret = -1; \
} while (0)
- DO_TEST("qemu-0.9.1", 0x002f, 9001, 0, 0);
- DO_TEST("kvm-74", 0x633e, 9001, 1, 74);
- DO_TEST("qemu-0.10.5", 0x5c6f, 10005, 0, 0);
- DO_TEST("qemu-kvm-0.10.5", 0x7d7e, 10005, 1, 0);
- DO_TEST("kvm-86", 0x7d7e, 10050, 1, 0);
+ DO_TEST("qemu-0.9.1",
+ QEMUD_CMD_FLAG_KQEMU |
+ QEMUD_CMD_FLAG_VNC_COLON |
+ QEMUD_CMD_FLAG_NO_REBOOT |
+ QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_NAME,
+ 9001, 0, 0);
+ DO_TEST("kvm-74",
+ QEMU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AG_NO_REBOOT |
+ QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_DRIVE_BOOT |
+ QEMUD_CMD_FLAG_NAME |
+ QEMUD_CMD_FLAG_UUID |
+ QEMUD_CMD_FLAG_VNET_HDR |
+ QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
+ QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
+ QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
+ QEMUD_CMD_FLAG_KVM |
+ QEMUD_CMD_FLAG_DRIVE_FORMAT |
+ QEMUD_CMD_FLAG_VGA,
+ 10050, 1, 0);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
index fe1fe1acaf..f3fc5889e2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
index 3b2b0497e5..f908252bf0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test XAUTHORITY=/root/.Xauthority DISPLAY=:0.1 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test XAUTHORITY=/root/.Xauthority DISPLAY=:0.1 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -std-vga
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
index 1e04f12071..431c3c98b2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args
index a41a57cf83..bd63540ede 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args
@@ -1 +1 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test SASL_CONF_DIR=/root/.sasl2 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3,sasl
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test SASL_CONF_DIR=/root/.sasl2 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3,sasl -vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
index cbaa1dac08..b6f99d327b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
index cbaa1dac08..b6f99d327b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
index cbaa1dac08..b6f99d327b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
index 1e80317c43..fea7f8edd2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml
@@ -20,5 +20,8 @@
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 28609ebe27..2a93018b42 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -216,7 +216,7 @@ mymain(int argc, char **argv)
driver.vncSASL = 1;
driver.vncSASLdir = strdup("/root/.sasl2");
- DO_TEST("graphics-vnc-sasl", 0);
+ DO_TEST("graphics-vnc-sasl", QEMUD_CMD_FLAG_VGA);
driver.vncTLS = 1;
driver.vncTLSx509verify = 1;
driver.vncTLSx509certdir = strdup("/etc/pki/tls/qemu");
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index ab9943d6ec..7db76118c6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -102,6 +102,8 @@ mymain(int argc, char **argv)
DO_TEST("disk-drive-cache-v1-wb");
DO_TEST("disk-drive-cache-v1-none");
DO_TEST("graphics-vnc");
+ DO_TEST("graphics-vnc-sasl");
+ DO_TEST("graphics-vnc-tls");
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("input-usbmouse");