From 14ef9330b16cb11a5707213ec56f5585ee9d55e3 Mon Sep 17 00:00:00 2001
From: Slade Baumann <baumann@us.ibm.com>
Date: Mon, 28 Dec 2015 10:44:34 -0600
Subject: [PATCH] Add ConsistencyGroupStatus enum field

This change adds a new enum and field, ConsistencyGroupStatus and
ConsistencyGroupStatusField, that will hold the constants for the
'status' field of the ConsistencyGroup object. This enum and field
are based off the base oslo.versionedobjects enum and field. This
also changes over the ConsistencyGroup object to use the new field
(and bumps the version so newer versions know to enforce
valid values). Finally, all uses of strings for comparison and
assignment to this field are changed over to use the constants
defined within the enum.

Change-Id: Icee2727f0a550541876c63b6e7340acf3de553c8
Implements:  bp cinder-object-fields
---
 cinder/consistencygroup/api.py                | 16 ++--
 cinder/db/sqlalchemy/api.py                   |  2 +-
 cinder/objects/consistencygroup.py            |  6 +-
 cinder/objects/fields.py                      | 22 +++++
 .../api/contrib/test_consistencygroups.py     | 83 +++++++++++--------
 cinder/tests/unit/fake_driver.py              |  6 +-
 .../unit/objects/test_consistencygroup.py     | 12 +--
 cinder/tests/unit/objects/test_fields.py      | 23 +++++
 cinder/tests/unit/objects/test_objects.py     |  2 +-
 cinder/tests/unit/scheduler/test_scheduler.py |  7 +-
 cinder/tests/unit/test_dellsc.py              |  5 +-
 cinder/tests/unit/test_emc_vmax.py            |  6 +-
 cinder/tests/unit/test_emc_vnx.py             | 20 +++--
 cinder/tests/unit/test_gpfs.py                |  5 +-
 cinder/tests/unit/test_hpe3par.py             |  3 +-
 cinder/tests/unit/test_hpelefthand.py         | 34 +++++---
 cinder/tests/unit/test_ibm_xiv_ds8k.py        | 17 ++--
 cinder/tests/unit/test_prophetstor_dpl.py     | 10 ++-
 cinder/tests/unit/test_solidfire.py           |  7 +-
 cinder/tests/unit/test_storwize_svc.py        | 33 +++++---
 cinder/tests/unit/test_volume.py              | 33 ++++----
 cinder/tests/unit/utils.py                    |  2 +-
 cinder/volume/drivers/emc/emc_vmax_common.py  |  7 +-
 cinder/volume/drivers/emc/emc_vnx_cli.py      |  5 +-
 cinder/volume/drivers/emc/xtremio.py          |  3 +-
 cinder/volume/drivers/hpe/hpe_3par_common.py  |  3 +-
 .../volume/drivers/hpe/hpe_lefthand_iscsi.py  |  3 +-
 cinder/volume/drivers/ibm/gpfs.py             |  3 +-
 .../ibm/storwize_svc/storwize_svc_common.py   |  9 +-
 .../volume/drivers/prophetstor/dplcommon.py   | 10 ++-
 cinder/volume/drivers/pure.py                 |  3 +-
 cinder/volume/drivers/solidfire.py            |  6 +-
 cinder/volume/manager.py                      | 11 ++-
 33 files changed, 273 insertions(+), 144 deletions(-)

diff --git a/cinder/consistencygroup/api.py b/cinder/consistencygroup/api.py
index 3539df8ad..ef16314cf 100644
--- a/cinder/consistencygroup/api.py
+++ b/cinder/consistencygroup/api.py
@@ -29,6 +29,7 @@ from cinder.db import base
 from cinder import exception
 from cinder.i18n import _, _LE, _LW
 from cinder import objects
+from cinder.objects import fields as c_fields
 import cinder.policy
 from cinder import quota
 from cinder.scheduler import rpcapi as scheduler_rpcapi
@@ -42,7 +43,8 @@ CONF = cfg.CONF
 
 LOG = logging.getLogger(__name__)
 CGQUOTAS = quota.CGQUOTAS
-VALID_REMOVE_VOL_FROM_CG_STATUS = ('available', 'in-use',)
+VALID_REMOVE_VOL_FROM_CG_STATUS = (c_fields.ConsistencyGroupStatus.AVAILABLE,
+                                   c_fields.ConsistencyGroupStatus.IN_USE)
 
 
 def wrap_check_policy(func):
@@ -130,7 +132,7 @@ class API(base.Base):
         kwargs = {'user_id': context.user_id,
                   'project_id': context.project_id,
                   'availability_zone': availability_zone,
-                  'status': "creating",
+                  'status': c_fields.ConsistencyGroupStatus.CREATING,
                   'name': name,
                   'description': description,
                   'volume_type_id': req_volume_type_ids}
