diff options
-rw-r--r-- | nova/api/ec2/cloud.py | 4 | ||||
-rw-r--r-- | nova/api/metadata/password.py | 1 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/attach_interfaces.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/extended_ips.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/fixed_ips.py | 3 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/flavorextraspecs.py | 2 | ||||
-rw-r--r-- | nova/api/openstack/compute/contrib/services.py | 3 | ||||
-rw-r--r-- | nova/api/openstack/compute/servers.py | 8 | ||||
-rw-r--r-- | nova/cmd/manage.py | 15 | ||||
-rwxr-xr-x | nova/compute/manager.py | 2 | ||||
-rw-r--r-- | nova/conductor/api.py | 2 | ||||
-rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/186_new_bdm_format.py | 3 | ||||
-rw-r--r-- | nova/db/sqlalchemy/utils.py | 2 | ||||
-rw-r--r-- | nova/image/s3.py | 5 | ||||
-rw-r--r-- | nova/network/model.py | 2 | ||||
-rw-r--r-- | nova/network/quantumv2/api.py | 2 | ||||
-rw-r--r-- | nova/scheduler/filters/trusted_filter.py | 2 | ||||
-rw-r--r-- | nova/service.py | 2 | ||||
-rw-r--r-- | nova/vnc/xvp_proxy.py | 5 | ||||
-rw-r--r-- | smoketests/base.py | 2 | ||||
-rw-r--r-- | smoketests/public_network_smoketests.py | 2 | ||||
-rw-r--r-- | smoketests/test_sysadmin.py | 1 |
22 files changed, 28 insertions, 44 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 47575b201..e02f7b6f9 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -802,7 +802,6 @@ class CloudController(object): 'detaching': 'in-use'} instance_ec2_id = None - instance_data = None if volume.get('instance_uuid', None): instance_uuid = volume['instance_uuid'] @@ -810,8 +809,7 @@ class CloudController(object): instance_uuid) instance_ec2_id = ec2utils.id_to_ec2_inst_id(instance_uuid) - instance_data = '%s[%s]' % (instance_ec2_id, - instance['host']) + v = {} v['volumeId'] = ec2utils.id_to_ec2_vol_id(volume['id']) v['status'] = valid_ec2_api_volume_status_map.get(volume['status'], diff --git a/nova/api/metadata/password.py b/nova/api/metadata/password.py index f3453e945..50f6c94ac 100644 --- a/nova/api/metadata/password.py +++ b/nova/api/metadata/password.py @@ -49,7 +49,6 @@ def convert_password(context, password): def handle_password(req, meta_data): ctxt = context.get_admin_context() - password = meta_data.password if req.method == 'GET': return meta_data.password elif req.method == 'POST': diff --git a/nova/api/openstack/compute/contrib/attach_interfaces.py b/nova/api/openstack/compute/contrib/attach_interfaces.py index ec565a0d1..a823eed2b 100644 --- a/nova/api/openstack/compute/contrib/attach_interfaces.py +++ b/nova/api/openstack/compute/contrib/attach_interfaces.py @@ -60,7 +60,7 @@ class InterfaceAttachmentController(object): port_id = id try: - instance = self.compute_api.get(context, server_id) + self.compute_api.get(context, server_id) except exception.NotFound: raise exc.HTTPNotFound() diff --git a/nova/api/openstack/compute/contrib/extended_ips.py b/nova/api/openstack/compute/contrib/extended_ips.py index ac75293a6..20356c08d 100644 --- a/nova/api/openstack/compute/contrib/extended_ips.py +++ b/nova/api/openstack/compute/contrib/extended_ips.py @@ -94,7 +94,7 @@ def make_server(elem): class ExtendedIpsServerTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('server', selector='server') - elem = xmlutil.SubTemplateElement(root, 'server', selector='servers') + xmlutil.SubTemplateElement(root, 'server', selector='servers') make_server(root) return xmlutil.SlaveTemplate(root, 1, nsmap={ Extended_ips.alias: Extended_ips.namespace}) diff --git a/nova/api/openstack/compute/contrib/fixed_ips.py b/nova/api/openstack/compute/contrib/fixed_ips.py index b474b685d..532282a2b 100644 --- a/nova/api/openstack/compute/contrib/fixed_ips.py +++ b/nova/api/openstack/compute/contrib/fixed_ips.py @@ -69,8 +69,7 @@ class FixedIPController(object): fixed_ip = db.fixed_ip_get_by_address(context, address) db.fixed_ip_update(context, fixed_ip['address'], {'reserved': reserved}) - except (exception.FixedIpNotFoundForAddress, - exception.FixedIpInvalid) as ex: + except (exception.FixedIpNotFoundForAddress, exception.FixedIpInvalid): msg = _("Fixed IP %s not found") % address raise webob.exc.HTTPNotFound(explanation=msg) diff --git a/nova/api/openstack/compute/contrib/flavorextraspecs.py b/nova/api/openstack/compute/contrib/flavorextraspecs.py index 6e33d3603..00e7d7233 100644 --- a/nova/api/openstack/compute/contrib/flavorextraspecs.py +++ b/nova/api/openstack/compute/contrib/flavorextraspecs.py @@ -104,7 +104,7 @@ class FlavorExtraSpecsController(object): extra_spec = db.instance_type_extra_specs_get_item(context, flavor_id, id) return extra_spec - except exception.InstanceTypeExtraSpecsNotFound as e: + except exception.InstanceTypeExtraSpecsNotFound: raise exc.HTTPNotFound() def delete(self, req, flavor_id, id): diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py index 3a637010a..76eec7ce4 100644 --- a/nova/api/openstack/compute/contrib/services.py +++ b/nova/api/openstack/compute/contrib/services.py @@ -183,8 +183,7 @@ class ServiceController(object): raise webob.exc.HTTPUnprocessableEntity(detail=msg) try: - svc = self.host_api.service_update(context, host, binary, - status_detail) + self.host_api.service_update(context, host, binary, status_detail) except exception.ServiceNotFound: raise webob.exc.HTTPNotFound(_("Unknown service")) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index de7a51812..b9e18b501 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -552,10 +552,10 @@ class Controller(wsgi.Controller): search_opts=search_opts, limit=limit, marker=marker) - except exception.MarkerNotFound as e: + except exception.MarkerNotFound: msg = _('marker [%s] not found') % marker raise exc.HTTPBadRequest(explanation=msg) - except exception.FlavorNotFound as e: + except exception.FlavorNotFound: log_msg = _("Flavor '%s' could not be found ") LOG.debug(log_msg, search_opts['flavor']) instance_list = [] @@ -1093,11 +1093,11 @@ class Controller(wsgi.Controller): except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state(state_error, 'resize') - except exception.ImageNotAuthorized as image_error: + except exception.ImageNotAuthorized: msg = _("You are not authorized to access the image " "the instance was started with.") raise exc.HTTPUnauthorized(explanation=msg) - except exception.ImageNotFound as image_error: + except exception.ImageNotFound: msg = _("Image that the instance was started " "with could not be found.") raise exc.HTTPBadRequest(explanation=msg) diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 46e6d371f..df54e8677 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -72,7 +72,6 @@ from nova.openstack.common.db import exception as db_exc from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import rpc -from nova.openstack.common import timeutils from nova import quota from nova import servicegroup from nova import version @@ -655,7 +654,6 @@ class ServiceCommands(object): """ servicegroup_api = servicegroup.API() ctxt = context.get_admin_context() - now = timeutils.utcnow() services = db.service_get_all(ctxt) services = availability_zones.set_availability_zones(ctxt, services) if host: @@ -1003,13 +1001,12 @@ class AgentBuildCommands(object): hypervisor='xen'): """Creates a new agent build.""" ctxt = context.get_admin_context() - agent_build = db.agent_build_create(ctxt, - {'hypervisor': hypervisor, - 'os': os, - 'architecture': architecture, - 'version': version, - 'url': url, - 'md5hash': md5hash}) + db.agent_build_create(ctxt, {'hypervisor': hypervisor, + 'os': os, + 'architecture': architecture, + 'version': version, + 'url': url, + 'md5hash': md5hash}) def delete(self, os, architecture, hypervisor='xen'): """Deletes an existing agent build.""" diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 15d1d7d28..1def5b069 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -495,7 +495,7 @@ class ComputeManager(manager.SchedulerDependentManager): 'assuming it\'s not on shared storage'), instance=instance) shared_storage = False - except Exception as e: + except Exception: LOG.exception(_('Failed to check if instance shared'), instance=instance) finally: diff --git a/nova/conductor/api.py b/nova/conductor/api.py index 150c9a41d..3f955d24f 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -395,7 +395,7 @@ class API(LocalAPI): self.base_rpcapi.ping(context, '1.21 GigaWatts', timeout=timeout) break - except rpc_common.Timeout as e: + except rpc_common.Timeout: LOG.warning(_('Timed out waiting for nova-conductor. ' 'Is it running? Or did this service start ' 'before nova-conductor?')) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/186_new_bdm_format.py b/nova/db/sqlalchemy/migrate_repo/versions/186_new_bdm_format.py index 88462a2c8..e8b9a1570 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/186_new_bdm_format.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/186_new_bdm_format.py @@ -111,9 +111,6 @@ def _upgrade_bdm_v2(meta, bdm_table, bdm_shadow_table): _bdm_rows_v1 = ('id', 'device_name', 'virtual_name', 'snapshot_id', 'volume_id', 'instance_uuid') - _bdm_rows_v2 = ('id', 'source_type', 'destination_type', 'guest_format', - 'device_type', 'disk_bus', 'boot_index', 'image_id') - _instance_cols = ('uuid', 'image_ref', 'root_device_name') def _get_columns(table, names): diff --git a/nova/db/sqlalchemy/utils.py b/nova/db/sqlalchemy/utils.py index 67acad2b7..6c0a53846 100644 --- a/nova/db/sqlalchemy/utils.py +++ b/nova/db/sqlalchemy/utils.py @@ -73,7 +73,7 @@ def visit_insert_from_select(element, compiler, **kw): def _get_not_supported_column(col_name_col_instance, column_name): try: column = col_name_col_instance[column_name] - except Exception as e: + except Exception: msg = _("Please specify column %s in col_name_col_instance " "param. It is required because column has unsupported " "type by sqlite).") diff --git a/nova/image/s3.py b/nova/image/s3.py index 42cb97170..a1ae55b4e 100644 --- a/nova/image/s3.py +++ b/nova/image/s3.py @@ -198,13 +198,11 @@ class S3ImageService(object): def _s3_parse_manifest(self, context, metadata, manifest): manifest = etree.fromstring(manifest) image_format = 'ami' - image_type = 'machine' try: kernel_id = manifest.find('machine_configuration/kernel_id').text if kernel_id == 'true': image_format = 'aki' - image_type = 'kernel' kernel_id = None except Exception: kernel_id = None @@ -213,7 +211,6 @@ class S3ImageService(object): ramdisk_id = manifest.find('machine_configuration/ramdisk_id').text if ramdisk_id == 'true': image_format = 'ari' - image_type = 'ramdisk' ramdisk_id = None except Exception: ramdisk_id = None @@ -270,7 +267,7 @@ class S3ImageService(object): #TODO(bcwaldon): right now, this removes user-defined ids. # We need to re-enable this. - image_id = metadata.pop('id', None) + metadata.pop('id', None) image = self.service.create(context, metadata) diff --git a/nova/network/model.py b/nova/network/model.py index 240911ea9..4efa70ab6 100644 --- a/nova/network/model.py +++ b/nova/network/model.py @@ -72,7 +72,7 @@ class IP(Model): if self['address'] and not self['version']: try: self['version'] = netaddr.IPAddress(self['address']).version - except netaddr.AddrFormatError as e: + except netaddr.AddrFormatError: raise exception.InvalidIpAddressError(self['address']) def __eq__(self, other): diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py index 054611cd3..61995a344 100644 --- a/nova/network/quantumv2/api.py +++ b/nova/network/quantumv2/api.py @@ -325,7 +325,7 @@ class API(base.Base): for port in ports: try: quantumv2.get_client(context).delete_port(port['id']) - except Exception as ex: + except Exception: LOG.exception(_("Failed to delete quantum port %(portid)s ") % {'portid': port['id']}) diff --git a/nova/scheduler/filters/trusted_filter.py b/nova/scheduler/filters/trusted_filter.py index bb1962ebe..522a68096 100644 --- a/nova/scheduler/filters/trusted_filter.py +++ b/nova/scheduler/filters/trusted_filter.py @@ -153,7 +153,7 @@ class AttestationService(object): return httplib.OK, res return status_code, None - except (socket.error, IOError) as e: + except (socket.error, IOError): return IOError, None def _request(self, cmd, subcmd, hosts): diff --git a/nova/service.py b/nova/service.py index 0377ba44b..715040323 100644 --- a/nova/service.py +++ b/nova/service.py @@ -286,7 +286,7 @@ class Service(service.Service): """Perform basic config checks before starting processing.""" # Make sure the tempdir exists and is writable try: - with utils.tempdir() as tmpdir: + with utils.tempdir(): pass except Exception as e: LOG.error(_('Temporary directory is invalid: %s'), e) diff --git a/nova/vnc/xvp_proxy.py b/nova/vnc/xvp_proxy.py index 4331e5b40..920f24b7a 100644 --- a/nova/vnc/xvp_proxy.py +++ b/nova/vnc/xvp_proxy.py @@ -57,7 +57,7 @@ class XCPVNCProxy(object): while True: try: d = source.recv(32384) - except Exception as e: + except Exception: d = None # If recv fails, send a write shutdown the other direction @@ -68,7 +68,7 @@ class XCPVNCProxy(object): try: # sendall raises an exception on write error, unlike send dest.sendall(d) - except Exception as e: + except Exception: source.close() dest.close() break @@ -102,7 +102,6 @@ class XCPVNCProxy(object): client = req.environ['eventlet.input'].get_socket() client.sendall("HTTP/1.1 200 OK\r\n\r\n") - socketsserver = None sockets['client'] = client sockets['server'] = server diff --git a/smoketests/base.py b/smoketests/base.py index 1ecb5a92e..c3b2be131 100644 --- a/smoketests/base.py +++ b/smoketests/base.py @@ -98,7 +98,7 @@ class SmokeTestCase(unittest.TestCase): try: conn = self.connect_ssh(ip, key_name) conn.close() - except Exception as e: + except Exception: time.sleep(wait) else: return True diff --git a/smoketests/public_network_smoketests.py b/smoketests/public_network_smoketests.py index f20b0923e..9b68a8fc7 100644 --- a/smoketests/public_network_smoketests.py +++ b/smoketests/public_network_smoketests.py @@ -96,7 +96,7 @@ class InstanceTestsFromPublic(base.UserSmokeTestCase): conn = self.connect_ssh( self.data['ip_v6'], TEST_KEY) conn.close() - except Exception as ex: + except Exception: time.sleep(1) else: break diff --git a/smoketests/test_sysadmin.py b/smoketests/test_sysadmin.py index b05f0ac4b..d45a75b74 100644 --- a/smoketests/test_sysadmin.py +++ b/smoketests/test_sysadmin.py @@ -161,7 +161,6 @@ class InstanceTests(base.UserSmokeTestCase): self.data['instance'] = reservation.instances[0] def test_003_instance_runs_within_60_seconds(self): - instance = self.data['instance'] # allow 60 seconds to exit pending with IP if not self.wait_for_running(self.data['instance']): self.fail('instance failed to start') |