summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-12-21 04:43:00 +0000
committerGerrit Code Review <review@openstack.org>2012-12-21 04:43:00 +0000
commitee710e7fc574f166a4f2f7a5b58d9670f6a7c7dc (patch)
tree9feb5dc93962cf4675032285b48a76de4ccd3831
parent1dc9d73cf0d79dc86064228ca4da23f00947b7e0 (diff)
parent65d9f80b5bfe9e94323f31f2d109670798774466 (diff)
downloadnova-ee710e7fc574f166a4f2f7a5b58d9670f6a7c7dc.tar.gz
nova-ee710e7fc574f166a4f2f7a5b58d9670f6a7c7dc.tar.xz
nova-ee710e7fc574f166a4f2f7a5b58d9670f6a7c7dc.zip
Merge "Update exceptions to pass correct kwargs."
-rw-r--r--nova/api/ec2/cloud.py4
-rw-r--r--nova/compute/api.py5
-rw-r--r--nova/crypto.py4
-rw-r--r--nova/db/sqlalchemy/api.py7
-rw-r--r--nova/network/manager.py2
-rw-r--r--nova/virt/fake.py2
-rw-r--r--nova/virt/libvirt/driver.py2
7 files changed, 14 insertions, 12 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 2ee8fa157..156042833 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 cc02e4a82..757f78f2d 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 41e8e9869..b7caa1c6e 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 ec85ddcef..1638283e1 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 1ba1370e0..97d4fa10d 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -1374,7 +1374,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 77f600e22..c9cd41680 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 85ff91218..dc1ab3936 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -821,7 +821,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'])