Add update_host for backup in cinder-manager

As scaling backup is imported, if users sepecify backup_use_same_host,
they have to manually update backups' host.

Change-Id: Ic031cae16f4c58fa06d92e979fe2b83d244832fc
This commit is contained in:
LisaLi
2016-02-19 16:39:38 +08:00
committed by Tom Barron
parent 207f8d332c
commit ea89376494
2 changed files with 43 additions and 0 deletions

View File

@@ -414,6 +414,20 @@ class BackupCommands(object):
backup['size'],
object_count))
@args('--currenthost', required=True, help='Existing backup host name')
@args('--newhost', required=True, help='New backup host name')
def update_backup_host(self, currenthost, newhost):
"""Modify the host name associated with a backup.
Particularly to recover from cases where one has moved
their Cinder Backup node, and not set backup_use_same_backend.
"""
ctxt = context.get_admin_context()
backups = objects.BackupList.get_all_by_host(ctxt, currenthost)
for bk in backups:
bk.host = newhost
bk.save()
class ServiceCommands(object):
"""Methods for managing services."""