LGTM
On Friday, April 8, 2016 at 4:17:55 PM UTC+1, Brian Foley wrote: > > This produces debug messages like: > DEBUG Request from 10.0.0.1:52912 <ganeti.http.client.HttpClientRequest > 10.0.0.42:1811 POST /jobqueue_update at 0x7fc6797ca1d0> finished, > errmsg=None > > This is useful for debugging noded communication issues, as the noded > logs contain the source IP address, and this avoids the need to do fuzzy > matches on timestamps in the different logs. > > Signed-off-by: Brian Foley <[email protected]> > --- > lib/http/client.py | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/lib/http/client.py b/lib/http/client.py > index 722bd33..86a9db8 100644 > --- a/lib/http/client.py > +++ b/lib/http/client.py > @@ -225,7 +225,15 @@ class _PendingRequest(object): > > assert req.success is None, "Request has already been finalized" > > - logging.debug("Request %s finished, errmsg=%s", req, errmsg) > + try: > + # LOCAL_* options added in pycurl 7.21.5 > + from_str = "from %s:%s " % ( > + curl.getinfo(pycurl.LOCAL_IP), > + curl.getinfo(pycurl.LOCAL_PORT) > + ) > + except AttributeError: > + from_str = "" > + logging.debug("Request %s%s finished, errmsg=%s", from_str, req, > errmsg) > > req.success = not bool(errmsg) > req.error = errmsg > -- > 2.1.4 > >
