[PATCH 0 of 2] Support for VNC password and sdl type graphics devices

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247095850 25200 # Node ID f609e31b0c17ea550f27426dd8e329c362f4db3e # Parent 0fb4613252c19abb6bf5496a8b7031793ba7f298 Add Password attribute to GraphicsRASD Also add necessary changes to the graphics struct and generating XML with the passwd attribute. The passwd won't show up in the XML we get back from libvirt, so pulling the passwd from the guest XML isn't included in parse_graphics_device(). Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.c Wed Jul 08 16:30:50 2009 -0700 @@ -81,6 +81,7 @@ free(dev->port); free(dev->host); free(dev->keymap); + free(dev->passwd); } static void cleanup_input_device(struct input_device *dev) diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.h Wed Jul 08 16:30:50 2009 -0700 @@ -70,6 +70,7 @@ char *port; char *host; char *keymap; + char *passwd; }; struct input_device { diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/xmlgen.c Wed Jul 08 16:30:50 2009 -0700 @@ -338,11 +338,21 @@ return XML_ERROR; xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); + + if (STREQC(dev->type, "sdl")) + goto out; + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + + if (dev->passwd != NULL) + xmlNewProp(tmp, + BAD_CAST "passwd", + BAD_CAST dev->passwd); } + out: return NULL; } diff -r 0fb4613252c1 -r f609e31b0c17 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Jun 30 14:33:31 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Wed Jul 08 16:30:50 2009 -0700 @@ -132,6 +132,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; }; [Description ("KVM virtual graphics device"), @@ -141,6 +144,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; }; [Description ("LXC virtual graphics device"), @@ -150,6 +156,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; }; [Description ("Xen virtual input device"),

I think you should at least print the Password property as an empty property (or even with asterisks) in the set_graphics_rasd_parameters(). It's kinda weird to print it on the template rasd, but not on the real rasd instance. Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247095850 25200 # Node ID f609e31b0c17ea550f27426dd8e329c362f4db3e # Parent 0fb4613252c19abb6bf5496a8b7031793ba7f298 Add Password attribute to GraphicsRASD
Also add necessary changes to the graphics struct and generating XML with the passwd attribute.
The passwd won't show up in the XML we get back from libvirt, so pulling the passwd from the guest XML isn't included in parse_graphics_device().
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.c Wed Jul 08 16:30:50 2009 -0700 @@ -81,6 +81,7 @@ free(dev->port); free(dev->host); free(dev->keymap); + free(dev->passwd); }
static void cleanup_input_device(struct input_device *dev) diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.h Wed Jul 08 16:30:50 2009 -0700 @@ -70,6 +70,7 @@ char *port; char *host; char *keymap; + char *passwd; };
struct input_device { diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/xmlgen.c Wed Jul 08 16:30:50 2009 -0700 @@ -338,11 +338,21 @@ return XML_ERROR;
xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); + + if (STREQC(dev->type, "sdl")) + goto out; + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + + if (dev->passwd != NULL) + xmlNewProp(tmp, + BAD_CAST "passwd", + BAD_CAST dev->passwd); }
+ out: return NULL; }
diff -r 0fb4613252c1 -r f609e31b0c17 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Jun 30 14:33:31 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Wed Jul 08 16:30:50 2009 -0700 @@ -132,6 +132,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("KVM virtual graphics device"), @@ -141,6 +144,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("LXC virtual graphics device"), @@ -150,6 +156,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("Xen virtual input device"),
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com

