aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir@xensource.com>2007-10-02 10:01:10 +0100
committerKeir Fraser <keir@xensource.com>2007-10-02 10:01:10 +0100
commit01025319d169d8e08c947875a0a3e88064ea1762 (patch)
treea03016791737e7e3ef432cf6951e100055800fd2 /tools
parentc3aaa708a8a29bc999ba53c4975b6d7d198830ac (diff)
downloadxen-01025319d169d8e08c947875a0a3e88064ea1762.tar.gz
xen-01025319d169d8e08c947875a0a3e88064ea1762.tar.bz2
xen-01025319d169d8e08c947875a0a3e88064ea1762.zip
xend: Fix name/uuid uniqueness checks.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 6de4b2ff54..d341176899 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -74,9 +74,15 @@ def create(config):
@return: An up and running XendDomainInfo instance
@raise VmError: Invalid configuration or failure to start.
"""
-
+ from xen.xend import XendDomain
+ domconfig = XendConfig.XendConfig(sxp_obj = config)
+ othervm = XendDomain.instance().domain_lookup_nr(domconfig["name_label"])
+ if othervm is None or othervm.domid is None:
+ othervm = XendDomain.instance().domain_lookup_nr(domconfig["uuid"])
+ if othervm is not None and othervm.domid is not None:
+ raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid))
log.debug("XendDomainInfo.create(%s)", scrub_password(config))
- vm = XendDomainInfo(XendConfig.XendConfig(sxp_obj = config))
+ vm = XendDomainInfo(domconfig)
try:
vm.start()
except: