'Rename cluster name for Volumes and Consistency Groups.
Useful when you want to rename a cluster, particularly when the
backend_name has been modified in a multi-backend config or we have
moved from a single backend to multi-backend.'

@args('--full-rename', dest='partial', action='store_false', default=True, help='Do    full    cluster    rename    instead    of    just    replacing    provided    current    cluster    name    and    preserving    backend    and/or    pool    info.')
@args('current', help='Current    cluster    name.')
@args('new', help='New    cluster    name.')
def rename(self, partial, current, new):

    ctxt = context.get_admin_context()
    current = (current or None)
    new = (new or None)
    num_vols = objects.VolumeList.include_in_cluster(ctxt, new, partial_rename=partial, cluster_name=current)
    num_cgs = objects.ConsistencyGroupList.include_in_cluster(ctxt, new, partial_rename=partial, cluster_name=current)
    if (num_vols or num_cgs):
        msg = _('Successfully    renamed    %(num_vols)s    volumes    and    %(num_cgs)s    consistency    groups    from    cluster    %(current)s    to    %(new)s')
        print((msg % {'num_vols': num_vols, 'num_cgs': num_cgs, 'new': new, 'current': current}))
    else:
        msg = _('No    volumes    or    consistency    groups    exist    in    cluster    %(current)s.')
        print((msg % {'current': current}))
        return 2
