qmmemman: force static_memory_max to be as much as total RAM

Not including netvm, it causes some issues with it.
This commit is contained in:
Rafal Wojtczuk 2010-09-20 11:24:56 +02:00
parent c411519220
commit 885d747272

View File

@ -473,6 +473,13 @@ class QubesVm(object):
ret = host_metrics_record["memory_free"]
return long(ret)
def get_total_xen_memory(self):
hosts = xend_session.session.xenapi.host.get_all()
host_record = xend_session.session.xenapi.host.get_record(hosts[0])
host_metrics_record = xend_session.session.xenapi.host_metrics.get_record(host_record["metrics"])
ret = host_metrics_record["memory_total"]
return long(ret)
def start(self, debug_console = False, verbose = False):
if dry_run:
return
@ -487,6 +494,10 @@ class QubesVm(object):
if verbose:
print "--> Loading the VM (type = {0})...".format(self.type)
if not self.is_netvm():
total_mem_mb = self.get_total_xen_memory()/1024/1024
xend_session.xend_server.xend.domain.maxmem_set(self.name, total_mem_mb)
mem_required = self.get_mem_dynamic_max()
qmemman_client = QMemmanClient()
if not qmemman_client.request_memory(mem_required):