summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-04-26 04:26:14 +0000
committerTarmac <>2011-04-26 04:26:14 +0000
commit5ea80e2f62e7a35967fc509aef8e7158577a2980 (patch)
tree0916e260d30612ef6187aa7daa3bbc6bf8db2cc9 /nova/virt
parent08cf0db667b68a6351662b2c550af93624e66d4d (diff)
parentc2ec2054a6b42b086580c6647ae0d5d808b4d2c7 (diff)
Refactoring the usage of nova.exception.Duplicate
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/hyperv.py3
-rw-r--r--nova/virt/vmwareapi/vmops.py3
-rw-r--r--nova/virt/xenapi/vm_utils.py3
-rw-r--r--nova/virt/xenapi/vmops.py3
4 files changed, 4 insertions, 8 deletions
diff --git a/nova/virt/hyperv.py b/nova/virt/hyperv.py
index 13f403a66..85d5190fb 100644
--- a/nova/virt/hyperv.py
+++ b/nova/virt/hyperv.py
@@ -143,8 +143,7 @@ class HyperVConnection(driver.ComputeDriver):
""" Create a new VM and start it."""
vm = self._lookup(instance.name)
if vm is not None:
- raise exception.Duplicate(_('Attempt to create duplicate vm %s') %
- instance.name)
+ raise exception.InstanceExists(name=instance.name)
user = manager.AuthManager().get_user(instance['user_id'])
project = manager.AuthManager().get_project(instance['project_id'])
diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py
index b700c438f..d77f9f8cb 100644
--- a/nova/virt/vmwareapi/vmops.py
+++ b/nova/virt/vmwareapi/vmops.py
@@ -100,8 +100,7 @@ class VMWareVMOps(object):
"""
vm_ref = self._get_vm_ref_from_the_name(instance.name)
if vm_ref:
- raise exception.Duplicate(_("Attempted to create a VM with a name"
- " %s, but that already exists on the host") % instance.name)
+ raise exception.InstanceExists(name=instance.name)
client_factory = self._session._get_vim().client.factory
service_content = self._session._get_vim().get_service_content()
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 1927500ad..b5835da7c 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -643,8 +643,7 @@ class VMHelper(HelperBase):
if n == 0:
return None
elif n > 1:
- raise exception.Duplicate(_('duplicate name found: %s') %
- name_label)
+ raise exception.InstanceExists(name=name_label)
else:
return vm_refs[0]
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 8b6a35f74..f11f8ce40 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -127,8 +127,7 @@ class VMOps(object):
instance_name = instance.name
vm_ref = VMHelper.lookup(self._session, instance_name)
if vm_ref is not None:
- raise exception.Duplicate(_('Attempted to create'
- ' non-unique name %s') % instance_name)
+ raise exception.InstanceExists(name=instance_name)
#ensure enough free memory is available
if not VMHelper.ensure_free_mem(self._session, instance):