Merge "Update exceptions to pass correct kwargs."
This commit is contained in:
commit
ee710e7fc5
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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):
|
||||
|
@ -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'])
|
||||
|
Loading…
Reference in New Issue
Block a user