The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4073

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
dir and btrfs allow the bind-mounting of an existing fs path, as this
can be outside of the snap's mount namespace, we need to wrap those
paths using shared.HostPath.

Signed-off-by: Stéphane Graber <[email protected]>
From 215e8425299923da9ae1712ff70039d81cad97cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Tue, 5 Dec 2017 01:20:12 -0500
Subject: [PATCH] storage: Use HostPath for dir/btrfs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

dir and btrfs allow the bind-mounting of an existing fs path, as this
can be outside of the snap's mount namespace, we need to wrap those
paths using shared.HostPath.

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxd/storage_btrfs.go | 6 +++---
 lxd/storage_dir.go   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 4b4bf37b8..20a2dd45b 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -108,7 +108,7 @@ func (s *storageBtrfs) StoragePoolCreate() error {
        s.pool.Config["volatile.initial_source"] = s.pool.Config["source"]
 
        isBlockDev := false
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                source = filepath.Join(shared.VarPath("disks"), 
fmt.Sprintf("%s.img", s.pool.Name))
                s.pool.Config["source"] = source
@@ -259,7 +259,7 @@ func (s *storageBtrfs) StoragePoolCreate() error {
 func (s *storageBtrfs) StoragePoolDelete() error {
        logger.Infof("Deleting BTRFS storage pool \"%s\".", s.pool.Name)
 
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                return fmt.Errorf("no \"source\" property found for the storage 
pool")
        }
@@ -324,7 +324,7 @@ func (s *storageBtrfs) StoragePoolDelete() error {
 func (s *storageBtrfs) StoragePoolMount() (bool, error) {
        logger.Debugf("Mounting BTRFS storage pool \"%s\".", s.pool.Name)
 
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                return false, fmt.Errorf("no \"source\" property found for the 
storage pool")
        }
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 3f59d3ec0..78e562fa7 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -56,7 +56,7 @@ func (s *storageDir) StoragePoolCreate() error {
 
        poolMntPoint := getStoragePoolMountPoint(s.pool.Name)
 
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                source = filepath.Join(shared.VarPath("storage-pools"), 
s.pool.Name)
                s.pool.Config["source"] = source
@@ -128,7 +128,7 @@ func (s *storageDir) StoragePoolCreate() error {
 func (s *storageDir) StoragePoolDelete() error {
        logger.Infof("Deleting DIR storage pool \"%s\".", s.pool.Name)
 
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                return fmt.Errorf("no \"source\" property found for the storage 
pool")
        }
@@ -163,7 +163,7 @@ func (s *storageDir) StoragePoolDelete() error {
 }
 
 func (s *storageDir) StoragePoolMount() (bool, error) {
-       source := s.pool.Config["source"]
+       source := shared.HostPath(s.pool.Config["source"])
        if source == "" {
                return false, fmt.Errorf("no \"source\" property found for the 
storage pool")
        }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to