
# 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;