From 8c3388697c262312a58895b89e0f5139e76e13ed Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 22 Feb 2018 18:47:49 -0500 Subject: [PATCH] virt-xml: Remove redundant XML roundtripping Based on how we do diff reporting it doesn't accomplish anything anyways --- virt-xml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/virt-xml b/virt-xml index e0495029c..30fee7c74 100755 --- a/virt-xml +++ b/virt-xml @@ -68,13 +68,6 @@ def get_diff(origxml, newxml): return ret -def _make_guest(conn, xml): - # We do this to minimize the diff, sanitizing XML quotes to what libxml - # generates - return virtinst.Guest(conn, - parsexml=virtinst.Guest(conn, parsexml=xml).get_xml_config()) - - def get_domain_and_guest(conn, domstr): try: int(domstr) @@ -97,11 +90,11 @@ def get_domain_and_guest(conn, domstr): state = domain.info()[0] active_xmlobj = None - inactive_xmlobj = _make_guest(conn, domain.XMLDesc(0)) + inactive_xmlobj = virtinst.Guest(conn, parsexml=domain.XMLDesc(0)) if state != libvirt.VIR_DOMAIN_SHUTOFF: active_xmlobj = inactive_xmlobj - inactive_xmlobj = _make_guest(conn, - domain.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)) + inactive_xmlobj = virtinst.Guest(conn, + parsexml=domain.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)) return (domain, inactive_xmlobj, active_xmlobj) @@ -440,7 +433,7 @@ def main(conn=None): domain, inactive_xmlobj, active_xmlobj = get_domain_and_guest( conn, options.domain) elif not options.build_xml: - inactive_xmlobj = _make_guest(conn, options.stdinxml) + inactive_xmlobj = virtinst.Guest(conn, options.stdinxml) check_action_collision(options) parserclass = check_xmlopt_collision(options)