[Libvirt-cim] [PATCH] (#3) add sdl frame buffer support
Eduardo Lima (Etrunko)
eblima at linux.vnet.ibm.com
Thu Jul 28 18:45:50 UTC 2011
On 07/26/2011 10:01 PM, Wayne Xia wrote:
> # HG changeset patch
> # User Wayne Xia<xiawenc at linux.vnet.ibm.com>
> # Date 1311670971 -28800
> # Node ID d0bb7e93d02d3bd55d9b984165db0265c9865462
> # Parent 792db1a6ead075375fad4a7d22143a0f978b5e48
> (#3) add sdl frame buffer support.
>
> Now libvirt still supports sdl frame buffer, and it may take three
> parameters: display,xauth,fullscreen. This patch enable the libvirt-cim
> to accept these configuration and pass them in XML define to let
> libvirt know about it. Exposed interface could be found in the file
> ResourceAllocationSettingData.mof.
> https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347
>
> Signed-off-by: Wayne Xia (Wayne)<xiawenc at linux.vnet.ibm.com>
>
> diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/device_parsing.c
> --- a/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/libxkutil/device_parsing.c Tue Jul 26 17:02:51 2011 +0800
> @@ -538,6 +538,11 @@
> if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL)
> goto err;
> }
> + else if (STREQC(gdev->type, "sdl")) {
> + gdev->dev.sdl.display = get_attr_value(node, "display");
> + gdev->dev.sdl.xauth = get_attr_value(node, "xauth");
> + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen");
> + }
> else if (STREQC(gdev->type, "pty")) {
> if (node->name == NULL)
> goto err;
> diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/xmlgen.c
> --- a/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/libxkutil/xmlgen.c Tue Jul 26 17:02:51 2011 +0800
> @@ -421,8 +421,21 @@
>
> xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
>
> - if (STREQC(dev->type, "sdl"))
> - return NULL;
> + if (STREQC(dev->type, "sdl")) {
> + if (dev->dev.sdl.display) {
> + xmlNewProp(tmp, BAD_CAST "display",
> + BAD_CAST dev->dev.sdl.display);
> + }
> + if (dev->dev.sdl.xauth) {
> + xmlNewProp(tmp, BAD_CAST "xauth",
> + BAD_CAST dev->dev.sdl.xauth);
> + }
> + if (dev->dev.sdl.fullscreen) {
> + xmlNewProp(tmp, BAD_CAST "fullscreen",
> + BAD_CAST dev->dev.sdl.fullscreen);
> + }
> + return NULL;
> + }
>
> if (dev->dev.vnc.port) {
> xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port);
> diff -r 792db1a6ead0 -r d0bb7e93d02d schema/ResourceAllocationSettingData.mof
> --- a/schema/ResourceAllocationSettingData.mof Mon Jul 25 19:39:08 2011 +0800
> +++ b/schema/ResourceAllocationSettingData.mof Tue Jul 26 17:02:51 2011 +0800
> @@ -219,7 +219,9 @@
> [Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
> "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType "
> "is 'console', this is a character device path in "
> - "path:port format (e.g., '/dev/pts/3:0'\)")]
> + "path:port format (e.g., '/dev/pts/3:0'\) "
> + "if ResourceSubType is 'sdl', this is a combination of its params as "
> + "xauth:display (e.g., '/root/.Xauthority::0'\)")]
> string Address;
>
> [Description ("Keyboard keymapping")]
> @@ -228,7 +230,8 @@
> [Description ("VNC password")]
> string Password;
>
> - [Description ("Is IPv6 only addressing is to be used")]
> + [Description ("Is IPv6 only addressing is to be used."
> + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")]
> boolean IsIPv6Only;
> };
Would be nice to hear comments about this 'change' in the schema from
the CIM experts.
>
> diff -r 792db1a6ead0 -r d0bb7e93d02d src/Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800
> +++ b/src/Virt_VirtualSystemManagementService.c Tue Jul 26 17:02:51 2011 +0800
> @@ -1060,6 +1060,52 @@
> return ret;
> }
>
> +static int parse_sdl_address(const char *id,
> + char **display,
> + char **xauth)
> +{
> + int ret;
> + char *tmp_display = NULL;
> + char *tmp_xauth = NULL;
> +
> + CU_DEBUG("Entering parse_sdl_address, address is %s", id);
> +
> + ret = sscanf(id, "%a[^:]:%as",&tmp_xauth,&tmp_display);
> +
> + if (ret<= 0) {
> + ret = sscanf(id, ":%as",&tmp_display);
> + if (ret<= 0) {
> + if (STREQC(id, ":")) {
> + /* do nothing, it is empty */
> + }
> + else {
> + ret = 0;
> + goto out;
> + }
> + }
> + }
> +
> + if (display) {
> + if (tmp_display == NULL)
> + *display = NULL;
> + else
> + *display = strdup(tmp_display);
> + }
> + if (xauth) {
> + if (tmp_xauth == NULL)
> + *xauth = NULL;
> + else
> + *xauth = strdup(tmp_xauth);
> + }
> + ret = 1;
> +
> + out:
> + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s",
> + *display, *xauth);
> +
> + return ret;
> +}
> +
> static int parse_vnc_address(const char *id,
> char **ip,
> char **port)
> @@ -1163,6 +1209,30 @@
> msg = "GraphicsRASD field Address not valid";
> goto out;
> }
> + }
> + else if (STREQC(dev->dev.graphics.type, "sdl")) {
> + if (cu_get_str_prop(inst, "Address",&val) != CMPI_RC_OK) {
> + CU_DEBUG("sdl graphics Address empty, using default");
> + dev->dev.graphics.dev.sdl.display = NULL;
> + dev->dev.graphics.dev.sdl.xauth = NULL;
> + }
> + else {
> + ret = parse_sdl_address(val,
> +&dev->dev.graphics.dev.sdl.display,
> +&dev->dev.graphics.dev.sdl.xauth);
> + if (ret != 1) {
> + msg = "GraphicsRASD sdl Address not valid";
> + goto out;
> + }
> + }
> + dev->dev.graphics.dev.sdl.fullscreen = NULL;
> + if (cu_get_bool_prop(inst, "IsIPV6Only",&ipv6) ==
> + CMPI_RC_OK) {
> + if (ipv6)
> + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes");
> + else
> + dev->dev.graphics.dev.sdl.fullscreen = strdup("no");
> + }
> } else {
> CU_DEBUG("Unsupported graphics type %s",
> dev->dev.graphics.type);
> @@ -1171,7 +1241,8 @@
> }
>
> free(dev->id);
> - if (STREQC(dev->dev.graphics.type, "vnc"))
> + if ((STREQC(dev->dev.graphics.type, "vnc"))||
> + (STREQC(dev->dev.graphics.type, "sdl")))
> ret = asprintf(&dev->id, "%s", dev->dev.graphics.type);
> else
> ret = asprintf(&dev->id, "%s:%s",
>
I think this one looks good, but as it depends on the previous "made
graphics structure union", it should wait until the former gets accepted.
--
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima at br.ibm.com
More information about the Libvirt-cim
mailing list