From 84a545dc61090b0d747166c71fc4ccfe175032ac Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 20 Jul 2020 12:10:30 +0300 Subject: [PATCH] fix divide remainder error for memory resize etc --- vrtManager/connection.py | 4 ++-- vrtManager/instance.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vrtManager/connection.py b/vrtManager/connection.py index 3b79a71..4ac9f4f 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -841,7 +841,7 @@ class wvmConnect(object): def get_info(doc): mem = util.get_xpath(doc, "/domain/currentMemory") - mem = int(mem) / 1024 + mem = int(mem) // 1024 if raw_mem_size: mem = int(mem) * (1024 * 1024) cur_vcpu = util.get_xpath(doc, "/domain/vcpu/@current") @@ -875,7 +875,7 @@ class wvmConnect(object): def get_info(ctx): mem = util.get_xpath(ctx, "/domain/currentMemory") - mem = int(mem) / 1024 + mem = int(mem) // 1024 cur_vcpu = util.get_xpath(ctx, "/domain/vcpu/@current") if cur_vcpu: vcpu = cur_vcpu diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 46d4cc1..9ee2702 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -32,7 +32,7 @@ class wvmInstances(wvmConnect): def get_instance_memory(self, name): inst = self.get_instance(name) mem = util.get_xml_path(inst.XMLDesc(0), "/domain/currentMemory") - return int(mem) / 1024 + return int(mem) // 1024 def get_instance_vcpu(self, name): inst = self.get_instance(name) @@ -242,11 +242,11 @@ class wvmInstance(wvmConnect): def get_memory(self): mem = util.get_xml_path(self._XMLDesc(0), "/domain/memory") - return int(mem) / 1024 + return int(mem) // 1024 def get_cur_memory(self): mem = util.get_xml_path(self._XMLDesc(0), "/domain/currentMemory") - return int(mem) / 1024 + return int(mem) // 1024 def get_title(self): title = util.get_xml_path(self._XMLDesc(0), "/domain/title")