Commit febc591683cf51e4551f8bcf3ce279a776056e1c introduced -vga none in
case no video card is included in domain XML. However, old qemu
versions do not support this and such domain cannot be successfully
started.
---
src/qemu/qemu_conf.c | 10 ++++++-
src/qemu/qemu_conf.h | 1 +
tests/qemuhelptest.c | 18 +++++++++----
.../qemuxml2argvdata/qemuxml2argv-nographics.args | 1 +
tests/qemuxml2argvdata/qemuxml2argv-nographics.xml | 25 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 ++-
6 files changed, 50 insertions(+), 9 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics.xml
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e5d0206..d5e72cd 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1220,6 +1220,7 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
unsigned int kvm_version)
{
unsigned long long flags = 0;
+ const char *p;
if (strstr(help, "-no-kqemu"))
flags |= QEMUD_CMD_FLAG_KQEMU;
@@ -1252,11 +1253,15 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
if (strstr(help, "readonly="))
flags |= QEMUD_CMD_FLAG_DRIVE_READONLY;
}
- if (strstr(help, "-vga") && !strstr(help, "-std-vga")) {
+ if ((p = strstr(help, "-vga")) && !strstr(help,
"-std-vga")) {
+ const char *nl = strstr(p, "\n");
+
flags |= QEMUD_CMD_FLAG_VGA;
if (strstr(help, "|qxl"))
flags |= QEMUD_CMD_FLAG_VGA_QXL;
+ if ((p = strstr(p, "|none")) && p < nl)
+ flags |= QEMUD_CMD_FLAG_VGA_NONE;
}
if (strstr(help, "-spice"))
flags |= QEMUD_CMD_FLAG_SPICE;
@@ -5192,7 +5197,8 @@ qemudBuildCommandLine(virConnectPtr conn,
} else {
/* If we have -device, then we set -nodefault already */
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
- (qemuCmdFlags & QEMUD_CMD_FLAG_VGA))
+ (qemuCmdFlags & QEMUD_CMD_FLAG_VGA) &&
+ (qemuCmdFlags & QEMUD_CMD_FLAG_VGA_NONE))
virCommandAddArgList(cmd, "-vga", "none", NULL);
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 71318bf..2d0314c 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -101,6 +101,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_SMBIOS_TYPE = (1LL << 44), /* Is -smbios type= available */
QEMUD_CMD_FLAG_VGA_QXL = (1LL << 45), /* The 'qxl' arg for
'-vga' */
QEMUD_CMD_FLAG_SPICE = (1LL << 46), /* Is -spice avail */
+ QEMUD_CMD_FLAG_VGA_NONE = (1LL << 47), /* The 'none' arg for
'-vga' */
};
/* Main driver state */
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 5339ec8..f3b6537 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -173,7 +173,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_ENABLE_KVM |
QEMUD_CMD_FLAG_SDL |
QEMUD_CMD_FLAG_RTC_TD_HACK |
- QEMUD_CMD_FLAG_NO_HPET,
+ QEMUD_CMD_FLAG_NO_HPET |
+ QEMUD_CMD_FLAG_VGA_NONE,
10005, 0, 0);
DO_TEST("qemu-kvm-0.10.5",
QEMUD_CMD_FLAG_VNC_COLON |
@@ -198,7 +199,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_NO_HPET |
QEMUD_CMD_FLAG_NO_KVM_PIT |
QEMUD_CMD_FLAG_TDF |
- QEMUD_CMD_FLAG_NESTING,
+ QEMUD_CMD_FLAG_NESTING |
+ QEMUD_CMD_FLAG_VGA_NONE,
10005, 1, 0);
DO_TEST("kvm-86",
QEMUD_CMD_FLAG_VNC_COLON |
@@ -223,7 +225,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_NO_KVM_PIT |
QEMUD_CMD_FLAG_TDF |
QEMUD_CMD_FLAG_NESTING |
- QEMUD_CMD_FLAG_SMBIOS_TYPE,
+ QEMUD_CMD_FLAG_SMBIOS_TYPE |
+ QEMUD_CMD_FLAG_VGA_NONE,
10050, 1, 0);
DO_TEST("qemu-kvm-0.11.0-rc2",
QEMUD_CMD_FLAG_VNC_COLON |
@@ -253,7 +256,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_BOOT_MENU |
QEMUD_CMD_FLAG_NESTING |
QEMUD_CMD_FLAG_NAME_PROCESS |
- QEMUD_CMD_FLAG_SMBIOS_TYPE,
+ QEMUD_CMD_FLAG_SMBIOS_TYPE |
+ QEMUD_CMD_FLAG_VGA_NONE,
10092, 1, 0);
DO_TEST("qemu-0.12.1",
QEMUD_CMD_FLAG_VNC_COLON |
@@ -281,7 +285,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_NO_HPET |
QEMUD_CMD_FLAG_BOOT_MENU |
QEMUD_CMD_FLAG_NAME_PROCESS |
- QEMUD_CMD_FLAG_SMBIOS_TYPE,
+ QEMUD_CMD_FLAG_SMBIOS_TYPE |
+ QEMUD_CMD_FLAG_VGA_NONE,
12001, 0, 0);
DO_TEST("qemu-kvm-0.12.3",
QEMUD_CMD_FLAG_VNC_COLON |
@@ -316,7 +321,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_BOOT_MENU |
QEMUD_CMD_FLAG_NESTING |
QEMUD_CMD_FLAG_NAME_PROCESS |
- QEMUD_CMD_FLAG_SMBIOS_TYPE,
+ QEMUD_CMD_FLAG_SMBIOS_TYPE |
+ QEMUD_CMD_FLAG_VGA_NONE,
12003, 1, 0);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics.args
b/tests/qemuxml2argvdata/qemuxml2argv-nographics.args
new file mode 100644
index 0000000..0d3ef6f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics.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
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics.xml
b/tests/qemuxml2argvdata/qemuxml2argv-nographics.xml
new file mode 100644
index 0000000..ed91e37
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics.xml
@@ -0,0 +1,25 @@
+<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'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5fe91f1..662f7bb 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -325,7 +325,9 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl", 0, false);
DO_TEST("graphics-sdl-fullscreen", 0, false);
- DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA, false);
+ DO_TEST("nographics", QEMUD_CMD_FLAG_VGA, false);
+ DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA |
+ QEMUD_CMD_FLAG_VGA_NONE, false);
DO_TEST("graphics-spice",
QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_VGA_QXL |
QEMUD_CMD_FLAG_DEVICE | QEMUD_CMD_FLAG_SPICE, false);
--
1.7.3.3