Merge "HPE Lefthand: Fixed cloning operation"
This commit is contained in:
commit
3aa26053ab
@ -1171,6 +1171,40 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
|
||||
mock_replicated_client.assert_has_calls(
|
||||
expected_calls_replica_client)
|
||||
|
||||
@mock.patch.object(volume_types, 'get_volume_type')
|
||||
def test_create_cloned_volume_with_different_provision(self,
|
||||
mock_volume_type):
|
||||
|
||||
conf = self.default_mock_conf()
|
||||
mock_client = self.setup_driver(config=conf)
|
||||
|
||||
mock_client.getVolumeByName.return_value = {'id': self.volume_id}
|
||||
mock_client.cloneVolume.return_value = {
|
||||
'iscsiIqn': self.connector['initiator']}
|
||||
|
||||
mock_volume_type.return_value = {
|
||||
'name': 'replicated',
|
||||
'extra_specs': {'hpelh:provisioning': 'full'}}
|
||||
cloned_volume = self.cloned_volume.copy()
|
||||
volume = self.volume.copy()
|
||||
volume['volume_type_id'] = 2
|
||||
with mock.patch.object(
|
||||
hpe_lefthand_iscsi.HPELeftHandISCSIDriver,
|
||||
'_create_client') as mock_do_setup:
|
||||
|
||||
mock_do_setup.return_value = mock_client
|
||||
|
||||
# execute create_cloned_volume
|
||||
self.driver.create_cloned_volume(
|
||||
cloned_volume, volume)
|
||||
expected = self.driver_startup_call_stack + [
|
||||
mock.call.getVolumeByName('fakevolume'),
|
||||
mock.call.cloneVolume('clone_volume', 1),
|
||||
mock.call.getVolumeByName('clone_volume'),
|
||||
mock.call.modifyVolume(1, {'isThinProvisioned': False}),
|
||||
mock.call.logout()]
|
||||
mock_client.assert_has_calls(expected)
|
||||
|
||||
def test_create_cloned_volume_exception(self):
|
||||
|
||||
# setup driver with default configuration
|
||||
|
@ -163,9 +163,10 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
|
||||
2.0.10 - Add entry point tracing
|
||||
2.0.11 - Fix extend volume if larger than snapshot bug #1560654
|
||||
2.0.12 - add CG capability to generic volume groups.
|
||||
2.0.13 - Fix cloning operation related to provisioning, bug #1688243
|
||||
"""
|
||||
|
||||
VERSION = "2.0.12"
|
||||
VERSION = "2.0.13"
|
||||
|
||||
CI_WIKI_NAME = "HPE_Storage_CI"
|
||||
|
||||
@ -865,6 +866,21 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
|
||||
if volume['size'] > src_vref['size']:
|
||||
LOG.debug("Resize the new volume to %s.", volume['size'])
|
||||
self.extend_volume(volume, volume['size'])
|
||||
# TODO(kushal) : we will use volume.volume_types when we re-write
|
||||
# the design for unit tests to use objects instead of dicts.
|
||||
# Get the extra specs of interest from this volume's volume type
|
||||
volume_extra_specs = self._get_volume_extra_specs(src_vref)
|
||||
extra_specs = self._get_lh_extra_specs(
|
||||
volume_extra_specs,
|
||||
extra_specs_key_map.keys())
|
||||
|
||||
# Check provisioning type of source volume. If it's full then need
|
||||
# to change provisioning of clone volume to full as lefthand
|
||||
# creates clone volume only with thin provisioning type.
|
||||
if extra_specs.get('hpelh:provisioning') == 'full':
|
||||
options = {'isThinProvisioned': False}
|
||||
clone_volume_info = client.getVolumeByName(volume['name'])
|
||||
client.modifyVolume(clone_volume_info['id'], options)
|
||||
|
||||
model_update = self._update_provider(clone_info)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user