@@ -194,7 +196,7 @@ class API(base.Base):
         kwargs = {
             'user_id': context.user_id,
             'project_id': context.project_id,
-            'status': "creating",
+            'status': c_fields.ConsistencyGroupStatus.CREATING,
             'name': name,
             'description': description,
             'cgsnapshot_id': cgsnapshot_id,
@@ -440,7 +442,9 @@ class API(base.Base):
 
             return
 
-        if not force and group.status not in ["available", "error"]:
+        if not force and group.status not in (
+                [c_fields.ConsistencyGroupStatus.AVAILABLE,
+                 c_fields.ConsistencyGroupStatus.ERROR]):
             msg = _("Consistency group status must be available or error, "
                     "but current status is: %s") % group.status
             raise exception.InvalidConsistencyGroup(reason=msg)
@@ -477,7 +481,7 @@ class API(base.Base):
                 LOG.error(msg)
                 raise exception.InvalidConsistencyGroup(reason=msg)
 
-        group.status = 'deleting'
+        group.status = c_fields.ConsistencyGroupStatus.DELETING
         group.terminated_at = timeutils.utcnow()
         group.save()
 
@@ -486,7 +490,7 @@ class API(base.Base):
     def update(self, context, group, name, description,
                add_volumes, remove_volumes):
         """Update consistency group."""
-        if group.status != 'available':
+        if group.status != c_fields.ConsistencyGroupStatus.AVAILABLE:
             msg = _("Consistency group status must be available, "
                     "but current status is: %s.") % group.status
             raise exception.InvalidConsistencyGroup(reason=msg)
diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py
index 393240c3a..a5fda055d 100644
--- a/cinder/db/sqlalchemy/api.py
+++ b/cinder/db/sqlalchemy/api.py
@@ -3883,7 +3883,7 @@ def consistencygroup_destroy(context, consistencygroup_id):
     with session.begin():
         model_query(context, models.ConsistencyGroup, session=session).\
             filter_by(id=consistencygroup_id).\
-            update({'status': 'deleted',
+            update({'status': fields.ConsistencyGroupStatus.DELETED,
                     'deleted': True,
                     'deleted_at': timeutils.utcnow(),
                     'updated_at': literal_column('updated_at')})
diff --git a/cinder/objects/consistencygroup.py b/cinder/objects/consistencygroup.py
index 1c16fbc6e..07e41d2c4 100644
--- a/cinder/objects/consistencygroup.py
+++ b/cinder/objects/consistencygroup.py
@@ -17,6 +17,7 @@ from cinder import exception
 from cinder.i18n import _
 from cinder import objects
 from cinder.objects import base
+from cinder.objects import fields as c_fields
 from oslo_versionedobjects import fields
 
 OPTIONAL_FIELDS = ['cgsnapshots', 'volumes']
@@ -27,7 +28,8 @@ class ConsistencyGroup(base.CinderPersistentObject, base.CinderObject,
                        base.CinderObjectDictCompat):
     # Version 1.0: Initial version
     # Version 1.1: Added cgsnapshots and volumes relationships
-    VERSION = '1.1'
+    # Version 1.2: Changed 'status' field to use ConsistencyGroupStatusField
+    VERSION = '1.2'
 
     fields = {
         'id': fields.UUIDField(),
@@ -38,7 +40,7 @@ class ConsistencyGroup(base.CinderPersistentObject, base.CinderObject,
         'name': fields.StringField(nullable=True),
         'description': fields.StringField(nullable=True),
         'volume_type_id': fields.UUIDField(nullable=True),
-        'status': fields.StringField(nullable=True),
+        'status': c_fields.ConsistencyGroupStatusField(nullable=True),
         'cgsnapshot_id': fields.UUIDField(nullable=True),
         'source_cgid': fields.UUIDField(nullable=True),
         'cgsnapshots': fields.ObjectField('CGSnapshotList', nullable=True),
diff --git a/cinder/objects/fields.py b/cinder/objects/fields.py
index 38fe312ef..8ad215fc0 100644
--- a/cinder/objects/fields.py
+++ b/cinder/objects/fields.py
@@ -41,3 +41,25 @@ class BackupStatus(Enum):
 
 class BackupStatusField(BaseEnumField):
     AUTO_TYPE = BackupStatus()
+
+
+class ConsistencyGroupStatus(Enum):
+    ERROR = 'error'
+    AVAILABLE = 'available'
+    CREATING = 'creating'
+    DELETING = 'deleting'
+    DELETED = 'deleted'
+    UPDATING = 'updating'
+    IN_USE = 'in-use'
+    ERROR_DELETING = 'error_deleting'
+
+    ALL = (ERROR, AVAILABLE, CREATING, DELETING, DELETED,
+           UPDATING, IN_USE, ERROR_DELETING)
+
+    def __init__(self):
+        super(ConsistencyGroupStatus, self).__init__(
+            valid_values=ConsistencyGroupStatus.ALL)
+
+
+class ConsistencyGroupStatusField(BaseEnumField):
+    AUTO_TYPE = ConsistencyGroupStatus()
diff --git a/cinder/tests/unit/api/contrib/test_consistencygroups.py b/cinder/tests/unit/api/contrib/test_consistencygroups.py
index d723f03bb..4ea93c1b0 100644
--- a/cinder/tests/unit/api/contrib/test_consistencygroups.py
+++ b/cinder/tests/unit/api/contrib/test_consistencygroups.py
@@ -29,6 +29,7 @@ from cinder import db
 from cinder import exception
 from cinder.i18n import _
 from cinder import objects
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit.api import fakes
 from cinder.tests.unit.api.v2 import stubs
@@ -53,7 +54,7 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
             volume_type_id='123456',
             availability_zone='az1',
             host='fakehost',
-            status='creating'):
+            status=fields.ConsistencyGroupStatus.CREATING):
         """Create a consistency group object."""
         ctxt = ctxt or self.ctxt
         consistencygroup = objects.ConsistencyGroup(ctxt)
@@ -366,7 +367,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
                          res_dict['badRequest']['message'])
 
     def test_delete_consistencygroup_available(self):
-        consistencygroup = self._create_consistencygroup(status='available')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -378,7 +380,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup = objects.ConsistencyGroup.get_by_id(
             self.ctxt, consistencygroup.id)
         self.assertEqual(202, res.status_int)
-        self.assertEqual('deleting', consistencygroup.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETING,
+                         consistencygroup.status)
 
         consistencygroup.destroy()
 
@@ -396,7 +399,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
                          res_dict['itemNotFound']['message'])
 
     def test_delete_consistencygroup_with_Invalidconsistencygroup(self):
-        consistencygroup = self._create_consistencygroup(status='invalid')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.IN_USE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -409,7 +413,7 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         self.assertEqual(400, res.status_int)
         self.assertEqual(400, res_dict['badRequest']['code'])
         msg = (_('Invalid ConsistencyGroup: Consistency group status must be '
-                 'available or error, but current status is: invalid'))
+                 'available or error, but current status is: in-use'))
         self.assertEqual(msg, res_dict['badRequest']['message'])
 
         consistencygroup.destroy()
@@ -417,7 +421,7 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
     def test_delete_consistencygroup_no_host(self):
         consistencygroup = self._create_consistencygroup(
             host=None,
-            status='error')
+            status=fields.ConsistencyGroupStatus.ERROR)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -430,7 +434,7 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         cg = objects.ConsistencyGroup.get_by_id(
             context.get_admin_context(read_deleted='yes'),
             consistencygroup.id)
-        self.assertEqual('deleted', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED, cg.status)
         self.assertIsNone(cg.host)
 
     def test_create_delete_consistencygroup_update_quota(self):
@@ -449,20 +453,21 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
                                 fake_type['name'])
         self.cg_api.update_quota.assert_called_once_with(
             self.ctxt, cg, 1)
-        self.assertEqual('creating', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.CREATING, cg.status)
         self.assertIsNone(cg.host)
         self.cg_api.update_quota.reset_mock()
-        cg.status = 'error'
+        cg.status = fields.ConsistencyGroupStatus.ERROR
         self.cg_api.delete(self.ctxt, cg)
         self.cg_api.update_quota.assert_called_once_with(
             self.ctxt, cg, -1, self.ctxt.project_id)
         cg = objects.ConsistencyGroup.get_by_id(
             context.get_admin_context(read_deleted='yes'),
             cg.id)
-        self.assertEqual('deleted', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED, cg.status)
 
     def test_delete_consistencygroup_with_invalid_body(self):
-        consistencygroup = self._create_consistencygroup(status='available')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -474,7 +479,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         self.assertEqual(400, res.status_int)
 
     def test_delete_consistencygroup_with_invalid_force_value_in_body(self):
-        consistencygroup = self._create_consistencygroup(status='available')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -486,7 +492,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         self.assertEqual(400, res.status_int)
 
     def test_delete_consistencygroup_with_empty_force_value_in_body(self):
-        consistencygroup = self._create_consistencygroup(status='available')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/delete' %
                                   consistencygroup.id)
         req.method = 'POST'
@@ -519,8 +526,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         'cinder.api.openstack.wsgi.Controller.validate_name_and_description')
     def test_update_consistencygroup_success(self, mock_validate):
         volume_type_id = '123456'
-        consistencygroup = self._create_consistencygroup(status='available',
-                                                         host='test_host')
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.AVAILABLE,
+            host='test_host')
 
         remove_volume_id = utils.create_volume(
             self.ctxt,
@@ -531,7 +539,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
             volume_type_id=volume_type_id,
             consistencygroup_id=consistencygroup.id)['id']
 
-        self.assertEqual('available', consistencygroup.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                         consistencygroup.status)
 
         cg_volumes = db.volume_get_all_by_group(self.ctxt.elevated(),
                                                 consistencygroup.id)
@@ -564,13 +573,15 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
             self.ctxt, consistencygroup.id)
         self.assertEqual(202, res.status_int)
         self.assertTrue(mock_validate.called)
-        self.assertEqual('updating', consistencygroup.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.UPDATING,
+                         consistencygroup.status)
 
         consistencygroup.destroy()
 
     def test_update_consistencygroup_add_volume_not_found(self):
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/update' %
                                   consistencygroup.id)
         req.method = 'PUT'
@@ -594,8 +605,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup.destroy()
 
     def test_update_consistencygroup_remove_volume_not_found(self):
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/update' %
                                   consistencygroup.id)
         req.method = 'PUT'
@@ -619,8 +631,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup.destroy()
 
     def test_update_consistencygroup_empty_parameters(self):
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/update' %
                                   consistencygroup.id)
         req.method = 'PUT'
