mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Support <video> element for QEMU guests
* src/qemu_conf.c, src/qemu_conf.h: Use -vga or -std-vga when starting guests if video card is present * tests/qemuhelptest.c: Change to use constants instead of hardcoded hex numbers, and add VGA support * tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml, tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml, tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml, tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml, tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml, tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml: Add <video> element for testing graphics adapter * tests/qemuxml2argvtest.c: Add QEMUD_CMD_FLAG_VGA flag * tests/qemuxml2xmltest.c: Add missing graphics-vnc-sasl/tls tests
This commit is contained in:
parent
6b4d18c7b3
commit
ad6d5acb42
@ -78,6 +78,15 @@ VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAIN_DISK_CACHE_LAST,
|
||||
"writethrough",
|
||||
"writeback");
|
||||
|
||||
VIR_ENUM_DECL(qemuVideo)
|
||||
|
||||
VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
|
||||
"std",
|
||||
"cirrus",
|
||||
"vmware",
|
||||
NULL, /* no arg needed for xen */
|
||||
NULL /* don't support vbox */);
|
||||
|
||||
|
||||
int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
const char *filename) {
|
||||
@ -455,6 +464,8 @@ static unsigned int qemudComputeCmdFlags(const char *help,
|
||||
if (strstr(help, "format="))
|
||||
flags |= QEMUD_CMD_FLAG_DRIVE_FORMAT;
|
||||
}
|
||||
if (strstr(help, "-vga") && !strstr(help, "-std-vga"))
|
||||
flags |= QEMUD_CMD_FLAG_VGA;
|
||||
if (strstr(help, "boot=on"))
|
||||
flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
|
||||
if (version >= 9000)
|
||||
@ -1530,6 +1541,53 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
ADD_ARG_LIT("-full-screen");
|
||||
}
|
||||
|
||||
if (def->nvideos) {
|
||||
if (def->nvideos > 1) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("only one video card is currentely supported"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_VGA) {
|
||||
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) {
|
||||
/* nothing - vga has no effect on Xen pvfb */
|
||||
} else {
|
||||
const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
|
||||
if (!vgastr) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("video type %s is not supported with QEMU"),
|
||||
virDomainVideoTypeToString(def->videos[0]->type));
|
||||
goto error;
|
||||
}
|
||||
|
||||
ADD_ARG_LIT("-vga");
|
||||
ADD_ARG_LIT(vgastr);
|
||||
}
|
||||
} else {
|
||||
|
||||
switch (def->videos[0]->type) {
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VGA:
|
||||
ADD_ARG_LIT("-std-vga");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
|
||||
ADD_ARG_LIT("-vmwarevga");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VIDEO_TYPE_XEN:
|
||||
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
|
||||
/* No special args - this is the default */
|
||||
break;
|
||||
|
||||
default:
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("video type %s is not supported with QEMU"),
|
||||
virDomainVideoTypeToString(def->videos[0]->type));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add sound hardware */
|
||||
if (def->nsounds) {
|
||||
int size = 100;
|
||||
@ -2425,6 +2483,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
|
||||
char *path;
|
||||
int nnics = 0;
|
||||
const char **nics = NULL;
|
||||
int video = VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
|
||||
|
||||
if (!progargv[0]) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
@ -2802,6 +2861,18 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
|
||||
def->os.bootloader = strdup(val);
|
||||
if (!def->os.bootloader)
|
||||
goto no_memory;
|
||||
} else if (STREQ(arg, "-vmwarevga")) {
|
||||
video = VIR_DOMAIN_VIDEO_TYPE_VMVGA;
|
||||
} else if (STREQ(arg, "-std-vga")) {
|
||||
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;
|
||||
}
|
||||
} else if (STREQ(arg, "-domid")) {
|
||||
WANT_VALUE();
|
||||
/* ignore, generted on the fly */
|
||||
@ -2856,6 +2927,24 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
|
||||
def->graphics[def->ngraphics++] = sdl;
|
||||
}
|
||||
|
||||
if (def->ngraphics) {
|
||||
virDomainVideoDefPtr vid;
|
||||
if (VIR_ALLOC(vid) < 0)
|
||||
goto no_memory;
|
||||
if (def->virtType == VIR_DOMAIN_VIRT_XEN)
|
||||
vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN;
|
||||
else
|
||||
vid->type = video;
|
||||
vid->vram = virDomainVideoDefaultRAM(def, vid->type);
|
||||
vid->heads = 1;
|
||||
|
||||
if (VIR_REALLOC_N(def->videos, def->nvideos+1) < 0) {
|
||||
virDomainVideoDefFree(vid);
|
||||
goto no_memory;
|
||||
}
|
||||
def->videos[def->nvideos++] = vid;
|
||||
}
|
||||
|
||||
VIR_FREE(nics);
|
||||
|
||||
if (!def->name) {
|
||||
|
@ -57,6 +57,7 @@ enum qemud_cmd_flags {
|
||||
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 = (1 << 12), /* Is the cache= flag wanting new v2 values */
|
||||
QEMUD_CMD_FLAG_KVM = (1 << 13), /* Whether KVM is compiled in */
|
||||
QEMUD_CMD_FLAG_DRIVE_FORMAT = (1 << 14), /* Is -drive format= avail */
|
||||
QEMUD_CMD_FLAG_VGA = (1 << 15), /* Is -vga avail */
|
||||
};
|
||||
|
||||
/* Main driver state */
|
||||
|
@ -89,11 +89,67 @@ mymain(int argc, char **argv)
|
||||
ret = -1; \
|
||||
} while (0)
|
||||
|
||||
DO_TEST("qemu-0.9.1", 0x002f, 9001, 0, 0);
|
||||
DO_TEST("kvm-74", 0x633e, 9001, 1, 74);
|
||||
DO_TEST("qemu-0.10.5", 0x5c6f, 10005, 0, 0);
|
||||
DO_TEST("qemu-kvm-0.10.5", 0x7d7e, 10005, 1, 0);
|
||||
DO_TEST("kvm-86", 0x7d7e, 10050, 1, 0);
|
||||
DO_TEST("qemu-0.9.1",
|
||||
QEMUD_CMD_FLAG_KQEMU |
|
||||
QEMUD_CMD_FLAG_VNC_COLON |
|
||||
QEMUD_CMD_FLAG_NO_REBOOT |
|
||||
QEMUD_CMD_FLAG_DRIVE |
|
||||
QEMUD_CMD_FLAG_NAME,
|
||||
9001, 0, 0);
|
||||
DO_TEST("kvm-74",
|
||||
QEMUD_CMD_FLAG_VNC_COLON |
|
||||
QEMUD_CMD_FLAG_NO_REBOOT |
|
||||
QEMUD_CMD_FLAG_DRIVE |
|
||||
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
||||
QEMUD_CMD_FLAG_NAME |
|
||||
QEMUD_CMD_FLAG_VNET_HDR |
|
||||
QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO |
|
||||
QEMUD_CMD_FLAG_KVM |
|
||||
QEMUD_CMD_FLAG_DRIVE_FORMAT,
|
||||
9001, 1, 74);
|
||||
DO_TEST("qemu-0.10.5",
|
||||
QEMUD_CMD_FLAG_KQEMU |
|
||||
QEMUD_CMD_FLAG_VNC_COLON |
|
||||
QEMUD_CMD_FLAG_NO_REBOOT |
|
||||
QEMUD_CMD_FLAG_DRIVE |
|
||||
QEMUD_CMD_FLAG_NAME |
|
||||
QEMUD_CMD_FLAG_UUID |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
||||
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
||||
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
||||
QEMUD_CMD_FLAG_VGA,
|
||||
10005, 0, 0);
|
||||
DO_TEST("qemu-kvm-0.10.5",
|
||||
QEMUD_CMD_FLAG_VNC_COLON |
|
||||
QEMUD_CMD_FLAG_NO_REBOOT |
|
||||
QEMUD_CMD_FLAG_DRIVE |
|
||||
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
||||
QEMUD_CMD_FLAG_NAME |
|
||||
QEMUD_CMD_FLAG_UUID |
|
||||
QEMUD_CMD_FLAG_VNET_HDR |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
||||
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
||||
QEMUD_CMD_FLAG_KVM |
|
||||
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
||||
QEMUD_CMD_FLAG_VGA,
|
||||
10005, 1, 0);
|
||||
DO_TEST("kvm-86",
|
||||
QEMUD_CMD_FLAG_VNC_COLON |
|
||||
QEMUD_CMD_FLAG_NO_REBOOT |
|
||||
QEMUD_CMD_FLAG_DRIVE |
|
||||
QEMUD_CMD_FLAG_DRIVE_BOOT |
|
||||
QEMUD_CMD_FLAG_NAME |
|
||||
QEMUD_CMD_FLAG_UUID |
|
||||
QEMUD_CMD_FLAG_VNET_HDR |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP |
|
||||
QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC |
|
||||
QEMUD_CMD_FLAG_DRIVE_CACHE_V2 |
|
||||
QEMUD_CMD_FLAG_KVM |
|
||||
QEMUD_CMD_FLAG_DRIVE_FORMAT |
|
||||
QEMUD_CMD_FLAG_VGA,
|
||||
10050, 1, 0);
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/>
|
||||
<video>
|
||||
<model type='cirrus' vram='9216' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -1 +1 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test XAUTHORITY=/root/.Xauthority DISPLAY=:0.1 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test XAUTHORITY=/root/.Xauthority DISPLAY=:0.1 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -std-vga
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/>
|
||||
<video>
|
||||
<model type='vga' vram='9216' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -1 +1 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test SASL_CONF_DIR=/root/.sasl2 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3,sasl
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test SASL_CONF_DIR=/root/.sasl2 /usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3,sasl -vga cirrus
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'/>
|
||||
<video>
|
||||
<model type='cirrus' vram='9216' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'/>
|
||||
<video>
|
||||
<model type='cirrus' vram='9216' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'/>
|
||||
<video>
|
||||
<model type='cirrus' vram='9216' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -20,5 +20,8 @@
|
||||
</disk>
|
||||
<input type='mouse' bus='xen'/>
|
||||
<graphics type='vnc' port='5903' autoport='no' listen='127.0.0.1'/>
|
||||
<video>
|
||||
<model type='xen' vram='4096' heads='1'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -216,7 +216,7 @@ mymain(int argc, char **argv)
|
||||
|
||||
driver.vncSASL = 1;
|
||||
driver.vncSASLdir = strdup("/root/.sasl2");
|
||||
DO_TEST("graphics-vnc-sasl", 0);
|
||||
DO_TEST("graphics-vnc-sasl", QEMUD_CMD_FLAG_VGA);
|
||||
driver.vncTLS = 1;
|
||||
driver.vncTLSx509verify = 1;
|
||||
driver.vncTLSx509certdir = strdup("/etc/pki/tls/qemu");
|
||||
|
@ -102,6 +102,8 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("disk-drive-cache-v1-wb");
|
||||
DO_TEST("disk-drive-cache-v1-none");
|
||||
DO_TEST("graphics-vnc");
|
||||
DO_TEST("graphics-vnc-sasl");
|
||||
DO_TEST("graphics-vnc-tls");
|
||||
DO_TEST("graphics-sdl");
|
||||
DO_TEST("graphics-sdl-fullscreen");
|
||||
DO_TEST("input-usbmouse");
|
||||
|
Loading…
x
Reference in New Issue
Block a user