XtremIO: support multiattach
- add multiattach to XtremIO driver capabilities. - add handling for volume attachment list and test - add release note Change-Id: I88fe943df753a97684077189c6a13dc1e290968d
This commit is contained in:
parent
32e14499e7
commit
607e7688b9
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2012 - 2014 EMC Corporation, Inc.
|
# Copyright (c) 2018 Dell Inc. or its subsidiaries.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
@ -20,12 +20,15 @@ import time
|
|||||||
import mock
|
import mock
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from cinder import context
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
|
from cinder.objects import volume_attachment
|
||||||
from cinder import test
|
from cinder import test
|
||||||
from cinder.tests.unit.consistencygroup import fake_consistencygroup as fake_cg
|
from cinder.tests.unit.consistencygroup import fake_consistencygroup as fake_cg
|
||||||
from cinder.tests.unit import fake_constants as fake
|
from cinder.tests.unit import fake_constants as fake
|
||||||
from cinder.tests.unit import fake_snapshot
|
from cinder.tests.unit import fake_snapshot
|
||||||
from cinder.tests.unit.fake_volume import fake_volume_obj
|
from cinder.tests.unit.fake_volume import fake_volume_obj
|
||||||
|
from cinder.tests.unit.fake_volume import fake_volume_type_obj
|
||||||
from cinder.volume.drivers.dell_emc import xtremio
|
from cinder.volume.drivers.dell_emc import xtremio
|
||||||
|
|
||||||
typ2id = {'volumes': 'vol-id',
|
typ2id = {'volumes': 'vol-id',
|
||||||
@ -243,7 +246,7 @@ class D(dict):
|
|||||||
|
|
||||||
|
|
||||||
class CommonData(object):
|
class CommonData(object):
|
||||||
context = {'user': 'admin', }
|
context = context.RequestContext('admin', 'fake', True)
|
||||||
connector = {'ip': '10.0.0.2',
|
connector = {'ip': '10.0.0.2',
|
||||||
'initiator': 'iqn.1993-08.org.debian:01:222',
|
'initiator': 'iqn.1993-08.org.debian:01:222',
|
||||||
'wwpns': ["123456789012345", "123456789054321"],
|
'wwpns': ["123456789012345", "123456789054321"],
|
||||||
@ -251,19 +254,25 @@ class CommonData(object):
|
|||||||
'host': 'fakehost',
|
'host': 'fakehost',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_volume_type = fake_volume_type_obj(
|
||||||
|
context=context
|
||||||
|
)
|
||||||
|
|
||||||
test_volume = fake_volume_obj(context,
|
test_volume = fake_volume_obj(context,
|
||||||
|
volume_type = test_volume_type,
|
||||||
name='vol1',
|
name='vol1',
|
||||||
size=1,
|
|
||||||
volume_name='vol1',
|
volume_name='vol1',
|
||||||
|
display_name='vol1',
|
||||||
|
display_description='test volume',
|
||||||
|
size=1,
|
||||||
id='192eb39b-6c2f-420c-bae3-3cfd117f0001',
|
id='192eb39b-6c2f-420c-bae3-3cfd117f0001',
|
||||||
provider_auth=None,
|
provider_auth=None,
|
||||||
project_id='project',
|
project_id='project',
|
||||||
display_name='vol1',
|
|
||||||
display_description='test volume',
|
|
||||||
volume_type_id=None,
|
volume_type_id=None,
|
||||||
consistencygroup_id=
|
consistencygroup_id=
|
||||||
'192eb39b-6c2f-420c-bae3-3cfd117f0345',
|
'192eb39b-6c2f-420c-bae3-3cfd117f0345',
|
||||||
)
|
)
|
||||||
|
|
||||||
test_snapshot = D()
|
test_snapshot = D()
|
||||||
test_snapshot.update({'name': 'snapshot1',
|
test_snapshot.update({'name': 'snapshot1',
|
||||||
'size': 1,
|
'size': 1,
|
||||||
@ -319,6 +328,10 @@ class CommonData(object):
|
|||||||
'consistencygroup_id': None,
|
'consistencygroup_id': None,
|
||||||
'group_id': group['id'], }
|
'group_id': group['id'], }
|
||||||
|
|
||||||
|
test_volume_attachment = volume_attachment.VolumeAttachment(
|
||||||
|
id='2b06255d-f5f0-4520-a953-b029196add6b', volume_id=test_volume.id,
|
||||||
|
connector=connector)
|
||||||
|
|
||||||
|
|
||||||
class BaseXtremIODriverTestCase(test.TestCase):
|
class BaseXtremIODriverTestCase(test.TestCase):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -697,7 +710,9 @@ class XtremIODriverISCSITestCase(BaseXtremIODriverTestCase):
|
|||||||
|
|
||||||
def test_get_ig_indexes_from_initiators_called_once(self, req):
|
def test_get_ig_indexes_from_initiators_called_once(self, req):
|
||||||
req.side_effect = xms_request
|
req.side_effect = xms_request
|
||||||
self.driver.create_volume(self.data.test_volume)
|
volume1 = copy.deepcopy(self.data.test_volume)
|
||||||
|
volume1.volume_attachment.objects = [self.data.test_volume_attachment]
|
||||||
|
self.driver.create_volume(volume1)
|
||||||
map_data = self.driver.initialize_connection(self.data.test_volume,
|
map_data = self.driver.initialize_connection(self.data.test_volume,
|
||||||
self.data.connector)
|
self.data.connector)
|
||||||
i1 = xms_data['initiators'][1]
|
i1 = xms_data['initiators'][1]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2012 - 2014 EMC Corporation.
|
# Copyright (c) 2018 Dell Inc. or its subsidiaries.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
@ -30,6 +30,7 @@ supported XtremIO version 2.4 and up
|
|||||||
1.0.8 - support for volume retype, CG fixes
|
1.0.8 - support for volume retype, CG fixes
|
||||||
1.0.9 - performance improvements, support force detach, support for X2
|
1.0.9 - performance improvements, support force detach, support for X2
|
||||||
1.0.10 - option to clean unused IGs
|
1.0.10 - option to clean unused IGs
|
||||||
|
1.0.11 - add support for multiattach
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@ -409,7 +410,7 @@ class XtremIOClient42(XtremIOClient4):
|
|||||||
class XtremIOVolumeDriver(san.SanDriver):
|
class XtremIOVolumeDriver(san.SanDriver):
|
||||||
"""Executes commands relating to Volumes."""
|
"""Executes commands relating to Volumes."""
|
||||||
|
|
||||||
VERSION = '1.0.10'
|
VERSION = '1.0.11'
|
||||||
|
|
||||||
# ThirdPartySystems wiki
|
# ThirdPartySystems wiki
|
||||||
CI_WIKI_NAME = "EMC_XIO_CI"
|
CI_WIKI_NAME = "EMC_XIO_CI"
|
||||||
@ -616,7 +617,7 @@ class XtremIOVolumeDriver(san.SanDriver):
|
|||||||
'reserved_percentage':
|
'reserved_percentage':
|
||||||
self.configuration.reserved_percentage,
|
self.configuration.reserved_percentage,
|
||||||
'QoS_support': False,
|
'QoS_support': False,
|
||||||
'multiattach': False,
|
'multiattach': True,
|
||||||
}
|
}
|
||||||
self._stats.update(self.client.get_extra_capabilities())
|
self._stats.update(self.client.get_extra_capabilities())
|
||||||
|
|
||||||
@ -725,6 +726,23 @@ class XtremIOVolumeDriver(san.SanDriver):
|
|||||||
LOG.info('Force detach volume %(vol)s from luns %(luns)s.',
|
LOG.info('Force detach volume %(vol)s from luns %(luns)s.',
|
||||||
{'vol': vol['name'], 'luns': ig_indexes})
|
{'vol': vol['name'], 'luns': ig_indexes})
|
||||||
else:
|
else:
|
||||||
|
host = connector['host']
|
||||||
|
attachment_list = volume.volume_attachment
|
||||||
|
LOG.debug("Volume attachment list: %(atl)s. "
|
||||||
|
"Attachment type: %(at)s",
|
||||||
|
{'atl': attachment_list, 'at': type(attachment_list)})
|
||||||
|
try:
|
||||||
|
att_list = attachment_list.objects
|
||||||
|
except AttributeError:
|
||||||
|
att_list = attachment_list
|
||||||
|
if att_list is not None:
|
||||||
|
host_list = [att.connector['host'] for att in att_list if
|
||||||
|
att is not None and att.connector is not None]
|
||||||
|
current_host_occurances = host_list.count(host)
|
||||||
|
if current_host_occurances > 1:
|
||||||
|
LOG.info("Volume is attached to multiple instances on "
|
||||||
|
"this host. Not removing the lun map.")
|
||||||
|
return
|
||||||
vol = self.client.req('volumes', name=volume.id,
|
vol = self.client.req('volumes', name=volume.id,
|
||||||
data={'prop': 'index'})['content']
|
data={'prop': 'index'})['content']
|
||||||
ig_indexes = self._get_ig_indexes_from_initiators(connector)
|
ig_indexes = self._get_ig_indexes_from_initiators(connector)
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Dell EMC XtremIO driver has added multiattach support.
|
Loading…
x
Reference in New Issue
Block a user