From 550d4a49678df203ecbda6e469f0c9d4b26c1a43 Mon Sep 17 00:00:00 2001
From: Nikos Skalkotos <skalkoto@grnet.gr>
Date: Thu, 14 Jun 2012 17:46:00 +0300
Subject: [PATCH] Allow readonly mount in DiskDevice class

Add an option to DiskDevice's mount method to allow readonly mount
---
 image_creator/disk.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/image_creator/disk.py b/image_creator/disk.py
index 38df2fd..6cd910b 100644
--- a/image_creator/disk.py
+++ b/image_creator/disk.py
@@ -238,9 +238,10 @@ class DiskDevice(object):
 
         self.progressbar.goto((position * 100) // total)
 
-    def mount(self):
+    def mount(self, readonly=False):
         """Mount all disk partitions in a correct order."""
 
+        mount = self.g.mount_ro if readonly else self.g.mount
         self.out.output("Mounting image...", False)
         mps = self.g.inspect_get_mountpoints(self.root)
 
@@ -256,7 +257,7 @@ class DiskDevice(object):
         mps.sort(compare)
         for mp, dev in mps:
             try:
-                self.g.mount(dev, mp)
+                mount(dev, mp)
             except RuntimeError as msg:
                 self.out.warn("%s (ignored)" % msg)
         self.out.success("done")
-- 
GitLab