[Libvirt-cim] [PATCH] Set PoolID for CIM_DiskResourceAllocationSettingData

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


On 07/18/2011 02:12 PM, Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra<snmishra at us.ibm.com>
> # Date 1311012637 25200
> # Node ID d1f131ad4cf75263d8178ebb89ad9dada3997280
> # Parent  e8c1cdd5c9cbe887286ef169d8ff525cc9035485
> 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.
>
> Signed-off-by: Sharad Mishra<snmishra at us.ibm.com>
>
> diff -r e8c1cdd5c9cb -r d1f131ad4cf7 src/Virt_RASD.c
> --- a/src/Virt_RASD.c	Sun Jul 17 12:37:31 2011 -0700
> +++ b/src/Virt_RASD.c	Mon Jul 18 11:10:37 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;
> +        }
> +
> +        char *pool_name = virStoragePoolGetName(pool);

cc1: warnings being treated as errors
Virt_RASD.c: In function ‘set_disk_rasd_params’:
Virt_RASD.c:285: error: initialization discards qualifiers from pointer 
target type

According to libvirt docs:
const char *	virStoragePoolGetName	(virStoragePoolPtr 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