ia64/xen-unstable

changeset 16042:a345f9897226

xend: Fix name/uuid uniqueness checks.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
author Keir Fraser <keir@xensource.com>
date Tue Oct 02 10:01:10 2007 +0100 (2007-10-02)
parents 93b7f47407bc
children 8c67b2038ff2
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 02 09:59:39 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 02 10:01:10 2007 +0100
     1.3 @@ -74,9 +74,15 @@ def create(config):
     1.4      @return: An up and running XendDomainInfo instance
     1.5      @raise VmError: Invalid configuration or failure to start.
     1.6      """
     1.7 -
     1.8 +    from xen.xend import XendDomain
     1.9 +    domconfig = XendConfig.XendConfig(sxp_obj = config)
    1.10 +    othervm = XendDomain.instance().domain_lookup_nr(domconfig["name_label"])
    1.11 +    if othervm is None or othervm.domid is None:
    1.12 +        othervm = XendDomain.instance().domain_lookup_nr(domconfig["uuid"])
    1.13 +    if othervm is not None and othervm.domid is not None:
    1.14 +        raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid))
    1.15      log.debug("XendDomainInfo.create(%s)", scrub_password(config))
    1.16 -    vm = XendDomainInfo(XendConfig.XendConfig(sxp_obj = config))
    1.17 +    vm = XendDomainInfo(domconfig)
    1.18      try:
    1.19          vm.start()
    1.20      except: