[PATCH 0 of 3] Add support for SCSI (host bus adapter) type pools

This set of changes is for scsi pools that are based on a host bus adapter. These types of sotrage include FiberChannel attached storage devices, as well as SANs. There's two different ways to define these pools: FiberChannel connected devices: <pool type="scsi"> <name>hba0</name> <source> <adapter name="host4"/> </source> <target> <path>/dev/disk/by-id</path> </target> </pool> SAN devices: <pool type="scsi"> <name>npiv</name> <source> <adapter name="host6" wwpn="0000111122223333" wwnn="4444555566667777"/> </source> <target> <path>/dev/disk/by-id</path> </target> </pool>

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1246397611 25200 # Node ID fb4f5e6e30cf8316165fa8307bc3fd184ff231fd # Parent 7e1613aaff99b7ff536a9bd0277345bf2d62f4f1 Schema changes and pool_parsing changes needed to add SCSI pool support For SCSI pools (pools using a host bus adapter) will need to specify the AdapterName attribute. The PortName and NodeName attributes are optional. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 7e1613aaff99 -r fb4f5e6e30cf libxkutil/pool_parsing.c --- a/libxkutil/pool_parsing.c Wed Jun 24 11:46:08 2009 -0700 +++ b/libxkutil/pool_parsing.c Tue Jun 30 14:33:31 2009 -0700 @@ -58,6 +58,9 @@ free(pool.path); free(pool.host); free(pool.src_dir); + free(pool.adapter); + free(pool.port_name); + free(pool.node_name); for (i = 0; i < pool.device_paths_ct; i++) free(pool.device_paths[i]); diff -r 7e1613aaff99 -r fb4f5e6e30cf libxkutil/pool_parsing.h --- a/libxkutil/pool_parsing.h Wed Jun 24 11:46:08 2009 -0700 +++ b/libxkutil/pool_parsing.h Tue Jun 30 14:33:31 2009 -0700 @@ -43,12 +43,16 @@ DISK_POOL_NETFS, DISK_POOL_DISK, DISK_POOL_ISCSI, - DISK_POOL_LOGICAL} pool_type; + DISK_POOL_LOGICAL, + DISK_POOL_SCSI} pool_type; char *path; char **device_paths; uint16_t device_paths_ct; char *host; char *src_dir; + char *adapter; + char *port_name; + char *node_name; }; struct virt_pool { diff -r 7e1613aaff99 -r fb4f5e6e30cf schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Wed Jun 24 11:46:08 2009 -0700 +++ b/schema/ResourceAllocationSettingData.mof Tue Jun 30 14:33:31 2009 -0700 @@ -230,14 +230,17 @@ class Xen_DiskPoolResourceAllocationSettingData : Xen_ResourceAllocationSettingData { [Description ("Storage pool type"), - ValueMap {"0", "1", "2", "3", "4", "5", "6"}, + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, Values {"Unknown", "Directory, File System, Network File System, " - "Disk, ISCSI, Logical"}] + "Disk, ISCSI, Logical, SCSI Host Bus Adapter"}] uint16 Type; string Path; string DevicePaths[]; string Host; string SourceDirectory; + string AdapterName; + string PortName; + string NodeName; }; [Description ("KVM virtual disk pool settings"), @@ -246,14 +249,17 @@ class KVM_DiskPoolResourceAllocationSettingData : KVM_ResourceAllocationSettingData { [Description ("Storage pool type"), - ValueMap {"0", "1", "2", "3", "4", "5", "6"}, + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, Values {"Unknown", "Directory, File System, Network File System, " - "Disk, ISCSI, Logical"}] + "Disk, ISCSI, Logical, SCSI Host Bus Adapter"}] uint16 Type; string Path; string DevicePaths[]; string Host; string SourceDirectory; + string AdapterName; + string PortName; + string NodeName; }; [Description ("LXC virtual disk pool settings"), @@ -262,13 +268,16 @@ class LXC_DiskPoolResourceAllocationSettingData : LXC_ResourceAllocationSettingData { [Description ("Storage pool type"), - ValueMap {"0", "1", "2", "3", "4", "5", "6"}, + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, Values {"Unknown", "Directory, File System, Network File System, " - "Disk, ISCSI, Logical"}] + "Disk, ISCSI, Logical, SCSI Host Bus Adapter"}] uint16 Type; string Path; string DevicePaths[]; string Host; string SourceDirectory; + string AdapterName; + string PortName; + string NodeName; };

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1246397611 25200 # Node ID 696c377aa8fce213b01916af24e1e1027d08c2f7 # Parent fb4f5e6e30cf8316165fa8307bc3fd184ff231fd Update xmlgen to generate SCSI storage pool XML, add support to RPCS This adds the code necessary to read in the SCSI pool related attributes and then generate the appropriate XML. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r fb4f5e6e30cf -r 696c377aa8fc libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jun 30 14:33:31 2009 -0700 +++ b/libxkutil/xmlgen.c Tue Jun 30 14:33:31 2009 -0700 @@ -874,6 +874,8 @@ return "iscsi"; case DISK_POOL_LOGICAL: return "logical"; + case DISK_POOL_SCSI: + return "scsi"; default: CU_DEBUG("Unsupported disk pool type"); } @@ -925,6 +927,31 @@ return XML_ERROR; } + if (pool->adapter != NULL) { + tmp = xmlNewChild(src, NULL, BAD_CAST "adapter", BAD_CAST NULL); + if (tmp == NULL) + return XML_ERROR; + + if (xmlNewProp(tmp, + BAD_CAST "name", + BAD_CAST pool->adapter) == NULL) + return XML_ERROR; + + if (pool->port_name != NULL) { + if (xmlNewProp(tmp, + BAD_CAST "wwpn", + BAD_CAST pool->port_name) == NULL) + return XML_ERROR; + } + + if (pool->node_name != NULL) { + if (xmlNewProp(tmp, + BAD_CAST "wwnn", + BAD_CAST pool->node_name) == NULL) + return XML_ERROR; + } + } + return NULL; } diff -r fb4f5e6e30cf -r 696c377aa8fc src/Virt_ResourcePoolConfigurationService.c --- a/src/Virt_ResourcePoolConfigurationService.c Tue Jun 30 14:33:31 2009 -0700 +++ b/src/Virt_ResourcePoolConfigurationService.c Tue Jun 30 14:33:31 2009 -0700 @@ -147,6 +147,9 @@ pool->pool_info.disk.path = NULL; pool->pool_info.disk.host = NULL; pool->pool_info.disk.src_dir = NULL; + pool->pool_info.disk.adapter = NULL; + pool->pool_info.disk.port_name = NULL; + pool->pool_info.disk.node_name = NULL; } static char *get_dev_paths(CMPIInstance *inst, @@ -257,6 +260,29 @@ return NULL; } +static const char *disk_scsi_pool(CMPIInstance *inst, + struct virt_pool *pool) +{ + const char *val = NULL; + + if (cu_get_str_prop(inst, "AdapterName", &val) != CMPI_RC_OK) + return "Missing `AdapterName' property"; + + pool->pool_info.disk.adapter = strdup(val); + + if (cu_get_str_prop(inst, "PortName", &val) != CMPI_RC_OK) { + CU_DEBUG("No `PortName' property specified"); + } else + pool->pool_info.disk.port_name = strdup(val); + + if (cu_get_str_prop(inst, "NodeName", &val) != CMPI_RC_OK) { + CU_DEBUG("No `NodeName' property specified"); + } else + pool->pool_info.disk.node_name = strdup(val); + + return NULL; +} + static const char *disk_rasd_to_pool(CMPIInstance *inst, struct virt_pool *pool) { @@ -285,6 +311,9 @@ case DISK_POOL_ISCSI: msg = disk_iscsi_pool(inst, pool); break; + case DISK_POOL_SCSI: + msg = disk_scsi_pool(inst, pool); + break; default: return "Storage pool type not supported"; }

# HG changeset patch # User Kaitlin Rupert <karupert@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@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);

+1 Kaitlin Rupert wrote:
This set of changes is for scsi pools that are based on a host bus adapter. These types of sotrage include FiberChannel attached storage devices, as well as SANs. There's two different ways to define these pools:
FiberChannel connected devices: <pool type="scsi"> <name>hba0</name> <source> <adapter name="host4"/> </source> <target> <path>/dev/disk/by-id</path> </target> </pool>
SAN devices: <pool type="scsi"> <name>npiv</name> <source> <adapter name="host6" wwpn="0000111122223333" wwnn="4444555566667777"/> </source> <target> <path>/dev/disk/by-id</path> </target> </pool>
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Richard Maciel, MSc IBM Linux Technology Center rmaciel@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
Richard Maciel