diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-29 23:13:48 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-29 23:13:48 +0000 |
commit | d4569534b42075ad78aa67732d07b22e7504a77a (patch) | |
tree | 76a965b8cf24d42363d01e2044eb4f42e4693fdc | |
parent | 64cde9f7f7f465f96926926eaea57e4072284ce0 (diff) | |
parent | 88934c2708b52ad78b26dea179f95512f6f80fc5 (diff) | |
download | python-cinderclient-d4569534b42075ad78aa67732d07b22e7504a77a.tar.gz |
Merge "Add replication v2.1 (cheesecake) calls"
-rw-r--r-- | cinderclient/v2/services.py | 15 | ||||
-rw-r--r-- | cinderclient/v2/shell.py | 31 |
2 files changed, 46 insertions, 0 deletions
diff --git a/cinderclient/v2/services.py b/cinderclient/v2/services.py index b58efa6..8cefc34 100644 --- a/cinderclient/v2/services.py +++ b/cinderclient/v2/services.py @@ -62,3 +62,18 @@ class ServiceManager(base.ManagerWithFind): body = {"host": host, "binary": binary, "disabled_reason": reason} result = self._update("/os-services/disable-log-reason", body) return self.resource_class(self, result, resp=result.request_ids) + + def freeze_host(self, host): + """Freeze the service specified by hostname.""" + body = {"host": host} + return self._update("/os-services/freeze", body) + + def thaw_host(self, host): + """Thaw the service specified by hostname.""" + body = {"host": host} + return self._update("/os-services/thaw", body) + + def failover_host(self, host, backend_id): + """Failover a replicated backend by hostname.""" + body = {"host": host, "backend_id": backend_id} + return self._update("/os-services/failover_host", body) diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index a73fd5b..409675e 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -1694,11 +1694,21 @@ def do_extend(cs, args): help='Host name. Default=None.') @utils.arg('--binary', metavar='<binary>', default=None, help='Service binary. Default=None.') +@utils.arg('--withreplication', + metavar='<True|False>', + const=True, + nargs='?', + default=False, + help='Enables or disables display of ' + 'Replication info for c-vol services. Default=False.') @utils.service_type('volumev2') def do_service_list(cs, args): """Lists all services. Filter by host and service binary.""" + replication = strutils.bool_from_string(args.withreplication) result = cs.services.list(host=args.host, binary=args.binary) columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"] + if replication: + columns.extend(["Replication Status", "Active Backend ID", "Frozen"]) # NOTE(jay-lau-513): we check if the response has disabled_reason # so as not to add the column when the extended ext is not enabled. if result and hasattr(result[0], 'disabled_reason'): @@ -2655,3 +2665,24 @@ def do_snapshot_unmanage(cs, args): """Stop managing a snapshot.""" snapshot = _find_volume_snapshot(cs, args.snapshot) cs.volume_snapshots.unmanage(snapshot.id) + + +@utils.arg('host', metavar='<hostname>', help='Host name.') +@utils.service_type('volumev2') +def do_freeze_host(cs, args): + cs.services.freeze_host(args.host) + + +@utils.arg('host', metavar='<hostname>', help='Host name.') +@utils.service_type('volumev2') +def do_thaw_host(cs, args): + cs.services.thaw_host(args.host) + + +@utils.arg('host', metavar='<hostname>', help='Host name.') +@utils.arg('--backend_id', + metavar='<backend-id>', + help='ID of backend to failover to (Default=None)') +@utils.service_type('volumev2') +def do_failover_host(cs, args): + cs.services.failover_host(args.host, args.backend_id) |