[libvirt] [sandbox][PATCH 2/2] virt-sandbox-service: mount /var after all other file systems

Cédric Bosdonnat cbosdonnat at suse.com
Tue Nov 25 13:29:26 UTC 2014


When creating a sandbox with an image file, the /var folder contains
the mounted image. If we mount it before other file systems, how
could we possibly mount them? The new /var won't contain the mounted
image.
---
 bin/virt-sandbox-service | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 7f72107..701bd6e 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -658,7 +658,7 @@ WantedBy=multi-user.target
         self.config.add_mount(mount)
 
         for d in self.BIND_SYSTEM_DIRS:
-            if os.path.exists(d):
+            if d != "/var" and os.path.exists(d):
                 source = "%s%s" % ( self.dest, d)
                 self.add_bind_mount(source, d)
 
@@ -677,6 +677,10 @@ WantedBy=multi-user.target
             if not found:
                 source = "%s%s" % ( self.dest, d)
                 self.add_bind_mount(source, d)
+
+        # /var contains the mounted image if there is an image: should be the
+        # last thing to mount
+        self.add_bind_mount(source, "/var")
         self.add_mounts()
 
     def get_expanded_unit_template(self, unit):
-- 
2.1.2




More information about the libvir-list mailing list