From 9c4c994b952d7af5252c88e9486424033fa95d1b Mon Sep 17 00:00:00 2001 From: Tina Date: Tue, 15 Sep 2015 23:38:03 -0400 Subject: [PATCH] Fixing create CG from Cgsnapshot bug in VNX driver When creating a consistency group from a cgsnapshot, VNX driver didn't force a poll to the VNX system. This caused the creation to fail because the out-of-date status was returned. This patch forces a poll to the VNX system to get rid of this issue. Change-Id: I710bd0ac2a6049a79fce0d552ad8fba2c9fbde67 Closes-Bug: #1496660 --- cinder/tests/unit/test_emc_vnxdirect.py | 6 +++--- cinder/volume/drivers/emc/emc_vnx_cli.py | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cinder/tests/unit/test_emc_vnxdirect.py b/cinder/tests/unit/test_emc_vnxdirect.py index d5143225a..a7e82c285 100644 --- a/cinder/tests/unit/test_emc_vnxdirect.py +++ b/cinder/tests/unit/test_emc_vnxdirect.py @@ -641,7 +641,7 @@ class EMCVNXCLIDriverTestData(object): storage_pool, '-fastcache') def CREATE_CONSISTENCYGROUP_CMD(self, cg_name, members=None): - create_cmd = ('-np', 'snap', '-group', '-create', + create_cmd = ('snap', '-group', '-create', '-name', cg_name, '-allowSnapAutoDelete', 'no') if not members: @@ -3637,7 +3637,7 @@ Time Remaining: 0 second(s) expect_cmd = [ mock.call( *self.testData.CREATE_CONSISTENCYGROUP_CMD( - cg_name))] + cg_name), poll=False)] fake_cli.assert_has_calls(expect_cmd) @mock.patch( @@ -4013,7 +4013,7 @@ Time Remaining: 0 second(s) mock.call(*td.MIGRATION_VERIFY_CMD(6232), poll=True), mock.call(*td.MIGRATION_VERIFY_CMD(6231), poll=True), mock.call(*td.CREATE_CONSISTENCYGROUP_CMD( - new_cg['id'], [6232, 6231])), + new_cg['id'], [6232, 6231]), poll=True), mock.call(*td.DELETE_CG_SNAPSHOT(copied_snap_name))] self.assertEqual(expect_cmd, fake_cli.call_args_list) diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py index b16624c5b..b4ef7bf99 100644 --- a/cinder/volume/drivers/emc/emc_vnx_cli.py +++ b/cinder/volume/drivers/emc/emc_vnx_cli.py @@ -656,9 +656,9 @@ class CommandLineHelper(object): if rc != 0: self._raise_cli_error(command_modify_lun, rc, out) - def create_consistencygroup(self, cg_name, members=None): + def create_consistencygroup(self, cg_name, members=None, poll=False): """create the consistency group.""" - command_create_cg = ('-np', 'snap', '-group', + command_create_cg = ('snap', '-group', '-create', '-name', cg_name, '-allowSnapAutoDelete', 'no') @@ -666,7 +666,7 @@ class CommandLineHelper(object): command_create_cg += ('-res', ','.join(map(six.text_type, members))) - out, rc = self.command_execute(*command_create_cg) + out, rc = self.command_execute(*command_create_cg, poll=poll) if rc != 0: # Ignore the error if consistency group already exists if VNXError.has_error(out, VNXError.CG_EXISTED): @@ -3825,7 +3825,8 @@ class CreateConsistencyGroupTask(task.Task): def execute(self, client, group, *args, **kwargs): LOG.debug('CreateConsistencyGroupTask.execute') lun_ids = [kwargs[key] for key in self.lun_id_keys] - client.create_consistencygroup(group['id'], lun_ids) + client.create_consistencygroup(group['id'], lun_ids, + poll=True) class WaitMigrationsCompleteTask(task.Task): -- 2.45.2