From 02d72b9d56f44481ff3971ec4c1aa87ad6c06775 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Fri, 21 Jun 2024 18:09:04 +0100 Subject: [PATCH] Remove nova debugger functionality The nova debuger functionality was intended to help debugging running process however it has never been reliable due to our use of eventlet and is generally not required when not using eventlet. I.e. you can just run the nova console-scripts form a debugger or add pdb statements as required. As part of the eventlet removal the debugger functionality is removed given its untested and undocumented. Change-Id: I7bf88f06f3d1dbd2c7e342b27a21440a123c631d --- doc/source/cli/nova-compute.rst | 4 -- doc/source/cli/nova-conductor.rst | 4 -- doc/source/cli/nova-novncproxy.rst | 4 -- doc/source/cli/nova-policy.rst | 4 -- doc/source/cli/nova-scheduler.rst | 4 -- doc/source/cli/nova-serialproxy.rst | 4 -- doc/source/cli/nova-spicehtml5proxy.rst | 4 -- doc/source/cli/opts/debugger.rst | 15 ---- .../contributor/development-environment.rst | 16 ----- nova/cmd/baseproxy.py | 5 +- 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/remote_debug.py | 71 ------------------- nova/debugger.py | 60 ---------------- nova/monkey_patch.py | 10 +-- nova/service.py | 3 - ...ote-debugger-removal-07e26d43c561d495.yaml | 9 +++ 21 files changed, 12 insertions(+), 217 deletions(-) delete mode 100644 doc/source/cli/opts/debugger.rst delete mode 100644 nova/conf/remote_debug.py delete mode 100644 nova/debugger.py create mode 100644 releasenotes/notes/remote-debugger-removal-07e26d43c561d495.yaml diff --git a/doc/source/cli/nova-compute.rst b/doc/source/cli/nova-compute.rst index 1346dab92e60..6be153de7ec3 100644 --- a/doc/source/cli/nova-compute.rst +++ b/doc/source/cli/nova-compute.rst @@ -26,10 +26,6 @@ Options .. include:: opts/common.rst -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/nova-conductor.rst b/doc/source/cli/nova-conductor.rst index 3020250e3987..114208b312e9 100644 --- a/doc/source/cli/nova-conductor.rst +++ b/doc/source/cli/nova-conductor.rst @@ -24,10 +24,6 @@ Options .. include:: opts/common.rst -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/nova-novncproxy.rst b/doc/source/cli/nova-novncproxy.rst index f2df84e2ccae..2b73d1909525 100644 --- a/doc/source/cli/nova-novncproxy.rst +++ b/doc/source/cli/nova-novncproxy.rst @@ -72,10 +72,6 @@ Options path to a PEM file containing the private key which the VNC proxy server presents to the compute node during VNC authentication. -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/nova-policy.rst b/doc/source/cli/nova-policy.rst index 480c3b2d983f..a15efeee07a5 100644 --- a/doc/source/cli/nova-policy.rst +++ b/doc/source/cli/nova-policy.rst @@ -43,10 +43,6 @@ Options Defaults to ``$OS_USER_ID``. -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Commands ======== diff --git a/doc/source/cli/nova-scheduler.rst b/doc/source/cli/nova-scheduler.rst index dd5cd468725e..647c26d1f923 100644 --- a/doc/source/cli/nova-scheduler.rst +++ b/doc/source/cli/nova-scheduler.rst @@ -25,10 +25,6 @@ Options .. include:: opts/common.rst -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/nova-serialproxy.rst b/doc/source/cli/nova-serialproxy.rst index f362b1b951ec..30b25f4c71da 100644 --- a/doc/source/cli/nova-serialproxy.rst +++ b/doc/source/cli/nova-serialproxy.rst @@ -45,10 +45,6 @@ Options this port number for incoming connection requests to instances which expose serial console. -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/nova-spicehtml5proxy.rst b/doc/source/cli/nova-spicehtml5proxy.rst index 65173c8d336c..70857278077b 100644 --- a/doc/source/cli/nova-spicehtml5proxy.rst +++ b/doc/source/cli/nova-spicehtml5proxy.rst @@ -46,10 +46,6 @@ Options in ``nova.conf``. The ``nova-spicehtml5proxy`` service must be listening on a port that is accessible from the HTML5 client. -.. rubric:: Debugger options - -.. include:: opts/debugger.rst - Files ===== diff --git a/doc/source/cli/opts/debugger.rst b/doc/source/cli/opts/debugger.rst deleted file mode 100644 index a0698e0c9799..000000000000 --- a/doc/source/cli/opts/debugger.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. option:: --remote_debug-host REMOTE_DEBUG_HOST - - 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. 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. - -.. option:: --remote_debug-port REMOTE_DEBUG_PORT - - 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. 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. diff --git a/doc/source/contributor/development-environment.rst b/doc/source/contributor/development-environment.rst index 5e2b4c391332..fc80603319a2 100644 --- a/doc/source/contributor/development-environment.rst +++ b/doc/source/contributor/development-environment.rst @@ -179,22 +179,6 @@ As a reminder, the hooks are optional and you are not enforced to run them. You can either not install pre-commit or skip the hooks once by using the ``--no-verify`` flag on ``git commit``. -Using a remote debugger -======================= - -Some modern IDE such as pycharm (commercial) or Eclipse (open source) support remote debugging. In order to -run nova with remote debugging, start the nova process with the following parameters:: - - --remote_debug-host - --remote_debug-port - -Before you start your nova process, start the remote debugger using the instructions for that debugger: - -* For pycharm - http://blog.jetbrains.com/pycharm/2010/12/python-remote-debug-with-pycharm/ -* For Eclipse - http://pydev.org/manual_adv_remote_debugger.html - -More detailed instructions are located here - https://wiki.openstack.org/wiki/Nova/RemoteDebugging - Using fake computes for tests ============================= diff --git a/nova/cmd/baseproxy.py b/nova/cmd/baseproxy.py index fdd4f28892b4..9260df832363 100644 --- a/nova/cmd/baseproxy.py +++ b/nova/cmd/baseproxy.py @@ -26,16 +26,15 @@ 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) +# NOTE this is required ensure CONF.web +# is registered properly 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 3d68892d805a..58e765667bc6 100644 --- a/nova/cmd/compute.py +++ b/nova/cmd/compute.py @@ -29,7 +29,6 @@ from oslo_reports import opts as gmr_opts 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 import nova.db.main.api from nova import objects @@ -39,7 +38,6 @@ 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 f7ae1f6b8f8f..16847c2e5610 100644 --- a/nova/cmd/conductor.py +++ b/nova/cmd/conductor.py @@ -23,14 +23,12 @@ 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 36635f77d973..7d4234ad10f1 100644 --- a/nova/cmd/novncproxy.py +++ b/nova/cmd/novncproxy.py @@ -23,14 +23,12 @@ 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 8b9892d7424e..5c72a19bc575 100644 --- a/nova/cmd/scheduler.py +++ b/nova/cmd/scheduler.py @@ -24,7 +24,6 @@ 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 @@ -32,7 +31,6 @@ 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 49d402d6df2e..8b93abf2eefa 100644 --- a/nova/cmd/serialproxy.py +++ b/nova/cmd/serialproxy.py @@ -21,13 +21,11 @@ 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 c2a6926cc786..1365215be5d8 100644 --- a/nova/cmd/spicehtml5proxy.py +++ b/nova/cmd/spicehtml5proxy.py @@ -22,13 +22,11 @@ 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/remote_debug.py b/nova/conf/remote_debug.py deleted file mode 100644 index 4dea3f5944ea..000000000000 --- a/nova/conf/remote_debug.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (c) 2016 Intel, Inc. -# Copyright (c) 2013 OpenStack Foundation -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_config import cfg - -debugger_group = cfg.OptGroup('remote_debug', - title='debugger options') - -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. - -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:: - - 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. - -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:: - - nova-compute --config-file /etc/nova/nova.conf \ - --remote_debug-host \ - --remote_debug-port . -"""), -] - - -def register_cli_opts(conf): - conf.register_group(debugger_group) - conf.register_cli_opts(CLI_OPTS, group=debugger_group) - - -def list_opts(): - return {debugger_group: CLI_OPTS} diff --git a/nova/debugger.py b/nova/debugger.py deleted file mode 100644 index 6e52e712eb3e..000000000000 --- a/nova/debugger.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# Copyright 2011 Justin Santa Barbara -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# NOTE(markmc): this is imported before monkey patching in nova.cmd -# so we avoid extra imports here - -import sys - - -def enabled(): - return ('--remote_debug-host' in sys.argv and - '--remote_debug-port' in sys.argv) - - -def init(): - import nova.conf - CONF = nova.conf.CONF - - # NOTE(markmc): gracefully handle the CLI options not being registered - if 'remote_debug' not in CONF: - return - - if not (CONF.remote_debug.host and CONF.remote_debug.port): - return - - from oslo_log import log as logging - LOG = logging.getLogger(__name__) - - LOG.debug('Listening on %(host)s:%(port)s for debug connection', - {'host': CONF.remote_debug.host, - 'port': CONF.remote_debug.port}) - - try: - from pydev import pydevd - except ImportError: - import pydevd - - pydevd.settrace(host=CONF.remote_debug.host, - port=CONF.remote_debug.port, - stdoutToServer=False, - stderrToServer=False) - - LOG.warning('WARNING: 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.') diff --git a/nova/monkey_patch.py b/nova/monkey_patch.py index 1dea5f9360ec..27171a42f044 100644 --- a/nova/monkey_patch.py +++ b/nova/monkey_patch.py @@ -30,10 +30,6 @@ def _monkey_patch(): import eventlet import sys - # NOTE(mdbooth): Imports only sys (2019-01-30). Other modules imported at - # runtime on execution of debugger.init(). - from nova import debugger - # Note any modules with known monkey-patching issues which have been # imported before monkey patching. # urllib3: https://bugs.launchpad.net/nova/+bug/1808951 @@ -41,11 +37,7 @@ def _monkey_patch(): problems = (set(['urllib3', 'oslo_context.context']) & set(sys.modules.keys())) - if debugger.enabled(): - # turn off thread patching to enable the remote debugger - eventlet.monkey_patch(thread=False) - else: - eventlet.monkey_patch() + eventlet.monkey_patch() # NOTE(mdbooth): Log here instead of earlier to avoid loading oslo logging # before monkey patching. diff --git a/nova/service.py b/nova/service.py index 2a8d8e9cb325..ed54f7a55233 100644 --- a/nova/service.py +++ b/nova/service.py @@ -31,7 +31,6 @@ from nova import baserpc from nova import conductor import nova.conf from nova import context -from nova import debugger from nova import exception from nova.i18n import _ from nova import objects @@ -243,8 +242,6 @@ class Service(service.Service): if periodic_fuzzy_delay is None: periodic_fuzzy_delay = CONF.periodic_fuzzy_delay - debugger.init() - service_obj = cls(host, binary, topic, manager, report_interval=report_interval, periodic_enable=periodic_enable, diff --git a/releasenotes/notes/remote-debugger-removal-07e26d43c561d495.yaml b/releasenotes/notes/remote-debugger-removal-07e26d43c561d495.yaml new file mode 100644 index 000000000000..bbd0940d6d09 --- /dev/null +++ b/releasenotes/notes/remote-debugger-removal-07e26d43c561d495.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + The remote debugger has been removed from the codebase. If you were using + it, you will need to find an alternative solution. The remote debugger was + un-maintained and was first introduced in the early days of OpenStack when + we used python 2.7. While it was useful at the time, it has not been + maintained and updated to work with new versions of python and eventlet. + As a result it is being removed until we complete the eventlet removal. \ No newline at end of file