Remove deprecated services binary CLI arg

The services CLI 'binary' arg was deprecated in Pike
via change Idd0d2be960ca0ed59097c10c931da47a1a3e66fb
because with cells v2 support in the API, the binary
argument for the enable/disable CLIs doesn't make sense
as the only binary those work with is 'nova-compute'.
So this removes the deprecated argument and hard-codes
the value to be 'nova-compute'.

Change-Id: I60490f3d74212bb172dccc1c7d337198e1021236
This commit is contained in:
Matt Riedemann 2018-01-11 17:39:50 -05:00
parent 01fb16533b
commit fefc3ba723
5 changed files with 25 additions and 47 deletions

View File

@ -41,13 +41,12 @@ class TestOsServicesNovaClient(base.ClientTestBase):
continue
host = self._get_column_value_from_single_row_table(
self.nova('service-list --binary %s' % serv.binary), 'Host')
service = self.nova('service-disable %s %s' % (host, serv.binary))
self.addCleanup(self.nova, 'service-enable',
params="%s %s" % (host, serv.binary))
service = self.nova('service-disable %s' % host)
self.addCleanup(self.nova, 'service-enable', params=host)
status = self._get_column_value_from_single_row_table(
service, 'Status')
self.assertEqual('disabled', status)
service = self.nova('service-enable %s %s' % (host, serv.binary))
service = self.nova('service-enable %s' % host)
status = self._get_column_value_from_single_row_table(
service, 'Status')
self.assertEqual('enabled', status)
@ -64,10 +63,9 @@ class TestOsServicesNovaClient(base.ClientTestBase):
continue
host = self._get_column_value_from_single_row_table(
self.nova('service-list --binary %s' % serv.binary), 'Host')
service = self.nova('service-disable --reason test_disable %s %s'
% (host, serv.binary))
self.addCleanup(self.nova, 'service-enable',
params="%s %s" % (host, serv.binary))
service = self.nova(
'service-disable --reason test_disable %s' % host)
self.addCleanup(self.nova, 'service-enable', params=host)
status = self._get_column_value_from_single_row_table(
service, 'Status')
log_reason = self._get_column_value_from_single_row_table(

View File

@ -38,15 +38,13 @@ class TestOsServicesNovaClientV211(test_os_services.TestOsServicesNovaClient):
host = self._get_column_value_from_single_row_table(service_list,
'Host')
service = self.nova('service-force-down %s %s'
% (host, serv.binary))
service = self.nova('service-force-down %s' % host)
self.addCleanup(self.nova, 'service-force-down --unset',
params="%s %s" % (host, serv.binary))
params=host)
status = self._get_column_value_from_single_row_table(
service, 'Forced down')
self.assertEqual('True', status)
service = self.nova('service-force-down --unset %s %s'
% (host, serv.binary))
service = self.nova('service-force-down --unset %s' % host)
status = self._get_column_value_from_single_row_table(
service, 'Forced down')
self.assertEqual('False', status)

View File

@ -2369,8 +2369,8 @@ class ShellTest(utils.TestCase):
self.assert_called('GET', '/os-services?host=host1&binary=nova-cert')
def test_services_enable(self):
self.run_command('service-enable host1 nova-cert')
body = {'host': 'host1', 'binary': 'nova-cert'}
self.run_command('service-enable host1')
body = {'host': 'host1', 'binary': 'nova-compute'}
self.assert_called('PUT', '/os-services/enable', body)
def test_services_enable_v2_53(self):
@ -2381,15 +2381,9 @@ class ShellTest(utils.TestCase):
self.assert_called(
'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body)
def test_services_enable_default_binary(self):
"""Tests that the default binary is nova-compute if not specified."""
self.run_command('service-enable host1')
body = {'host': 'host1', 'binary': 'nova-compute'}
self.assert_called('PUT', '/os-services/enable', body)
def test_services_disable(self):
self.run_command('service-disable host1 nova-cert')
body = {'host': 'host1', 'binary': 'nova-cert'}
self.run_command('service-disable host1')
body = {'host': 'host1', 'binary': 'nova-compute'}
self.assert_called('PUT', '/os-services/disable', body)
def test_services_disable_v2_53(self):
@ -2400,15 +2394,9 @@ class ShellTest(utils.TestCase):
self.assert_called(
'PUT', '/os-services/%s' % fakes.FAKE_SERVICE_UUID_1, body)
def test_services_disable_default_binary(self):
"""Tests that the default binary is nova-compute if not specified."""
self.run_command('service-disable host1')
body = {'host': 'host1', 'binary': 'nova-compute'}
self.assert_called('PUT', '/os-services/disable', body)
def test_services_disable_with_reason(self):
self.run_command('service-disable host1 nova-cert --reason no_reason')
body = {'host': 'host1', 'binary': 'nova-cert',
self.run_command('service-disable host1 --reason no_reason')
body = {'host': 'host1', 'binary': 'nova-compute',
'disabled_reason': 'no_reason'}
self.assert_called('PUT', '/os-services/disable-log-reason', body)

View File

@ -3400,13 +3400,9 @@ def do_service_list(cs, args):
# values.
@api_versions.wraps('2.0', '2.52')
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
'meaningful binary is "nova-compute". (Deprecated)'),
default='nova-compute', nargs='?')
def do_service_enable(cs, args):
"""Enable the service."""
result = cs.services.enable(args.host, args.binary)
result = cs.services.enable(args.host, 'nova-compute')
utils.print_list([result], ['Host', 'Binary', 'Status'])
@ -3423,10 +3419,6 @@ def do_service_enable(cs, args):
# values.
@api_versions.wraps('2.0', '2.52')
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
'meaningful binary is "nova-compute". (Deprecated)'),
default='nova-compute', nargs='?')
@utils.arg(
'--reason',
metavar='<reason>',
@ -3434,12 +3426,12 @@ def do_service_enable(cs, args):
def do_service_disable(cs, args):
"""Disable the service."""
if args.reason:
result = cs.services.disable_log_reason(args.host, args.binary,
result = cs.services.disable_log_reason(args.host, 'nova-compute',
args.reason)
utils.print_list([result], ['Host', 'Binary', 'Status',
'Disabled Reason'])
else:
result = cs.services.disable(args.host, args.binary)
result = cs.services.disable(args.host, 'nova-compute')
utils.print_list([result], ['Host', 'Binary', 'Status'])
@ -3465,10 +3457,6 @@ def do_service_disable(cs, args):
# values.
@api_versions.wraps("2.11", "2.52")
@utils.arg('host', metavar='<hostname>', help=_('Name of host.'))
# TODO(mriedem): Eventually just hard-code the binary to "nova-compute".
@utils.arg('binary', metavar='<binary>', help=_('Service binary. The only '
'meaningful binary is "nova-compute". (Deprecated)'),
default='nova-compute', nargs='?')
@utils.arg(
'--unset',
dest='force_down',
@ -3477,7 +3465,7 @@ def do_service_disable(cs, args):
default=True)
def do_service_force_down(cs, args):
"""Force service to down."""
result = cs.services.force_down(args.host, args.binary, args.force_down)
result = cs.services.force_down(args.host, 'nova-compute', args.force_down)
utils.print_list([result], ['Host', 'Binary', 'Forced down'])

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The deprecated ``binary`` argument to the ``nova service-enable``,
``nova service-disable``, and ``nova service-force-down`` commands has been
removed.