mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Add users and users VMs
;
This commit is contained in:
parent
29b05745ad
commit
55e93a9087
11 changed files with 213 additions and 21 deletions
|
@ -435,9 +435,27 @@ class wvmConnect(object):
|
|||
vname = {}
|
||||
for name in self.get_instances():
|
||||
dom = self.get_instance(name)
|
||||
vname[dom.name()] = {'status': dom.info()[0], 'uuid': dom.UUIDString()}
|
||||
mem = util.get_xml_path(dom.XMLDesc(0), "/domain/currentMemory")
|
||||
mem = int(mem) * 1024
|
||||
cur_vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu/@current")
|
||||
if cur_vcpu:
|
||||
vcpu = cur_vcpu
|
||||
else:
|
||||
vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu")
|
||||
vname[dom.name()] = {'status': dom.info()[0], 'uuid': dom.UUIDString(), 'vcpu': vcpu, 'memory': mem}
|
||||
return vname
|
||||
|
||||
def get_user_instances(self, name):
|
||||
dom = self.get_instance(name)
|
||||
mem = util.get_xml_path(dom.XMLDesc(0), "/domain/currentMemory")
|
||||
mem = int(mem) / 1024
|
||||
cur_vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu/@current")
|
||||
if cur_vcpu:
|
||||
vcpu = cur_vcpu
|
||||
else:
|
||||
vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu")
|
||||
return {'name': dom.name(), 'status': dom.info()[0], 'uuid': dom.UUIDString(), 'vcpu': vcpu, 'memory': mem}
|
||||
|
||||
def close(self):
|
||||
"""Close connection"""
|
||||
# to-do: do not close connection ;)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue