Discussion:
[lxc-devel] [lxd/master] lxd/storage: user_subvol_rm_allowed for btrfs
stgraber on Github
2018-11-23 22:27:54 UTC
Permalink
From 2bfebbe35fca732f54d90ebccd63a293e081b2e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <***@ubuntu.com>
Date: Fri, 23 Nov 2018 17:25:28 -0500
Subject: [PATCH] lxd/storage: user_subvol_rm_allowed for btrfs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This sets user_subvol_rm_allowed for btrfs on block storage, matching
the default behavior on the btrfs backend.

block mount options overrides will still override this default.

Closes #5301

Signed-off-by: Stéphane Graber <***@ubuntu.com>
---
lxd/storage_ceph_utils.go | 4 ++++
lxd/storage_lvm_utils.go | 4 ++++
2 files changed, 8 insertions(+)

diff --git a/lxd/storage_ceph_utils.go b/lxd/storage_ceph_utils.go
index a8f9a84b89..73ad4b4052 100644
--- a/lxd/storage_ceph_utils.go
+++ b/lxd/storage_ceph_utils.go
@@ -696,6 +696,10 @@ func (s *storageCeph) getRBDMountOptions() string {
return s.pool.Config["volume.block.mount_options"]
}

+ if s.getRBDFilesystem() == "btrfs" {
+ return "user_subvol_rm_allowed,discard"
+ }
+
return "discard"
}

diff --git a/lxd/storage_lvm_utils.go b/lxd/storage_lvm_utils.go
index 9e2eab01ab..f98d372f1d 100644
--- a/lxd/storage_lvm_utils.go
+++ b/lxd/storage_lvm_utils.go
@@ -95,6 +95,10 @@ func (s *storageLvm) getLvmMountOptions() string {
return s.pool.Config["volume.block.mount_options"]
}

+ if s.getRBDFilesystem() == "btrfs" {
+ return "user_subvol_rm_allowed,discard"
+ }
+
return "discard"
}

Loading...