Removed variables used not in the scope that they are declared

Co-Author: Pavel Kholkin <pkholkin@mirantis.com>

Change-Id: I577dfdf7f65a0c883ddbcfda62daf8c5f9c746c1
This commit is contained in:
Sergey Nikitin 2015-04-29 13:43:00 +03:00
parent e4e74150b2
commit d1af9cbe01
9 changed files with 6 additions and 12 deletions

View File

@ -257,7 +257,6 @@ def is_ec2_timestamp_expired(request, expires=None):
"""Checks the timestamp or expiry time included in an EC2 request
and returns true if the request is expired
"""
query_time = None
timestamp = request.get('Timestamp')
expiry_time = request.get('Expires')

View File

@ -77,7 +77,7 @@ def init_leases(network_id):
def add_action_parsers(subparsers):
parser = subparsers.add_parser('init')
subparsers.add_parser('init')
# NOTE(cfb): dnsmasq always passes mac, and ip. hostname
# is passed if known. We don't care about

View File

@ -2674,7 +2674,6 @@ class API(base.Base):
self._record_action_start(context, instance, instance_actions.SHELVE)
image_id = None
if not self.is_volume_backed_instance(context, instance):
name = '%s-shelved' % instance.display_name
image_meta = self._create_image(context, instance, name,

View File

@ -485,7 +485,7 @@ class UnsupportedDriverTestCase(BaseTestCase):
def test_disabled_instance_context_claim(self):
# instance context manager variation:
instance = self._fake_instance()
claim = self.tracker.instance_claim(self.context, instance)
self.tracker.instance_claim(self.context, instance)
with self.tracker.instance_claim(self.context, instance) as claim:
self.assertEqual(0, claim.memory_mb)

View File

@ -1950,7 +1950,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
utils.metadata_to_dict(inst['system_metadata']))
def test_instance_get_all_with_meta(self):
inst = self.create_instance_with_args()
self.create_instance_with_args()
for inst in db.instance_get_all(self.ctxt):
meta = utils.metadata_to_dict(inst['metadata'])
self.assertEqual(meta, self.sample_data['metadata'])
@ -2036,7 +2036,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
mock_undefer.assert_called_once_with('extra.pci_requests')
def test_instance_get_all_by_filters_with_meta(self):
inst = self.create_instance_with_args()
self.create_instance_with_args()
for inst in db.instance_get_all_by_filters(self.ctxt, {}):
meta = utils.metadata_to_dict(inst['metadata'])
self.assertEqual(meta, self.sample_data['metadata'])
@ -2044,7 +2044,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
self.assertEqual(sys_meta, self.sample_data['system_metadata'])
def test_instance_get_all_by_filters_without_meta(self):
inst = self.create_instance_with_args()
self.create_instance_with_args()
result = db.instance_get_all_by_filters(self.ctxt, {},
columns_to_join=[])
for inst in result:

View File

@ -520,7 +520,6 @@ class ImageCacheManager(imagecache.ImageCacheManager):
# Give other threads a chance to run
time.sleep(0)
instances = []
if img_id in self.used_images:
local, remote, instances = self.used_images[img_id]

View File

@ -398,7 +398,6 @@ class LibvirtISCSIVolumeDriver(LibvirtBaseVolumeDriver):
# multipath installed, discovering other targets if available
# multipath should be configured on the nova-compute node,
# in order to fit storage vendor
out = None
if self.use_multipath:
out = self._run_iscsiadm_discover(iscsi_properties)

View File

@ -541,8 +541,6 @@ class SessionBase(object):
def SR_introduce(self, _1, sr_uuid, label, desc, type, content_type,
shared, sm_config):
ref = None
rec = None
for ref, rec in _db_content['SR'].iteritems():
if rec.get('uuid') == sr_uuid:
# make forgotten = 0 and return ref

View File

@ -94,7 +94,7 @@ class XenAPIBridgeDriver(XenVIFDriver):
bridge_interface)
pifs = self._session.call_xenapi('PIF.get_all_records_where',
expr)
pif_ref = None
# Multiple PIF are ok: we are dealing with a pool
if len(pifs) == 0:
raise Exception(_('Found no PIF for device %s') %