diff options
author | Dan Prince <dprince@redhat.com> | 2012-12-18 09:55:46 -0500 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2012-12-18 14:27:16 -0500 |
commit | 65d9f80b5bfe9e94323f31f2d109670798774466 (patch) | |
tree | 7b465b3ff368231e2682f3aff8d1309ee283b172 /nova | |
parent | 2e80b297865e9c7b4251f97a95adaa6f4d0d4643 (diff) | |
download | nova-65d9f80b5bfe9e94323f31f2d109670798774466.tar.gz |
Update exceptions to pass correct kwargs.
Updates a variety of Nova exceptions so that they pass the correct
kwargs for proper exception message formatting. Previously
these exceptions would work but have incorrect error messages
because of how NovaException handled exception formatting errors.
Change-Id: I9601d3884a72d53a8ad742cf6610399968747cea
Diffstat (limited to 'nova')
-rw-r--r-- | nova/api/ec2/cloud.py | 4 | ||||
-rw-r--r-- | nova/compute/api.py | 5 | ||||
-rw-r--r-- | nova/crypto.py | 4 | ||||
-rw-r--r-- | nova/db/sqlalchemy/api.py | 7 | ||||
-rw-r--r-- | nova/network/manager.py | 2 | ||||
-rw-r--r-- | nova/virt/fake.py | 2 | ||||
-rw-r--r-- | nova/virt/libvirt/driver.py | 2 |
7 files changed, 14 insertions, 12 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 2ee8fa1572..1560428331 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -80,11 +80,11 @@ QUOTAS = quota.QUOTAS def validate_ec2_id(val): if not validator.validate_str()(val): - raise exception.InvalidInstanceIDMalformed(val) + raise exception.InvalidInstanceIDMalformed(val=val) try: ec2utils.ec2_id_to_id(val) except exception.InvalidEc2Id: - raise exception.InvalidInstanceIDMalformed(val) + raise exception.InvalidInstanceIDMalformed(val=val) # EC2 API can return the following values as documented in the EC2 API diff --git a/nova/compute/api.py b/nova/compute/api.py index cc02e4a82d..757f78f2d4 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1496,7 +1496,8 @@ class API(base.Base): raise exception.InstanceInvalidState( attr='task_state', instance_uuid=instance['uuid'], - state=instance['task_state']) + state=instance['task_state'], + method='reboot') state = {'SOFT': task_states.REBOOTING, 'HARD': task_states.REBOOTING_HARD}[reboot_type] instance = self.update(context, instance, vm_state=vm_states.ACTIVE, @@ -1942,7 +1943,7 @@ class API(base.Base): def get_vnc_console(self, context, instance, console_type): """Get a url to an instance Console.""" if not instance['host']: - raise exception.InstanceNotReady(instance=instance) + raise exception.InstanceNotReady(instance_id=instance['uuid']) connect_info = self.compute_rpcapi.get_vnc_console(context, instance=instance, console_type=console_type) diff --git a/nova/crypto.py b/nova/crypto.py index 73af2f25a4..2ba2c3582a 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -99,7 +99,7 @@ def fetch_ca(project_id=None): project_id = None ca_file_path = ca_path(project_id) if not os.path.exists(ca_file_path): - raise exception.CryptoCAFileNotFound(project_id=project_id) + raise exception.CryptoCAFileNotFound(project=project_id) with open(ca_file_path, 'r') as cafile: return cafile.read() @@ -161,7 +161,7 @@ def fetch_crl(project_id): project_id = None crl_file_path = crl_path(project_id) if not os.path.exists(crl_file_path): - raise exception.CryptoCRLFileNotFound(project_id) + raise exception.CryptoCRLFileNotFound(project=project_id) with open(crl_file_path, 'r') as crlfile: return crlfile.read() diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index ec85ddcef6..1638283e14 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -997,9 +997,10 @@ def fixed_ip_associate(context, address, instance_uuid, network_id=None, # then this has concurrency issues if fixed_ip_ref is None: raise exception.FixedIpNotFoundForNetwork(address=address, - network_id=network_id) + network_uuid=network_id) if fixed_ip_ref.instance_uuid: - raise exception.FixedIpAlreadyInUse(address=address) + raise exception.FixedIpAlreadyInUse(address=address, + instance_uuid=instance_uuid) if not fixed_ip_ref.network_id: fixed_ip_ref.network_id = network_id @@ -1200,7 +1201,7 @@ def fixed_ip_get_by_network_host(context, network_id, host): first() if not result: - raise exception.FixedIpNotFoundForNetworkHost(network_id=network_id, + raise exception.FixedIpNotFoundForNetworkHost(network_uuid=network_id, host=host) return result diff --git a/nova/network/manager.py b/nova/network/manager.py index cea7f6dc30..f4063ad15f 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -1370,7 +1370,7 @@ class NetworkManager(manager.SchedulerDependentManager): self.deallocate_fixed_ip(context, address, host) return raise exception.FixedIpNotFoundForSpecificInstance( - instance_id=instance_id, ip=address) + instance_uuid=instance_id, ip=address) def _validate_instance_zone_for_dns_domain(self, context, instance): instance_zone = instance.get('availability_zone') diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 28d0fd95db..37d06bf0e9 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -124,7 +124,7 @@ class FakeDriver(driver.ComputeDriver): def snapshot(self, context, instance, name): if not instance['name'] in self.instances: - raise exception.InstanceNotRunning() + raise exception.InstanceNotRunning(instance_id=instance['uuid']) def reboot(self, instance, network_info, reboot_type, block_device_info=None): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 263fd5ca4d..2a0d76ab89 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -815,7 +815,7 @@ class LibvirtDriver(driver.ComputeDriver): try: virt_dom = self._lookup_by_name(instance['name']) except exception.InstanceNotFound: - raise exception.InstanceNotRunning() + raise exception.InstanceNotRunning(instance_id=instance['uuid']) (image_service, image_id) = glance.get_remote_image_service( context, instance['image_ref']) |