diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py index e8365ec17..1423b4016 100644 --- a/src/virtManager/addhardware.py +++ b/src/virtManager/addhardware.py @@ -1369,6 +1369,9 @@ class vmmAddHardware(vmmGObjectUI): if self.storage_browser == None: self.storage_browser = vmmStorageBrowser(conn) + rhel6 = self.vm.enable_unsupported_rhel_opts() + self.storage_browser.enable_unsupported_rhel_opts = rhel6 + self.storage_browser.set_finish_cb(set_storage_cb) self.storage_browser.set_browse_reason(reason) diff --git a/src/virtManager/choosecd.py b/src/virtManager/choosecd.py index 0fe5da1d4..89124ff5c 100644 --- a/src/virtManager/choosecd.py +++ b/src/virtManager/choosecd.py @@ -158,6 +158,9 @@ class vmmChooseCD(vmmGObjectUI): self.storage_browser.connect("storage-browse-finish", self.set_storage_path) + rhel6 = self.vm.enable_unsupported_rhel_opts() + self.storage_browser.enable_unsupported_rhel_opts = rhel6 + self.storage_browser.set_browse_reason(self.config.CONFIG_DIR_MEDIA) self.storage_browser.show(self.topwin, self.conn) diff --git a/src/virtManager/connection.py b/src/virtManager/connection.py index 6f0b84b41..af5518441 100644 --- a/src/virtManager/connection.py +++ b/src/virtManager/connection.py @@ -375,6 +375,13 @@ class vmmConnection(vmmGObject): return path == "/session" # Connection capabilities debug helpers + def enable_unsupported_rhel_opts(self, emulator): + if not self.is_qemu_system(): + return True + if not str(emulator).startswith("/usr/libexec"): + return True + return self.config.enable_unsupported_rhel_opts + def is_kvm_supported(self): return self.get_capabilities().is_kvm_available() diff --git a/src/virtManager/create.py b/src/virtManager/create.py index ba9d9c69e..2896e7fa0 100644 --- a/src/virtManager/create.py +++ b/src/virtManager/create.py @@ -1980,6 +1980,15 @@ class vmmCreate(vmmGObjectUI): if self.storage_browser == None: self.storage_browser = vmmStorageBrowser(self.conn) + emu = None + if self.guest: + emu = self.guest.emulator + elif self.capsdomain: + emu = self.capsdomain.emulator + + rhel6 = self.conn.enable_unsupported_rhel_opts(emu) + self.storage_browser.enable_unsupported_rhel_opts = rhel6 + self.storage_browser.set_vm_name(self.get_config_name()) self.storage_browser.set_finish_cb(callback) self.storage_browser.set_browse_reason(reason) diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py index 4ad02798e..51b44e442 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -245,13 +245,7 @@ class vmmDomain(vmmLibvirtObject): return bool(self._install_abort) 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")) + return self.connection.enable_unsupported_rhel_opts(self.get_emulator()) def is_read_only(self): if self.connection.is_read_only(): diff --git a/src/virtManager/storagebrowse.py b/src/virtManager/storagebrowse.py index 26caf1d39..105da9308 100644 --- a/src/virtManager/storagebrowse.py +++ b/src/virtManager/storagebrowse.py @@ -48,6 +48,7 @@ class vmmStorageBrowser(vmmGObjectUI): # Arguments to pass to util.browse_local for local storage self.browse_reason = None + self.enable_unsupported_rhel_opts = True self.local_args = {} self.window.signal_autoconnect({ @@ -321,8 +322,9 @@ class vmmStorageBrowser(vmmGObjectUI): vols = pool.get_volumes() for key in vols.keys(): vol = vols[key] - sensitive = (not dironly or vol.get_format() == 'dir') + sensitive = True path = vol.get_target_path() + fmt = vol.get_format() or "" namestr = None try: @@ -336,9 +338,14 @@ class vmmStorageBrowser(vmmGObjectUI): logging.exception("Failed to determine if storage volume in " "use.") + if dironly and fmt != 'dir': + sensitive = False + elif not self.enable_unsupported_rhel_opts: + if fmt == "vmdk": + sensitive = False model.append([key, vol.get_name(), vol.get_pretty_capacity(), - vol.get_format() or "", namestr, sensitive]) + fmt, namestr, sensitive]) def show_err(self, info, details=None): self.err.show_err(info, diff --git a/src/virtManager/uihelpers.py b/src/virtManager/uihelpers.py index d39838f1c..375070875 100644 --- a/src/virtManager/uihelpers.py +++ b/src/virtManager/uihelpers.py @@ -338,12 +338,15 @@ def build_vnc_keymap_combo(vm, combo, no_default=False): ##################################### def build_storage_format_combo(vm, combo): - ignore = vm dev_model = gtk.ListStore(str) combo.set_model(dev_model) combo.set_text_column(0) - for m in ["raw", "qcow2", "vmdk"]: + formats = ["raw", "qcow2"] + if vm.enable_unsupported_rhel_opts(): + formats.append("vmdk") + + for m in formats: dev_model.append([m]) combo.set_active(0)