From 2362970d5cb6c0a4ef3aca972929c84ba8395509 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 20 Aug 2019 11:44:12 +0100 Subject: [PATCH] config: Explicitly register 'remote_debug' CLI opts We were registering the 'remote_debug' CLI opts as part of the 'nova.conf' init code. This meant not only every service we used (bar 'nova-console') but also every CLI tool we provided was exposing these options, even though they made zero sense in the latter option. Resolve this by explicitly registering the options against the services that we want them in. Specifically, these are the API services (nova-api, nova-api-metadata, nova-api-os-compute), the console proxy services (nova-novncproxy, nova-serialproxy, nova-spicehtml5proxy), nova-compute, nova-conductor and nova-scheduler. While we're here, we also clean up the documentation for these options since there are a few non-rST'y things in there. Change-Id: I7b7489e8412cc93d49904d4ef08a775b07b27d26 Signed-off-by: Stephen Finucane --- nova/cmd/api.py | 2 ++ nova/cmd/api_metadata.py | 2 ++ nova/cmd/api_os_compute.py | 2 ++ nova/cmd/baseproxy.py | 3 +++ nova/cmd/compute.py | 2 ++ nova/cmd/conductor.py | 2 ++ nova/cmd/novncproxy.py | 2 ++ nova/cmd/scheduler.py | 2 ++ nova/cmd/serialproxy.py | 2 ++ nova/cmd/spicehtml5proxy.py | 2 ++ nova/conf/__init__.py | 3 --- nova/conf/remote_debug.py | 41 +++++++++++++++++++------------------ 12 files changed, 42 insertions(+), 23 deletions(-) diff --git a/nova/cmd/api.py b/nova/cmd/api.py index 2080b0d5e81c..a7515ef859fb 100644 --- a/nova/cmd/api.py +++ b/nova/cmd/api.py @@ -27,6 +27,7 @@ from oslo_reports import guru_meditation_report as gmr from oslo_reports import opts as gmr_opts import nova.conf +from nova.conf import remote_debug from nova import config from nova import exception from nova import objects @@ -34,6 +35,7 @@ from nova import service from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/api_metadata.py b/nova/cmd/api_metadata.py index 493f3e0c8e9c..0d95de2f78e3 100644 --- a/nova/cmd/api_metadata.py +++ b/nova/cmd/api_metadata.py @@ -24,6 +24,7 @@ from oslo_reports import opts as gmr_opts from nova.conductor import rpcapi as conductor_rpcapi import nova.conf +from nova.conf import remote_debug from nova import config from nova import objects from nova.objects import base as objects_base @@ -32,6 +33,7 @@ from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/api_os_compute.py b/nova/cmd/api_os_compute.py index f7d3beb10c6b..643c3ed7b104 100644 --- a/nova/cmd/api_os_compute.py +++ b/nova/cmd/api_os_compute.py @@ -23,6 +23,7 @@ from oslo_reports import guru_meditation_report as gmr from oslo_reports import opts as gmr_opts import nova.conf +from nova.conf import remote_debug from nova import config from nova import objects from nova import service @@ -30,6 +31,7 @@ from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/baseproxy.py b/nova/cmd/baseproxy.py index c2693e00f5cd..fdd4f28892b4 100644 --- a/nova/cmd/baseproxy.py +++ b/nova/cmd/baseproxy.py @@ -26,13 +26,16 @@ from oslo_reports import opts as gmr_opts import nova.conf from nova.conf import novnc +from nova.conf import remote_debug from nova.console import websocketproxy from nova import objects from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) novnc.register_cli_opts(CONF) + gmr_opts.set_defaults(CONF) objects.register_all() diff --git a/nova/cmd/compute.py b/nova/cmd/compute.py index 01fd20de2e54..24ce1b3ba8c5 100644 --- a/nova/cmd/compute.py +++ b/nova/cmd/compute.py @@ -29,6 +29,7 @@ from nova.cmd import common as cmd_common from nova.compute import rpcapi as compute_rpcapi from nova.conductor import rpcapi as conductor_rpcapi import nova.conf +from nova.conf import remote_debug from nova import config from nova import objects from nova.objects import base as objects_base @@ -37,6 +38,7 @@ from nova import utils from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/conductor.py b/nova/cmd/conductor.py index 16847c2e5610..f7ae1f6b8f8f 100644 --- a/nova/cmd/conductor.py +++ b/nova/cmd/conductor.py @@ -23,12 +23,14 @@ from oslo_reports import opts as gmr_opts from nova.conductor import rpcapi import nova.conf +from nova.conf import remote_debug from nova import config from nova import objects from nova import service from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/novncproxy.py b/nova/cmd/novncproxy.py index 954602542d7d..64b2cb9de971 100644 --- a/nova/cmd/novncproxy.py +++ b/nova/cmd/novncproxy.py @@ -23,12 +23,14 @@ import sys from nova.cmd import baseproxy import nova.conf +from nova.conf import remote_debug from nova.conf import vnc from nova import config from nova.console.securityproxy import rfb CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) vnc.register_cli_opts(CONF) diff --git a/nova/cmd/scheduler.py b/nova/cmd/scheduler.py index 3ea220d4d99e..a8ec999b5858 100644 --- a/nova/cmd/scheduler.py +++ b/nova/cmd/scheduler.py @@ -24,6 +24,7 @@ from oslo_reports import guru_meditation_report as gmr from oslo_reports import opts as gmr_opts import nova.conf +from nova.conf import remote_debug from nova import config from nova import objects from nova.scheduler import rpcapi as scheduler_rpcapi @@ -31,6 +32,7 @@ from nova import service from nova import version CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) def main(): diff --git a/nova/cmd/serialproxy.py b/nova/cmd/serialproxy.py index 8b93abf2eefa..49d402d6df2e 100644 --- a/nova/cmd/serialproxy.py +++ b/nova/cmd/serialproxy.py @@ -21,11 +21,13 @@ import sys from nova.cmd import baseproxy import nova.conf +from nova.conf import remote_debug from nova.conf import serial_console as serial from nova import config CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) serial.register_cli_opts(CONF) diff --git a/nova/cmd/spicehtml5proxy.py b/nova/cmd/spicehtml5proxy.py index 1365215be5d8..c2a6926cc786 100644 --- a/nova/cmd/spicehtml5proxy.py +++ b/nova/cmd/spicehtml5proxy.py @@ -22,11 +22,13 @@ import sys from nova.cmd import baseproxy import nova.conf +from nova.conf import remote_debug from nova.conf import spice from nova import config CONF = nova.conf.CONF +remote_debug.register_cli_opts(CONF) spice.register_cli_opts(CONF) diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index a2be1c01eacc..c9843ed67f1c 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -52,7 +52,6 @@ from nova.conf import placement from nova.conf import powervm from nova.conf import quota from nova.conf import rdp -from nova.conf import remote_debug from nova.conf import rpc from nova.conf import scheduler from nova.conf import serial_console @@ -119,5 +118,3 @@ workarounds.register_opts(CONF) wsgi.register_opts(CONF) xenserver.register_opts(CONF) zvm.register_opts(CONF) - -remote_debug.register_cli_opts(CONF) diff --git a/nova/conf/remote_debug.py b/nova/conf/remote_debug.py index 7e464bcb4970..4dea3f5944ea 100644 --- a/nova/conf/remote_debug.py +++ b/nova/conf/remote_debug.py @@ -21,42 +21,43 @@ debugger_group = cfg.OptGroup('remote_debug', CLI_OPTS = [ cfg.HostAddressOpt('host', - help=""" -Debug host (IP or name) to connect to. This command line parameter is used when -you want to connect to a nova service via a debugger running on a different -host. + help=""" +Debug host (IP or name) to connect to. -Note that using the remote debug option changes how Nova uses the eventlet +This command line parameter is used when you want to connect to a nova service +via a debugger running on a different host. + +Note that using the remote debug option changes how nova uses the eventlet library to support async IO. This could result in failures that do not occur under normal operation. Use at your own risk. Possible Values: - * IP address of a remote host as a command line parameter - to a nova service. For Example: +* IP address of a remote host as a command line parameter to a nova service. + For example:: - /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf - --remote_debug-host + nova-compute --config-file /etc/nova/nova.conf \ + --remote_debug-host """), - cfg.PortOpt('port', - help=""" -Debug port to connect to. This command line parameter allows you to specify -the port you want to use to connect to a nova service via a debugger running -on different host. + help=""" +Debug port to connect to. -Note that using the remote debug option changes how Nova uses the eventlet +This command line parameter allows you to specify the port you want to use to +connect to a nova service via a debugger running on different host. + +Note that using the remote debug option changes how nova uses the eventlet library to support async IO. This could result in failures that do not occur under normal operation. Use at your own risk. Possible Values: - * Port number you want to use as a command line parameter - to a nova service. For Example: +* Port number you want to use as a command line parameter to a nova service. + For example:: - /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf - --remote_debug-host - --remote_debug-port it's listening on>. + nova-compute --config-file /etc/nova/nova.conf \ + --remote_debug-host \ + --remote_debug-port . """), ]