mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
fsdetails: Use combo entry for format list
And stop listing all the crazy qemu formats
This commit is contained in:
parent
f13d10590d
commit
c5033c02d5
@ -505,7 +505,11 @@ Foo bar baz & yeah boii < > yeahfoo
|
||||
<source usage='8192' units='KiB'/>
|
||||
<target dir='/run'/>
|
||||
</filesystem>
|
||||
|
||||
<filesystem type='file' accessmode='passthrough'>
|
||||
<driver type='nbd' format='vmdk'/>
|
||||
<source file='/root/container.vmdk'/>
|
||||
<target dir='/home'/>
|
||||
</filesystem>
|
||||
|
||||
<!-- tpm devices -->
|
||||
<tpm model='tpm-tis'>
|
||||
|
@ -443,7 +443,7 @@ class AddHardware(uiutils.UITestCase):
|
||||
tab.find("File", "menu item").click()
|
||||
tab.find("Driver:", "combo box").click()
|
||||
tab.find("Nbd", "menu item").click()
|
||||
tab.find("Format:", "combo box").click()
|
||||
tab.find("Format:", "combo box").click_combo_entry()
|
||||
tab.find("qcow2", "menu item").click()
|
||||
tab.find("Browse...", "push button").click()
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.2 -->
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<object class="GtkAdjustment" id="adjustment6">
|
||||
@ -390,7 +390,14 @@
|
||||
<object class="GtkComboBox" id="fs-format-combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_entry">True</property>
|
||||
<signal name="changed" handler="on_fs_format_combo_changed" swapped="no"/>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="fs-format-entry">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -258,7 +258,7 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
disk.set_vol_install(vol_install)
|
||||
|
||||
fmt = self.conn.get_default_storage_format()
|
||||
if fmt in disk.get_vol_install().list_formats():
|
||||
if disk.get_vol_install().supports_property("format"):
|
||||
logging.debug("Using default prefs format=%s for path=%s",
|
||||
fmt, disk.path)
|
||||
disk.get_vol_install().format = fmt
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
from virtinst import DeviceFilesystem, StorageVolume
|
||||
from virtinst import DeviceFilesystem
|
||||
from . import uiutil
|
||||
from .baseclass import vmmGObjectUI
|
||||
from .storagebrowse import vmmStorageBrowser
|
||||
@ -102,20 +102,17 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
self.widget("fs-type-label").set_text(DeviceFilesystem.TYPE_MOUNT)
|
||||
|
||||
simple_store_set("fs-mode-combo", DeviceFilesystem.MODES + [None])
|
||||
|
||||
drivers = []
|
||||
if self.conn.is_qemu() or self.conn.is_test():
|
||||
simple_store_set("fs-driver-combo",
|
||||
[DeviceFilesystem.DRIVER_PATH,
|
||||
DeviceFilesystem.DRIVER_HANDLE,
|
||||
None])
|
||||
elif self.conn.is_lxc():
|
||||
simple_store_set("fs-driver-combo",
|
||||
[DeviceFilesystem.DRIVER_LOOP,
|
||||
DeviceFilesystem.DRIVER_NBD,
|
||||
None])
|
||||
else:
|
||||
simple_store_set("fs-driver-combo", [None])
|
||||
simple_store_set("fs-format-combo",
|
||||
StorageVolume.ALL_FORMATS, capitalize=False)
|
||||
drivers += [DeviceFilesystem.DRIVER_PATH,
|
||||
DeviceFilesystem.DRIVER_HANDLE]
|
||||
if self.conn.is_lxc() or self.conn.is_test():
|
||||
drivers += [DeviceFilesystem.DRIVER_LOOP,
|
||||
DeviceFilesystem.DRIVER_NBD]
|
||||
simple_store_set("fs-driver-combo", drivers + [None])
|
||||
|
||||
simple_store_set("fs-format-combo", ["raw", "qcow2"], capitalize=False)
|
||||
simple_store_set("fs-wrpolicy-combo",
|
||||
DeviceFilesystem.WRPOLICIES + [None])
|
||||
self.show_pair_combo("fs-type",
|
||||
@ -189,13 +186,7 @@ class vmmFSDetails(vmmGObjectUI):
|
||||
combo = self.widget("%s-combo" % name)
|
||||
label = self.widget("%s-label" % name)
|
||||
|
||||
idx = -1
|
||||
model_list = [x[0] for x in combo.get_model()]
|
||||
model_in_list = (value in model_list)
|
||||
if model_in_list:
|
||||
idx = model_list.index(value)
|
||||
|
||||
combo.set_active(idx)
|
||||
uiutil.set_list_selection(combo, value)
|
||||
if label:
|
||||
label.set_text(value or "default")
|
||||
|
||||
|
@ -529,9 +529,6 @@ class StorageVolume(_StorageObject):
|
||||
"""
|
||||
Base class for building and installing libvirt storage volume xml
|
||||
"""
|
||||
ALL_FORMATS = ["raw", "bochs", "cloop", "dmg", "iso", "qcow",
|
||||
"qcow2", "qed", "vmdk", "vpc", "fat", "vhd", "vdi"]
|
||||
|
||||
@staticmethod
|
||||
def get_file_extension_for_format(fmt):
|
||||
if not fmt:
|
||||
@ -705,16 +702,6 @@ class StorageVolume(_StorageObject):
|
||||
return self._supports_format()
|
||||
return hasattr(self, propname)
|
||||
|
||||
def list_formats(self):
|
||||
if self._supports_format():
|
||||
return self.ALL_FORMATS
|
||||
return []
|
||||
|
||||
def list_create_formats(self):
|
||||
if self._supports_format():
|
||||
return ["raw", "qcow", "qcow2", "qed", "vmdk", "vpc", "vdi"]
|
||||
return None
|
||||
|
||||
|
||||
##################
|
||||
# Build routines #
|
||||
|
Loading…
Reference in New Issue
Block a user