提交 febc5916 编写于 作者: D Daniel P. Berrange

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
上级 4f6c9990
......@@ -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();
......
......@@ -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 */
......
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
<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>
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册