Consistency Groups

This patch enables Consistency Groups support in Cinder.
It will be implemented for snapshots for CGs in phase 1.

Design
------------------------------------------------
The workflow is as follows:

1) Create a CG, specifying all volume types that can be supported by this
CG. The scheduler chooses a backend that supports all specified volume types.
The CG will be empty when it is first created.   Backend needs to report
consistencygroup_support = True.  Volume type can have the following in
extra specs: {'capabilities:consistencygroup_support': '<is> True'}.
If consistencygroup_support is not in volume type extra specs, it will be
added to filter_properties by the scheduler to make sure that the scheduler
will select the backend which reports consistency group support capability.

Create CG CLI:
cinder consisgroup-create --volume-type type1,type2 mycg1

This will add a CG entry in the new consistencygroups table.

2) After the CG is created, create a new volume and add to the CG.
Repeat until all volumes are created for the CG.

Create volume CLI (with CG):
cinder create --volume-type type1 --consisgroup-id <CG uuid> 10

This will add a consistencygroup_id foreign key in the new volume
entry in the db.

3) Create a snapshot of the CG (cgsnapshot).

Create cgsnapshot CLI:
cinder cgsnapshot-create <CG uuid>

This will add a cgsnapshot entry in the new cgsnapshots table, create
snapshot for each volume in the CG, and add a cgsnapshot_id foreign key
in each newly created snapshot entry in the db.

DocImpact
Implements: blueprint consistency-groups

Change-Id: Ic105698aaad86ee30ef57ecf5107c224fdadf724
This commit is contained in:
Xing Yang
2014-08-26 23:53:34 -04:00
parent 9bddf33f9f
commit cf961f83ac
39 changed files with 3731 additions and 32 deletions

View File

@@ -147,6 +147,69 @@ def notify_about_replication_error(context, volume, suffix,
usage_info)
def _usage_from_consistencygroup(context, group_ref, **kw):
usage_info = dict(tenant_id=group_ref['project_id'],
user_id=group_ref['user_id'],
availability_zone=group_ref['availability_zone'],
consistencygroup_id=group_ref['id'],
name=group_ref['name'],
created_at=null_safe_str(group_ref['created_at']),
status=group_ref['status'])
usage_info.update(kw)
return usage_info
def notify_about_consistencygroup_usage(context, group, event_suffix,
extra_usage_info=None, host=None):
if not host:
host = CONF.host
if not extra_usage_info:
extra_usage_info = {}
usage_info = _usage_from_consistencygroup(context,
group,
**extra_usage_info)
rpc.get_notifier("consistencygroup", host).info(
context,
'consistencygroup.%s' % event_suffix,
usage_info)
def _usage_from_cgsnapshot(context, cgsnapshot_ref, **kw):
usage_info = dict(
tenant_id=cgsnapshot_ref['project_id'],
user_id=cgsnapshot_ref['user_id'],
cgsnapshot_id=cgsnapshot_ref['id'],
name=cgsnapshot_ref['name'],
consistencygroup_id=cgsnapshot_ref['consistencygroup_id'],
created_at=null_safe_str(cgsnapshot_ref['created_at']),
status=cgsnapshot_ref['status'])
usage_info.update(kw)
return usage_info
def notify_about_cgsnapshot_usage(context, cgsnapshot, event_suffix,
extra_usage_info=None, host=None):
if not host:
host = CONF.host
if not extra_usage_info:
extra_usage_info = {}
usage_info = _usage_from_cgsnapshot(context,
cgsnapshot,
**extra_usage_info)
rpc.get_notifier("cgsnapshot", host).info(
context,
'cgsnapshot.%s' % event_suffix,
usage_info)
def setup_blkio_cgroup(srcpath, dstpath, bps_limit, execute=utils.execute):
if not bps_limit:
LOG.debug('Not using bps rate limiting on volume copy')