summaryrefslogtreecommitdiffstats
path: root/nova/openstack
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-01 17:09:59 +0000
committerGerrit Code Review <review@openstack.org>2013-05-01 17:09:59 +0000
commit08968d255df65a0a290dabcc5c8d63d5b7d2bca4 (patch)
tree4aa5832661d8fa1152defd6588e438b1556f88f9 /nova/openstack
parent92c974d987a561048e97f109db745944370cb0e7 (diff)
parent25c9322966f02317b16f5e85e3c16ee3f0a479ff (diff)
downloadnova-08968d255df65a0a290dabcc5c8d63d5b7d2bca4.tar.gz
nova-08968d255df65a0a290dabcc5c8d63d5b7d2bca4.tar.xz
nova-08968d255df65a0a290dabcc5c8d63d5b7d2bca4.zip
Merge "Sync small and safe changes from oslo"
Diffstat (limited to 'nova/openstack')
-rw-r--r--nova/openstack/common/context.py5
-rw-r--r--nova/openstack/common/lockutils.py2
-rw-r--r--nova/openstack/common/loopingcall.py4
-rw-r--r--nova/openstack/common/network_utils.py3
-rw-r--r--nova/openstack/common/notifier/api.py1
-rw-r--r--nova/openstack/common/plugin/pluginmanager.py2
-rw-r--r--nova/openstack/common/policy.py2
-rw-r--r--nova/openstack/common/processutils.py2
-rw-r--r--nova/openstack/common/rpc/__init__.py2
-rw-r--r--nova/openstack/common/rpc/common.py4
-rw-r--r--nova/openstack/common/rpc/impl_kombu.py8
-rw-r--r--nova/openstack/common/rpc/impl_qpid.py2
-rw-r--r--nova/openstack/common/rpc/impl_zmq.py2
13 files changed, 20 insertions, 19 deletions
diff --git a/nova/openstack/common/context.py b/nova/openstack/common/context.py
index e9cfd73cc..ba47700f8 100644
--- a/nova/openstack/common/context.py
+++ b/nova/openstack/common/context.py
@@ -23,11 +23,12 @@ context or provide additional information in their specific WSGI pipeline.
"""
import itertools
-import uuid
+
+from nova.openstack.common import uuidutils
def generate_request_id():
- return 'req-' + str(uuid.uuid4())
+ return 'req-%s' % uuidutils.generate_uuid()
class RequestContext(object):
diff --git a/nova/openstack/common/lockutils.py b/nova/openstack/common/lockutils.py
index e1af8bac7..672e7ad7d 100644
--- a/nova/openstack/common/lockutils.py
+++ b/nova/openstack/common/lockutils.py
@@ -82,7 +82,7 @@ class _InterProcessLock(object):
# to have a laughable 10 attempts "blocking" mechanism.
self.trylock()
return self
- except IOError, e:
+ except IOError as e:
if e.errno in (errno.EACCES, errno.EAGAIN):
# external locks synchronise things like iptables
# updates - give it some time to prevent busy spinning
diff --git a/nova/openstack/common/loopingcall.py b/nova/openstack/common/loopingcall.py
index f9ca53003..217c44325 100644
--- a/nova/openstack/common/loopingcall.py
+++ b/nova/openstack/common/loopingcall.py
@@ -84,7 +84,7 @@ class FixedIntervalLoopingCall(LoopingCallBase):
LOG.warn(_('task run outlasted interval by %s sec') %
-delay)
greenthread.sleep(delay if delay > 0 else 0)
- except LoopingCallDone, e:
+ except LoopingCallDone as e:
self.stop()
done.send(e.retvalue)
except Exception:
@@ -131,7 +131,7 @@ class DynamicLoopingCall(LoopingCallBase):
LOG.debug(_('Dynamic looping call sleeping for %.02f '
'seconds'), idle)
greenthread.sleep(idle)
- except LoopingCallDone, e:
+ except LoopingCallDone as e:
self.stop()
done.send(e.retvalue)
except Exception:
diff --git a/nova/openstack/common/network_utils.py b/nova/openstack/common/network_utils.py
index 5224e01aa..86c8c9646 100644
--- a/nova/openstack/common/network_utils.py
+++ b/nova/openstack/common/network_utils.py
@@ -19,7 +19,8 @@
Network-related utilities and helper functions.
"""
-import logging
+from nova.openstack.common import log as logging
+
LOG = logging.getLogger(__name__)
diff --git a/nova/openstack/common/notifier/api.py b/nova/openstack/common/notifier/api.py
index 54da07b7e..5b1dc9944 100644
--- a/nova/openstack/common/notifier/api.py
+++ b/nova/openstack/common/notifier/api.py
@@ -30,7 +30,6 @@ LOG = logging.getLogger(__name__)
notifier_opts = [
cfg.MultiStrOpt('notification_driver',
default=[],
- deprecated_name='list_notifier_drivers',
help='Driver or drivers to handle sending notifications'),
cfg.StrOpt('default_notification_level',
default='INFO',
diff --git a/nova/openstack/common/plugin/pluginmanager.py b/nova/openstack/common/plugin/pluginmanager.py
index 4730ea1cd..e651546fe 100644
--- a/nova/openstack/common/plugin/pluginmanager.py
+++ b/nova/openstack/common/plugin/pluginmanager.py
@@ -62,7 +62,7 @@ class PluginManager(object):
pluginclass = entrypoint.load()
plugin = pluginclass(self._service_name)
self.plugins.append(plugin)
- except Exception, exc:
+ except Exception as exc:
LOG.error(_("Failed to load plugin %(plug)s: %(exc)s") %
{'plug': entrypoint, 'exc': exc})
diff --git a/nova/openstack/common/policy.py b/nova/openstack/common/policy.py
index 028a970fe..c15c0d5fe 100644
--- a/nova/openstack/common/policy.py
+++ b/nova/openstack/common/policy.py
@@ -57,7 +57,6 @@ as it allows particular rules to be explicitly disabled.
"""
import abc
-import logging
import re
import urllib
@@ -65,6 +64,7 @@ import urllib2
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
+from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/nova/openstack/common/processutils.py b/nova/openstack/common/processutils.py
index b2b75abf9..04e8c041a 100644
--- a/nova/openstack/common/processutils.py
+++ b/nova/openstack/common/processutils.py
@@ -19,7 +19,6 @@
System-level utilities and helper functions.
"""
-import logging
import random
import shlex
@@ -27,6 +26,7 @@ from eventlet.green import subprocess
from eventlet import greenthread
from nova.openstack.common.gettextutils import _
+from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/nova/openstack/common/rpc/__init__.py b/nova/openstack/common/rpc/__init__.py
index 991820b7c..c55ca7a97 100644
--- a/nova/openstack/common/rpc/__init__.py
+++ b/nova/openstack/common/rpc/__init__.py
@@ -26,13 +26,13 @@ For some wrappers that add message versioning to rpc, see:
"""
import inspect
-import logging
from oslo.config import cfg
from nova.openstack.common.gettextutils import _
from nova.openstack.common import importutils
from nova.openstack.common import local
+from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/nova/openstack/common/rpc/common.py b/nova/openstack/common/rpc/common.py
index 73e508e3e..3c8d56938 100644
--- a/nova/openstack/common/rpc/common.py
+++ b/nova/openstack/common/rpc/common.py
@@ -276,7 +276,7 @@ def _safe_log(log_func, msg, msg_data):
for elem in arg[:-1]:
d = d[elem]
d[arg[-1]] = '<SANITIZED>'
- except KeyError, e:
+ except KeyError as e:
LOG.info(_('Failed to sanitize %(item)s. Key error %(err)s'),
{'item': arg,
'err': e})
@@ -419,7 +419,7 @@ class ClientException(Exception):
def catch_client_exception(exceptions, func, *args, **kwargs):
try:
return func(*args, **kwargs)
- except Exception, e:
+ except Exception as e:
if type(e) in exceptions:
raise ClientException()
else:
diff --git a/nova/openstack/common/rpc/impl_kombu.py b/nova/openstack/common/rpc/impl_kombu.py
index 81afc2a8b..6bf0dfcc0 100644
--- a/nova/openstack/common/rpc/impl_kombu.py
+++ b/nova/openstack/common/rpc/impl_kombu.py
@@ -176,7 +176,7 @@ class ConsumerBase(object):
"""Cancel the consuming from the queue, if it has started"""
try:
self.queue.cancel(self.tag)
- except KeyError, e:
+ except KeyError as e:
# NOTE(comstud): Kludge to get around a amqplib bug
if str(e) != "u'%s'" % self.tag:
raise
@@ -520,7 +520,7 @@ class Connection(object):
return
except (IOError, self.connection_errors) as e:
pass
- except Exception, e:
+ except Exception as e:
# NOTE(comstud): Unfortunately it's possible for amqplib
# to return an error not covered by its transport
# connection_errors in the case of a timeout waiting for
@@ -561,10 +561,10 @@ class Connection(object):
while True:
try:
return method(*args, **kwargs)
- except (self.connection_errors, socket.timeout, IOError), e:
+ except (self.connection_errors, socket.timeout, IOError) as e:
if error_callback:
error_callback(e)
- except Exception, e:
+ except Exception as e:
# NOTE(comstud): Unfortunately it's possible for amqplib
# to return an error not covered by its transport
# connection_errors in the case of a timeout waiting for
diff --git a/nova/openstack/common/rpc/impl_qpid.py b/nova/openstack/common/rpc/impl_qpid.py
index 43f17cbc9..00f4d0e2a 100644
--- a/nova/openstack/common/rpc/impl_qpid.py
+++ b/nova/openstack/common/rpc/impl_qpid.py
@@ -346,7 +346,7 @@ class Connection(object):
try:
self.connection_create(broker)
self.connection.open()
- except qpid_exceptions.ConnectionError, e:
+ except qpid_exceptions.ConnectionError as e:
msg_dict = dict(e=e, delay=delay)
msg = _("Unable to connect to AMQP server: %(e)s. "
"Sleeping %(delay)s seconds") % msg_dict
diff --git a/nova/openstack/common/rpc/impl_zmq.py b/nova/openstack/common/rpc/impl_zmq.py
index 0b69ed8e4..a2c5fa36a 100644
--- a/nova/openstack/common/rpc/impl_zmq.py
+++ b/nova/openstack/common/rpc/impl_zmq.py
@@ -282,7 +282,7 @@ class InternalContext(object):
except greenlet.GreenletExit:
# ignore these since they are just from shutdowns
pass
- except rpc_common.ClientException, e:
+ except rpc_common.ClientException as e:
LOG.debug(_("Expected exception during message handling (%s)") %
e._exc_info[1])
return {'exc':