Merge "XtremIO: fix fetching FC targets from X2 array" into stable/ocata

This commit is contained in:
Jenkins 2017-08-01 19:58:23 +00:00 committed by Gerrit Code Review
commit 1daa96fef5
2 changed files with 28 additions and 17 deletions

View File

@ -60,16 +60,18 @@ xms_init = {'xms': {1: {'version': '4.2.0',
"index": 1,
},
},
'targets': {'X1-SC2-fc1': {'index': 1, "name": "X1-SC2-fc1",
"port-address":
"21:00:00:24:ff:57:b2:36",
'port-state': 'up',
},
'X1-SC2-fc2': {'index': 2, "name": "X1-SC2-fc2",
"port-address":
"21:00:00:24:ff:57:b2:55",
'port-state': 'up',
}
'targets': {'X1-SC2-target1': {'index': 1, "name": "X1-SC2-fc1",
"port-address":
"21:00:00:24:ff:57:b2:36",
'port-type': 'fc',
'port-state': 'up',
},
'X1-SC2-target2': {'index': 2, "name": "X1-SC2-fc2",
"port-address":
"21:00:00:24:ff:57:b2:55",
'port-type': 'fc',
'port-state': 'up',
}
},
'volumes': {},
'initiator-groups': {},

View File

@ -216,6 +216,13 @@ class XtremIOClient(object):
return list(ig_indexes)
def get_fc_up_ports(self):
targets = [self.req('targets', name=target['name'])['content']
for target in self.req('targets')['targets']]
return [target for target in targets
if target['port-type'] == 'fc' and
target["port-state"] == 'up']
class XtremIOClient3(XtremIOClient):
def __init__(self, configuration, cluster_id):
@ -363,6 +370,13 @@ class XtremIOClient4(XtremIOClient):
else:
pass
def get_fc_up_ports(self):
return self.req('targets',
data={'full': 1,
'filter': ['port-type:eq:fc',
'port-state:eq:up'],
'prop': 'port-address'})["targets"]
class XtremIOClient42(XtremIOClient4):
def get_initiators_igs(self, port_addresses):
@ -1111,14 +1125,9 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
def get_targets(self):
if not self._targets:
try:
target_list = self.client.req('targets')["targets"]
targets = [self.client.req('targets',
name=target['name'])['content']
for target in target_list
if '-fc' in target['name']]
targets = self.client.get_fc_up_ports()
self._targets = [target['port-address'].replace(':', '')
for target in targets
if target['port-state'] == 'up']
for target in targets]
except exception.NotFound:
raise (exception.VolumeBackendAPIException
(data=_("Failed to get targets")))