virt-install: Make default graphics configurable

The '--default-graphics' option of 'setup.py configure' only affects
virt-manager, but not virt-install.  This should be unified, so this
patch checks whether default_graphics taken from the cli is supported
and uses that option.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=912615
This commit is contained in:
Martin Kletzander 2013-07-11 15:42:31 +02:00
parent 4f7f9e2267
commit b8a209ef9c
3 changed files with 14 additions and 7 deletions

View File

@ -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<virt-install> will default to
'--graphics vnc' if the DISPLAY environment variable is set, otherwise
'--graphics none' is used.
If no graphics option is specified, C<virt-install> will try to select
the appropriate graphics if the DISPLAY environment variable is set,
otherwise '--graphics none' is used.
=over 2

View File

@ -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")

View File

@ -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