diff --git a/man/virt-install.pod b/man/virt-install.pod index 4067ec204..153345f08 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -639,9 +639,9 @@ This parameter is deprecated in favour of C<--network NETWORK,mac=12:34...> =head2 Graphics Configuration -If no graphics option is specified, C will default to -'--graphics vnc' if the DISPLAY environment variable is set, otherwise -'--graphics none' is used. +If no graphics option is specified, C will try to select +the appropriate graphics if the DISPLAY environment variable is set, +otherwise '--graphics none' is used. =over 2 diff --git a/virtcli/cliconfig.py b/virtcli/cliconfig.py index 3edb96446..ce43b3cac 100644 --- a/virtcli/cliconfig.py +++ b/virtcli/cliconfig.py @@ -84,4 +84,4 @@ preferred_distros = _split_list(_get_param("preferred_distros", "")) hv_packages = _split_list(_get_param("hv_packages", "")) askpass_package = _split_list(_get_param("askpass_packages", "")) libvirt_packages = _split_list(_get_param("libvirt_packages", "")) -default_graphics = _get_param("default_graphics", "vnc") +default_graphics = _get_param("default_graphics", "spice") diff --git a/virtinst/cli.py b/virtinst/cli.py index 2ab72c9e6..9ec62c6a4 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -788,7 +788,8 @@ def digest_graphics(guest, options, default_override=None): if optnum == 0: # If no graphics specified, choose a default if default_override is True: - vnc = True + if cliconfig.default_graphics in ["spice", "vnc", "sdl"]: + return [cliconfig.default_graphics] elif default_override is False: nographics = True else: @@ -796,8 +797,14 @@ def digest_graphics(guest, options, default_override=None): logging.debug("Container guest, defaulting to nographics") nographics = True elif "DISPLAY" in os.environ.keys(): - logging.debug("DISPLAY is set: graphics defaulting to VNC.") - vnc = True + logging.debug("DISPLAY is set: looking for pre-configured graphics") + if cliconfig.default_graphics in ["spice", "vnc", "sdl"]: + logging.debug("Defaulting graphics to pre-configured %s" % + cliconfig.default_graphics.upper()) + return [cliconfig.default_graphics] + logging.debug("No valid pre-configured graphics " + "found, defaulting to VNC") + return ["vnc"] else: logging.debug("DISPLAY is not set: defaulting to nographics.") nographics = True