dom0/core: do not relay on any max xid (#445)

What is really required is the maximum number of domains, not its IDs. Use max
QID as maximum number of domains.
This commit is contained in:
Marek Marczykowski 2012-04-28 02:17:04 +02:00
parent c0f1d3c53b
commit db6eb497a6

View File

@ -59,7 +59,6 @@ qubes_servicevms_dir = qubes_base_dir + "/servicevms"
qubes_store_filename = qubes_base_dir + "/qubes.xml"
qubes_kernels_base_dir = qubes_base_dir + "/vm-kernels"
qubes_max_xid = 1024
qubes_max_qid = 254
qubes_max_netid = 254
vm_default_netmask = "255.255.255.0"
@ -134,7 +133,7 @@ class QubesHost(object):
if previous is None:
previous_time = time.time()
previous = {}
info = xc.domain_getinfo(0, qubes_max_xid)
info = xc.domain_getinfo(0, qubes_max_qid)
for vm in info:
previous[vm['domid']] = {}
previous[vm['domid']]['cpu_time'] = vm['cpu_time']/vm['online_vcpus']
@ -143,7 +142,7 @@ class QubesHost(object):
current_time = time.time()
current = {}
info = xc.domain_getinfo(0, qubes_max_xid)
info = xc.domain_getinfo(0, qubes_max_qid)
for vm in info:
current[vm['domid']] = {}
current[vm['domid']]['cpu_time'] = vm['cpu_time']/max(vm['online_vcpus'],1)
@ -545,7 +544,7 @@ class QubesVm(object):
if start_xid < 0:
start_xid = 0
try:
domains = xc.domain_getinfo(start_xid, qubes_max_xid-start_xid)
domains = xc.domain_getinfo(start_xid, qubes_max_qid)
except xen.lowlevel.xc.Error:
return None