Merge pull request #6770 from lemonlatte/fix_default_uri_of_get_xml
Fix the default url of get_xml function.
This commit is contained in:
commit
91dba74bf9
1 changed files with 7 additions and 9 deletions
14
cloud/virt
14
cloud/virt
|
@ -197,6 +197,10 @@ class LibvirtConnection(object):
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return self.conn.getType()
|
return self.conn.getType()
|
||||||
|
|
||||||
|
def get_xml(self, vmid):
|
||||||
|
vm = self.conn.lookupByName(vmid)
|
||||||
|
return vm.XMLDesc(0)
|
||||||
|
|
||||||
def get_maxVcpus(self, vmid):
|
def get_maxVcpus(self, vmid):
|
||||||
vm = self.conn.lookupByName(vmid)
|
vm = self.conn.lookupByName(vmid)
|
||||||
return vm.maxVcpus()
|
return vm.maxVcpus()
|
||||||
|
@ -361,14 +365,8 @@ class Virt(object):
|
||||||
Return an xml describing vm config returned by a libvirt call
|
Return an xml describing vm config returned by a libvirt call
|
||||||
"""
|
"""
|
||||||
|
|
||||||
conn = libvirt.openReadOnly(None)
|
self.__get_conn()
|
||||||
if not conn:
|
return self.conn.get_xml(vmid)
|
||||||
return (-1,'Failed to open connection to the hypervisor')
|
|
||||||
try:
|
|
||||||
domV = conn.lookupByName(vmid)
|
|
||||||
except:
|
|
||||||
return (-1,'Failed to find the main domain')
|
|
||||||
return domV.XMLDesc(0)
|
|
||||||
|
|
||||||
def get_maxVcpus(self, vmid):
|
def get_maxVcpus(self, vmid):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue