qemu: generate -display none

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@redhat.com>
This commit is contained in:
Paolo Bonzini 2016-07-05 14:35:28 +02:00 committed by Michal Privoznik
parent ca57b5d60c
commit 7a97676b96
9 changed files with 118 additions and 2 deletions

View File

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

View File

@ -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")) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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