[Libvirt-cim] [PATCH] Patch to fix missing DiskPool type
Chip Vincent
cvincent at linux.vnet.ibm.com
Thu Jan 13 19:25:38 UTC 2011
+1. Thanks.
Pushed.
Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra <snmishra at us.ibm.com>
> # Date 1293496322 28800
> # Node ID 28f3d6f46a06aa5be6aba8bcfeda55bd0ddc5468
> # Parent 35396e5b805193c024b6d4f065136d7b57a0b03d
> Patch to fix missing DiskPool type.
>
> DiskPool type was not being populated.
>
> Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>
>
> diff -r 35396e5b8051 -r 28f3d6f46a06 libxkutil/pool_parsing.c
> --- a/libxkutil/pool_parsing.c Tue Dec 14 13:59:51 2010 -0800
> +++ b/libxkutil/pool_parsing.c Mon Dec 27 16:32:02 2010 -0800
> @@ -166,6 +166,30 @@
> return 1;
> }
>
> +char *get_disk_pool_type(uint16_t type)
> +{
> +
> + switch (type) {
> + case DISK_POOL_DIR:
> + return "dir";
> + case DISK_POOL_FS:
> + return "fs";
> + case DISK_POOL_NETFS:
> + return "netfs";
> + case DISK_POOL_DISK:
> + return "disk";
> + case DISK_POOL_ISCSI:
> + return "iscsi";
> + case DISK_POOL_LOGICAL:
> + return "logical";
> + case DISK_POOL_SCSI:
> + return "scsi";
> + default:
> + return NULL;
> + }
> +
> +}
> +
> static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool)
> {
> xmlNode **nodes = nsv->nodeTab;
> diff -r 35396e5b8051 -r 28f3d6f46a06 libxkutil/pool_parsing.h
> --- a/libxkutil/pool_parsing.h Tue Dec 14 13:59:51 2010 -0800
> +++ b/libxkutil/pool_parsing.h Mon Dec 27 16:32:02 2010 -0800
> @@ -86,6 +86,7 @@
> void cleanup_virt_pool_res(struct virt_pool_res **res);
>
> int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type);
> +char *get_disk_pool_type(uint16_t type);
>
> int define_pool(virConnectPtr conn, const char *xml, int res_type);
> int destroy_pool(virConnectPtr conn, const char *name, int res_type);
> diff -r 35396e5b8051 -r 28f3d6f46a06 src/Virt_DevicePool.c
> --- a/src/Virt_DevicePool.c Tue Dec 14 13:59:51 2010 -0800
> +++ b/src/Virt_DevicePool.c Mon Dec 27 16:32:02 2010 -0800
> @@ -172,6 +172,7 @@
> virStoragePoolInfo info;
> uint64_t cap;
> uint64_t res;
> + uint16_t type;
> struct virt_pool *pool_vals = NULL;
> const char *pool_str = NULL;
>
> @@ -204,6 +205,10 @@
> CMSetProperty(inst, "Path",
> (CMPIValue *)pool_str, CMPI_chars);
> }
> + type = pool_vals->pool_info.disk.pool_type;
> + CMSetProperty(inst, "OtherResourceType",
> + (CMPIValue *)get_disk_pool_type(type),
> + CMPI_chars);
> }
>
> result = true;
> @@ -957,11 +962,19 @@
> const char *refcn,
> const CMPIBroker *broker)
> {
> + CMPIStatus s = {CMPI_RC_OK, NULL};
> CMPIInstance *inst;
> char *poolid = NULL;
>
> inst = get_typed_instance(broker, refcn, "DiskPool", ns);
>
> + if (inst == NULL) {
> + cu_statusf(broker, &s,
> + CMPI_RC_ERR_FAILED,
> + "Unable to init DiskPool instance");
> + goto out;
> + }
> +
> if (asprintf(&poolid, "DiskPool/%s", pool->tag) == -1)
> return NULL;
>
> @@ -976,6 +989,7 @@
> CU_DEBUG("Failed to set capacity for disk pool: %s",
> pool->tag);
>
> +out:
> free(poolid);
>
> return inst;
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent at us.ibm.com
More information about the Libvirt-cim
mailing list