[libvirt] [0/3] Rebased patches for SPICE graphics support

This is a rebase of the 4 RHEL specific patches posted last sptember by Dan Berrange (but with patch 3 and 4 merged). It's actually a rebase from the gitorious spice set from Dan http://www.redhat.com/archives/libvir-list/2009-September/msg00865.html -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Author: Daniel P. Berrange <berrange@redhat.com> Add a QXL graphics card type to domain XML schema * src/qemu_conf.c: Add dummy entry in enumeration * docs/schemas/domain.rng: Add 'qxl' as a type for the <video> tag * src/domain_conf.c, src/domain_conf.h: Add QXL to video type enumerations diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index bb6d00d..e01843b 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -880,10 +880,8 @@ </element> </define> <!-- - A graphic description, currently in Xen only 2 types are supported: - - sdl with optional display, xauth and fullscreen - - vnc with a required port and optional listen IP address, password - and keymap + A video adapter description, allowing configuration of device + model, number of virtual heads, and video ram size --> <define name="video"> <element name="video"> @@ -896,6 +894,7 @@ <value>vmvga</value> <value>xen</value> <value>vbox</value> + <value>qxl</value> </choice> </attribute> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 306776d..f00bbe7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -184,7 +184,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "cirrus", "vmvga", "xen", - "vbox") + "vbox", + "qxl") VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST, "mouse", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0b79e88..4ba8eed 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -388,6 +388,7 @@ enum virDomainVideoType { VIR_DOMAIN_VIDEO_TYPE_VMVGA, VIR_DOMAIN_VIDEO_TYPE_XEN, VIR_DOMAIN_VIDEO_TYPE_VBOX, + VIR_DOMAIN_VIDEO_TYPE_QXL, VIR_DOMAIN_VIDEO_TYPE_LAST }; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3d83a8f..0b91d68 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -90,7 +90,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "cirrus", "vmware", "", /* no arg needed for xen */ - "" /* don't support vbox */); + "", /* don't support vbox */ + "" /* XQL not implemented yet */); int qemudLoadDriverConfig(struct qemud_driver *driver, const char *filename) { -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2010/2/5 Daniel Veillard <veillard@redhat.com>:
Author: Daniel P. Berrange <berrange@redhat.com>
Add a QXL graphics card type to domain XML schema
* src/qemu_conf.c: Add dummy entry in enumeration * docs/schemas/domain.rng: Add 'qxl' as a type for the <video> tag * src/domain_conf.c, src/domain_conf.h: Add QXL to video type enumerations
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 3d83a8f..0b91d68 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -90,7 +90,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "cirrus", "vmware", "", /* no arg needed for xen */ - "" /* don't support vbox */); + "", /* don't support vbox */ + "" /* XQL not implemented yet */);
Typo here, but that is fixed in a later patch. ACK. Matthias

