configure: Allow specifying 'preferred' VM distro choices

The create wizard will then list these options first
This commit is contained in:
Cole Robinson 2010-12-13 16:02:59 -05:00
parent 361b098bb1
commit 004623a886
5 changed files with 21 additions and 2 deletions

View File

@ -48,7 +48,7 @@ AC_ARG_WITH([qemu-user],
[DEFAULT_QEMU_USER=$withval],
[DEFAULT_QEMU_USER="root"])
dnl
dnl Don't list options that rhel doesn't support
AC_ARG_ENABLE([unsupported-rhel-options],
AC_HELP_STRING(
[--enable-unsupported-rhel-options],
@ -56,6 +56,13 @@ AC_ARG_ENABLE([unsupported-rhel-options],
[test "x$enableval" == "xno" && ENABLE_UNSUPPORTED_RHEL_OPTS=0],
[ENABLE_UNSUPPORTED_RHEL_OPTS=1])
dnl Allow passing in a prefered distro list
AC_ARG_WITH([preferred-distros],
AC_HELP_STRING(
[--with-preferred-distros],
[Distros to list first in New VM wizard @<:@default=root@:>@]),
[PREFERRED_DISTROS=$withval],
[PREFERRED_DISTROS=""])
dnl -----------------------
dnl Variable substitution
@ -63,6 +70,7 @@ dnl -----------------------
AC_SUBST([VIRTINST_VERSION])
AC_SUBST([DEFAULT_QEMU_USER])
AC_SUBST([ENABLE_UNSUPPORTED_RHEL_OPTS])
AC_SUBST([PREFERRED_DISTROS])
AM_CONDITIONAL([INSTALL_TUI], [test "x$with_tui" = "xyes"])
@ -101,6 +109,11 @@ AC_MSG_NOTICE([Enable unsupported RHEL opts: yes])
else
AC_MSG_NOTICE([Enable unsupported RHEL opts: no])
fi
if test "x$PREFERRED_DISTROS" = "x" ; then
AC_MSG_NOTICE([Preferred distros: none])
else
AC_MSG_NOTICE([Preferred distros: $PREFERRED_DISTROS])
fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([])

View File

@ -62,6 +62,7 @@ endif
-e "s,::VIRTINST_VERSION::,$(VIRTINST_VERSION)," \
-e "s,::DEFAULT_QEMU_USER::,$(DEFAULT_QEMU_USER)," \
-e "s,::ENABLE_UNSUPPORTED_RHEL_OPTS::,$(ENABLE_UNSUPPORTED_RHEL_OPTS)," \
-e "s|::PREFERRED_DISTROS::|$(PREFERRED_DISTROS)|" \
< $< > $@
$(PACKAGE): $(srcdir)/$(PACKAGE).in

View File

@ -58,6 +58,7 @@ data_dir = "::DATADIR::"
default_qemu_user = "::DEFAULT_QEMU_USER::"
rhel_enable_unsupported_opts = bool(int("::ENABLE_UNSUPPORTED_RHEL_OPTS::"))
preferred_distros = [d for d in "::PREFERRED_DISTROS::".split(",") if d]
logging_setup = False
@ -381,6 +382,7 @@ def main():
virtManager.config.running_config = config
config.default_qemu_user = default_qemu_user
config.enable_unsupported_rhel_opts = rhel_enable_unsupported_opts
config.preferred_distros = preferred_distros
# Now we've got basic environment up & running we can fork
if not options.nofork and not options.debug:

View File

@ -103,6 +103,7 @@ class vmmConfig(object):
# Use this key to disable certain features not supported on RHEL
self.enable_unsupported_rhel_opts = True
self.preferred_distros = []
self.status_icons = {
libvirt.VIR_DOMAIN_BLOCKED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_running.png", 18, 18),

View File

@ -688,7 +688,9 @@ class vmmCreate(vmmGObjectUI):
model.append([OS_GENERIC, _("Generic")])
return
variants = virtinst.FullVirtGuest.list_os_variants(_type)
preferred = self.config.preferred_distros
variants = virtinst.FullVirtGuest.list_os_variants(_type,
preferred)
for variant in variants:
model.append([variant,
virtinst.FullVirtGuest.get_os_variant_label(_type,