@@ -640,8 +653,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
 
     def test_update_consistencygroup_add_volume_invalid_state(self):
         volume_type_id = '123456'
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         add_volume_id = utils.create_volume(
             self.ctxt,
             volume_type_id=volume_type_id,
@@ -673,8 +687,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup.destroy()
 
     def test_update_consistencygroup_add_volume_invalid_volume_type(self):
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         wrong_type = 'wrong-volume-type-id'
         add_volume_id = utils.create_volume(
             self.ctxt,
@@ -705,8 +720,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup.destroy()
 
     def test_update_consistencygroup_add_volume_already_in_cg(self):
-        consistencygroup = self._create_consistencygroup(ctxt=self.ctxt,
-                                                         status='available')
+        consistencygroup = self._create_consistencygroup(
+            ctxt=self.ctxt,
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         add_volume_id = utils.create_volume(
             self.ctxt,
             consistencygroup_id='some_other_cg')['id']
@@ -730,9 +746,9 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         consistencygroup.destroy()
 
     def test_update_consistencygroup_invalid_state(self):
-        wrong_status = 'wrong_status'
-        consistencygroup = self._create_consistencygroup(status=wrong_status,
-                                                         ctxt=self.ctxt)
+        consistencygroup = self._create_consistencygroup(
+            status=fields.ConsistencyGroupStatus.IN_USE,
+            ctxt=self.ctxt)
         req = webob.Request.blank('/v2/fake/consistencygroups/%s/update' %
                                   consistencygroup.id)
         req.method = 'PUT'
@@ -748,7 +764,8 @@ class ConsistencyGroupsAPITestCase(test.TestCase):
         self.assertEqual(400, res.status_int)
         self.assertEqual(400, res_dict['badRequest']['code'])
         msg = _("Invalid ConsistencyGroup: Consistency group status must be "
-                "available, but current status is: %s.") % wrong_status
+                "available, but current status is: %s.") % (
+            fields.ConsistencyGroupStatus.IN_USE)
         self.assertEqual(msg, res_dict['badRequest']['message'])
 
         consistencygroup.destroy()
diff --git a/cinder/tests/unit/fake_driver.py b/cinder/tests/unit/fake_driver.py
index ff81e59a8..9137cf048 100644
--- a/cinder/tests/unit/fake_driver.py
+++ b/cinder/tests/unit/fake_driver.py
@@ -15,6 +15,7 @@
 from oslo_utils import timeutils
 
 from cinder import exception
+from cinder.objects import fields
 from cinder.tests.unit.brick import fake_lvm
 from cinder.volume import driver
 from cinder.volume.drivers import lvm
@@ -227,7 +228,8 @@ class FakeGateDriver(lvm.LVMVolumeDriver):
         # A consistencygroup entry is already created in db
         # This driver just returns a status
         now = timeutils.utcnow()
-        model_update = {'status': 'available', 'updated_at': now}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE,
+                        'updated_at': now}
 
         return model_update
 
@@ -268,7 +270,7 @@ class FakeGateDriver(lvm.LVMVolumeDriver):
                 volume_model_update['status'] = 'available'
             except Exception:
                 volume_model_update['status'] = 'error'
-                model_update['status'] = 'error'
+                model_update['status'] = fields.ConsistencyGroupStatus.ERROR
             volume_model_updates.append(volume_model_update)
 
         return model_update, volume_model_updates
diff --git a/cinder/tests/unit/objects/test_consistencygroup.py b/cinder/tests/unit/objects/test_consistencygroup.py
index d4a5e1ffa..2188508d1 100644
--- a/cinder/tests/unit/objects/test_consistencygroup.py
+++ b/cinder/tests/unit/objects/test_consistencygroup.py
@@ -16,6 +16,7 @@ import mock
 
 from cinder import exception
 from cinder import objects
+from cinder.objects import fields
 from cinder.tests.unit import objects as test_objects
 
 fake_consistencygroup = {
@@ -27,7 +28,7 @@ fake_consistencygroup = {
     'name': 'fake_name',
     'description': 'fake_description',
     'volume_type_id': 'fake_volume_type_id',
-    'status': 'creating',
+    'status': fields.ConsistencyGroupStatus.CREATING,
     'cgsnapshot_id': 'fake_id',
     'source_cgid': None,
 }
@@ -78,11 +79,12 @@ class TestConsistencyGroup(test_objects.BaseObjectsTestCase):
     def test_save(self, consistencygroup_update):
         consistencygroup = objects.ConsistencyGroup._from_db_object(
             self.context, objects.ConsistencyGroup(), fake_consistencygroup)
-        consistencygroup.status = 'active'
+        consistencygroup.status = fields.ConsistencyGroupStatus.AVAILABLE
         consistencygroup.save()
-        consistencygroup_update.assert_called_once_with(self.context,
-                                                        consistencygroup.id,
-                                                        {'status': 'active'})
+        consistencygroup_update.assert_called_once_with(
+            self.context,
+            consistencygroup.id,
+            {'status': fields.ConsistencyGroupStatus.AVAILABLE})
 
     def test_save_with_cgsnapshots(self):
         consistencygroup = objects.ConsistencyGroup._from_db_object(
diff --git a/cinder/tests/unit/objects/test_fields.py b/cinder/tests/unit/objects/test_fields.py
index 977d6ada3..3fecdc39b 100644
--- a/cinder/tests/unit/objects/test_fields.py
+++ b/cinder/tests/unit/objects/test_fields.py
@@ -82,3 +82,26 @@ class TestBackupStatus(TestField):
 
     def test_stringify_invalid(self):
         self.assertRaises(ValueError, self.field.stringify, 'not_a_status')
+
+
+class TestConsistencyGroupStatus(TestField):
+    def setUp(self):
+        super(TestConsistencyGroupStatus, self).setUp()
+        self.field = fields.ConsistencyGroupStatusField()
+        self.coerce_good_values = [('error', 'error'),
+                                   ('available', 'available'),
+                                   ('creating', 'creating'),
+                                   ('deleting', 'deleting'),
+                                   ('deleted', 'deleted'),
+                                   ('updating', 'updating'),
+                                   ('in-use', 'in-use'),
+                                   ('error_deleting', 'error_deleting')]
+        self.coerce_bad_values = ['acme']
+        self.to_primitive_values = self.coerce_good_values[0:1]
+        self.from_primitive_values = self.coerce_good_values[0:1]
+
+    def test_stringify(self):
+        self.assertEqual("'error'", self.field.stringify('error'))
+
+    def test_stringify_invalid(self):
+        self.assertRaises(ValueError, self.field.stringify, 'not_a_status')
diff --git a/cinder/tests/unit/objects/test_objects.py b/cinder/tests/unit/objects/test_objects.py
index 4dc3cef7c..c4a43e151 100644
--- a/cinder/tests/unit/objects/test_objects.py
+++ b/cinder/tests/unit/objects/test_objects.py
@@ -26,7 +26,7 @@ object_data = {
     'BackupList': '1.0-24591dabe26d920ce0756fe64cd5f3aa',
     'CGSnapshot': '1.0-190da2a2aa9457edc771d888f7d225c4',
     'CGSnapshotList': '1.0-e8c3f4078cd0ee23487b34d173eec776',
-    'ConsistencyGroup': '1.1-8d8b867a67c1bd6e9f840bcf5e375dbb',
+    'ConsistencyGroup': '1.2-ed7f90a6871991a19af716ade7337fc9',
     'ConsistencyGroupList': '1.0-09d0aad5491e762ecfdf66bef02ceb8d',
     'Service': '1.0-64baeb4911dbab1153064dd1c87edb9f',
     'ServiceList': '1.0-d242d3384b68e5a5a534e090ff1d5161',
diff --git a/cinder/tests/unit/scheduler/test_scheduler.py b/cinder/tests/unit/scheduler/test_scheduler.py
index 33a808b86..1830cfa6b 100644
--- a/cinder/tests/unit/scheduler/test_scheduler.py
+++ b/cinder/tests/unit/scheduler/test_scheduler.py
@@ -23,6 +23,7 @@ from oslo_config import cfg
 from cinder import context
 from cinder import db
 from cinder import exception
+from cinder.objects import fields
 from cinder.scheduler import driver
 from cinder.scheduler import filter_scheduler
 from cinder.scheduler import manager
@@ -279,7 +280,8 @@ class SchedulerManagerTestCase(test.TestCase):
                               consistencygroup_obj)
             self.assertTrue(LOG.exception.call_count > 0)
             db.consistencygroup_update.assert_called_once_with(
-                self.context, group_id, {'status': 'error'})
+                self.context, group_id, {'status': (
+                    fields.ConsistencyGroupStatus.ERROR)})
 
             mock_cg.reset_mock()
             LOG.exception.reset_mock()
@@ -291,7 +293,8 @@ class SchedulerManagerTestCase(test.TestCase):
                 self.context, 'volume', consistencygroup_obj)
             self.assertTrue(LOG.error.call_count > 0)
             db.consistencygroup_update.assert_called_once_with(
-                self.context, group_id, {'status': 'error'})
+                self.context, group_id, {'status': (
+                    fields.ConsistencyGroupStatus.ERROR)})
 
             self.manager.driver = original_driver
 
