Added update-host for CGs in cinder-manage

Currently in cinder-manage, "update_host" command for consistency
groups is missing.

Hence, in a similar way like volumes and backups, 'update_host'
is added for Consistency Groups as well, because if host
configuration is changed then even if we change volumes and
backups using cinder-manage, we would have to go to the DB to
change our CGs.

Change-Id: I820ae9d17460a5aa7b3b2e41afc861e8bc0265a3
Closes-Bug: 1591153
This commit is contained in:
PranaliD
2016-06-20 02:21:41 -04:00
parent 0db18b8351
commit 67520e5eb2
3 changed files with 51 additions and 0 deletions

View File

@@ -597,10 +597,33 @@ class ClusterCommands(BaseCommand):
return 2
class ConsistencyGroupCommands(object):
"""Methods for managing consistency groups."""
@args('--currenthost', required=True, help='Existing CG host name')
@args('--newhost', required=True, help='New CG host name')
def update_cg_host(self, currenthost, newhost):
"""Modify the host name associated with a Consistency Group.
Particularly to recover from cases where one has moved
a host from single backend to multi-backend, or changed the host
configuration option, or modified the backend_name in a multi-backend
config.
"""
ctxt = context.get_admin_context()
groups = objects.ConsistencyGroupList.get_all(
ctxt, {'host': currenthost})
for gr in groups:
gr.host = newhost
gr.save()
CATEGORIES = {
'backup': BackupCommands,
'config': ConfigCommands,
'cluster': ClusterCommands,
'cg': ConsistencyGroupCommands,
'db': DbCommands,
'host': HostCommands,
'logs': GetLogCommands,