mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-12 09:18:00 +03:00
Disable VMDK option if on RHEL6
RHEL6 qemu doesn't accept VMDK files
This commit is contained in:
parent
64ccb02e08
commit
1f46603edf
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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():
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user