[Libvirt-cim] [PATCH 4 of 4] Make VSMS not parse the InstanceID of a RASD, but rather use the proper fields

Zhengang Li zli at linux.vnet.ibm.com
Wed Apr 16 10:38:44 UTC 2008


Dan Smith wrote:

>  - Set the namespace on the instance of the RASD we got from the parser,
>    so that it's a usable reference for namespace, etc.
> 
...
>  static const char *classify_resources(CMPIArray *resources,
> +                                      const char *ns,
>                                        struct domain *domain)
>  {
>          int i;
> @@ -308,31 +394,37 @@ static const char *classify_resources(CM
>          for (i = 0; i < count; i++) {
>                  CMPIObjectPath *op;
>                  CMPIData item;
> +                CMPIInstance *inst;
>                  const char *msg = NULL;
> 
>                  item = CMGetArrayElementAt(resources, i, NULL);
>                  if (CMIsNullObject(item.value.inst))
>                          return "Internal array error";
> 
> -                op = CMGetObjectPath(item.value.inst, NULL);
> +                inst = item.value.inst;
> +
> +                op = CMGetObjectPath(inst, NULL);
>                  if (op == NULL)
>                          return "Unknown resource instance type";
> +
> +                CMSetNameSpace(op, ns);
> +                CMSetObjectPath(inst, op);
This line gave me a segfault. I'm on sfcb in opensuse 10.3.

Deepti also saw a segfault. But I am not sure this is the same as hers. 
She is using pegasus.

> 
>                  if (res_type_from_rasd_classname(CLASSNAME(op), &type) != 
>                      CMPI_RC_OK)
>                          return "Unable to determine resource type";
> 
>                  if (type == CIM_RES_TYPE_PROC)
> -                        msg = rasd_to_vdev(item.value.inst,
> +                        msg = rasd_to_vdev(inst,
>                                             &domain->dev_vcpu[domain->dev_vcpu_ct++]);
>                  else if (type == CIM_RES_TYPE_MEM)
> -                        msg = rasd_to_vdev(item.value.inst,
> +                        msg = rasd_to_vdev(inst,
>                                             &domain->dev_mem[domain->dev_mem_ct++]);
>                  else if (type == CIM_RES_TYPE_DISK)
> -                        msg = rasd_to_vdev(item.value.inst,
> +                        msg = rasd_to_vdev(inst,
>                                             &domain->dev_disk[domain->dev_disk_ct++]);
>                  else if (type == CIM_RES_TYPE_NET)
> -                        msg = rasd_to_vdev(item.value.inst,
> +                        msg = rasd_to_vdev(inst,
>                                             &domain->dev_net[domain->dev_net_ct++]);
> 
>                  if (msg != NULL)


-- 
- Zhengang




More information about the Libvirt-cim mailing list