From 7c89fa8aeaefd9e06511da62aa94365529a53b97 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 17 Jul 2018 21:37:27 -0400 Subject: [PATCH] Change where the memalloc increase is --- pvcd/NodeInstance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvcd/NodeInstance.py b/pvcd/NodeInstance.py index 8d213d55..de3ef0b4 100644 --- a/pvcd/NodeInstance.py +++ b/pvcd/NodeInstance.py @@ -227,8 +227,11 @@ class NodeInstance(): self.daemon_state = 'run' # Toggle state management of dead VMs to restart them + memalloc = 0 for domain, instance in self.s_domain.items(): if instance.inshutdown == False and domain in self.domain_list: + # Add the allocated memory to our memalloc value + memalloc += instance.maxMemory() if instance.getstate() == 'start' and instance.gethypervisor() == self.name: if instance.getdom() != None: try: @@ -239,12 +242,9 @@ class NodeInstance(): zkhandler.writedata(self.zk_conn, { '/domains/{}/state'.format(domain): instance.getstate() }) # Ensure that any running VMs are readded to the domain_list - memalloc = 0 running_domains = lv_conn.listAllDomains(libvirt.VIR_CONNECT_LIST_DOMAINS_ACTIVE) for domain in running_domains: domain_uuid = domain.UUIDString() - # Add the allocated memory to our memalloc value - memalloc += instance.maxMemory() if domain_uuid not in self.domain_list: self.domain_list.append(domain_uuid)