From 5c6c5216b329d42dcee1eed61c5345cbe76b87f3 Mon Sep 17 00:00:00 2001 From: Stanislaw Pitucha Date: Thu, 13 Jun 2013 17:08:49 +0000 Subject: Remove trivial cases of unused variables (3) Kill some of the variables marked as unused by flakes8. This should allow to enable F841 check in the future. Only trivial cases with no function calls and obviously pure functions (like datetime.now(), or len()) are cleaned up here. Part 3, split to reduce conflicts. Change-Id: I7b8e806ddd7b0e077243d4e31de140cd08fe0155 --- nova/virt/baremetal/pxe.py | 2 +- nova/virt/baremetal/tilera.py | 4 ++-- nova/virt/baremetal/tilera_pdu.py | 2 +- nova/virt/hyperv/vmutils.py | 2 +- nova/virt/libvirt/driver.py | 7 +++---- nova/virt/powervm/lpar.py | 2 +- nova/virt/powervm/operator.py | 4 ++-- 7 files changed, 11 insertions(+), 12 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/baremetal/pxe.py b/nova/virt/baremetal/pxe.py index f44a5f87a..21fc2ce47 100644 --- a/nova/virt/baremetal/pxe.py +++ b/nova/virt/baremetal/pxe.py @@ -213,7 +213,7 @@ def get_tftp_image_info(instance, instance_type): image_info['ramdisk'][0] = str(instance['ramdisk_id']) image_info['deploy_kernel'][0] = get_deploy_aki_id(instance_type) image_info['deploy_ramdisk'][0] = get_deploy_ari_id(instance_type) - except KeyError as e: + except KeyError: pass missing_labels = [] diff --git a/nova/virt/baremetal/tilera.py b/nova/virt/baremetal/tilera.py index bb89a5f94..36127bfa2 100755 --- a/nova/virt/baremetal/tilera.py +++ b/nova/virt/baremetal/tilera.py @@ -106,7 +106,7 @@ def get_tftp_image_info(instance): } try: image_info['kernel'][0] = str(instance['kernel_id']) - except KeyError as e: + except KeyError: pass missing_labels = [] @@ -347,7 +347,7 @@ class Tilera(base.NodeDriver): user_data = instance['user_data'] try: self._iptables_set(node_ip, user_data) - except Exception as ex: + except Exception: self.deactivate_bootloader(context, node, instance) raise exception.NovaException(_("Node is " "unknown error state.")) diff --git a/nova/virt/baremetal/tilera_pdu.py b/nova/virt/baremetal/tilera_pdu.py index 0e491168f..90f9287e4 100755 --- a/nova/virt/baremetal/tilera_pdu.py +++ b/nova/virt/baremetal/tilera_pdu.py @@ -109,7 +109,7 @@ class Pdu(base.PowerManager): return CONF.baremetal.tile_pdu_off else: try: - out = utils.execute(CONF.baremetal.tile_pdu_mgr, + utils.execute(CONF.baremetal.tile_pdu_mgr, CONF.baremetal.tile_pdu_ip, mode) time.sleep(CONF.baremetal.tile_power_wait) return mode diff --git a/nova/virt/hyperv/vmutils.py b/nova/virt/hyperv/vmutils.py index 680ec2d61..2cc40a1de 100644 --- a/nova/virt/hyperv/vmutils.py +++ b/nova/virt/hyperv/vmutils.py @@ -335,7 +335,7 @@ class VMUtils(object): def get_vm_storage_paths(self, vm_name): vm = self._lookup_vm_check(vm_name) - vs_man_svc = self._conn.Msvm_VirtualSystemManagementService()[0] + self._conn.Msvm_VirtualSystemManagementService() vmsettings = vm.associators( wmi_result_class='Msvm_VirtualSystemSettingData') rasds = vmsettings[0].associators( diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 4544d35fb..ca673579b 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -555,7 +555,7 @@ class LibvirtDriver(driver.ComputeDriver): event_thread.start() LOG.debug("Starting green dispatch thread") - dispatch_thread = eventlet.spawn(self._dispatch_thread) + eventlet.spawn(self._dispatch_thread) def init_host(self, host): if not self.has_min_version(MIN_LIBVIRT_VERSION): @@ -593,7 +593,7 @@ class LibvirtDriver(driver.ComputeDriver): libvirt.VIR_DOMAIN_EVENT_ID_LIFECYCLE, self._event_lifecycle_callback, self) - except Exception as e: + except Exception: LOG.warn(_("URI %s does not support events"), self.uri()) @@ -1116,7 +1116,7 @@ class LibvirtDriver(driver.ComputeDriver): if state == power_state.RUNNING: flags |= libvirt.VIR_DOMAIN_AFFECT_LIVE virt_dom.attachDeviceFlags(cfg.to_xml(), flags) - except libvirt.libvirtError as ex: + except libvirt.libvirtError: LOG.error(_('attaching network adapter failed.'), instance=instance) self.vif_driver.unplug(instance, (network, mapping)) @@ -3075,7 +3075,6 @@ class LibvirtDriver(driver.ComputeDriver): (disk_available_gb * 1024) - CONF.reserved_host_disk_mb # Compare CPU - src = instance['host'] source_cpu_info = src_compute_info['cpu_info'] self._compare_cpu(source_cpu_info) diff --git a/nova/virt/powervm/lpar.py b/nova/virt/powervm/lpar.py index 7be8b046a..a6c782692 100644 --- a/nova/virt/powervm/lpar.py +++ b/nova/virt/powervm/lpar.py @@ -51,7 +51,7 @@ def load_from_conf_data(conf_data): for (key, value) in attribs.items(): try: lpar[key] = value - except exception.PowerVMLPARAttributeNotFound as e: + except exception.PowerVMLPARAttributeNotFound: LOG.info(_('Encountered unknown LPAR attribute: %s\n' 'Continuing without storing') % key) return lpar diff --git a/nova/virt/powervm/operator.py b/nova/virt/powervm/operator.py index 18cba0ba2..fffb77fc9 100644 --- a/nova/virt/powervm/operator.py +++ b/nova/virt/powervm/operator.py @@ -766,11 +766,11 @@ class BaseOperator(object): def _decompress_image_file(self, file_path, outfile_path): command = "/usr/bin/gunzip -c %s > %s" % (file_path, outfile_path) - output = self.run_vios_command_as_root(command) + self.run_vios_command_as_root(command) # Remove compressed image file command = "/usr/bin/rm %s" % file_path - output = self.run_vios_command_as_root(command) + self.run_vios_command_as_root(command) return outfile_path -- cgit