[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH] virt-install: Add support for fs readonly attribute



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 linux vnet ibm com>
---

 virtinst/VirtualFilesystem.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/virtinst/VirtualFilesystem.py b/virtinst/VirtualFilesystem.py
index 1e67004..76631c1 100644
--- a/virtinst/VirtualFilesystem.py
+++ b/virtinst/VirtualFilesystem.py
@@ -74,6 +74,7 @@ class VirtualFilesystem(VirtualDevice.VirtualDevice):
         self._driver = None
         self._target = None
         self._source = None
+        self._readonly = None
 
         if self._is_parse():
             return
@@ -98,6 +99,13 @@ class VirtualFilesystem(VirtualDevice.VirtualDevice):
         self._mode = val
     mode = _xml_property(_get_mode, _set_mode, xpath="./@accessmode")
 
+    def _get_readonly(self):
+       return self._readonly
+    def _set_readonly(self, val):
+       self._readonly = val
+    readonly = _xml_property(_get_readonly, _set_readonly,
+                             xpath="./readonly", is_bool=True) 
+
     def _get_driver(self):
         return self._driver
     def _set_driver(self, val):
@@ -154,6 +162,7 @@ class VirtualFilesystem(VirtualDevice.VirtualDevice):
         driver = self.driver
         source = self.source
         target = self.target
+        readonly = self.readonly
 
         if mode == self.MODE_DEFAULT:
             mode = None
@@ -181,6 +190,9 @@ class VirtualFilesystem(VirtualDevice.VirtualDevice):
                                             source)
         fsxml += "      <target dir='%s'/>\n" % target
 
+        if readonly:
+           fsxml += "      <readonly/>\n"
+  
         fsxml += "    </filesystem>"
 
         return fsxml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]