[Libvirt-cim] [PATCH] Fix DiskRASD size reporting
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Tue Jul 29 15:57:34 UTC 2008
>
> +#if LIBVIR_VERSION_NUMBER > 4000
> +static bool get_vol_size(const CMPIBroker *broker,
> + const CMPIObjectPath *ref,
> + const char *image,
> + uint64_t *size)
> +{
> + virConnectPtr conn = NULL;
> + virStorageVolPtr vol = NULL;
> + virStorageVolInfo volinfo;
> + CMPIStatus s;
> +
> + *size = 0;
> +
> + conn = connect_by_classname(broker, CLASSNAME(ref), &s);
> + if (conn == NULL)
> + return false;
> +
> + vol = virStorageVolLookupByPath(conn, image);
> + if (vol != NULL) {
> + if (virStorageVolGetInfo(vol, &volinfo) != 0) {
> + CU_DEBUG("Failed to get info for volume %s", image);
You don't set a return code here, so you'll return true in this case.
You're not using the return code of this function in the calling
function, but that may change in the future.
> + } else {
> + *size = volinfo.capacity;
> + }
> + }
> +
> + virStorageVolFree(vol);
> + virConnectClose(conn);
> +
> + return true;
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list