[Libvirt-cim] [PATCH 3 of 3] Expose SCSI template DiskPoolRASD in SettingsDefineCapabilities

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Jun 30 21:45:20 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1246397611 25200
# Node ID b1a29661b142f455bcbb9b4d21ae2cb7c038f5e8
# Parent  696c377aa8fce213b01916af24e1e1027d08c2f7
Expose SCSI template DiskPoolRASD in SettingsDefineCapabilities

Since PortName and NodeName are optional, this will need to be reworked some
so that both template types are exposed.  That will be in a follow-up patch,
since it involves restructuring the function.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 696c377aa8fc -r b1a29661b142 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Tue Jun 30 14:33:31 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Tue Jun 30 14:33:31 2009 -0700
@@ -1258,13 +1258,14 @@
         CMPIInstance *inst;
         CMPIStatus s = {CMPI_RC_OK, NULL};
         const char *path = "/dev/null";
-        int type[6] = {DISK_POOL_DIR, 
+        int type[7] = {DISK_POOL_DIR, 
                        DISK_POOL_FS, 
                        DISK_POOL_NETFS, 
                        DISK_POOL_DISK, 
                        DISK_POOL_ISCSI,
-                       DISK_POOL_LOGICAL};
-        int pool_types = 6;
+                       DISK_POOL_LOGICAL,
+                       DISK_POOL_SCSI};
+        int pool_types = 7;
         int i;
 
         switch (template_type) {
@@ -1291,6 +1292,9 @@
                 const char *dev_path = NULL;
                 const char *host = NULL;
                 const char *src_dir = NULL;
+                const char *adapter = NULL;
+                const char *port_name = NULL;
+                const char *node_name = NULL;
 
                 inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_DISK, POOL_RASD);
                 if ((inst == NULL) || (s.rc != CMPI_RC_OK))
@@ -1317,6 +1321,13 @@
                         dev_path = "iscsi-target";
 
                         break;
+                case DISK_POOL_SCSI:
+                        adapter = "host0";
+                        port_name = "0000111122223333";
+                        node_name = "4444555566667777";
+                        path = "/dev/disk/by-id";
+
+                        break;
                 default:
                         break;
                 }
@@ -1333,6 +1344,18 @@
                         CMSetProperty(inst, "SourceDirectory", 
                                       (CMPIValue *)src_dir, CMPI_chars);
 
+                if (adapter != NULL)
+                        CMSetProperty(inst, "AdapterName", 
+                                      (CMPIValue *)adapter, CMPI_chars);
+
+                if (port_name != NULL)
+                        CMSetProperty(inst, "PortName", 
+                                      (CMPIValue *)port_name, CMPI_chars);
+
+                if (node_name != NULL)
+                        CMSetProperty(inst, "NodeName", 
+                                      (CMPIValue *)node_name, CMPI_chars);
+
                 CMSetProperty(inst, "Type", (CMPIValue *)&type[i], CMPI_uint16);
                 CMSetProperty(inst, "Path", (CMPIValue *)path, CMPI_chars);
 




More information about the Libvirt-cim mailing list