diff --git a/configure.ac b/configure.ac index 6c59288a8..7f45d8ffd 100644 --- a/configure.ac +++ b/configure.ac @@ -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([]) diff --git a/src/Makefile.am b/src/Makefile.am index 8a25b9c14..8eacef3a3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in index 60ee52c3c..4036697be 100755 --- a/src/virt-manager.py.in +++ b/src/virt-manager.py.in @@ -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: diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py index 8b381879f..8986f1657 100644 --- a/src/virtManager/addhardware.py +++ b/src/virtManager/addhardware.py @@ -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(): diff --git a/src/virtManager/config.py b/src/virtManager/config.py index 8cbee54a9..1f864b3fb 100644 --- a/src/virtManager/config.py +++ b/src/virtManager/config.py @@ -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), diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py index a19a18b70..c0f227e3e 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -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 diff --git a/src/virtManager/uihelpers.py b/src/virtManager/uihelpers.py index 671ab3691..e7707f6ec 100644 --- a/src/virtManager/uihelpers.py +++ b/src/virtManager/uihelpers.py @@ -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])