From df840b34570022c5e9f1c6024cbd895f43eac1ff Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Mon, 2 Nov 2015 14:32:38 +0100 Subject: [PATCH] Deprecate nova-manage service subcommand The novaclient already has the following service commands: service-disable Disable the service. service-enable Enable the service. service-list Show a list of all running services. host-describe Describe a specific host This covers what nova-manage service was providing so let's deprecate the legacy nova-manage subcommand and mark it for removal in the N release. UpgradeImpact: nova-manage service is deprecated, use novaclient DocImpact: update openstack operations guide Implements: bp deprecate-service-management-in-nova-manage Change-Id: I3e625dbf39f5831157104f5c368acd53b1899f76 --- nova/cmd/manage.py | 20 +++++++++++++++++++ ...e-service-subcommand-7626f7692bd62e41.yaml | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 releasenotes/notes/deprecate-nova-manage-service-subcommand-7626f7692bd62e41.yaml diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index a460a53ed4c9..8c8431bb8706 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -107,6 +107,17 @@ def args(*args, **kwargs): return _decorator +def deprecate(msg): + """Decorator which print the deprecation message before the decorated + function is called + """ + @decorator.decorator + def _deprecate(f, *args, **kwargs): + print(msg, file=sys.stderr) + return f(*args, **kwargs) + return _deprecate + + def param2id(object_id): """Helper function to convert various volume id types to internal id. args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10' @@ -701,6 +712,12 @@ class VmCommands(object): class ServiceCommands(object): """Enable and disable running services.""" + description = ('DEPRECATED: Use the nova service-* commands from ' + 'python-novaclient instead or the os-services REST ' + 'resource. The service subcommand will be ' + 'removed in the 14.0 release.') + + @deprecate(description) @args('--host', metavar='', help='Host') @args('--service', metavar='', help='Nova service') def list(self, host=None, service=None): @@ -733,6 +750,7 @@ class ServiceCommands(object): svc['availability_zone'], active, art, svc['updated_at'])) + @deprecate(description) @args('--host', metavar='', help='Host') @args('--service', metavar='', help='Nova service') def enable(self, host, service): @@ -747,6 +765,7 @@ class ServiceCommands(object): print((_("Service %(service)s on host %(host)s enabled.") % {'service': service, 'host': host})) + @deprecate(description) @args('--host', metavar='', help='Host') @args('--service', metavar='', help='Nova service') def disable(self, host, service): @@ -815,6 +834,7 @@ class ServiceCommands(object): return {'resource': resource, 'usage': usage} + @deprecate(description) @args('--host', metavar='', help='Host') def describe_resource(self, host): """Describes cpu/memory/hdd info for host. diff --git a/releasenotes/notes/deprecate-nova-manage-service-subcommand-7626f7692bd62e41.yaml b/releasenotes/notes/deprecate-nova-manage-service-subcommand-7626f7692bd62e41.yaml new file mode 100644 index 000000000000..c2fb3db22762 --- /dev/null +++ b/releasenotes/notes/deprecate-nova-manage-service-subcommand-7626f7692bd62e41.yaml @@ -0,0 +1,6 @@ +--- +other: + - The service subcommand of nova-manage is deprecated. Use the nova + service-* commands from python-novaclient instead or the os-services + REST resource. The service subcommand will be removed in the 14.0 release. +