Cisco zonemanager: fix create multi-fabric zones

Firstly,cisco zone driver can't support multi-fabric with different ip.

If we configure multi-fabric with different ip in cinder.conf,
we can only get the first fabric's nameserver_info, we can't get other
fabric's nameserver_info with cmd - show fcns database vsan xxx.

Secondly, cisco zone driver can't support multi-fabric with same vsan.

If we configure multi-fabric with the same zoning_vsan name, we can only
get the last fabric's fabric_map. This may lead to missing other
fabric_map.

Change-Id: I8ac698d511232b3aedf457061269cb6188b61b12
Closes-Bug: #1704142
This commit is contained in:
dongdongpei 2017-07-13 20:31:40 -07:00
parent 00415019f4
commit 594368e4ee
2 changed files with 25 additions and 23 deletions

View File

@ -40,7 +40,7 @@ switch_data = ['VSAN 304\n',
nsshow_data = ['10:00:8c:7c:ff:52:3b:01', '20:24:00:02:ac:00:0a:50']
_device_map_to_verify = {
'304': {
'CISCO_FAB_2': {
'initiator_port_wwn_list': ['10008c7cff523b01'],
'target_port_wwn_list': ['20240002ac000a50']}}

View File

@ -55,7 +55,7 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
self.switch_port = ""
self.switch_pwd = ""
self.switch_ip = ""
self.sshpool = None
self.sshpool = {}
def create_configuration(self):
"""Configuration specific to SAN context values."""
@ -87,7 +87,7 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
.. code-block:: python
{
<San name>: {
<Fabric name>: {
'initiator_port_wwn_list':
('200000051e55a100', '200000051e55a121'..)
'target_port_wwn_list':
@ -168,7 +168,7 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
fabric_map = {'initiator_port_wwn_list': visible_initiators,
'target_port_wwn_list': visible_targets
}
device_map[zoning_vsan] = fabric_map
device_map[fabric_name] = fabric_map
LOG.debug("Device map for SAN context: %s", device_map)
return device_map
@ -232,17 +232,18 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
command = ' '.join(cmd_list)
if not self.sshpool:
self.sshpool = ssh_utils.SSHPool(self.switch_ip,
self.switch_port,
None,
self.switch_user,
self.switch_pwd,
min_size=1,
max_size=5)
if self.sshpool.get(self.switch_ip) is None:
self.sshpool[self.switch_ip] = ssh_utils.SSHPool(self.switch_ip,
self.switch_port,
None,
self.switch_user,
self.switch_pwd,
min_size=1,
max_size=5)
last_exception = None
try:
with self.sshpool.item() as ssh:
with self.sshpool.get(self.switch_ip).item() as ssh:
while attempts > 0:
attempts -= 1
try:
@ -288,19 +289,20 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
# Combine into a single command.
command = ' ; '.join(map(lambda x: ' '.join(x), cmd_list))
if not self.sshpool:
self.sshpool = ssh_utils.SSHPool(self.switch_ip,
self.switch_port,
None,
self.switch_user,
self.switch_pwd,
min_size=1,
max_size=5)
if self.sshpool.get(self.switch_ip) is None:
self.sshpool[self.switch_ip] = ssh_utils.SSHPool(self.switch_ip,
self.switch_port,
None,
self.switch_user,
self.switch_pwd,
min_size=1,
max_size=5)
stdin, stdout, stderr = None, None, None
LOG.debug("Executing command via ssh: %s", command)
last_exception = None
try:
with self.sshpool.item() as ssh:
with self.sshpool.get(self.switch_ip).item() as ssh:
while attempts > 0:
attempts -= 1
try:
@ -355,4 +357,4 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService):
stderr.close()
def cleanup(self):
self.sshpool = None
self.sshpool = {}