xen/xend_multiple_create.patch

27 lines
1.0 KiB
Diff

Bugzilla #245253
Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
@@ -32,6 +32,7 @@ import threading
import xen.lowlevel.xc
+from xen.xend import sxp
from xen.xend import XendRoot, XendCheckpoint, XendDomainInfo
from xen.xend.PrettyPrint import prettyprint
from xen.xend.XendConfig import XendConfig
@@ -860,6 +861,11 @@ class XendDomain:
self.domains_lock.acquire()
try:
self._refresh()
+ for domid, dom in self.domains.items():
+ if (dom.state != DOM_STATE_HALTED and
+ (dom.getName() == sxp.child_value(config, 'name') or
+ dom.get_uuid() == sxp.child_value(config, 'uuid'))):
+ raise XendError("Domain is already running")
dominfo = XendDomainInfo.create(config)
self._add_domain(dominfo)