mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-03 01:18:00 +03:00
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
This commit is contained in:
parent
f7854d0a84
commit
53f075ab76
@ -1086,6 +1086,7 @@ c = vixml.add_category("misc", "")
|
|||||||
c.add_valid("--help") # basic --help test
|
c.add_valid("--help") # basic --help test
|
||||||
c.add_valid("--sound=? --tpm=?") # basic introspection test
|
c.add_valid("--sound=? --tpm=?") # basic introspection test
|
||||||
c.add_valid("test-state-shutoff --edit --update --boot menu=on", grep="The VM is not running") # --update with inactive VM, should work but warn
|
c.add_valid("test-state-shutoff --edit --update --boot menu=on", grep="The VM is not running") # --update with inactive VM, should work but warn
|
||||||
|
c.add_valid("test-state-shutoff --edit --boot menu=on", grep="XML did not change after domain define") # menu=on is discarded because <bootloader> is specified
|
||||||
c.add_valid("test-for-virtxml --edit --graphics password=foo --update --confirm", input_text="no\nno\n") # prompt exiting
|
c.add_valid("test-for-virtxml --edit --graphics password=foo --update --confirm", input_text="no\nno\n") # prompt exiting
|
||||||
c.add_valid("test-for-virtxml --edit --cpu host-passthrough --no-define --start --confirm", input_text="no") # transient prompt exiting
|
c.add_valid("test-for-virtxml --edit --cpu host-passthrough --no-define --start --confirm", input_text="no") # transient prompt exiting
|
||||||
c.add_valid("test-for-virtxml --edit --metadata name=test-for-virtxml", grep="requested changes will have no effect")
|
c.add_valid("test-for-virtxml --edit --metadata name=test-for-virtxml", grep="requested changes will have no effect")
|
||||||
|
10
virt-xml
10
virt-xml
@ -103,6 +103,12 @@ def get_domain_and_guest(conn, domstr):
|
|||||||
return (domain, inactive_xmlobj, active_xmlobj)
|
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 #
|
# Change logic #
|
||||||
################
|
################
|
||||||
@ -522,6 +528,7 @@ def main(conn=None):
|
|||||||
# It's hard to hit this case with the test suite
|
# It's hard to hit this case with the test suite
|
||||||
return 0 # pragma: no cover
|
return 0 # pragma: no cover
|
||||||
|
|
||||||
|
original_xml = inactive_xmlobj.get_xml()
|
||||||
devs, action = prepare_changes(inactive_xmlobj, options, parserclass)
|
devs, action = prepare_changes(inactive_xmlobj, options, parserclass)
|
||||||
if not options.define:
|
if not options.define:
|
||||||
if options.start:
|
if options.start:
|
||||||
@ -547,6 +554,9 @@ def main(conn=None):
|
|||||||
elif vm_is_running and not performed_update:
|
elif vm_is_running and not performed_update:
|
||||||
print_stdout(
|
print_stdout(
|
||||||
_("Changes will take effect after the domain is fully powered off."))
|
_("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
|
return 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user