summaryrefslogtreecommitdiff
path: root/virt-xml
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-06-16 17:01:32 -0400
committerCole Robinson <crobinso@redhat.com>2019-06-16 17:08:59 -0400
commit53f075ab76e1c372474ae0d88f202e487d9f213f (patch)
tree580c45374b785ca02c193a5e71fc8de36291c497 /virt-xml
parentf7854d0a8417106d2dbb9cdfed684c9aa4010604 (diff)
downloadvirt-manager-53f075ab76e1c372474ae0d88f202e487d9f213f.tar.gz
virt-xml: Warn if libvirt discards our defined changes
This can happen if we try to remove a default device, like a ps2 mouse on x86, but it can happen for many other reasons as well https://bugzilla.redhat.com/show_bug.cgi?id=1405263
Diffstat (limited to 'virt-xml')
-rwxr-xr-xvirt-xml10
1 files changed, 10 insertions, 0 deletions
diff --git a/virt-xml b/virt-xml
index 5ed470f4..1fbf2bbb 100755
--- a/virt-xml
+++ b/virt-xml
@@ -103,6 +103,12 @@ def get_domain_and_guest(conn, domstr):
return (domain, inactive_xmlobj, active_xmlobj)
+def defined_xml_is_unchanged(conn, domain, original_xml):
+ rawxml = get_xmldesc(domain, inactive=True)
+ new_xml = virtinst.Guest(conn, parsexml=rawxml)
+ return new_xml != original_xml
+
+
################
# Change logic #
################
@@ -522,6 +528,7 @@ def main(conn=None):
# It's hard to hit this case with the test suite
return 0 # pragma: no cover
+ original_xml = inactive_xmlobj.get_xml()
devs, action = prepare_changes(inactive_xmlobj, options, parserclass)
if not options.define:
if options.start:
@@ -547,6 +554,9 @@ def main(conn=None):
elif vm_is_running and not performed_update:
print_stdout(
_("Changes will take effect after the domain is fully powered off."))
+ elif defined_xml_is_unchanged(conn, domain, original_xml):
+ logging.warning(_("XML did not change after domain define. You may "
+ "have changed a value that libvirt is setting by default."))
return 0