diff options
author | Cole Robinson <crobinso@redhat.com> | 2019-11-24 18:10:56 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2019-11-25 06:20:42 -0500 |
commit | 85a33caa76036c2dd486c636762e8f931475298e (patch) | |
tree | 4d1fde7fc1f9312ef1260b6b2b17035ff8e1832d /virt-install | |
parent | 44c519200c8db61a7ae8c06259f5d69a3383d4c8 (diff) | |
download | virt-manager-85a33caa76036c2dd486c636762e8f931475298e.tar.gz |
cli: Expose default console handling through _AutoconsoleData
Rework all console queries to go through that object API
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virt-install')
-rwxr-xr-x | virt-install | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/virt-install b/virt-install index f7fb624f..fc0ab0ac 100755 --- a/virt-install +++ b/virt-install @@ -263,7 +263,7 @@ def convert_wait_zero(options): # Historical back compat, --wait 0 is identical to --noautoconsole if options.wait == 0: log.warning("Treating --wait 0 as --noautoconsole") - options.autoconsole = False + options.autoconsole = "none" options.wait = None @@ -319,18 +319,16 @@ def validate_required_options(options, guest, installer): fail(msg) -def show_console_warnings(options, guest, installer): - if guest.devices.graphics: +def show_console_warnings(installer, autoconsole): + if not installer.cdrom: return - if not options.autoconsole: + if not autoconsole.is_text(): return - - if installer.cdrom: - log.warning(_("CDROM media does not print to the text console " - "by default, so you likely will not see text install output. " - "You might want to use --location.") + " " + - _("See the man page for examples of " - "using --location with CDROM media")) + log.warning(_("CDROM media does not print to the text console " + "by default, so you likely will not see text install output. " + "You might want to use --location.") + " " + + _("See the man page for examples of " + "using --location with CDROM media")) def _show_memory_warnings(guest): @@ -633,18 +631,17 @@ class WaitHandler: def start_install(guest, installer, options): - show_console_warnings(options, guest, installer) - autoconsole = cli.parse_autoconsole(options.autoconsole) - - conscb = None - if autoconsole.is_default(): - conscb = cli.get_console_cb(guest) - if not conscb and options.wait is None: - # If there isn't any console to actually connect up, - # default to --wait -1 to get similarish behavior - log.warning(_("No console to launch for the guest, " - "defaulting to --wait -1")) - options.wait = -1 + autoconsole = cli.parse_autoconsole(options, guest) + show_console_warnings(installer, autoconsole) + conscb = autoconsole.get_console_cb() + + conscb = autoconsole.get_console_cb() + if autoconsole.is_default() and not conscb and options.wait is None: + # If there isn't any console to actually connect up, + # default to --wait -1 to get similarish behavior + log.warning(_("No console to launch for the guest, " + "defaulting to --wait -1")) + options.wait = -1 waithandler = WaitHandler(options.wait) meter = cli.get_meter() |