]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixing create CG from Cgsnapshot bug in VNX driver
authorTina <tina.tang@emc.com>
Wed, 16 Sep 2015 03:38:03 +0000 (23:38 -0400)
committerTina <tina.tang@emc.com>
Sat, 19 Sep 2015 21:19:44 +0000 (17:19 -0400)
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
cinder/volume/drivers/emc/emc_vnx_cli.py

index d5143225a2f236be5c7b487e2d48651006b4098a..a7e82c285355279b4a74cac1b0e666f94f180df7 100644 (file)
@@ -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)
 
index b16624c5ba3b0688fd96cfd64355c46db0e19574..b4ef7bf994ea8a3eb8340b22571ee479e9b54106 100644 (file)
@@ -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):