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

Martin Kletzander mkletzan at redhat.com
Wed Nov 26 04:32:11 UTC 2014


On Tue, Nov 25, 2014 at 02:29:26PM +0100, Cédric Bosdonnat wrote:
>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")

You have the source set from a random value from self.dirs, ACK if you
use "%s/var" % self.dist instead of source.

Martin

>         self.add_mounts()
>
>     def get_expanded_unit_template(self, unit):
>--
>2.1.2
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141126/424b2dea/attachment-0001.sig>


More information about the libvir-list mailing list