DS8K: correct the behavior for get_pools method
If the pools defined in the config file but these can't be queried from the storage. The driver should catch this exception and ignore it to support the Report Backend status feature. Change-Id: I8d77b9b172df963063b38ccbd32e805dd7db1e00 Closes-Bug: 1780095
This commit is contained in:
parent
52deeff8d2
commit
f16987466e
cinder
@ -2689,8 +2689,9 @@ class DS8KProxyTest(test.TestCase):
|
||||
}
|
||||
mock_get_flashcopy.side_effect = [[TEST_FLASHCOPY], {}]
|
||||
with mock.patch.object(helper.DS8KCommonHelper,
|
||||
'_get_pools') as get_pools:
|
||||
get_pools.return_value = FAKE_GET_POOL_RESPONSE_2['data']['pools']
|
||||
'_get_pool') as get_pool:
|
||||
get_pool.return_value = FAKE_GET_POOL_RESPONSE_2['data'][
|
||||
'pools'][0]
|
||||
moved, model_update = self.driver.migrate_volume(
|
||||
self.ctxt, volume, backend)
|
||||
self.assertTrue(moved)
|
||||
|
@ -277,10 +277,19 @@ class DS8KCommonHelper(object):
|
||||
else:
|
||||
pools_str = self.backend['pools_str'].replace(
|
||||
' ', '').upper().split(',')
|
||||
pools = self._get_pools(pools_str)
|
||||
unsorted_pools = self._format_pools(pools)
|
||||
storage_pools = collections.OrderedDict(sorted(
|
||||
unsorted_pools, key=lambda i: i[1]['capavail'], reverse=True))
|
||||
pools = []
|
||||
storage_pools = collections.OrderedDict()
|
||||
for pid in pools_str:
|
||||
try:
|
||||
pools.append(self._get_pool(pid))
|
||||
except restclient.APIException as e:
|
||||
LOG.warning("Failed to get pool %(id)s information, "
|
||||
"Exception: %(ex)s.", {'id': pid,
|
||||
'ex': six.text_type(e)})
|
||||
if len(pools):
|
||||
unsorted_pools = self._format_pools(pools)
|
||||
storage_pools = collections.OrderedDict(sorted(
|
||||
unsorted_pools, key=lambda i: i[1]['capavail'], reverse=True))
|
||||
return storage_pools
|
||||
|
||||
@proxy.logger
|
||||
@ -757,10 +766,10 @@ class DS8KCommonHelper(object):
|
||||
def _create_lun(self, volData):
|
||||
return self._client.fetchid('POST', '/volumes', volData)
|
||||
|
||||
def _get_pools(self, pools_str):
|
||||
return [self._client.fetchone('GET', '/pools/%s' % pid,
|
||||
fields=['id', 'name', 'node', 'stgtype', 'cap', 'capavail'])
|
||||
for pid in pools_str]
|
||||
def _get_pool(self, pool_id):
|
||||
return self._client.fetchone('GET', '/pools/%s' % pool_id,
|
||||
fields=['id', 'name', 'node', 'stgtype',
|
||||
'cap', 'capavail'])
|
||||
|
||||
def start_flashcopy(self, vol_pairs, freeze=False):
|
||||
options = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user