qemu: Use -vga none only if it is supported

Commit febc591683 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.
This commit is contained in:
Jiri Denemark 2010-12-08 14:45:00 +01:00
parent 6f7c6f8c1f
commit 2cfb107905
6 changed files with 51 additions and 10 deletions

View File

@ -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"))
if (strstr(p, "|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);
}

View File

@ -103,6 +103,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 */

View File

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

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

View File

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

View File

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