domain: virtinst: custom implement _redefine_xmlobj

This commit is contained in:
Cole Robinson 2019-05-08 17:41:24 -04:00
parent cfa1a0569b
commit a6495bb38f
2 changed files with 6 additions and 9 deletions

View File

@ -1649,8 +1649,10 @@ class vmmDomainVirtinst(vmmDomain):
self._orig_xml = self._backend.get_xml()
return self._backend
def _redefine_xmlobj(self, xmlobj, origxml=None):
vmmDomain._redefine_xmlobj(self, xmlobj, origxml=self._orig_xml)
def _redefine_xmlobj(self, xmlobj):
newxml = xmlobj.get_xml()
self.log_redefine_xml_diff(self, self._orig_xml or "", newxml)
self._define(newxml)
def rename_domain(self, new_name):
self.define_name(new_name)

View File

@ -371,19 +371,14 @@ class vmmLibvirtObject(vmmGObject):
"""
return self.get_xmlobj(inactive=True)
def _redefine_xmlobj(self, xmlobj, origxml=None):
def _redefine_xmlobj(self, xmlobj):
"""
Redefine the passed xmlobj, which should be generated with
self._make_xmlobj_to_define()
Most subclasses shouldn't touch this, but vmmDomainVirtinst needs to.
:param origxml: vmmDomainVirtinst uses that field to make sure
we detect the actual XML change and log it correctly.
"""
if not origxml:
origxml = self._make_xmlobj_to_define().get_xml()
origxml = self._make_xmlobj_to_define().get_xml()
newxml = xmlobj.get_xml()
self.log_redefine_xml_diff(self, origxml, newxml)