Author: Daniel P. Berrange <berrange@redhat.com> Add a <graphics> type for SPICE protocol This adds an element <graphics type='spice' port='5903' tlsPort='5904' listen='127.0.0.1'/> This is the bare minimum that should be exposed in the guest config for SPICE. Other parameters are better handled as per host level configuration tunables * docs/schemas/domain.rng: Define the SPICE <graphics> schema * src/domain_conf.h, src/domain_conf.c: Add parsing and formatting for SPICE graphics config * src/qemu_conf.c: Complain about unsupported graphics types diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index e01843b..227f410 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -821,6 +821,36 @@ </group> <group> <attribute name="type"> + <value>spice</value> + </attribute> + <optional> + <attribute name="port"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="tlsPort"> + <ref name="PortNumber"/> + </attribute> + </optional> + <optional> + <attribute name="listen"> + <ref name="addrIP"/> + </attribute> + </optional> + <optional> + <attribute name="passwd"> + <text/> + </attribute> + </optional> + <optional> + <attribute name="keymap"> + <text/> + </attribute> + </optional> + </group> + <group> + <attribute name="type"> <value>rdp</value> </attribute> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f00bbe7..9ab3f68 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -200,7 +200,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, "sdl", "vnc", "rdp", - "desktop") + "desktop", + "spice") VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST, "subsystem", @@ -346,6 +347,12 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: VIR_FREE(def->data.desktop.display); break; + + case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + VIR_FREE(def->data.spice.listenAddr); + VIR_FREE(def->data.spice.keymap); + VIR_FREE(def->data.spice.passwd); + break; } VIR_FREE(def); @@ -2466,6 +2473,38 @@ virDomainGraphicsDefParseXML(virConnectPtr conn, def->data.desktop.fullscreen = 0; def->data.desktop.display = virXMLPropString(node, "display"); + } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + char *port = virXMLPropString(node, "port"); + char *tlsPort; + + if (port) { + if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("cannot parse spice port %s"), port); + VIR_FREE(port); + goto error; + } + VIR_FREE(port); + } else { + def->data.spice.port = 5900; + } + + tlsPort = virXMLPropString(node, "tlsPort"); + if (tlsPort) { + if (virStrToLong_i(tlsPort, NULL, 10, &def->data.spice.tlsPort) < 0) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("cannot parse spice tlsPort %s"), tlsPort); + VIR_FREE(tlsPort); + goto error; + } + VIR_FREE(tlsPort); + } else { + def->data.spice.tlsPort = 0; + } + + def->data.spice.listenAddr = virXMLPropString(node, "listen"); + def->data.spice.passwd = virXMLPropString(node, "passwd"); + def->data.spice.keymap = virXMLPropString(node, "keymap"); } cleanup: @@ -5205,6 +5244,30 @@ virDomainGraphicsDefFormat(virConnectPtr conn, break; + case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + if (def->data.spice.port) + virBufferVSprintf(buf, " port='%d'", + def->data.spice.port); + + if (def->data.spice.tlsPort) + virBufferVSprintf(buf, " tlsPort='%d'", + def->data.spice.tlsPort); + + if (def->data.spice.listenAddr) + virBufferVSprintf(buf, " listen='%s'", + def->data.spice.listenAddr); + + if (def->data.spice.keymap) + virBufferEscapeString(buf, " keymap='%s'", + def->data.spice.keymap); + + if (def->data.spice.passwd && + (flags & VIR_DOMAIN_XML_SECURE)) + virBufferEscapeString(buf, " passwd='%s'", + def->data.spice.passwd); + + break; + } virBufferAddLit(buf, "/>\n"); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4ba8eed..b6491bc 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -418,6 +418,7 @@ enum virDomainGraphicsType { VIR_DOMAIN_GRAPHICS_TYPE_VNC, VIR_DOMAIN_GRAPHICS_TYPE_RDP, VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP, + VIR_DOMAIN_GRAPHICS_TYPE_SPICE, VIR_DOMAIN_GRAPHICS_TYPE_LAST, }; @@ -450,6 +451,13 @@ struct _virDomainGraphicsDef { char *display; unsigned int fullscreen :1; } desktop; + struct { + int port; + int tlsPort; + char *listenAddr; + char *keymap; + char *passwd; + } spice; } data; }; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 0b91d68..4baf218 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -3791,6 +3791,12 @@ int qemudBuildCommandLine(virConnectPtr conn, } } + if (def->ngraphics > 1) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("only one graphics output is currently supported")); + goto error; + } + if ((def->ngraphics == 1) && def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBuffer opt = VIR_BUFFER_INITIALIZER; @@ -3887,6 +3893,9 @@ int qemudBuildCommandLine(virConnectPtr conn, * default, since the default changes :-( */ if (qemuCmdFlags & QEMUD_CMD_FLAG_SDL) ADD_ARG_LIT("-sdl"); + } else if (def->ngraphics) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + "%s", _("unsupported graphics output requested")); } if (def->nvideos) { -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2010/2/5 Daniel Veillard <veillard@redhat.com>:
Author: Daniel P. Berrange <berrange@redhat.com>
Add a <graphics> type for SPICE protocol
This adds an element
<graphics type='spice' port='5903' tlsPort='5904' listen='127.0.0.1'/>
This is the bare minimum that should be exposed in the guest config for SPICE. Other parameters are better handled as per host level configuration tunables
* docs/schemas/domain.rng: Define the SPICE <graphics> schema * src/domain_conf.h, src/domain_conf.c: Add parsing and formatting for SPICE graphics config * src/qemu_conf.c: Complain about unsupported graphics types
ACK. Matthias

Comments for commit grabbed from gitorious and apparently not updated as this commit now inclides the spice activating code and tests too... Daniel Author: Daniel P. Berrange <berrange@redhat.com> Implement RHEL-5.4 KVM QXL support in QEMU driver This supports the -qxl argument in RHEL-5's fork of KVM which has SPICE support. QXL is a graphics card, but inexplicably doesn't use the standard -vga syntax for generic configuration. Also -qxl is rather useless unless you also supply -spice (coming in next patch) * src/qemu_conf.c: Probe for -qxl arg in QEMU help. Format a -qxl arg for launching VMs * src/qemu_conf.h: Add flag for -qxl arg availability * tests/qemuhelpdata/kvm-83-rhel, tests/qemuhelptest.c: test for -qxl arg help parsing * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: add tests for -qxl graphics XML to ARGV handling diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 4baf218..dff39a0 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -91,7 +91,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "vmware", "", /* no arg needed for xen */ "", /* don't support vbox */ - "" /* XQL not implemented yet */); + "" /* qxl is a bizarre special case */); int qemudLoadDriverConfig(struct qemud_driver *driver, const char *filename) { @@ -1141,6 +1141,10 @@ static unsigned int qemudComputeCmdFlags(const char *help, } if (strstr(help, "-vga") && !strstr(help, "-std-vga")) flags |= QEMUD_CMD_FLAG_VGA; + if (strstr(help, "-spice")) + flags |= QEMUD_CMD_FLAG_SPICE; + if (strstr(help, "-qxl")) + flags |= QEMUD_CMD_FLAG_QXL; if (strstr(help, "boot=on")) flags |= QEMUD_CMD_FLAG_DRIVE_BOOT; if (strstr(help, "serial=s")) @@ -3893,6 +3897,44 @@ int qemudBuildCommandLine(virConnectPtr conn, * default, since the default changes :-( */ if (qemuCmdFlags & QEMUD_CMD_FLAG_SDL) ADD_ARG_LIT("-sdl"); + } else if ((def->ngraphics == 1) && + def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { + virBuffer opt = VIR_BUFFER_INITIALIZER; + char *optstr; + + if (!(qemuCmdFlags & QEMUD_CMD_FLAG_SPICE)) { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", + _("spice graphics are not supported with this QEMU")); + goto error; + } + + virBufferVSprintf(&opt, "port=%u", def->graphics[0]->data.spice.port); + + if (def->graphics[0]->data.spice.tlsPort) + virBufferVSprintf(&opt, ",sport=%u", + def->graphics[0]->data.spice.tlsPort); + + if (def->graphics[0]->data.spice.listenAddr) + virBufferVSprintf(&opt, ",host=%s", + def->graphics[0]->data.spice.listenAddr); + + if (virBufferError(&opt)) + goto no_memory; + + optstr = virBufferContentAndReset(&opt); + + ADD_ARG_LIT("-spice"); + ADD_ARG(optstr); + if (def->graphics[0]->data.spice.keymap) { + ADD_ARG_LIT("-k"); + ADD_ARG_LIT(def->graphics[0]->data.spice.keymap); + } + /* SPICE includes native support for tunnelling audio, so we + * set the audio backend to none, to prevent it opening the + * host OS audio devices since that causes security issues + * and is non-sensical when using SPICE. + */ + ADD_ENV_LIT("QEMU_AUDIO_DRV=none"); } else if (def->ngraphics) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("unsupported graphics output requested")); @@ -3906,9 +3948,15 @@ int qemudBuildCommandLine(virConnectPtr conn, } if (qemuCmdFlags & QEMUD_CMD_FLAG_VGA) { - if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) { + switch (def->videos[0]->type) { + case VIR_DOMAIN_VIDEO_TYPE_XEN: /* nothing - vga has no effect on Xen pvfb */ - } else { + break; + case VIR_DOMAIN_VIDEO_TYPE_QXL: + /* handle later */ + break; + default: + { const char *vgastr = qemuVideoTypeToString(def->videos[0]->type); if (!vgastr || STREQ(vgastr, "")) { qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, @@ -3919,6 +3967,8 @@ int qemudBuildCommandLine(virConnectPtr conn, ADD_ARG_LIT("-vga"); ADD_ARG_LIT(vgastr); + break; + } } } else { @@ -3936,6 +3986,10 @@ int qemudBuildCommandLine(virConnectPtr conn, /* No special args - this is the default */ break; + case VIR_DOMAIN_VIDEO_TYPE_QXL: + /* handle later */ + break; + default: qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, _("video type %s is not supported with QEMU"), @@ -3943,6 +3997,26 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + + if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { + + if (qemuCmdFlags & QEMUD_CMD_FLAG_QXL) { + char *optstr; + + if (virAsprintf(&optstr, "%u,ram=%u", + def->videos[0]->heads, + (def->videos[0]->vram /1024)) < 0) + goto no_memory; + + ADD_ARG_LIT("-qxl"); + ADD_ARG(optstr); + } else { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", + _("qxl graphics are not supported with this QEMU")); + goto error; + } + } + } else { /* If we have -device, then we set -nodefault already */ if (!(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) && diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 101f187..54b8598 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -82,6 +82,8 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_SDL = (1 << 27), /* Is the new -sdl arg available */ QEMUD_CMD_FLAG_SMP_TOPOLOGY = (1 << 28), /* Is sockets=s,cores=c,threads=t available for -smp? */ QEMUD_CMD_FLAG_NETDEV = (1 << 29), /* The -netdev flag & netdev_add/remove monitor commands */ + QEMUD_CMD_FLAG_QXL = (1 << 30), /* Is -qxl avail (RHEL-5/6 custom) */ + QEMUD_CMD_FLAG_SPICE = (1 << 31), /* Is -spice avail (RHEL-5/6 custom) */ }; /* Main driver state */ diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 34a6048..4998503 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -204,6 +204,27 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_BALLOON | QEMUD_CMD_FLAG_SDL, 10092, 1, 0); + DO_TEST("kvm-83-rhel", + 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_PCIDEVICE | + QEMUD_CMD_FLAG_MEM_PATH | + QEMUD_CMD_FLAG_DRIVE_SERIAL | + QEMUD_CMD_FLAG_BALLOON | + QEMUD_CMD_FLAG_VGA | + QEMUD_CMD_FLAG_QXL | + QEMUD_CMD_FLAG_SPICE, + 9001, 1, 83); DO_TEST("qemu-0.12.1", QEMUD_CMD_FLAG_VNC_COLON | QEMUD_CMD_FLAG_NO_REBOOT | diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 67dc47e..0315610 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -269,6 +269,9 @@ mymain(int argc, char **argv) DO_TEST("graphics-sdl", 0); DO_TEST("graphics-sdl-fullscreen", 0); + + DO_TEST("graphics-spice", QEMUD_CMD_FLAG_QXL | QEMUD_CMD_FLAG_SPICE); + DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA); DO_TEST("input-usbmouse", 0); DO_TEST("input-usbtablet", 0); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 5b706bb..1d1fc52 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -110,6 +110,7 @@ mymain(int argc, char **argv) DO_TEST("graphics-vnc-tls"); DO_TEST("graphics-sdl"); DO_TEST("graphics-sdl-fullscreen"); + DO_TEST("graphics-spice"); DO_TEST("input-usbmouse"); DO_TEST("input-usbtablet"); DO_TEST("input-xen"); -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2010/2/5 Daniel Veillard <veillard@redhat.com>:
Comments for commit grabbed from gitorious and apparently not updated as this commit now inclides the spice activating code and tests too...
Daniel
Author: Daniel P. Berrange <berrange@redhat.com>
Implement RHEL-5.4 KVM QXL support in QEMU driver
This supports the -qxl argument in RHEL-5's fork of KVM which has SPICE support. QXL is a graphics card, but inexplicably doesn't use the standard -vga syntax for generic configuration. Also -qxl is rather useless unless you also supply -spice (coming in next patch)
* src/qemu_conf.c: Probe for -qxl arg in QEMU help. Format a -qxl arg for launching VMs * src/qemu_conf.h: Add flag for -qxl arg availability * tests/qemuhelpdata/kvm-83-rhel, tests/qemuhelptest.c: test for -qxl arg help parsing * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: add tests for -qxl graphics XML to ARGV handling
@@ -3943,6 +3997,26 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + + if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { + + if (qemuCmdFlags & QEMUD_CMD_FLAG_QXL) { + char *optstr; + + if (virAsprintf(&optstr, "%u,ram=%u", + def->videos[0]->heads, + (def->videos[0]->vram /1024)) < 0) + goto no_memory; + + ADD_ARG_LIT("-qxl"); + ADD_ARG(optstr); + } else { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", + _("qxl graphics are not supported with this QEMU"));
s/graphics/video/ because QXL is the video device and SPICE the graphics device. Updating the website section about the domain XML format would be a nice bonus :) ACK Matthias

On Tue, Feb 09, 2010 at 09:07:30PM +0100, Matthias Bolte wrote:
2010/2/5 Daniel Veillard <veillard@redhat.com>:
Comments for commit grabbed from gitorious and apparently not updated as this commit now inclides the spice activating code and tests too...
Daniel
Author: Daniel P. Berrange <berrange@redhat.com>
Implement RHEL-5.4 KVM QXL support in QEMU driver
This supports the -qxl argument in RHEL-5's fork of KVM which has SPICE support. QXL is a graphics card, but inexplicably doesn't use the standard -vga syntax for generic configuration. Also -qxl is rather useless unless you also supply -spice (coming in next patch)
* src/qemu_conf.c: Probe for -qxl arg in QEMU help. Format a -qxl arg for launching VMs * src/qemu_conf.h: Add flag for -qxl arg availability * tests/qemuhelpdata/kvm-83-rhel, tests/qemuhelptest.c: test for -qxl arg help parsing * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: add tests for -qxl graphics XML to ARGV handling
@@ -3943,6 +3997,26 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + + if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { + + if (qemuCmdFlags & QEMUD_CMD_FLAG_QXL) { + char *optstr; + + if (virAsprintf(&optstr, "%u,ram=%u", + def->videos[0]->heads, + (def->videos[0]->vram /1024)) < 0) + goto no_memory; + + ADD_ARG_LIT("-qxl"); + ADD_ARG(optstr); + } else { + qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", + _("qxl graphics are not supported with this QEMU"));
s/graphics/video/ because QXL is the video device and SPICE the graphics device.
Updating the website section about the domain XML format would be a nice bonus :)
ACK
Thanks for the ACK Matthias, but this is not really ready for commit, this need progress in Spice acceptance in QEmu upstream and as Dan pointed out privately this code need to be revamped to match the new device addressing method in QEmu. But I wanted to rebase those patches to make it easier once things speeds up on Spice front. So not to be commited yet :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Matthias Bolte