diff --git a/cinder/tests/unit/test_dellsc.py b/cinder/tests/unit/test_dellsc.py
index 3f27de76b..0889186c1 100644
--- a/cinder/tests/unit/test_dellsc.py
+++ b/cinder/tests/unit/test_dellsc.py
@@ -17,6 +17,7 @@ import uuid
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.volume.drivers.dell import dell_storagecenter_api
 from cinder.volume.drivers.dell import dell_storagecenter_common
@@ -1279,7 +1280,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
         self.driver.db.volume_get_all_by_group.return_value = expected_volumes
         context = {}
         group = {'id': 'fc8f2fec-fab2-4e34-9148-c094c913b9a3',
-                 'status': 'deleted'}
+                 'status': fields.ConsistencyGroupStatus.DELETED}
         model_update, volumes = self.driver.delete_consistencygroup(context,
                                                                     group,
                                                                     [])
@@ -1309,7 +1310,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
         self.driver.db.volume_get_all_by_group.return_value = expected_volumes
         context = {}
         group = {'id': 'fc8f2fec-fab2-4e34-9148-c094c913b9a3',
-                 'status': 'deleted'}
+                 'status': fields.ConsistencyGroupStatus.DELETED}
         model_update, volumes = self.driver.delete_consistencygroup(context,
                                                                     group,
                                                                     [])
diff --git a/cinder/tests/unit/test_emc_vmax.py b/cinder/tests/unit/test_emc_vmax.py
index d42e9eff4..5cbcb4249 100644
--- a/cinder/tests/unit/test_emc_vmax.py
+++ b/cinder/tests/unit/test_emc_vmax.py
@@ -26,6 +26,7 @@ import six
 
 from cinder import exception
 from cinder.i18n import _
+from cinder.objects import fields
 from cinder import test
 from cinder.volume.drivers.emc import emc_vmax_common
 from cinder.volume.drivers.emc import emc_vmax_fast
@@ -459,7 +460,7 @@ class EMCVMAXCommonData(object):
     test_CG = {'name': 'myCG1',
                'id': '12345abcde',
                'volume_type_id': 'abc',
-               'status': 'available'
+               'status': fields.ConsistencyGroupStatus.AVAILABLE
                }
     test_snapshot = {'name': 'myCG1',
                      'id': '12345abcde',
@@ -3600,7 +3601,8 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
             self.driver.create_consistencygroup_from_src(
                 self.data.test_ctxt, self.data.test_CG, volumes,
                 self.data.test_CG_snapshot, snapshots))
-        self.assertEqual({'status': 'available'}, model_update)
+        self.assertEqual({'status': fields.ConsistencyGroupStatus.AVAILABLE},
+                         model_update)
         self.assertEqual([{'status': 'available', 'id': '2'}],
                          volumes_model_update)
 
diff --git a/cinder/tests/unit/test_emc_vnx.py b/cinder/tests/unit/test_emc_vnx.py
index d4f3f2acd..4903a841b 100644
--- a/cinder/tests/unit/test_emc_vnx.py
+++ b/cinder/tests/unit/test_emc_vnx.py
@@ -21,6 +21,7 @@ import six
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit import fake_consistencygroup
 from cinder.tests.unit import fake_snapshot
@@ -373,11 +374,11 @@ class EMCVNXCLIDriverTestData(object):
 
     test_cg = {'id': 'consistencygroup_id',
                'name': 'group_name',
-               'status': 'deleting'}
+               'status': fields.ConsistencyGroupStatus.DELETING}
 
     test_cg_with_type = {'id': 'consistencygroup_id',
                          'name': 'group_name',
-                         'status': 'creating',
+                         'status': fields.ConsistencyGroupStatus.CREATING,
                          'volume_type_id':
                          'abc1-2320-9013-8813-8941-1374-8112-1231,'
                          '19fdd0dd-03b3-4d7c-b541-f4df46f308c8,'}
@@ -3952,7 +3953,8 @@ Time Remaining:  0 second(s)
 
         model_update = self.driver.create_consistencygroup(
             None, self.testData.test_cg)
