mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
addhardware: Drop 'storage format' field
Originally this made sense, as it was the only way to specify a non-default storage format when creating new storage. Nowadays the storage browser is a full featured storage manager... and this field is a bit confusing WRT whether it's used for creating new storage, or informing libvirt about an existing image's format. Drop it from the addhardware wizard, and simplify what we show in the details wizard as well.
This commit is contained in:
parent
6861d467a4
commit
16a744749f
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.19.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.8"/>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
@ -224,20 +224,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Stor_age format:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">storage-format-combobox-entry</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label28">
|
||||
<property name="visible">True</property>
|
||||
@ -252,22 +238,6 @@
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="storage-format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="storage-format-combobox-entry">
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="storage-cache">
|
||||
<property name="visible">True</property>
|
||||
|
@ -2523,7 +2523,7 @@ if you know what you are doing.</small></property>
|
||||
<property name="invisible_char">●</property>
|
||||
<signal name="changed" handler="on_cpu_vcpupin_changed" swapped="no"/>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="-vcpupin-atkobject">
|
||||
<object class="AtkObject" id="cpu-vcpupin-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Virtual CPU Affinity Select</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -3780,16 +3780,10 @@ if you know what you are doing.</small></property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="disk-format">
|
||||
<object class="GtkEntry" id="disk-format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_entry">True</property>
|
||||
<signal name="changed" handler="on_disk_format_changed" swapped="no"/>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="storage-format-combobox-entry">
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<signal name="changed" handler="on_disk_format_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -3849,7 +3843,7 @@ if you know what you are doing.</small></property>
|
||||
<property name="ypad">4</property>
|
||||
<property name="label" translatable="yes">Storage forma_t:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">storage-format-combobox-entry</property>
|
||||
<property name="mnemonic_widget">disk-format</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="yalign">0</property>
|
||||
</object>
|
||||
|
@ -91,7 +91,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
self.addstorage = vmmAddStorage(self.conn, self.builder, self.topwin)
|
||||
self.widget("storage-align").add(self.addstorage.top_box)
|
||||
self.addstorage.connect("browse-clicked", self._browse_storage_cb)
|
||||
self.addstorage.connect("storage-toggled", self._toggle_storage_select)
|
||||
|
||||
self.builder.connect_signals({
|
||||
"on_create_cancel_clicked" : self.close,
|
||||
@ -230,9 +229,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
cache_list = self.widget("storage-cache")
|
||||
self.build_disk_cache_combo(self.vm, cache_list)
|
||||
|
||||
# Disk format mode
|
||||
self._populate_disk_format_combo_wrapper(True)
|
||||
|
||||
# Input device type
|
||||
input_list = self.widget("input-type")
|
||||
input_model = Gtk.ListStore(str, str, str)
|
||||
@ -408,7 +404,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
def _reset_state(self):
|
||||
# Storage init
|
||||
self._populate_disk_format_combo_wrapper(True)
|
||||
self.widget("storage-devtype").set_active(0)
|
||||
self.widget("storage-devtype").emit("changed")
|
||||
self.addstorage.reset_state()
|
||||
@ -740,32 +735,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
if row[0] in bus_map[devtype]:
|
||||
model.append(row)
|
||||
|
||||
@staticmethod
|
||||
def populate_disk_format_combo(vm, combo, create):
|
||||
model = Gtk.ListStore(str)
|
||||
combo.set_model(model)
|
||||
uiutil.init_combo_text_column(combo, 0)
|
||||
|
||||
formats = ["raw", "qcow2", "qed"]
|
||||
no_create_formats = []
|
||||
if not vm.stable_defaults():
|
||||
formats.append("vmdk")
|
||||
no_create_formats.append("vdi")
|
||||
|
||||
for m in formats:
|
||||
model.append([m])
|
||||
if not create:
|
||||
for m in no_create_formats:
|
||||
model.append([m])
|
||||
|
||||
if create:
|
||||
fmt = vm.conn.get_default_storage_format()
|
||||
combo.set_active(0)
|
||||
for row in model:
|
||||
if row[0] == fmt:
|
||||
combo.set_active_iter(row.iter)
|
||||
break
|
||||
|
||||
@staticmethod
|
||||
def populate_controller_model_combo(combo, controller_type):
|
||||
model = combo.get_model()
|
||||
@ -911,12 +880,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
model.append([_("No Devices Available"), None])
|
||||
uiutil.set_list_selection_by_number(devlist, 0)
|
||||
|
||||
def _populate_disk_format_combo_wrapper(self, create):
|
||||
format_list = self.widget("storage-format")
|
||||
self.populate_disk_format_combo(self.vm, format_list, create)
|
||||
if not create:
|
||||
format_list.get_child().set_text("")
|
||||
|
||||
def _populate_controller_type(self):
|
||||
widget = self.widget("controller-type")
|
||||
model = widget.get_model()
|
||||
@ -1167,10 +1130,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
# Device page listeners #
|
||||
#########################
|
||||
|
||||
def _toggle_storage_select(self, ignore, src):
|
||||
act = src.get_active()
|
||||
self._populate_disk_format_combo_wrapper(not act)
|
||||
|
||||
def _change_storage_devtype(self, ignore):
|
||||
devtype = uiutil.get_list_selection(
|
||||
self.widget("storage-devtype"))
|
||||
@ -1520,7 +1479,6 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
self.widget("storage-devtype"))
|
||||
cache = uiutil.get_list_selection(
|
||||
self.widget("storage-cache"))
|
||||
fmt = uiutil.get_list_selection(self.widget("storage-format"))
|
||||
|
||||
controller_model = None
|
||||
if (bus == "scsi" and
|
||||
@ -1531,7 +1489,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
collidelist = [d.path for d in self.vm.get_disk_devices()]
|
||||
try:
|
||||
disk = self.addstorage.validate_storage(self.vm.get_name(),
|
||||
collidelist=collidelist, device=device, fmt=fmt or None)
|
||||
collidelist=collidelist, device=device)
|
||||
except Exception, e:
|
||||
return self.err.val_err(_("Storage parameter error."), e)
|
||||
|
||||
|
@ -242,8 +242,8 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
def is_default_storage(self):
|
||||
return self.widget("storage-create").get_active()
|
||||
|
||||
def validate_storage(self, vmname, path=None,
|
||||
device="disk", collidelist=None, fmt=None):
|
||||
def validate_storage(self, vmname,
|
||||
path=None, device="disk", collidelist=None):
|
||||
if self.is_default_storage():
|
||||
# Make sure default pool is running
|
||||
ret = self._check_default_pool_active()
|
||||
@ -270,15 +270,17 @@ class vmmAddStorage(vmmGObjectUI):
|
||||
|
||||
vol_install = virtinst.VirtualDisk.build_vol_install(
|
||||
disk.conn, os.path.basename(disk.path), pool,
|
||||
size, sparse, fmt=fmt)
|
||||
size, sparse)
|
||||
disk.set_vol_install(vol_install)
|
||||
|
||||
if not fmt:
|
||||
fmt = self.conn.get_default_storage_format()
|
||||
if (self.is_default_storage() and
|
||||
fmt in disk.get_vol_install().list_formats()):
|
||||
logging.debug("Setting disk format from prefs: %s", fmt)
|
||||
disk.get_vol_install().format = fmt
|
||||
fmt = self.conn.get_default_storage_format()
|
||||
if fmt in disk.get_vol_install().list_formats():
|
||||
logging.debug("Using default prefs format=%s for path=%s",
|
||||
fmt, disk.path)
|
||||
disk.get_vol_install().format = fmt
|
||||
else:
|
||||
logging.debug("path=%s can not use default prefs format=%s, "
|
||||
"not setting it", disk.path, fmt)
|
||||
|
||||
disk.validate()
|
||||
return disk
|
||||
|
@ -978,10 +978,6 @@ class vmmDetails(vmmGObjectUI):
|
||||
disk_io = self.widget("disk-io")
|
||||
vmmAddHardware.build_disk_io_combo(self.vm, disk_io)
|
||||
|
||||
# Disk format combo
|
||||
format_list = self.widget("disk-format")
|
||||
vmmAddHardware.populate_disk_format_combo(self.vm, format_list, False)
|
||||
|
||||
# Disk bus combo
|
||||
disk_bus = self.widget("disk-bus")
|
||||
vmmAddHardware.build_disk_bus_combo(self.vm, disk_bus)
|
||||
@ -2075,8 +2071,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
kwargs["io"] = uiutil.get_list_selection(self.widget("disk-io"))
|
||||
|
||||
if self.edited(EDIT_DISK_FORMAT):
|
||||
kwargs["driver_type"] = uiutil.get_list_selection(
|
||||
self.widget("disk-format"))
|
||||
kwargs["driver_type"] = self.widget("disk-format").get_text()
|
||||
|
||||
if self.edited(EDIT_DISK_SERIAL):
|
||||
kwargs["serial"] = self.get_text("disk-serial")
|
||||
@ -2571,10 +2566,6 @@ class vmmDetails(vmmGObjectUI):
|
||||
driver_type = disk.driver_type or ""
|
||||
serial = disk.serial
|
||||
|
||||
show_format = (not self.is_customize_dialog or
|
||||
virtinst.VirtualDisk.path_definitely_exists(
|
||||
disk.conn, disk.path))
|
||||
|
||||
size = "-"
|
||||
if path:
|
||||
size = _("Unknown")
|
||||
@ -2615,8 +2606,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
uiutil.set_list_selection(self.widget("disk-cache"), cache)
|
||||
uiutil.set_list_selection(self.widget("disk-io"), io)
|
||||
|
||||
self.widget("disk-format").set_sensitive(show_format)
|
||||
self.widget("disk-format").get_child().set_text(driver_type)
|
||||
self.widget("disk-format").set_text(driver_type)
|
||||
self.widget("disk-format-warn").hide()
|
||||
|
||||
vmmAddHardware.populate_disk_bus_combo(self.vm, devtype,
|
||||
|
Loading…
x
Reference in New Issue
Block a user