[virt-tools-list] [PATCH] virt-manager: Add support for fs readonly attribute
Deepak C Shetty
deepakcs at linux.vnet.ibm.com
Thu Dec 22 18:10:17 UTC 2011
Enables exporting filesytem as a readonly mount for guest, by
default read-write access is given (currently only works for
QEMU/KVM driver)
The support for the same in libvirt was added recently at ...
https://www.redhat.com/archives/libvir-list/2011-December/msg00937.html
Signed-off-by: Deepak C Shetty <deepakcs at linux.vnet.ibm.com>
---
src/virtManager/addhardware.py | 17 +++++++++++++++++
src/virtManager/details.py | 4 ++++
src/vmm-add-hardware.glade | 16 ++++++++++++++++
src/vmm-details.glade | 28 ++++++++++++++++++++++++++++
4 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py
index 1b0f004..3e746d5 100644
--- a/src/virtManager/addhardware.py
+++ b/src/virtManager/addhardware.py
@@ -328,6 +328,7 @@ class vmmAddHardware(vmmGObjectUI):
VirtualFilesystem.TYPE_TEMPLATE])
simple_store_set("fs-mode-combo", VirtualFilesystem.MOUNT_MODES)
self.show_pair_combo("fs-type", self.conn.is_openvz())
+ self.show_check_button("fs-readonly", self.conn.is_qemu())
# Smartcard widgets
combo = self.widget("smartcard-mode")
@@ -481,6 +482,7 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("fs-mode-combo").set_active(0)
self.widget("fs-source").set_text("")
self.widget("fs-target").set_text("")
+ self.widget("fs-readonly").set_active(False)
# Hide all notebook pages, so the wizard isn't as big as the largest
# page
@@ -731,6 +733,14 @@ class vmmAddHardware(vmmGObjectUI):
return combo.get_model()[combo.get_active()][0]
+ def get_config_fs_readonly(self):
+ name = "fs-readonly"
+ check = self.widget(name)
+ if not check.get_property("visible"):
+ return None
+
+ return check.get_active()
+
# Smartcard getters
def get_config_smartcard_mode(self):
mode = self.widget("smartcard-mode")
@@ -862,6 +872,10 @@ class vmmAddHardware(vmmGObjectUI):
combo.set_property("visible", show_combo)
label.set_property("visible", not show_combo)
+ def show_check_button(self, basename, show):
+ check = self.widget(basename)
+ check.set_property("visible", show)
+
# Storage listeners
def browse_storage(self, ignore1):
self._browse_file(self.widget("config-storage-entry"))
@@ -1373,6 +1387,7 @@ class vmmAddHardware(vmmGObjectUI):
target = self.widget("fs-target").get_text()
mode = self.get_config_fs_mode()
fstype = self.get_config_fs_type()
+ readonly = self.get_config_fs_readonly()
if not source:
return self.err.val_err(_("A filesystem source must be specified"))
@@ -1387,6 +1402,8 @@ class vmmAddHardware(vmmGObjectUI):
self._dev.mode = mode
if fstype:
self._dev.type = fstype
+ if readonly:
+ self._dev.readonly = readonly
except Exception, e:
return self.err.val_err(_("Filesystem parameter error"), e)
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index fcd0652..2b45dc1 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -3137,6 +3137,10 @@ class vmmDetails(vmmGObjectUI):
self.widget("fs-mode").set_text(dev.mode)
self.widget("fs-source").set_text(dev.source)
self.widget("fs-target").set_text(dev.target)
+ if dev.readonly:
+ self.widget("fs-readonly").set_text("Yes")
+ else:
+ self.widget("fs-readonly").set_text("No")
def refresh_boot_page(self):
# Refresh autostart
diff --git a/src/vmm-add-hardware.glade b/src/vmm-add-hardware.glade
index 3d13c49..a0b463f 100644
--- a/src/vmm-add-hardware.glade
+++ b/src/vmm-add-hardware.glade
@@ -2161,6 +2161,22 @@ access in the guest.</property>
</packing>
</child>
<child>
+ <widget class="GtkCheckButton" id="fs-readonly">
+ <property name="label" translatable="yes">E_xport filesystem as readonly mount</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox" id="hbox13">
<property name="visible">True</property>
<property name="spacing">6</property>
diff --git a/src/vmm-details.glade b/src/vmm-details.glade
index 852db1f..660f4b9 100644
--- a/src/vmm-details.glade
+++ b/src/vmm-details.glade
@@ -5715,6 +5715,19 @@ I/O:</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel" id="fs-readonly-title">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Readonly Filesystem:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel" id="fs-mode">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -5759,6 +5772,21 @@ I/O:</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel" id="fs-readonly">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ <property name="ellipsize">end</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel" id="label67">
<property name="visible">True</property>
<property name="xalign">0</property>
More information about the virt-tools-list
mailing list