Richard Maciel wrote:
I think you should at least print the Password property as an empty property (or even with asterisks) in the set_graphics_rasd_parameters().
It's kinda weird to print it on the template rasd, but not on the real rasd instance.
Yeah, I agree it's weird. The problem is that when you call virDomainGetXMLDesc(), libvirt doesn't return any kind of information that a password has been set for the given guest. What we could do is persist a flag that indicates whether a password have been set and then set the Password attribute accordingly.
Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247095850 25200 # Node ID f609e31b0c17ea550f27426dd8e329c362f4db3e # Parent 0fb4613252c19abb6bf5496a8b7031793ba7f298 Add Password attribute to GraphicsRASD
Also add necessary changes to the graphics struct and generating XML with the passwd attribute.
The passwd won't show up in the XML we get back from libvirt, so pulling the passwd from the guest XML isn't included in parse_graphics_device().
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.c Wed Jul 08 16:30:50 2009 -0700 @@ -81,6 +81,7 @@ free(dev->port); free(dev->host); free(dev->keymap); + free(dev->passwd); }
static void cleanup_input_device(struct input_device *dev) diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/device_parsing.h Wed Jul 08 16:30:50 2009 -0700 @@ -70,6 +70,7 @@ char *port; char *host; char *keymap; + char *passwd; };
struct input_device { diff -r 0fb4613252c1 -r f609e31b0c17 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/xmlgen.c Wed Jul 08 16:30:50 2009 -0700 @@ -338,11 +338,21 @@ return XML_ERROR;
xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); + + if (STREQC(dev->type, "sdl")) + goto out; + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + + if (dev->passwd != NULL) + xmlNewProp(tmp, + BAD_CAST "passwd", + BAD_CAST dev->passwd); }
+ out: return NULL; }
diff -r 0fb4613252c1 -r f609e31b0c17 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Jun 30 14:33:31 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Wed Jul 08 16:30:50 2009 -0700 @@ -132,6 +132,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("KVM virtual graphics device"), @@ -141,6 +144,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("LXC virtual graphics device"), @@ -150,6 +156,9 @@ { [Description ("Keyboard keymapping")] string KeyMap; + + [Description ("VNC password")] + string Password; };
[Description ("Xen virtual input device"),
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1247095850 25200 # Node ID 48442a47da882ce635ec043086613eb6d15d596f # Parent f609e31b0c17ea550f27426dd8e329c362f4db3e Add support for specifying a password for VNC connections to VSMS Also support sdl type graphics devices. Generate template RASDs for both types. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f609e31b0c17 -r 48442a47da88 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Wed Jul 08 16:30:50 2009 -0700 +++ b/src/Virt_SettingsDefineCapabilities.c Wed Jul 08 16:30:50 2009 -0700 @@ -1429,14 +1429,42 @@ return s; } +static CMPIStatus set_graphics_props(const CMPIObjectPath *ref, + const char *id, + const char *type, + struct inst_list *list) +{ + CMPIInstance *inst; + CMPIStatus s = {CMPI_RC_OK, NULL}; + + inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_GRAPHICS, DEVICE_RASD); + + CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars); + + if (STREQC(type, "vnc")) { + const char *addr = "127.0.0.1:-1"; + + CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars); + + CMSetProperty(inst, "KeyMap", (CMPIValue *)"en-us", CMPI_chars); + } + + CMSetProperty(inst, "ResourceSubType", (CMPIValue *)type, CMPI_chars); + + inst_list_add(list, inst); + + return s; +} + static CMPIStatus graphics_template(const CMPIObjectPath *ref, int template_type, struct inst_list *list) { const char *id; - const char *addr; - CMPIInstance *inst; CMPIStatus s = {CMPI_RC_OK, NULL}; + const char *type[] = {"vnc", "sdl"}; + int type_ct = 2; + int i; switch(template_type) { case SDC_RASD_MIN: @@ -1458,17 +1486,11 @@ goto out; } - inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_GRAPHICS, DEVICE_RASD); - - CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars); - - addr = "127.0.0.1:-1"; - CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars); - - CMSetProperty(inst, "KeyMap", (CMPIValue *)"en-us", CMPI_chars); - CMSetProperty(inst, "ResourceSubType", (CMPIValue *)"vnc", CMPI_chars); - - inst_list_add(list, inst); + for (i = 0; i < type_ct; i++) { + s = set_graphics_props(ref, id, type[i], list); + if (s.rc != CMPI_RC_OK) + goto out; + } out: return s; diff -r f609e31b0c17 -r 48442a47da88 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Jul 08 16:30:50 2009 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 08 16:30:50 2009 -0700 @@ -771,7 +771,11 @@ const char *keymap; int ret; - dev->dev.graphics.type = strdup("vnc"); + if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) { + msg = "GraphicsRASD ResourceSubType field not valid"; + goto out; + } + dev->dev.graphics.type = strdup(val); /* FIXME: Add logic to prevent address:port collisions */ if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { @@ -792,6 +796,12 @@ dev->dev.graphics.keymap = strdup(keymap); + if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) { + dev->dev.graphics.passwd = NULL; + } else { + dev->dev.graphics.passwd = strdup(val); + } + out: return msg;
participants (2)
-
Kaitlin Rupert
-
Richard Maciel