From cede470913db51a4a086b472db6bcd017fd8e247 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 7 Mar 2012 04:25:19 +0000 Subject: Don't use _ for variable name _ is reserved for gettext use and using _ for variable names can result in runtime failures when trying to lookup string translations Change-Id: I8835142fd19ba5f395ddef959c38167f4144b813 --- nova/virt/fake.py | 2 +- nova/virt/vmwareapi_conn.py | 2 +- nova/virt/xenapi/fake.py | 2 +- nova/virt/xenapi/pool.py | 2 +- nova/virt/xenapi_conn.py | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/fake.py b/nova/virt/fake.py index aacffb62c..6be69bd4d 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -36,7 +36,7 @@ from nova.virt import driver LOG = logging.getLogger(__name__) -def get_connection(_=None): +def get_connection(_read_only): # The read_only parameter is ignored. return FakeConnection.instance() diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 93cf9b6d2..8259974a3 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -95,7 +95,7 @@ class Failure(Exception): return str(self.details) -def get_connection(_): +def get_connection(_read_only): """Sets up the ESX host connection.""" host_ip = FLAGS.vmwareapi_host_ip host_username = FLAGS.vmwareapi_host_username diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 5813133d8..97ca29184 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -704,7 +704,7 @@ class SessionBase(object): def _destroy(self, name, params): self._check_session(params) self._check_arg_count(params, 2) - table, _ = name.split('.') + table = name.split('.')[0] ref = params[1] if ref not in _db_content[table]: raise Failure(['HANDLE_INVALID', table, ref]) diff --git a/nova/virt/xenapi/pool.py b/nova/virt/xenapi/pool.py index 5661fa01a..7448ae357 100644 --- a/nova/virt/xenapi/pool.py +++ b/nova/virt/xenapi/pool.py @@ -212,5 +212,5 @@ def forward_request(context, request_type, master, aggregate_id, def swap_xapi_host(url, host_addr): """Replace the XenServer address present in 'url' with 'host_addr'.""" temp_url = urlparse.urlparse(url) - _, sep, port = temp_url.netloc.partition(':') + _netloc, sep, port = temp_url.netloc.partition(':') return url.replace(temp_url.netloc, '%s%s%s' % (host_addr, sep, port)) diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index ececea2ee..05e77ef0d 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -153,7 +153,7 @@ FLAGS = flags.FLAGS FLAGS.register_opts(xenapi_opts) -def get_connection(_): +def get_connection(_read_only): """Note that XenAPI doesn't have a read-only connection mode, so the read_only parameter is ignored.""" url = FLAGS.xenapi_connection_url @@ -536,7 +536,7 @@ class XenAPISession(object): return url def _populate_session_pool(self, url, user, pw, exception): - for _ in xrange(FLAGS.xenapi_connection_concurrent - 1): + for i in xrange(FLAGS.xenapi_connection_concurrent - 1): session = self._create_session(url) with timeout.Timeout(FLAGS.xenapi_login_timeout, exception): session.login_with_password(user, pw) -- cgit