diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 4888a1dd..55ed8717 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -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):