From 764d3501351f91c23c705615483553313d8085b8 Mon Sep 17 00:00:00 2001 From: peter_wang Date: Mon, 17 Aug 2015 10:33:18 -0400 Subject: [PATCH] Update update_migrated_volume in VNX driver Cinder framework adds an extra 'original_volume_status' in update_migrated_volume. Driver interface needs to update accordingly. Change-Id: I59b3343529dd0a4c1f7ab3e74f203d6503f12697 Closes-Bug: 1486359 --- cinder/tests/unit/test_emc_vnxdirect.py | 12 +++++++++++- cinder/volume/drivers/emc/emc_cli_fc.py | 6 ++++-- cinder/volume/drivers/emc/emc_cli_iscsi.py | 6 ++++-- cinder/volume/drivers/emc/emc_vnx_cli.py | 3 ++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cinder/tests/unit/test_emc_vnxdirect.py b/cinder/tests/unit/test_emc_vnxdirect.py index b0190a26a..7c6385c9f 100644 --- a/cinder/tests/unit/test_emc_vnxdirect.py +++ b/cinder/tests/unit/test_emc_vnxdirect.py @@ -127,7 +127,9 @@ class EMCVNXCLIDriverTestData(object): 'display_name': 'vol2', 'consistencygroup_id': None, 'display_description': 'test volume', - 'volume_type_id': None} + 'volume_type_id': None, + 'provider_location': 'system^FNM11111|type^lun|id^1|version^05.03.00', + 'volume_metadata': [{'key': 'lun_type', 'value': 'lun'}]} volume_in_cg = { 'name': 'vol2', @@ -4169,6 +4171,14 @@ Time Remaining: 0 second(s) 'volume_id': '1'} self.assertEqual(expected_info, connect_info) + def test_update_migrated_volume(self): + self.driverSetup() + expected_update = {'metadata': {'lun_type': 'lun'}} + model_update = self.driver.update_migrated_volume( + None, self.testData.test_volume, + self.testData.test_volume2, 'available') + self.assertDictMatch(expected_update, model_update) + class EMCVNXCLIDArrayBasedDriverTestCase(DriverTestCaseBase): def setUp(self): diff --git a/cinder/volume/drivers/emc/emc_cli_fc.py b/cinder/volume/drivers/emc/emc_cli_fc.py index 8dcd142c8..d235c7db4 100644 --- a/cinder/volume/drivers/emc/emc_cli_fc.py +++ b/cinder/volume/drivers/emc/emc_cli_fc.py @@ -269,9 +269,11 @@ class EMCCLIFCDriver(driver.FibreChannelDriver): cgsnapshot, snapshots) - def update_migrated_volume(self, context, volume, new_volume): + def update_migrated_volume(self, context, volume, new_volume, + original_volume_status=None): """Returns model update for migrated volume.""" - return self.cli.update_migrated_volume(context, volume, new_volume) + return self.cli.update_migrated_volume(context, volume, new_volume, + original_volume_status) def create_export_snapshot(self, context, snapshot, connector): """Creates a snapshot mount point for snapshot.""" diff --git a/cinder/volume/drivers/emc/emc_cli_iscsi.py b/cinder/volume/drivers/emc/emc_cli_iscsi.py index 332fc8fae..236a59031 100644 --- a/cinder/volume/drivers/emc/emc_cli_iscsi.py +++ b/cinder/volume/drivers/emc/emc_cli_iscsi.py @@ -248,9 +248,11 @@ class EMCCLIISCSIDriver(driver.ISCSIDriver): cgsnapshot, snapshots) - def update_migrated_volume(self, context, volume, new_volume): + def update_migrated_volume(self, context, volume, new_volume, + original_volume_status=None): """Returns model update for migrated volume.""" - return self.cli.update_migrated_volume(context, volume, new_volume) + return self.cli.update_migrated_volume(context, volume, new_volume, + original_volume_status) def create_export_snapshot(self, context, snapshot, connector): """Creates a snapshot mount point for snapshot.""" diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py index d0d51c671..e3af3fda8 100644 --- a/cinder/volume/drivers/emc/emc_vnx_cli.py +++ b/cinder/volume/drivers/emc/emc_vnx_cli.py @@ -2265,7 +2265,8 @@ class EMCVnxCliBase(object): 'metadata': volume_metadata} return moved, model_update - def update_migrated_volume(self, context, volume, new_volume): + def update_migrated_volume(self, context, volume, new_volume, + original_volume_status): lun_type = self._extract_provider_location_for_lun( new_volume['provider_location'], 'type') volume_metadata = self._get_volume_metadata(volume) -- 2.45.2