configure: Add option to disable unsupported RHEL config

This commit is contained in:
Cole Robinson 2010-12-13 14:31:27 -05:00
parent f8d3701f29
commit 187190c362
7 changed files with 51 additions and 11 deletions

View File

@ -28,6 +28,10 @@ dnl ====================================
dnl = End tests for scrollkeeper
dnl ====================================
dnl ---------------
dnl Option handling
dnl ---------------
dnl Install TUI
AC_ARG_WITH([tui],
AC_HELP_STRING(
@ -44,8 +48,21 @@ AC_ARG_WITH([qemu-user],
[DEFAULT_QEMU_USER=$withval],
[DEFAULT_QEMU_USER="root"])
dnl
AC_ARG_ENABLE([unsupported-rhel-options],
AC_HELP_STRING(
[--enable-unsupported-rhel-options],
[enable VM config options unsupported by RHEL @<:@default=yes@:>@]),
[test "x$enableval" == "xno" && ENABLE_UNSUPPORTED_RHEL_OPTS=0],
[ENABLE_UNSUPPORTED_RHEL_OPTS=1])
dnl -----------------------
dnl Variable substitution
dnl -----------------------
AC_SUBST([VIRTINST_VERSION])
AC_SUBST([DEFAULT_QEMU_USER])
AC_SUBST([ENABLE_UNSUPPORTED_RHEL_OPTS])
AM_CONDITIONAL([INSTALL_TUI], [test "x$with_tui" = "xyes"])
@ -71,12 +88,19 @@ AC_OUTPUT(Makefile
AC_MSG_NOTICE([])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Required virtinst: $VIRTINST_VERSION])
AC_MSG_NOTICE([Default qemu user: $DEFAULT_QEMU_USER])
AC_MSG_NOTICE([Required virtinst: $VIRTINST_VERSION])
AC_MSG_NOTICE([Default qemu user: $DEFAULT_QEMU_USER])
if test "x$with_tui" = "xyes" ; then
AC_MSG_NOTICE([Install TUI: yes])
AC_MSG_NOTICE([Install TUI: yes])
else
AC_MSG_NOTICE([Install TUI: no])
AC_MSG_NOTICE([Install TUI: no])
fi
if test "x$ENABLE_UNSUPPORTED_RHEL_OPTS" = "x1" ; then
AC_MSG_NOTICE([Enable unsupported RHEL opts: yes])
else
AC_MSG_NOTICE([Enable unsupported RHEL opts: no])
fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([])

View File

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

View File

@ -57,6 +57,7 @@ pyarchlib_dir = "::PYARCHLIBDIR::"
data_dir = "::DATADIR::"
default_qemu_user = "::DEFAULT_QEMU_USER::"
rhel_enable_unsupported_opts = bool(int("::ENABLE_UNSUPPORTED_RHEL_OPTS::"))
logging_setup = False
@ -379,6 +380,7 @@ def main():
icon_dir, data_dir)
virtManager.config.running_config = config
config.default_qemu_user = default_qemu_user
config.enable_unsupported_rhel_opts = rhel_enable_unsupported_opts
# Now we've got basic environment up & running we can fork
if not options.nofork and not options.debug:

View File

@ -472,8 +472,10 @@ class vmmAddHardware(vmmGObjectUI):
add_dev("ide", virtinst.VirtualDisk.DEVICE_DISK, "IDE disk")
add_dev("ide", virtinst.VirtualDisk.DEVICE_CDROM, "IDE cdrom")
add_dev("fdc", virtinst.VirtualDisk.DEVICE_FLOPPY, "Floppy disk")
add_dev("scsi", virtinst.VirtualDisk.DEVICE_DISK, "SCSI disk")
add_dev("usb", virtinst.VirtualDisk.DEVICE_DISK, "USB disk")
if self.vm.enable_unsupported_rhel_opts():
add_dev("scsi", virtinst.VirtualDisk.DEVICE_DISK, "SCSI disk")
add_dev("usb", virtinst.VirtualDisk.DEVICE_DISK, "USB disk")
if self.vm.get_hv_type() == "kvm":
add_dev("virtio", virtinst.VirtualDisk.DEVICE_DISK, "Virtio Disk")
if self.vm.get_connection().is_xen():

View File

@ -101,6 +101,9 @@ class vmmConfig(object):
self.default_qemu_user = "root"
# Use this key to disable certain features not supported on RHEL
self.enable_unsupported_rhel_opts = True
self.status_icons = {
libvirt.VIR_DOMAIN_BLOCKED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_running.png", 18, 18),
libvirt.VIR_DOMAIN_CRASHED: gtk.gdk.pixbuf_new_from_file_at_size(self.get_icon_dir() + "/state_crashed.png", 18, 18),

View File

@ -426,6 +426,15 @@ class vmmDomainBase(vmmLibvirtObject):
def get_handle(self):
return self._backend
def enable_unsupported_rhel_opts(self):
if not self.is_libexec_qemu():
return True
return self.config.enable_unsupported_rhel_opts
def is_libexec_qemu(self):
return bool(self.connection.is_qemu_system() and
str(self.get_emulator()).startswith("/usr/libexec"))
def is_read_only(self):
if self.connection.is_read_only():
return True

View File

@ -41,8 +41,6 @@ OPTICAL_DEV_KEY = 3
OPTICAL_MEDIA_KEY = 4
OPTICAL_IS_VALID = 5
SUPPORTED_SOUND_MODELS = None
##############################################################
# Initialize an error object to use for validation functions #
##############################################################
@ -140,7 +138,6 @@ def build_video_combo(vm, video_dev, no_default=False):
video_dev.set_active(0)
def build_sound_combo(vm, combo, no_default=False):
ignore = vm
dev_model = gtk.ListStore(str)
combo.set_model(dev_model)
text = gtk.CellRendererText()
@ -148,12 +145,14 @@ def build_sound_combo(vm, combo, no_default=False):
combo.add_attribute(text, 'text', 0)
dev_model.set_sort_column_id(0, gtk.SORT_ASCENDING)
disable_rhel = not vm.enable_unsupported_rhel_opts()
rhel6_soundmodels = ["ac97", "es1370"]
for m in virtinst.VirtualAudio.MODELS:
if m == virtinst.VirtualAudio.MODEL_DEFAULT and no_default:
continue
if (SUPPORTED_SOUND_MODELS is not None and
m not in SUPPORTED_SOUND_MODELS):
if (disable_rhel and m not in rhel6_soundmodels):
continue
dev_model.append([m])