virt-xml: Only print message if changes are applied

This commit is contained in:
Cole Robinson 2017-03-06 21:32:32 -05:00
parent 405b5ea804
commit 38c10f70f8

View File

@ -257,7 +257,7 @@ def define_changes(conn, inactive_xmlobj, devs, action, confirm):
if confirm: if confirm:
if not prompt_yes_or_no( if not prompt_yes_or_no(
_("Define '%s' with the changed XML?") % inactive_xmlobj.name): _("Define '%s' with the changed XML?") % inactive_xmlobj.name):
return return False
if action == "hotplug": if action == "hotplug":
for dev in devs: for dev in devs:
@ -265,6 +265,7 @@ def define_changes(conn, inactive_xmlobj, devs, action, confirm):
conn.defineXML(inactive_xmlobj.get_xml_config()) conn.defineXML(inactive_xmlobj.get_xml_config())
print_stdout(_("Domain '%s' defined successfully.") % inactive_xmlobj.name) print_stdout(_("Domain '%s' defined successfully.") % inactive_xmlobj.name)
return True
def update_changes(domain, devs, action, confirm): def update_changes(domain, devs, action, confirm):
@ -461,8 +462,9 @@ def main(conn=None):
update_changes(domain, devs, action, options.confirm) update_changes(domain, devs, action, options.confirm)
if options.define: if options.define:
devs, action = prepare_changes(inactive_xmlobj, options, parserclass) devs, action = prepare_changes(inactive_xmlobj, options, parserclass)
define_changes(conn, inactive_xmlobj, devs, action, options.confirm) applied = define_changes(conn, inactive_xmlobj,
if not options.update and active_xmlobj: devs, action, options.confirm)
if not options.update and active_xmlobj and applied:
print_stdout( print_stdout(
_("Changes will take effect after the next domain shutdown.")) _("Changes will take effect after the next domain shutdown."))
if not options.update and not options.define: if not options.update and not options.define: