diff -r 64b13fb57f27 stubdom/stubdom-dm --- a/stubdom/stubdom-dm Thu Oct 22 12:22:55 2009 +0100 +++ b/stubdom/stubdom-dm Thu Oct 22 14:46:20 2009 +0100 @@ -69,12 +69,8 @@ term() { kill %1 - ( - [ -n "$vncpid" ] && kill -9 $vncpid - rm /etc/xen/stubdoms/$domname-dm - xm destroy $domname-dm - ) & - # We need to exit immediately so as to let xend do the commands above + [ -n "$vncpid" ] && kill -9 $vncpid + rm /etc/xen/stubdoms/$domname-dm exit 0 } diff -r 64b13fb57f27 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Oct 22 12:22:55 2009 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Oct 22 14:46:20 2009 +0100 @@ -1736,6 +1736,14 @@ def getDomid(self): return self.domid + + def getStubdomDomid(self): + dom_list = xstransact.List('/local/domain') + for d in dom_list: + target = xstransact.Read('/local/domain/' + d + '/target') + if target is not None and int(target) is self.domid : + return int(d) + return None def setName(self, name, to_store = True): self._checkName(name) diff -r 64b13fb57f27 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu Oct 22 12:22:55 2009 +0100 +++ b/tools/python/xen/xend/image.py Thu Oct 22 14:46:21 2009 +0100 @@ -561,7 +561,11 @@ return self.sentinel_lock.acquire() try: - if self.pid: + stubdomid = self.vm.getStubdomDomid() + if stubdomid is not None : + from xen.xend import XendDomain + XendDomain.instance().domain_destroy(stubdomid) + elif self.pid: try: os.kill(self.pid, signal.SIGHUP) except OSError, exn: