Enable remote debugger in Cinder

Registered by Trump.Zhang

Glance, Keystone and Nova all support the use of a remote debugger. It would be nice to add that to Cinder as well.

This feature is used when you want to connect to a Cinder service via a debugger running on a different host.

Similar to Nova, to use it you start the cinder service with the following command line parameters

    --remote_debug-host <where the debugger is running>
    --remote_debug-port <port> it's listening on>.

Blueprint information

Status:
Complete
Approver:
John Griffith
Priority:
Low
Drafter:
Trump.Zhang
Direction:
Approved
Assignee:
Trump.Zhang
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Sean McGinnis

Related branches

Sprints

Whiteboard

(smcginnis): Marking obsolete as this has been sitting out there for a long time. If this is still needed, please submit a new bp.

Note: Simple monkey patching disabling in Icehouse will not let you remote debug. We have a patch that will let you accomplish this in Icehouse. This could be a start to this work. (cjones) ,- replace with + in the code
example : (-) (25)->line no - -> eventlet.monkey_patch()
                (+) (25) -> line no --> eventlet.monkey_patch(thread=False)

Thanks for your advice. Could you give me some detailed info about your patch? (trump)

Adding a starter patch. More work will of course need to be done to flick the bits for port/ip on the command line. The patch below is the hard bit (cjones)

diff --git a/bin/cinder-volume b/bin/cinder-volume
index c8c0c84..88ab0f2 100755
--- a/bin/cinder-volume
+++ b/bin/cinder-volume
@@ -25,7 +25,7 @@ if os.name == 'nt':
     # on Windows when using pipes due to missing non-blocking IO support.
     eventlet.monkey_patch(os=False)
 else:
- eventlet.monkey_patch()
+ eventlet.monkey_patch(thread=False)

 import sys

diff --git a/cinder/openstack/common/service.py b/cinder/openstack/common/service.py
index 7632625..b952750 100644
--- a/cinder/openstack/common/service.py
+++ b/cinder/openstack/common/service.py
@@ -314,6 +314,9 @@ class ProcessLauncher(object):

         pid = os.fork()
         if pid == 0:
+ import pydevd
+ pydevd.settrace('10.10.0.1', port=5678, stdoutToServer=True,
+ stderrToServer=True)
             launcher = self._child_process(wrap.service)
             while True:
                 self._child_process_handle_signal()
@@ -481,7 +484,8 @@ class Services(object):

         """
         service.start()
- done.wait()
+ while not done.wait(1):
+ eventlet.greenthread.sleep(0)

 def launch(service, workers=None):

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.