mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
fix setting title/description function (xml -> lxml)
This commit is contained in:
parent
e911db8124
commit
e72073fa79
1 changed files with 9 additions and 8 deletions
|
@ -1139,6 +1139,12 @@ class wvmInstance(wvmConnect):
|
||||||
uuid = tree.find('uuid')
|
uuid = tree.find('uuid')
|
||||||
tree.remove(uuid)
|
tree.remove(uuid)
|
||||||
|
|
||||||
|
options = {
|
||||||
|
'title': clone_data.get('clone-title', ''),
|
||||||
|
'description': clone_data.get('clone-description', ''),
|
||||||
|
}
|
||||||
|
self._set_options(tree, options)
|
||||||
|
|
||||||
src_nvram_path = self.get_nvram()
|
src_nvram_path = self.get_nvram()
|
||||||
if src_nvram_path:
|
if src_nvram_path:
|
||||||
# Change XML for nvram
|
# Change XML for nvram
|
||||||
|
@ -1247,11 +1253,6 @@ class wvmInstance(wvmConnect):
|
||||||
storage = self.get_wvmStorage(pool_name)
|
storage = self.get_wvmStorage(pool_name)
|
||||||
storage.clone_volume(vol_name, target_file)
|
storage.clone_volume(vol_name, target_file)
|
||||||
|
|
||||||
options = {
|
|
||||||
'title': clone_data.get('clone-title', ''),
|
|
||||||
'description': clone_data.get('clone-description', ''),
|
|
||||||
}
|
|
||||||
self._set_options(tree, options)
|
|
||||||
self._defineXML(ElementTree.tostring(tree).decode())
|
self._defineXML(ElementTree.tostring(tree).decode())
|
||||||
|
|
||||||
return self.get_instance(clone_data['name']).UUIDString()
|
return self.get_instance(clone_data['name']).UUIDString()
|
||||||
|
@ -1391,7 +1392,7 @@ class wvmInstance(wvmConnect):
|
||||||
tree.remove(option)
|
tree.remove(option)
|
||||||
else:
|
else:
|
||||||
if option is None:
|
if option is None:
|
||||||
option = ElementTree.SubElement(tree, o)
|
option = etree.SubElement(tree , o)
|
||||||
option.text = option_value
|
option.text = option_value
|
||||||
|
|
||||||
def set_options(self, options):
|
def set_options(self, options):
|
||||||
|
@ -1399,10 +1400,10 @@ class wvmInstance(wvmConnect):
|
||||||
Function change description, title
|
Function change description, title
|
||||||
"""
|
"""
|
||||||
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||||
tree = ElementTree.fromstring(xml)
|
tree = etree.fromstring(xml)
|
||||||
|
|
||||||
self._set_options(tree, options)
|
self._set_options(tree, options)
|
||||||
new_xml = ElementTree.tostring(tree).decode()
|
new_xml = etree.tostring(tree).decode()
|
||||||
self._defineXML(new_xml)
|
self._defineXML(new_xml)
|
||||||
|
|
||||||
def set_memory(self, size, flags=0):
|
def set_memory(self, size, flags=0):
|
||||||
|
|
Loading…
Reference in a new issue