# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1268096483 28800
# Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704
# Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13
Use libvirt to get StorageVolume Path to set SV InstanceID.
InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume
RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This
patch fixed the issue by using libvirt to get the storage volume path. The path returned
by libvirt is used to set the InstanceID.
The patch assigns the Path to the InstanceID.
AFAIK, the InstanceID has always been name, for example for DiskPool it
would be Poolname or for NetworkPool it would be the NetworkPool name.
So, I think we should have the Volume Name as part of the InsanceID.
Is there a DMTF which describes about this, which you referred before
fixing this ?
Between is there a plan to enumerate StorageVolumeRASD like the way we
have DiskRASD and NetRASD?
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800
@@ -353,12 +353,12 @@
}
#if VIR_USE_LIBVIRT_STORAGE
-int create_resource(virConnectPtr conn,
+char *create_resource(virConnectPtr conn,
const char *pname,
const char *xml,
int res_type)
{
- int ret = 0;
+ char *path = NULL;
virStoragePoolPtr ptr = NULL;
virStorageVolPtr vptr = NULL;
@@ -376,14 +376,19 @@
goto out;
}
- ret = 1;
+ path = virStorageVolGetPath(vptr);
+ if (path == NULL) {
+ CU_DEBUG("Unable to get storage volume path");
+ goto out;
+ }
+
}
out:
virStoragePoolFree(ptr);
virStorageVolFree(vptr);
- return ret;
+ return path;
}
int delete_resource(virConnectPtr conn,
@@ -414,13 +419,13 @@
return ret;
}
#else
-int create_resource(virConnectPtr conn,
+char *create_resource(virConnectPtr conn,
const char *pname,
const char *xml,
int res_type)
{
CU_DEBUG("Creating resources within libvirt pools not supported");
- return 0;
+ return NULL;
}
int delete_resource(virConnectPtr conn,
diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800
@@ -90,7 +90,7 @@
int define_pool(virConnectPtr conn, const char *xml, int res_type);
int destroy_pool(virConnectPtr conn, const char *name, int res_type);
-int create_resource(virConnectPtr conn, const char *pname,
+char *create_resource(virConnectPtr conn, const char *pname,
const char *xml, int res_type);
int delete_resource(virConnectPtr conn, const char *rname, int res_type);
diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800
+++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800
@@ -832,6 +832,7 @@
{
virConnectPtr conn;
CMPIInstance *inst = NULL;
+ char *path = NULL;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -839,7 +840,8 @@
return NULL;
}
- if (create_resource(conn, res->pool_id, xml, res->type) == 0) {
+ path = create_resource(conn, res->pool_id, xml, res->type);
+ if (path == NULL) {
virt_set_status(_BROKER, s,
CMPI_RC_ERR_FAILED,
conn,
@@ -855,6 +857,8 @@
"Failed to lookup resulting resource");
}
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars);
+
out:
virConnectClose(conn);
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Thanks and Regards,
Deepti B. Kalakeri
IBM Linux Technology Center
deeptik(a)linux.vnet.ibm.com