[PATCH] Set namespace of object path in rasd_to_vdev()

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1212155823 25200 # Node ID 5b89d6aa5816613627a2869d8c72bde37a9f2e2c # Parent bebc49d05ccd893020673286905d5c64f652cd62 Set namespace of object path in rasd_to_vdev() This was being done in classify_resources(), however, rasd_to_vdev() needs to set this value because a call to CMGetObjectPath() strips the instance of it's namespace. Functions that call rasd_to_vdev() need to pass in the namespace, so those are updated as well. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r bebc49d05ccd -r 5b89d6aa5816 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu May 29 14:48:41 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Fri May 30 06:57:03 2008 -0700 @@ -487,7 +487,8 @@ static const char *rasd_to_vdev(CMPIInstance *inst, struct domain *domain, - struct virt_device *dev) + struct virt_device *dev, + const char *ns) { uint16_t type; CMPIObjectPath *op; @@ -498,6 +499,9 @@ msg = "Unable to get path for device instance"; goto out; } + + CMSetNameSpace(op, ns); + CMSetObjectPath(inst, op); if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) { msg = "Unable to get device type"; @@ -553,9 +557,6 @@ if (op == NULL) return "Unknown resource instance type"; - CMSetNameSpace(op, ns); - CMSetObjectPath(inst, op); - if (res_type_from_rasd_classname(CLASSNAME(op), &type) != CMPI_RC_OK) return "Unable to determine resource type"; @@ -563,19 +564,23 @@ if (type == CIM_RES_TYPE_PROC) msg = rasd_to_vdev(inst, domain, - &domain->dev_vcpu[domain->dev_vcpu_ct++]); + &domain->dev_vcpu[domain->dev_vcpu_ct++], + ns); else if (type == CIM_RES_TYPE_MEM) msg = rasd_to_vdev(inst, domain, - &domain->dev_mem[domain->dev_mem_ct++]); + &domain->dev_mem[domain->dev_mem_ct++], + ns); else if (type == CIM_RES_TYPE_DISK) msg = rasd_to_vdev(inst, domain, - &domain->dev_disk[domain->dev_disk_ct++]); + &domain->dev_disk[domain->dev_disk_ct++], + ns); else if (type == CIM_RES_TYPE_NET) msg = rasd_to_vdev(inst, domain, - &domain->dev_net[domain->dev_net_ct++]); + &domain->dev_net[domain->dev_net_ct++], + ns); if (msg != NULL) return msg; @@ -872,7 +877,8 @@ typedef CMPIStatus (*resmod_fn)(struct domain *, CMPIInstance *, uint16_t, - const char *); + const char *, + const char*); static struct virt_device **find_list(struct domain *dominfo, uint16_t type, @@ -966,7 +972,8 @@ static CMPIStatus resource_del(struct domain *dominfo, CMPIInstance *rasd, uint16_t type, - const char *devid) + const char *devid, + const char *ns) { CMPIStatus s; CMPIObjectPath *op; @@ -1013,7 +1020,8 @@ static CMPIStatus resource_add(struct domain *dominfo, CMPIInstance *rasd, uint16_t type, - const char *devid) + const char *devid, + const char *ns) { CMPIStatus s; CMPIObjectPath *op; @@ -1060,7 +1068,7 @@ dev->type = type; dev->id = strdup(devid); - rasd_to_vdev(rasd, dominfo, dev); + rasd_to_vdev(rasd, dominfo, dev, ns); s = _resource_dynamic(dominfo, dev, RESOURCE_ADD, CLASSNAME(op)); if (s.rc != CMPI_RC_OK) @@ -1078,7 +1086,8 @@ static CMPIStatus resource_mod(struct domain *dominfo, CMPIInstance *rasd, uint16_t type, - const char *devid) + const char *devid, + const char *ns) { CMPIStatus s; CMPIObjectPath *op; @@ -1109,7 +1118,7 @@ struct virt_device *dev = &list[i]; if (STREQ(dev->id, devid)) { - rasd_to_vdev(rasd, dominfo, dev); + rasd_to_vdev(rasd, dominfo, dev, ns); s = _resource_dynamic(dominfo, dev, RESOURCE_MOD, @@ -1156,7 +1165,7 @@ goto out; } - s = func(dominfo, rasd, type, devid); + s = func(dominfo, rasd, type, devid, NAMESPACE(ref)); if (s.rc != CMPI_RC_OK) { CU_DEBUG("Resource transform function failed"); goto out;
participants (1)
-
Kaitlin Rupert