Don't complain about name non-uniqueness if one domain is dying. This happens

across a reboot regularly.  Inside _refresh, there is the occasion for new
domains to appear, if an existing domain reboots itself.  In this case, we
need to get the list of running domains from Xen again.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
Ewan Mellor committed 2006-11-08 12:56:45 +00:00
1 parent 063ac3b074
commit 0fb54203dd
2 files changed
+25 -21

No files matched your search

+24 -18
View File
@@ -357,27 +357,29 @@ class XendDomain:
either xenstore has changed or when a method requires
up to date information (like uptime, cputime stats).
Expects to be protected by the domains_lock.
@rtype: None
"""
self.domains_lock.acquire()
try:
# update information for all running domains
# - like cpu_time, status, dying, etc.
running = self._running_domains()
for dom in running:
domid = dom['domid']
if domid in self.domains:
self.domains[domid].update(dom)
# remove domains that are not running from active
# domain list
running_domids = [d['domid'] for d in running]
for domid, dom in self.domains.items():
if domid not in running_domids and domid != DOM0_ID:
self._remove_domain(dom, domid)
finally:
self.domains_lock.release()
# update information for all running domains
# - like cpu_time, status, dying, etc.
running = self._running_domains()
for dom in running:
domid = dom['domid']
if domid in self.domains:
self.domains[domid].update(dom)
# remove domains that are not running from active domain list.
# The list might have changed by now, because the update call may
# cause new domains to be added, if the domain has rebooted. We get
# the list again.
running = self._running_domains()
running_domids = [d['domid'] for d in running]
for domid, dom in self.domains.items():
if domid not in running_domids and domid != DOM0_ID:
self._remove_domain(dom, domid)
def _add_domain(self, info):
"""Add the given domain entry to this instance's internal cache.
@@ -1228,8 +1230,12 @@ class XendDomain:
elif cap < 0 or cap > dominfo.getVCpuCount() * 100:
raise XendError("cap is out of range")
assert type(weight) == int
assert type(cap) == int
return xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
except Exception, ex:
log.exception(ex)
raise XendError(str(ex))
def domain_maxmem_set(self, domid, mem):
+1 -3
View File
@@ -1353,8 +1353,6 @@ class XendDomainInfo:
except:
log.exception("Removing domain path failed.")
self.info['dying'] = 0
self.info['shutdown'] = 0
self._stateSet(DOM_STATE_HALTED)
finally:
self.refresh_shutdown_lock.release()
@@ -1626,7 +1624,7 @@ class XendDomainInfo:
raise VmError('Invalid VM Name')
dom = XendDomain.instance().domain_lookup_nr(name)
if dom and dom != self:
if dom and dom != self and not dom.info['dying']:
raise VmError("VM name '%s' already exists" % name)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.