From 2c988430dbc8f13719d1bed3eaa92a416601ccf7 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 17 Jul 2018 21:40:30 -0400 Subject: [PATCH] Add maxmemory to the data for each VMInstance object --- pvcd/NodeInstance.py | 2 +- pvcd/VMInstance.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pvcd/NodeInstance.py b/pvcd/NodeInstance.py index de3ef0b4..ce4a30c8 100644 --- a/pvcd/NodeInstance.py +++ b/pvcd/NodeInstance.py @@ -231,7 +231,7 @@ class NodeInstance(): 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() + memalloc += instance.getmaxmemory() if instance.getstate() == 'start' and instance.gethypervisor() == self.name: if instance.getdom() != None: try: diff --git a/pvcd/VMInstance.py b/pvcd/VMInstance.py index ae5dc9f6..9f593a0e 100644 --- a/pvcd/VMInstance.py +++ b/pvcd/VMInstance.py @@ -44,6 +44,7 @@ class VMInstance: self.instop = False self.dom = self.lookupByUUID(self.domuuid) + self.maxmemory = self.dom.maxMemory() # Watch for changes to the state field in Zookeeper @zk_conn.DataWatch('/domains/{}/state'.format(self.domuuid)) @@ -65,6 +66,9 @@ class VMInstance: def getdom(self): return self.dom + def getmaxmemory(self): + return self.maxmemory + # Manage local node domain_list def addDomainToList(self): if not self.domuuid in self.thishypervisor.domain_list: