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
This commit is contained in:
Sean Mooney 2024-06-21 18:09:04 +01:00 committed by Balazs Gibizer
parent 12b32198ca
commit 02d72b9d56
21 changed files with 12 additions and 217 deletions

View File

@ -26,10 +26,6 @@ Options
.. include:: opts/common.rst
.. rubric:: Debugger options
.. include:: opts/debugger.rst
Files
=====

View File

@ -24,10 +24,6 @@ Options
.. include:: opts/common.rst
.. rubric:: Debugger options
.. include:: opts/debugger.rst
Files
=====

View File

@ -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
=====

View File

@ -43,10 +43,6 @@ Options
Defaults to ``$OS_USER_ID``.
.. rubric:: Debugger options
.. include:: opts/debugger.rst
Commands
========

View File

@ -25,10 +25,6 @@ Options
.. include:: opts/common.rst
.. rubric:: Debugger options
.. include:: opts/debugger.rst
Files
=====

View File

@ -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
=====

View File

@ -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
=====

View File

@ -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.

View File

@ -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 <host IP where the debugger is running>
--remote_debug-port <port it is listening on>
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
=============================

View File

@ -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()

View File

@ -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():

View File

@ -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():

View File

@ -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)

View File

@ -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():

View File

@ -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)

View File

@ -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)

View File

@ -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 <IP address of the debugger>
"""),
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 <IP address of the debugger> \
--remote_debug-port <port debugger is listening on>.
"""),
]
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}

View File

@ -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.')

View File

@ -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,10 +37,6 @@ 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()
# NOTE(mdbooth): Log here instead of earlier to avoid loading oslo logging

View File

@ -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,

View File

@ -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.