mirror of
https://github.com/retspen/webvirtcloud
synced 2024-10-31 19:44:16 +00:00
fix divide remainder error for memory resize etc
This commit is contained in:
parent
74028f35b8
commit
84a545dc61
2 changed files with 5 additions and 5 deletions
|
@ -841,7 +841,7 @@ class wvmConnect(object):
|
||||||
|
|
||||||
def get_info(doc):
|
def get_info(doc):
|
||||||
mem = util.get_xpath(doc, "/domain/currentMemory")
|
mem = util.get_xpath(doc, "/domain/currentMemory")
|
||||||
mem = int(mem) / 1024
|
mem = int(mem) // 1024
|
||||||
if raw_mem_size:
|
if raw_mem_size:
|
||||||
mem = int(mem) * (1024 * 1024)
|
mem = int(mem) * (1024 * 1024)
|
||||||
cur_vcpu = util.get_xpath(doc, "/domain/vcpu/@current")
|
cur_vcpu = util.get_xpath(doc, "/domain/vcpu/@current")
|
||||||
|
@ -875,7 +875,7 @@ class wvmConnect(object):
|
||||||
|
|
||||||
def get_info(ctx):
|
def get_info(ctx):
|
||||||
mem = util.get_xpath(ctx, "/domain/currentMemory")
|
mem = util.get_xpath(ctx, "/domain/currentMemory")
|
||||||
mem = int(mem) / 1024
|
mem = int(mem) // 1024
|
||||||
cur_vcpu = util.get_xpath(ctx, "/domain/vcpu/@current")
|
cur_vcpu = util.get_xpath(ctx, "/domain/vcpu/@current")
|
||||||
if cur_vcpu:
|
if cur_vcpu:
|
||||||
vcpu = cur_vcpu
|
vcpu = cur_vcpu
|
||||||
|
|
|
@ -32,7 +32,7 @@ class wvmInstances(wvmConnect):
|
||||||
def get_instance_memory(self, name):
|
def get_instance_memory(self, name):
|
||||||
inst = self.get_instance(name)
|
inst = self.get_instance(name)
|
||||||
mem = util.get_xml_path(inst.XMLDesc(0), "/domain/currentMemory")
|
mem = util.get_xml_path(inst.XMLDesc(0), "/domain/currentMemory")
|
||||||
return int(mem) / 1024
|
return int(mem) // 1024
|
||||||
|
|
||||||
def get_instance_vcpu(self, name):
|
def get_instance_vcpu(self, name):
|
||||||
inst = self.get_instance(name)
|
inst = self.get_instance(name)
|
||||||
|
@ -242,11 +242,11 @@ class wvmInstance(wvmConnect):
|
||||||
|
|
||||||
def get_memory(self):
|
def get_memory(self):
|
||||||
mem = util.get_xml_path(self._XMLDesc(0), "/domain/memory")
|
mem = util.get_xml_path(self._XMLDesc(0), "/domain/memory")
|
||||||
return int(mem) / 1024
|
return int(mem) // 1024
|
||||||
|
|
||||||
def get_cur_memory(self):
|
def get_cur_memory(self):
|
||||||
mem = util.get_xml_path(self._XMLDesc(0), "/domain/currentMemory")
|
mem = util.get_xml_path(self._XMLDesc(0), "/domain/currentMemory")
|
||||||
return int(mem) / 1024
|
return int(mem) // 1024
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
title = util.get_xml_path(self._XMLDesc(0), "/domain/title")
|
title = util.get_xml_path(self._XMLDesc(0), "/domain/title")
|
||||||
|
|
Loading…
Reference in a new issue