virt-manager: Add checkbox controlling disk 'removable' flag
(crobinso: Fix to use grid rework)
This commit is contained in:
parent
6de06778d3
commit
c45e1ef6b8
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.16.0 on Fri Oct 4 08:00:20 2013 -->
|
||||
<!-- Generated with glade 3.16.0 on Fri Oct 4 08:04:58 2013 -->
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||
|
@ -3630,7 +3630,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_disk_shareable_changed" swapped="no"/>
|
||||
</object>
|
||||
|
@ -3760,6 +3760,39 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label46">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Removab_le:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">disk-removable</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="disk-removable">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_disk_removable_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
|
@ -66,6 +66,7 @@ EDIT_INIT,
|
|||
|
||||
EDIT_DISK_RO,
|
||||
EDIT_DISK_SHARE,
|
||||
EDIT_DISK_REMOVABLE,
|
||||
EDIT_DISK_CACHE,
|
||||
EDIT_DISK_IO,
|
||||
EDIT_DISK_BUS,
|
||||
|
@ -94,7 +95,7 @@ EDIT_WATCHDOG_ACTION,
|
|||
EDIT_CONTROLLER_MODEL,
|
||||
|
||||
EDIT_TPM_TYPE,
|
||||
) = range(1, 41)
|
||||
) = range(1, 42)
|
||||
|
||||
|
||||
# Columns in hw list model
|
||||
|
@ -475,6 +476,7 @@ class vmmDetails(vmmGObjectUI):
|
|||
|
||||
"on_disk_readonly_changed": lambda *x: self.enable_apply(x, EDIT_DISK_RO),
|
||||
"on_disk_shareable_changed": lambda *x: self.enable_apply(x, EDIT_DISK_SHARE),
|
||||
"on_disk_removable_changed": lambda *x: self.enable_apply(x, EDIT_DISK_REMOVABLE),
|
||||
"on_disk_cache_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_CACHE),
|
||||
"on_disk_io_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_IO),
|
||||
"on_disk_bus_combo_changed": lambda *x: self.enable_apply(x, EDIT_DISK_BUS),
|
||||
|
@ -2157,6 +2159,10 @@ class vmmDetails(vmmGObjectUI):
|
|||
add_define(self.vm.define_disk_shareable,
|
||||
dev_id_info, do_shareable)
|
||||
|
||||
if self.edited(EDIT_DISK_REMOVABLE):
|
||||
do_removable = bool(self.widget("disk-removable").get_active())
|
||||
add_define(self.vm.define_disk_removable, dev_id_info, do_removable)
|
||||
|
||||
if self.edited(EDIT_DISK_CACHE):
|
||||
cache = self.get_combo_entry("disk-cache")
|
||||
add_define(self.vm.define_disk_cache, dev_id_info, cache)
|
||||
|
@ -2766,6 +2772,7 @@ class vmmDetails(vmmGObjectUI):
|
|||
ro = disk.read_only
|
||||
share = disk.shareable
|
||||
bus = disk.bus
|
||||
removable = disk.removable
|
||||
addr = disk.address.type
|
||||
idx = disk.disk_bus_index
|
||||
cache = disk.driver_cache
|
||||
|
@ -2797,6 +2804,12 @@ class vmmDetails(vmmGObjectUI):
|
|||
|
||||
is_cdrom = (devtype == virtinst.VirtualDisk.DEVICE_CDROM)
|
||||
is_floppy = (devtype == virtinst.VirtualDisk.DEVICE_FLOPPY)
|
||||
is_usb = (bus == "usb")
|
||||
|
||||
can_set_removable = (is_usb and (self.conn.is_qemu() or
|
||||
self.conn.is_test_conn()))
|
||||
if removable is None:
|
||||
removable = False
|
||||
|
||||
if addr == "spapr-vio":
|
||||
bus = "spapr-vscsi"
|
||||
|
@ -2809,6 +2822,9 @@ class vmmDetails(vmmGObjectUI):
|
|||
self.widget("disk-readonly").set_active(ro)
|
||||
self.widget("disk-readonly").set_sensitive(not is_cdrom)
|
||||
self.widget("disk-shareable").set_active(share)
|
||||
self.widget("disk-removable").set_active(removable)
|
||||
uihelpers.set_grid_row_visible(self.widget("disk-removable"),
|
||||
can_set_removable)
|
||||
self.widget("disk-size").set_text(size)
|
||||
self.set_combo_entry("disk-cache", cache)
|
||||
self.set_combo_entry("disk-io", io)
|
||||
|
|
|
@ -646,6 +646,10 @@ class vmmDomain(vmmLibvirtObject):
|
|||
def change(editdev):
|
||||
editdev.shareable = do_shareable
|
||||
return self._redefine_device(change, devobj)
|
||||
def define_disk_removable(self, devobj, do_removable):
|
||||
def change(editdev):
|
||||
editdev.removable = do_removable
|
||||
return self._redefine_device(change, devobj)
|
||||
def define_disk_cache(self, devobj, new_cache):
|
||||
def change(editdev):
|
||||
editdev.driver_cache = new_cache or None
|
||||
|
|
Loading…
Reference in New Issue