# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1242695586 25200
# Node ID c127bb551eb81bfe3fe3a2ad0225d7307e4bd1ee
# Parent 9ac4e06aa21334cf25b8096663dca6fea74dccd8
Update SDC to return template DiskPoolRASDs for disk and iscsi type pools
Rearrange things to reduce duplicate code.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 9ac4e06aa213 -r c127bb551eb8 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon May 18 18:13:06 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Mon May 18 18:13:06 2009 -0700
@@ -1239,11 +1239,12 @@
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
const char *path = "/dev/null";
- const char *dev_path;
- const char *host;
- const char *src_dir;
- int type[3] = {DISK_POOL_DIR, DISK_POOL_FS, DISK_POOL_NETFS};
- int pool_types = 3;
+ int type[5] = {DISK_POOL_DIR,
+ DISK_POOL_FS,
+ DISK_POOL_NETFS,
+ DISK_POOL_DISK,
+ DISK_POOL_ISCSI};
+ int pool_types = 5;
int i;
switch (template_type) {
@@ -1267,6 +1268,10 @@
}
for (i = 0; i < pool_types; i++) {
+ const char *dev_path = NULL;
+ const char *host = NULL;
+ const char *src_dir = NULL;
+
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_DISK, POOL_RASD);
if ((inst == NULL) || (s.rc != CMPI_RC_OK))
goto out;
@@ -1274,24 +1279,40 @@
CMSetProperty(inst, "InstanceID", (CMPIValue *)id,
CMPI_chars);
switch (type[i]) {
+ case DISK_POOL_DISK:
+ dev_path = "/dev/VolGroup00/LogVol100";
+
+ break;
case DISK_POOL_FS:
dev_path = "/dev/sda100";
- CMSetProperty(inst, "DevicePath",
- (CMPIValue *)dev_path, CMPI_chars);
+
break;
case DISK_POOL_NETFS:
host = "host_sys.domain.com";
- CMSetProperty(inst, "Host",
- (CMPIValue *)host, CMPI_chars);
+ src_dir = "/var/lib/images";
- src_dir = "/var/lib/images";
- CMSetProperty(inst, "SourceDirectory",
- (CMPIValue *)src_dir, CMPI_chars);
+ break;
+ case DISK_POOL_ISCSI:
+ host = "host_sys.domain.com";
+ dev_path = "iscsi-target";
+
break;
default:
break;
}
+ if (dev_path != NULL)
+ CMSetProperty(inst, "DevicePath",
+ (CMPIValue *)dev_path, CMPI_chars);
+
+ if (host != NULL)
+ CMSetProperty(inst, "Host",
+ (CMPIValue *)host, CMPI_chars);
+
+ if (src_dir != NULL)
+ CMSetProperty(inst, "SourceDirectory",
+ (CMPIValue *)src_dir, CMPI_chars);
+
CMSetProperty(inst, "Type", (CMPIValue *)&type[i],
CMPI_uint16);
CMSetProperty(inst, "Path", (CMPIValue *)path, CMPI_chars);
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel(a)linux.vnet.ibm.com