[Libvirt-cim] [PATCH] (#2)Set PoolID for CIM_DiskResourceAllocationSettingData

Chip Vincent cvincent at linux.vnet.ibm.com
Wed Jul 20 21:48:55 UTC 2011


+1 and pushed. Thanks.

On 07/20/2011 09:44 AM, Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra<snmishra at us.ibm.com>
> # Date 1311169386 25200
> # Node ID 7cb42b369d3776c9d727402ba0198eea573d0d40
> # Parent  6056961c3c5347d3b8375039767d7bc78fa97eb5
> (#2)Set PoolID for CIM_DiskResourceAllocationSettingData.
>
> PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID
> for DiskResourceAllocationSettingData is set by appending "DiskPool"
> to the Storage Pool name.
>
> #2: Added "const" to const char* virStoragePoolGetName at line 286.
>
> Signed-off-by: Sharad Mishra<snmishra at us.ibm.com>
>
> diff -r 6056961c3c53 -r 7cb42b369d37 src/Virt_RASD.c
> --- a/src/Virt_RASD.c	Tue Jul 19 16:46:19 2011 -0300
> +++ b/src/Virt_RASD.c	Wed Jul 20 06:43:06 2011 -0700
> @@ -234,6 +234,7 @@
>           uint64_t cap = 0;
>           uint16_t type;
>           CMPIStatus s = {CMPI_RC_OK, NULL};
> +        char *poolid = NULL;
>
>           get_vol_size(broker, ref, dev->dev.disk.source,&cap);
>
> @@ -253,6 +254,55 @@
>                         (CMPIValue *)dev->dev.disk.source,
>                         CMPI_chars);
>
> +        virConnectPtr conn = connect_by_classname(broker, CLASSNAME(ref),&s);
> +        if (conn == NULL) {
> +                virt_set_status(broker,&s,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Could not get connection to hypervisor");
> +                goto cont;
> +        }
> +
> +        virStorageVolPtr vol = virStorageVolLookupByPath(conn,
> +                                                         dev->dev.disk.source);
> +        if (vol == NULL) {
> +                virt_set_status(broker,&s,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Failed to get StorageVolPtr");
> +                goto cont;
> +        }
> +
> +        virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol);
> +        if (pool == NULL) {
> +                virt_set_status(broker,&s,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Failed to get StoragePoolPtr");
> +                goto cont;
> +        }
> +
> +        const char *pool_name = virStoragePoolGetName(pool);
> +        if (pool_name == NULL) {
> +                virt_set_status(broker,&s,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Failed to get Pool name for volume");
> +                goto cont;
> +        }
> +
> +        int ret = asprintf(&poolid, "DiskPool/%s", pool_name);
> +
> +        if (ret == -1) {
> +               CU_DEBUG("Failed to get disk poolid");
> +               goto cont;
> +        }
> +
> +        CMSetProperty(inst,
> +                      "PoolID",
> +                      (CMPIValue *)poolid,
> +                      CMPI_chars);
> + cont:
>           CMSetProperty(inst,
>                         "BusType",
>                         (CMPIValue *)dev->dev.disk.bus_type,
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-- 
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list