This is preferrable to -nographic which (in addition to disabling
graphics output) redirects the serial port to stdio and on OpenBIOS
enables the firmware's serial console.
Signed-off-by: Paolo Bonzini <pbonzini(a)redhat.com>
---
src/qemu/qemu_command.c | 7 ++++-
src/qemu/qemu_parse_command.c | 4 +++
.../qemuargv2xml-nographics-vga-display.args | 23 +++++++++++++++
.../qemuargv2xml-nographics-vga-display.xml | 34 ++++++++++++++++++++++
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-nographics-display.args | 22 ++++++++++++++
.../qemuxml2argv-nographics-display.xml | 25 ++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
tests/qemuxml2xmltest.c | 2 +-
9 files changed, 118 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.args
create mode 100644 tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-display.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-display.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3898ed7..68ee313 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9210,7 +9210,12 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
* these defaults ourselves...
*/
if (!def->ngraphics) {
- virCommandAddArg(cmd, "-nographic");
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISPLAY)) {
+ virCommandAddArg(cmd, "-display");
+ virCommandAddArg(cmd, "none");
+ } else {
+ virCommandAddArg(cmd, "-nographic");
+ }
if (cfg->nogfxAllowHostAudio)
virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 9ee262b..09bd09a 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -2039,6 +2039,10 @@ qemuParseCommandLine(virCapsPtr caps,
def->virtType = VIR_DOMAIN_VIRT_KVM;
} else if (STREQ(arg, "-nographic")) {
nographics = true;
+ } else if (STREQ(arg, "-display")) {
+ WANT_VALUE();
+ if (STREQ(val, "none"))
+ nographics = true;
} else if (STREQ(arg, "-full-screen")) {
fullscreen = true;
} else if (STREQ(arg, "-localtime")) {
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.args
b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.args
new file mode 100644
index 0000000..423c078
--- /dev/null
+++ b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.args
@@ -0,0 +1,23 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=ide,bus=0,unit=0 \
+-net none \
+-serial none \
+-parallel none \
+-vga none
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.xml
b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.xml
new file mode 100644
index 0000000..9beaf06
--- /dev/null
+++ b/tests/qemuargv2xmldata/qemuargv2xml-nographics-vga-display.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>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'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 55dda01..a709c72 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -232,6 +232,7 @@ mymain(void)
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("nographics-vga");
+ DO_TEST("nographics-vga-display");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
DO_TEST("misc-acpi");
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.args
b/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.args
new file mode 100644
index 0000000..c13735a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.xml
b/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.xml
new file mode 100644
index 0000000..2d0fbb4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-nographics-display.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>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'
target='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 6c526da..518b667 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -923,6 +923,8 @@ mymain(void)
DO_TEST("graphics-sdl", QEMU_CAPS_SDL);
DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL);
DO_TEST("nographics", NONE);
+ DO_TEST("nographics-display",
+ QEMU_CAPS_DISPLAY);
DO_TEST("nographics-vga",
QEMU_CAPS_VGA_NONE);
DO_TEST("graphics-spice",
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index af69709..ae328c2 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -448,7 +448,7 @@ mymain(void)
DO_TEST("graphics-spice-auto-socket-cfg");
cfg->spiceAutoUnixSocket = false;
- DO_TEST("nographics-vga");
+ DO_TEST_FULL("nographics-vga", WHEN_BOTH, GIC_NONE, QEMU_CAPS_DISPLAY);
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
DO_TEST("misc-acpi");
--
2.7.4