Add replication v2.1 (cheesecake) calls
Cheesecake introduces a host based replication use case. This change includes the changes needed to support those implementations in the Cinder API. Implements: blueprint replication-update Change-Id: I74dc1a00fb4a2c05510c6159253036ac19706959
This commit is contained in:
@@ -62,3 +62,18 @@ class ServiceManager(base.ManagerWithFind):
|
|||||||
body = {"host": host, "binary": binary, "disabled_reason": reason}
|
body = {"host": host, "binary": binary, "disabled_reason": reason}
|
||||||
result = self._update("/os-services/disable-log-reason", body)
|
result = self._update("/os-services/disable-log-reason", body)
|
||||||
return self.resource_class(self, result, resp=result.request_ids)
|
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)
|
||||||
|
@@ -1682,11 +1682,21 @@ def do_extend(cs, args):
|
|||||||
help='Host name. Default=None.')
|
help='Host name. Default=None.')
|
||||||
@utils.arg('--binary', metavar='<binary>', default=None,
|
@utils.arg('--binary', metavar='<binary>', default=None,
|
||||||
help='Service 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')
|
@utils.service_type('volumev2')
|
||||||
def do_service_list(cs, args):
|
def do_service_list(cs, args):
|
||||||
"""Lists all services. Filter by host and service binary."""
|
"""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)
|
result = cs.services.list(host=args.host, binary=args.binary)
|
||||||
columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"]
|
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
|
# 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.
|
# so as not to add the column when the extended ext is not enabled.
|
||||||
if result and hasattr(result[0], 'disabled_reason'):
|
if result and hasattr(result[0], 'disabled_reason'):
|
||||||
@@ -2641,3 +2651,24 @@ def do_snapshot_unmanage(cs, args):
|
|||||||
"""Stop managing a snapshot."""
|
"""Stop managing a snapshot."""
|
||||||
snapshot = _find_volume_snapshot(cs, args.snapshot)
|
snapshot = _find_volume_snapshot(cs, args.snapshot)
|
||||||
cs.volume_snapshots.unmanage(snapshot.id)
|
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)
|
||||||
|
Reference in New Issue
Block a user