Log object name with XML diff on redefine

This commit is contained in:
Cole Robinson 2013-10-01 10:21:44 -04:00
parent 868fbd9fc9
commit bdaa0e511a
3 changed files with 7 additions and 5 deletions

View File

@ -205,7 +205,7 @@ class vmmLibvirtObject(vmmGObject):
return self._xmlobj_to_define
def _redefine_helper(self, origxml, newxml):
uihelpers.log_redefine_xml_diff(origxml, newxml)
uihelpers.log_redefine_xml_diff(self, origxml, newxml)
if origxml != newxml:
self._define(newxml)

View File

@ -491,7 +491,7 @@ class vmmSnapshotPage(vmmGObjectUI):
xmlobj.description = desc
newxml = xmlobj.get_xml_config()
uihelpers.log_redefine_xml_diff(origxml, newxml)
uihelpers.log_redefine_xml_diff(snap, origxml, newxml)
if newxml == origxml:
return
self.vm.create_snapshot(newxml, redefine=True)

View File

@ -1415,9 +1415,11 @@ def exception_is_libvirt_error(e, error):
e.get_error_code() == getattr(libvirt, error))
def log_redefine_xml_diff(origxml, newxml):
def log_redefine_xml_diff(obj, origxml, newxml):
objname = "<%s name=%s>" % (obj.__class__.__name__, obj.get_name())
if origxml == newxml:
logging.debug("Redefine requested, but XML didn't change!")
logging.debug("Redefine requested for %s, but XML didn't change!",
objname)
return
import difflib
@ -1425,4 +1427,4 @@ def log_redefine_xml_diff(origxml, newxml):
newxml.splitlines(1),
fromfile="Original XML",
tofile="New XML"))
logging.debug("Redefining with XML diff:\n%s", diff)
logging.debug("Redefining %s with XML diff:\n%s", objname, diff)