-        self.assertDictMatch({'status': 'available'}, model_update)
+        self.assertDictMatch({'status': (
+            fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
         expect_cmd = [
             mock.call(
                 *self.testData.CREATE_CONSISTENCYGROUP_CMD(
@@ -3971,7 +3973,8 @@ Time Remaining:  0 second(s)
         fake_cli = self.driverSetup(commands, results)
         model_update = self.driver.create_consistencygroup(
             None, self.testData.test_cg)
-        self.assertDictMatch({'status': 'available'}, model_update)
+        self.assertDictMatch({'status': (
+            fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
         expect_cmd = [
             mock.call(
                 *self.testData.CREATE_CONSISTENCYGROUP_CMD(
@@ -4211,7 +4214,8 @@ Time Remaining:  0 second(s)
             mock.call(*self.testData.REPLACE_LUNS_IN_CG_CMD(
                 cg_name, ['4', '5']), poll=False)]
         fake_cli.assert_has_calls(expect_cmd)
-        self.assertEqual('available', model_update['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                         model_update['status'])
 
     def test_update_consistencygroup_remove_all(self):
         cg_name = self.testData.test_cg['id']
@@ -4227,7 +4231,8 @@ Time Remaining:  0 second(s)
             mock.call(*self.testData.REMOVE_LUNS_FROM_CG_CMD(
                 cg_name, ['1', '3']), poll=False)]
         fake_cli.assert_has_calls(expect_cmd)
-        self.assertEqual('available', model_update['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                         model_update['status'])
 
     def test_update_consistencygroup_remove_not_in_cg(self):
         cg_name = self.testData.test_cg['id']
@@ -4244,7 +4249,8 @@ Time Remaining:  0 second(s)
             mock.call(*self.testData.REPLACE_LUNS_IN_CG_CMD(
                 cg_name, ['1', '3']), poll=False)]
         fake_cli.assert_has_calls(expect_cmd)
-        self.assertEqual('available', model_update['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                         model_update['status'])
 
     def test_update_consistencygroup_error(self):
         cg_name = self.testData.test_cg['id']
diff --git a/cinder/tests/unit/test_gpfs.py b/cinder/tests/unit/test_gpfs.py
index 2bdecae42..e6617373a 100644
--- a/cinder/tests/unit/test_gpfs.py
+++ b/cinder/tests/unit/test_gpfs.py
@@ -23,6 +23,7 @@ from oslo_utils import units
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder import utils
 from cinder.volume import configuration as conf
@@ -1682,7 +1683,7 @@ class GPFSDriverTestCase(test.TestCase):
     def test_delete_consistencygroup(self, mock_exec):
         ctxt = self.context
         group = self._fake_group()
-        group['status'] = 'available'
+        group['status'] = fields.ConsistencyGroupStatus.AVAILABLE
         volume = self._fake_volume()
         volume['status'] = 'available'
         volumes = []
@@ -1703,7 +1704,7 @@ class GPFSDriverTestCase(test.TestCase):
     def test_delete_consistencygroup_fail(self, mock_exec):
         ctxt = self.context
         group = self._fake_group()
-        group['status'] = 'available'
+        group['status'] = fields.ConsistencyGroupStatus.AVAILABLE
         self.driver.db = mock.Mock()
         self.driver.db.volume_get_all_by_group = mock.Mock()
         self.driver.db.volume_get_all_by_group.return_value = []
diff --git a/cinder/tests/unit/test_hpe3par.py b/cinder/tests/unit/test_hpe3par.py
index ced41c715..9d2656c19 100644
--- a/cinder/tests/unit/test_hpe3par.py
+++ b/cinder/tests/unit/test_hpe3par.py
@@ -23,6 +23,7 @@ from oslo_utils import units
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit import fake_hpe_3par_client as hpe3parclient
 from cinder.volume.drivers.hpe import hpe_3par_common as hpecommon
@@ -3893,7 +3894,7 @@ class HPE3PARBaseDriver(object):
             mock_client.reset_mock()
 
             # remove the consistency group
-            group.status = 'deleting'
+            group.status = fields.ConsistencyGroupStatus.DELETING
             self.driver.delete_consistencygroup(context.get_admin_context(),
                                                 group, [])
 
diff --git a/cinder/tests/unit/test_hpelefthand.py b/cinder/tests/unit/test_hpelefthand.py
index 07266ca49..abd2917c3 100644
--- a/cinder/tests/unit/test_hpelefthand.py
+++ b/cinder/tests/unit/test_hpelefthand.py
@@ -20,6 +20,7 @@ from oslo_utils import units
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit import fake_hpe_lefthand_client as hpelefthandclient
 from cinder.volume.drivers.hpe import hpe_lefthand_iscsi
@@ -1628,7 +1629,8 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
 
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
     def test_delete_consistencygroup(self):
         ctxt = context.get_admin_context()
@@ -1645,13 +1647,15 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             # create a consistency group
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
             # delete the consistency group
-            group.status = 'deleting'
+            group.status = fields.ConsistencyGroupStatus.DELETING
             cg, vols = self.driver.delete_consistencygroup(ctxt, group,
                                                            volumes)
-            self.assertEqual('deleting', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.DELETING,
+                             cg['status'])
 
     def test_update_consistencygroup_add_vol_delete_cg(self):
         ctxt = context.get_admin_context()
@@ -1675,17 +1679,19 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             # create a consistency group
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
             # add volume to consistency group
             cg = self.driver.update_consistencygroup(
                 ctxt, group, add_volumes=[self.volume], remove_volumes=None)
 
             # delete the consistency group
-            group.status = 'deleting'
+            group.status = fields.ConsistencyGroupStatus.DELETING
             cg, vols = self.driver.delete_consistencygroup(ctxt, group,
                                                            volumes)
-            self.assertEqual('deleting', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.DELETING,
+                             cg['status'])
 
     def test_update_consistencygroup_remove_vol_delete_cg(self):
         ctxt = context.get_admin_context()
@@ -1709,7 +1715,8 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             # create a consistency group
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
             # add volume to consistency group
             cg = self.driver.update_consistencygroup(
@@ -1720,10 +1727,11 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
                 ctxt, group, add_volumes=None, remove_volumes=[self.volume])
 
             # delete the consistency group
-            group.status = 'deleting'
+            group.status = fields.ConsistencyGroupStatus.DELETING
             cg, vols = self.driver.delete_consistencygroup(ctxt, group,
                                                            volumes)
-            self.assertEqual('deleting', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.DELETING,
+                             cg['status'])
 
     def test_create_cgsnapshot(self):
         ctxt = context.get_admin_context()
@@ -1745,7 +1753,8 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             # create a consistency group
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
             # create volume and add it to the consistency group
             self.driver.update_consistencygroup(
@@ -1777,7 +1786,8 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase):
             # create a consistency group
             group = self.fake_consistencygroup_object()
             cg = self.driver.create_consistencygroup(ctxt, group)
-            self.assertEqual('available', cg['status'])
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
+                             cg['status'])
 
             # create volume and add it to the consistency group
             self.driver.update_consistencygroup(
diff --git a/cinder/tests/unit/test_ibm_xiv_ds8k.py b/cinder/tests/unit/test_ibm_xiv_ds8k.py
index 6171a5e1a..66926195b 100644
--- a/cinder/tests/unit/test_ibm_xiv_ds8k.py
+++ b/cinder/tests/unit/test_ibm_xiv_ds8k.py
@@ -27,6 +27,7 @@ from oslo_config import cfg
 from cinder import context
 from cinder import exception
 from cinder.i18n import _
+from cinder.objects import fields
 from cinder import test
 from cinder.volume import configuration as conf
 from cinder.volume.drivers.ibm import xiv_ds8k
@@ -204,7 +205,7 @@ class XIVDS8KFakeProxyDriver(object):
             raise exception.CinderException(
                 message='The consistency group id of volume may be wrong.')
 
-        return {'status': 'available'}
+        return {'status': fields.ConsistencyGroupStatus.AVAILABLE}
 
     def delete_consistencygroup(self, ctxt, group, volumes):
         for volume in self.volumes.values():
@@ -233,7 +234,7 @@ class XIVDS8KFakeProxyDriver(object):
             self, context, group,
             add_volumes, remove_volumes):
 
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update, None, None
 
     def create_consistencygroup_from_src(
@@ -685,7 +686,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
         # Create consistency group
         model_update = self.driver.create_consistencygroup(ctxt, CONSISTGROUP)
 
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "Consistency Group created failed")
 
@@ -723,7 +724,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
                 ctxt, CONSISTGROUP, [CG_VOLUME])
 
         # Verify the result
-        self.assertEqual('deleted',
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
                          model_update['status'],
                          'Consistency Group deleted failed')
         for volume in volumes:
@@ -872,7 +873,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
         model_update, added, removed = self.driver.update_consistencygroup(
             ctxt, CONSISTGROUP, [], [])
 
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "Consistency Group update failed")
         self.assertFalse(added,
@@ -891,7 +892,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
         model_update, added, removed = self.driver.update_consistencygroup(
             ctxt, CONSISTGROUP, [VOLUME], [VOLUME2])
 
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "Consistency Group update failed")
         self.assertFalse(added,
@@ -913,7 +914,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
 
         # model_update can be None or return available in status
         if model_update:
-            self.assertEqual('available',
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                              model_update['status'],
                              "Consistency Group create from source failed")
         # volumes_model_update can be None or return available in status
@@ -935,7 +936,7 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
 
         # model_update can be None or return available in status
         if model_update:
-            self.assertEqual('available',
+            self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                              model_update['status'],
                              "Consistency Group create from source failed")
         # volumes_model_update can be None or return available in status
diff --git a/cinder/tests/unit/test_prophetstor_dpl.py b/cinder/tests/unit/test_prophetstor_dpl.py
index f840e46ab..fee5e5464 100644
--- a/cinder/tests/unit/test_prophetstor_dpl.py
+++ b/cinder/tests/unit/test_prophetstor_dpl.py
@@ -21,6 +21,7 @@ from oslo_utils import units
 from six.moves import http_client
 
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit import fake_snapshot
 from cinder.volume import configuration as conf
@@ -683,7 +684,8 @@ class TestProphetStorDPLDriver(test.TestCase):
         self.DPL_MOCK.create_vg.assert_called_once_with(
             self._conver_uuid2hex(DATA_IN_GROUP['id']), DATA_IN_GROUP['name'],
             DATA_IN_GROUP['description'])
-        self.assertDictMatch({'status': 'available'}, model_update)
+        self.assertDictMatch({'status': (
+            fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
 
     def test_delete_consistency_group(self):
         self.DB_MOCK.volume_get_all_by_group.return_value = (
@@ -696,7 +698,8 @@ class TestProphetStorDPLDriver(test.TestCase):
             self._conver_uuid2hex(DATA_IN_GROUP['id']))
         self.DPL_MOCK.delete_vdev.assert_called_once_with(
             self._conver_uuid2hex((DATA_IN_VOLUME_VG['id'])))
-        self.assertDictMatch({'status': 'deleted'}, model_update)
+        self.assertDictMatch({'status': (
+            fields.ConsistencyGroupStatus.DELETED)}, model_update)
 
     def test_update_consistencygroup(self):
         self.DPL_MOCK.get_vg.return_value = (0, DATA_OUT_CG)
@@ -715,7 +718,8 @@ class TestProphetStorDPLDriver(test.TestCase):
         self.DPL_MOCK.leave_vg.assert_called_once_with(
             self._conver_uuid2hex(remove_vol['id']),
             self._conver_uuid2hex(DATA_IN_GROUP['id']))
-        self.assertDictMatch({'status': 'available'}, model_update)
+        self.assertDictMatch({'status': (
+            fields.ConsistencyGroupStatus.AVAILABLE)}, model_update)
 
     def test_update_consistencygroup_exception_join(self):
         self.DPL_MOCK.get_vg.return_value = (0, DATA_OUT_CG)
diff --git a/cinder/tests/unit/test_solidfire.py b/cinder/tests/unit/test_solidfire.py
index 3e3c6e32a..d1b9d1f42 100644
--- a/cinder/tests/unit/test_solidfire.py
+++ b/cinder/tests/unit/test_solidfire.py
@@ -22,6 +22,7 @@ from oslo_utils import units
 
 from cinder import context
 from cinder import exception
+from cinder.objects import fields
 from cinder import test
 from cinder.volume import configuration as conf
 from cinder.volume.drivers import solidfire
@@ -1668,7 +1669,8 @@ class SolidFireVolumeTestCase(test.TestCase):
                 cgsnapshot, snapshots,
                 source_cg, source_vols)
             get_snap.assert_called_with(name)
-            self.assertEqual({'status': 'available'}, model)
+            self.assertEqual(
+                {'status': fields.ConsistencyGroupStatus.AVAILABLE}, model)
 
     def test_create_consisgroup_from_src_source_cg(self):
         sfv = solidfire.SolidFireDriver(configuration=self.configuration)
@@ -1704,7 +1706,8 @@ class SolidFireVolumeTestCase(test.TestCase):
                 source_cg,
                 source_vols)
             get_snap.assert_called_with(source_cg['id'])
-            self.assertEqual({'status': 'available'}, model)
+            self.assertEqual(
+                {'status': fields.ConsistencyGroupStatus.AVAILABLE}, model)
 
     def test_create_cgsnapshot(self):
         sfv = solidfire.SolidFireDriver(configuration=self.configuration)
diff --git a/cinder/tests/unit/test_storwize_svc.py b/cinder/tests/unit/test_storwize_svc.py
index ff0ab6e81..9135a9c33 100644
--- a/cinder/tests/unit/test_storwize_svc.py
+++ b/cinder/tests/unit/test_storwize_svc.py
@@ -31,6 +31,7 @@ import six
 from cinder import context
 from cinder import exception
 from cinder.i18n import _
+from cinder.objects import fields
 from cinder import test
 from cinder.tests.unit import utils as testutils
 from cinder import utils
@@ -2650,7 +2651,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
         cg = self._create_consistencygroup_in_db(**kwargs)
 
         model_update = self.driver.create_consistencygroup(self.ctxt, cg)
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "CG created failed")
         return cg
@@ -3806,7 +3807,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
 
         model_update = self.driver.create_consistencygroup(self.ctxt, cg)
 
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "CG created failed")
         # Add volumes to CG
@@ -3829,7 +3830,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
 
         model_update = self.driver.delete_consistencygroup(self.ctxt, cg, [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for volume in model_update[1]:
             self.assertEqual('deleted', volume['status'])
 
@@ -3890,21 +3892,24 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
 
         model_update = self.driver.delete_consistencygroup(self.ctxt, cg, [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for volume in model_update[1]:
             self.assertEqual('deleted', volume['status'])
 
         model_update = (
             self.driver.delete_consistencygroup(self.ctxt, source_cg, []))
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for volume in model_update[1]:
             self.assertEqual('deleted', volume['status'])
 
         model_update = (
             self.driver.delete_consistencygroup(self.ctxt, cgsnapshot, []))
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for volume in model_update[1]:
             self.assertEqual('deleted', volume['status'])
 
@@ -3945,7 +3950,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
                                                          None, None,
                                                          source_cg,
                                                          source_vols))
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "CG create from src created failed")
 
@@ -3955,7 +3960,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
                                                            cg,
                                                            [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for each_vol in model_update[1]:
             self.assertEqual('deleted', each_vol['status'])
 
@@ -3967,7 +3973,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
                                                          cgsnapshot,
                                                          snapshots,
                                                          None, None))
-        self.assertEqual('available',
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE,
                          model_update['status'],
                          "CG create from src created failed")
 
@@ -3977,7 +3983,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
         model_update = self.driver.delete_consistencygroup(self.ctxt,
                                                            cg, [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for each_vol in model_update[1]:
             self.assertEqual('deleted', each_vol['status'])
 
@@ -3985,7 +3992,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
                                                            cgsnapshot,
                                                            [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for volume in model_update[1]:
             self.assertEqual('deleted', volume['status'])
 
@@ -3993,7 +4001,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
                                                            source_cg,
                                                            [])
 
-        self.assertEqual('deleted', model_update[0]['status'])
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED,
+                         model_update[0]['status'])
         for each_vol in model_update[1]:
             self.assertEqual('deleted', each_vol['status'])
 
diff --git a/cinder/tests/unit/test_volume.py b/cinder/tests/unit/test_volume.py
index 053d87f3b..44dea0bd4 100644
--- a/cinder/tests/unit/test_volume.py
+++ b/cinder/tests/unit/test_volume.py
@@ -4969,7 +4969,8 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
     @mock.patch.object(CGQUOTAS, "rollback")
     @mock.patch.object(driver.VolumeDriver,
                        "delete_consistencygroup",
-                       return_value=({'status': 'deleted'}, []))
+                       return_value=({'status': (
+                           fields.ConsistencyGroupStatus.DELETED)}, []))
     def test_create_delete_consistencygroup(self, fake_delete_cg,
                                             fake_rollback,
                                             fake_commit, fake_reserve):
@@ -5000,7 +5001,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         msg = self.notifier.notifications[0]
         self.assertEqual('consistencygroup.create.start', msg['event_type'])
         expected = {
-            'status': 'available',
+            'status': fields.ConsistencyGroupStatus.AVAILABLE,
             'name': 'test_cg',
             'availability_zone': 'nova',
             'tenant_id': self.context.project_id,
@@ -5020,7 +5021,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.volume.delete_consistencygroup(self.context, group)
         cg = objects.ConsistencyGroup.get_by_id(
             context.get_admin_context(read_deleted='yes'), group.id)
-        self.assertEqual('deleted', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED, cg.status)
         self.assertEqual(4, len(self.notifier.notifications),
                          self.notifier.notifications)
         msg = self.notifier.notifications[2]
@@ -5028,7 +5029,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.assertDictMatch(expected, msg['payload'])
         msg = self.notifier.notifications[3]
         self.assertEqual('consistencygroup.delete.end', msg['event_type'])
-        expected['status'] = 'deleted'
+        expected['status'] = fields.ConsistencyGroupStatus.DELETED
         self.assertDictMatch(expected, msg['payload'])
         self.assertRaises(exception.NotFound,
                           objects.ConsistencyGroup.get_by_id,
@@ -5069,7 +5070,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.volume.create_volume(self.context, volume_id2)
 
         fake_update_cg.return_value = (
-            {'status': 'available'},
+            {'status': fields.ConsistencyGroupStatus.AVAILABLE},
             [{'id': volume_id2, 'status': 'available'}],
             [{'id': volume_id, 'status': 'available'}])
 
@@ -5078,7 +5079,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
                                             remove_volumes=volume_id)
         cg = objects.ConsistencyGroup.get_by_id(self.context, group.id)
         expected = {
-            'status': 'available',
+            'status': fields.ConsistencyGroupStatus.AVAILABLE,
             'name': 'test_cg',
             'availability_zone': 'nova',
             'tenant_id': self.context.project_id,
@@ -5086,7 +5087,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
             'user_id': 'fake',
             'consistencygroup_id': group.id
         }
-        self.assertEqual('available', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE, cg.status)
         self.assertEqual(10, len(self.notifier.notifications),
                          self.notifier.notifications)
         msg = self.notifier.notifications[6]
@@ -5155,7 +5156,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
             self.context,
             availability_zone=CONF.storage_availability_zone,
             volume_type='type1,type2',
-            status='available')
+            status=fields.ConsistencyGroupStatus.AVAILABLE)
         volume = tests_utils.create_volume(
             self.context,
             consistencygroup_id=group.id,
@@ -5184,7 +5185,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
             self.context, group2, cgsnapshot=cgsnapshot)
         cg2 = objects.ConsistencyGroup.get_by_id(self.context, group2.id)
         expected = {
-            'status': 'available',
+            'status': fields.ConsistencyGroupStatus.AVAILABLE,
             'name': 'test_cg',
             'availability_zone': 'nova',
             'tenant_id': self.context.project_id,
@@ -5192,7 +5193,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
             'user_id': 'fake',
             'consistencygroup_id': group2.id,
         }
-        self.assertEqual('available', cg2.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE, cg2.status)
         self.assertEqual(group2.id, cg2['id'])
         self.assertEqual(cgsnapshot.id, cg2['cgsnapshot_id'])
         self.assertIsNone(cg2['source_cgid'])
@@ -5220,16 +5221,16 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
 
         msg = self.notifier.notifications[6]
         self.assertEqual('consistencygroup.delete.start', msg['event_type'])
-        expected['status'] = 'available'
+        expected['status'] = fields.ConsistencyGroupStatus.AVAILABLE
         self.assertDictMatch(expected, msg['payload'])
         msg = self.notifier.notifications[8]
         self.assertEqual('consistencygroup.delete.end', msg['event_type'])
-        expected['status'] = 'deleted'
+        expected['status'] = fields.ConsistencyGroupStatus.DELETED
         self.assertDictMatch(expected, msg['payload'])
 
         cg2 = objects.ConsistencyGroup.get_by_id(
             context.get_admin_context(read_deleted='yes'), group2.id)
-        self.assertEqual('deleted', cg2.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED, cg2.status)
         self.assertRaises(exception.NotFound,
                           objects.ConsistencyGroup.get_by_id,
                           self.context,
@@ -5252,7 +5253,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
 
         cg3 = objects.ConsistencyGroup.get_by_id(self.context, group3.id)
 
-        self.assertEqual('available', cg3.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE, cg3.status)
         self.assertEqual(group3.id, cg3.id)
         self.assertEqual(group.id, cg3.source_cgid)
         self.assertIsNone(cg3.cgsnapshot_id)
@@ -5509,7 +5510,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         cg = objects.ConsistencyGroup.get_by_id(
             context.get_admin_context(read_deleted='yes'),
             group.id)
-        self.assertEqual('deleted', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.DELETED, cg.status)
         self.assertRaises(exception.NotFound,
                           objects.ConsistencyGroup.get_by_id,
                           self.context,
@@ -5546,7 +5547,7 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
                           group)
         cg = objects.ConsistencyGroup.get_by_id(self.context, group.id)
         # Group is not deleted
-        self.assertEqual('available', cg.status)
+        self.assertEqual(fields.ConsistencyGroupStatus.AVAILABLE, cg.status)
 
     def test_create_volume_with_consistencygroup_invalid_type(self):
         """Test volume creation with ConsistencyGroup & invalid volume type."""
diff --git a/cinder/tests/unit/utils.py b/cinder/tests/unit/utils.py
index 54da7623f..fdb720b79 100644
--- a/cinder/tests/unit/utils.py
+++ b/cinder/tests/unit/utils.py
@@ -118,7 +118,7 @@ def create_consistencygroup(ctxt,
                             host='test_host@fakedrv#fakepool',
                             name='test_cg',
                             description='this is a test cg',
-                            status='available',
+                            status=fields.ConsistencyGroupStatus.AVAILABLE,
                             availability_zone='fake_az',
                             volume_type_id=None,
                             cgsnapshot_id=None,
diff --git a/cinder/volume/drivers/emc/emc_vmax_common.py b/cinder/volume/drivers/emc/emc_vmax_common.py
index 27b21c310..089502246 100644
--- a/cinder/volume/drivers/emc/emc_vmax_common.py
+++ b/cinder/volume/drivers/emc/emc_vmax_common.py
@@ -23,6 +23,7 @@ import six
 
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
+from cinder.objects import fields
 from cinder.volume.drivers.emc import emc_vmax_fast
 from cinder.volume.drivers.emc import emc_vmax_https
 from cinder.volume.drivers.emc import emc_vmax_masking
@@ -2362,7 +2363,7 @@ class EMCVMAXCommon(object):
         LOG.info(_LI("Create Consistency Group: %(group)s."),
                  {'group': group['id']})
 
-        modelUpdate = {'status': 'available'}
+        modelUpdate = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         volumeTypeId = group['volume_type_id'].replace(",", "")
 
         cgName = self.utils.truncate_string(group['id'], 8)
@@ -4128,7 +4129,7 @@ class EMCVMAXCommon(object):
                      "This adds and/or removes volumes from a CG."),
                  {'group': group['id']})
 
-        modelUpdate = {'status': 'available'}
+        modelUpdate = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         volumeTypeId = group['volume_type_id'].replace(",", "")
 
         cg_name = self.utils.truncate_string(group['id'], 8)
@@ -4226,7 +4227,7 @@ class EMCVMAXCommon(object):
             raise exception.VolumeBackendAPIException(
                 data=exceptionMessage)
 
-        modelUpdate = {'status': 'available'}
+        modelUpdate = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
 
         _poolInstanceName, storageSystem = (
             self._get_pool_and_storage_system(extraSpecs))
diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py
index 2a247bf50..def3772f8 100644
--- a/cinder/volume/drivers/emc/emc_vnx_cli.py
+++ b/cinder/volume/drivers/emc/emc_vnx_cli.py
@@ -40,6 +40,7 @@ from taskflow.types import failure
 
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
+from cinder.objects import fields
 from cinder import utils
 from cinder.volume import configuration as config
 from cinder.volume.drivers.san import san
@@ -3055,7 +3056,7 @@ class EMCVnxCliBase(object):
 
         self._consistencygroup_creation_check(group)
 
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         try:
             self._client.create_consistencygroup(group['id'])
         except Exception:
@@ -3096,7 +3097,7 @@ class EMCVnxCliBase(object):
                                 add_volumes,
                                 remove_volumes):
         """Adds or removes LUN(s) to/from an existing consistency group"""
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         cg_name = group['id']
         add_ids = [six.text_type(self.get_lun_id(vol))
                    for vol in add_volumes] if add_volumes else []
diff --git a/cinder/volume/drivers/emc/xtremio.py b/cinder/volume/drivers/emc/xtremio.py
index 362ca3dae..55e7a1125 100644
--- a/cinder/volume/drivers/emc/xtremio.py
+++ b/cinder/volume/drivers/emc/xtremio.py
@@ -42,6 +42,7 @@ from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
 from cinder import objects
+from cinder.objects import fields
 from cinder import utils
 from cinder.volume import driver
 from cinder.volume.drivers.san import san
@@ -599,7 +600,7 @@ class XtremIOVolumeDriver(san.SanDriver):
         create_data = {'consistency-group-name': group['id']}
         self.client.req('consistency-groups', 'POST', data=create_data,
                         ver='v2')
-        return {'status': 'available'}
+        return {'status': fields.ConsistencyGroupStatus.AVAILABLE}
 
     def delete_consistencygroup(self, context, group, volumes):
         """Deletes a consistency group."""
diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py
index 05f1f0c59..8f7be030e 100644
--- a/cinder/volume/drivers/hpe/hpe_3par_common.py
+++ b/cinder/volume/drivers/hpe/hpe_3par_common.py
@@ -61,6 +61,7 @@ from cinder import context
 from cinder import exception
 from cinder import flow_utils
 from cinder.i18n import _, _LE, _LI, _LW
+from cinder.objects import fields
 from cinder.volume import qos_specs
 from cinder.volume import utils as volume_utils
 from cinder.volume import volume_types
@@ -519,7 +520,7 @@ class HPE3PARCommon(object):
         self.client.createVolumeSet(cg_name, domain=domain,
                                     comment=six.text_type(extra))
 
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update
 
     def create_consistencygroup_from_src(self, context, group, volumes,
diff --git a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py
index 7b3fc073e..370bd48a4 100644
--- a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py
+++ b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py
@@ -43,6 +43,7 @@ from oslo_utils import units
 from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
+from cinder.objects import fields
 from cinder.volume import driver
 from cinder.volume import utils
 from cinder.volume import volume_types
@@ -291,7 +292,7 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver):
 
     def create_consistencygroup(self, context, group):
         """Creates a consistencygroup."""
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update
 
     def create_consistencygroup_from_src(self, context, group, volumes,
diff --git a/cinder/volume/drivers/ibm/gpfs.py b/cinder/volume/drivers/ibm/gpfs.py
index 656e6a9c4..8e79c77a4 100644
--- a/cinder/volume/drivers/ibm/gpfs.py
+++ b/cinder/volume/drivers/ibm/gpfs.py
@@ -31,6 +31,7 @@ from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LI
 from cinder.image import image_utils
+from cinder.objects import fields
 from cinder import utils
 from cinder.volume import driver
 from cinder.volume.drivers import nfs
@@ -1162,7 +1163,7 @@ class GPFSDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
             LOG.error(msg)
             raise exception.VolumeBackendAPIException(data=msg)
 
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update
 
     def delete_consistencygroup(self, context, group, volumes):
diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py
index f7ab07d82..f1c6eca69 100644
--- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py
+++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py
@@ -33,6 +33,7 @@ import six
 from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
+from cinder.objects import fields
 from cinder.volume import driver
 from cinder.volume.drivers.ibm.storwize_svc import (
     replication as storwize_rep)
@@ -1216,7 +1217,7 @@ class StorwizeHelpers(object):
         LOG.debug('Enter: create_cg_from_source: cg %(cg)s'
                   ' source %(source)s, target %(target)s',
                   {'cg': fc_consistgrp, 'source': sources, 'target': targets})
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         ctxt = context.get_admin_context()
         try:
             for source, target in zip(sources, targets):
@@ -1233,7 +1234,7 @@ class StorwizeHelpers(object):
             volumes_model_update = self._get_volume_model_updates(
                 ctxt, targets, group['id'], model_update['status'])
         except exception.VolumeBackendAPIException as err:
-            model_update['status'] = 'error'
+            model_update['status'] = fields.ConsistencyGroupStatus.ERROR
             volumes_model_update = self._get_volume_model_updates(
                 ctxt, targets, group['id'], model_update['status'])
             with excutils.save_and_reraise_exception():
@@ -2325,7 +2326,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
         db will maintain the volumes and CG relationship.
         """
         LOG.debug("Creating consistency group.")
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update
 
     def delete_consistencygroup(self, context, group, volumes):
@@ -2335,7 +2336,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
         """
         LOG.debug("Deleting consistency group.")
         model_update = {}
-        model_update['status'] = 'deleted'
+        model_update['status'] = fields.ConsistencyGroupStatus.DELETED
         volumes = self.db.volume_get_all_by_group(context, group['id'])
 
         for volume in volumes:
diff --git a/cinder/volume/drivers/prophetstor/dplcommon.py b/cinder/volume/drivers/prophetstor/dplcommon.py
index 8c5b3788c..c90bda93a 100644
--- a/cinder/volume/drivers/prophetstor/dplcommon.py
+++ b/cinder/volume/drivers/prophetstor/dplcommon.py
@@ -35,6 +35,7 @@ from six.moves import http_client
 from cinder import exception
 from cinder.i18n import _, _LI, _LW, _LE
 from cinder import objects
+from cinder.objects import fields
 from cinder.volume import driver
 from cinder.volume.drivers.prophetstor import options
 from cinder.volume.drivers.san import san
@@ -868,7 +869,7 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
         LOG.info(_LI('Start to create consistency group: %(group_name)s '
                      'id: %(id)s'),
                  {'group_name': group['name'], 'id': group['id']})
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         try:
             ret, output = self.dpl.create_vg(
                 self._conver_uuid2hex(group['id']),
@@ -911,9 +912,10 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
             except Exception:
                 ret = errno.EFAULT
                 volume_ref['status'] = 'error_deleting'
-                model_update['status'] = 'error_deleting'
+                model_update['status'] = (
+                    fields.ConsistencyGroupStatus.ERROR_DELETING)
         if ret == 0:
-            model_update['status'] = 'deleted'
+            model_update['status'] = fields.ConsistencyGroupStatus.DELETED
         return model_update, volumes
 
     def create_cgsnapshot(self, context, cgsnapshot, snapshots):
@@ -974,7 +976,7 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
         removevollist = []
         cgid = group['id']
         vid = ''
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         # Get current group info in backend storage.
         ret, output = self.dpl.get_vg(self._conver_uuid2hex(cgid))
         if ret == 0:
diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py
index f32916ce3..5c1c9ff1d 100644
--- a/cinder/volume/drivers/pure.py
+++ b/cinder/volume/drivers/pure.py
@@ -31,6 +31,7 @@ from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LI, _LW
 from cinder import objects
+from cinder.objects import fields
 from cinder import utils
 from cinder.volume import driver
 from cinder.volume.drivers.san import san
@@ -408,7 +409,7 @@ class PureBaseVolumeDriver(san.SanDriver):
 
         self._array.create_pgroup(self._get_pgroup_name_from_id(group.id))
 
-        model_update = {'status': 'available'}
+        model_update = {'status': fields.ConsistencyGroupStatus.AVAILABLE}
         return model_update
 
     def _create_cg_from_cgsnap(self, volumes, snapshots):
diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py
index b5af18a64..d4ab49322 100644
--- a/cinder/volume/drivers/solidfire.py
+++ b/cinder/volume/drivers/solidfire.py
@@ -34,6 +34,7 @@ from cinder import context
 from cinder import exception
 from cinder.i18n import _, _LE, _LW
 from cinder.image import image_utils
+from cinder.objects import fields
 from cinder.volume.drivers.san import san
 from cinder.volume import qos_specs
 from cinder.volume.targets import iscsi as iscsi_driver
@@ -1277,7 +1278,7 @@ class SolidFireDriver(san.SanISCSIDriver):
         # volume associations. So, we're just going to play along with the
         # consistency group song and dance. There will be a lot of no-ops
         # because of this.
-        return {'status': 'available'}
+        return {'status': fields.ConsistencyGroupStatus.AVAILABLE}
 
     def create_consistencygroup_from_src(self, ctxt, group, volumes,
                                          cgsnapshot, snapshots,
@@ -1294,7 +1295,8 @@ class SolidFireDriver(san.SanISCSIDriver):
                     snap['id'],
                     sf_group_snap,
                     vol))
-            return {'status': 'available'}, vol_models
+            return ({'status': fields.ConsistencyGroupStatus.AVAILABLE},
+                    vol_models)
 
         elif source_cg and source_vols:
             # Create temporary group snapshot.
diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py
index 40b9c2bd3..1c530612b 100644
--- a/cinder/volume/manager.py
+++ b/cinder/volume/manager.py
@@ -62,6 +62,7 @@ from cinder.image import cache as image_cache
 from cinder.image import glance
 from cinder import manager
 from cinder import objects
+from cinder.objects import fields
 from cinder import quota
 from cinder import utils
 from cinder import volume as cinder_volume
@@ -2371,7 +2372,7 @@ class VolumeManager(manager.SchedulerDependentManager):
         """Creates the consistency group."""
         context = context.elevated()
 
-        status = 'available'
+        status = fields.ConsistencyGroupStatus.AVAILABLE
         model_update = None
 
         self._notify_about_consistencygroup_usage(
@@ -2385,7 +2386,8 @@ class VolumeManager(manager.SchedulerDependentManager):
                                                                group)
 
             if model_update:
-                if model_update['status'] == 'error':
+                if (model_update['status'] ==
+                        fields.ConsistencyGroupStatus.ERROR):
                     msg = (_('Create consistency group failed.'))
                     LOG.error(msg,
                               resource={'type': 'consistency_group',
@@ -2396,7 +2398,7 @@ class VolumeManager(manager.SchedulerDependentManager):
                     group.save()
         except Exception:
             with excutils.save_and_reraise_exception():
-                group.status = 'error'
+                group.status = fields.ConsistencyGroupStatus.ERROR
                 group.save()
                 LOG.error(_LE("Consistency group %s: create failed"),
                           group.name)
@@ -2864,7 +2866,8 @@ class VolumeManager(manager.SchedulerDependentManager):
                     self.db.volume_update(context, update['id'], update)
 
             if model_update:
-                if model_update['status'] in ['error']:
+                if model_update['status'] in (
+                        [fields.ConsistencyGroupStatus.ERROR]):
                     msg = (_('Error occurred when updating consistency group '
                              '%s.') % group.id)
                     LOG.error(msg)
-- 
2.45.2