The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4764
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) === Closes #4731 Signed-off-by: Stéphane Graber <[email protected]>
From 866f48b8ee239366770b5e1cd45e56978d4da49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Mon, 9 Jul 2018 14:13:15 -0400 Subject: [PATCH] lxd/storage/btrfs: Fix recursive snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4731 Signed-off-by: Stéphane Graber <[email protected]> --- lxd/storage_btrfs.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go index 54666d2cd..17f6038bb 100644 --- a/lxd/storage_btrfs.go +++ b/lxd/storage_btrfs.go @@ -2232,12 +2232,6 @@ func (s *storageBtrfs) btrfsPoolVolumeSnapshot(source string, dest string, reado } func (s *storageBtrfs) btrfsPoolVolumesSnapshot(source string, dest string, readonly bool, recursive bool) error { - // First snapshot the root - err := s.btrfsPoolVolumeSnapshot(source, dest, readonly) - if err != nil { - return err - } - // Now snapshot all subvolumes of the root. if recursive { // Get a list of subvolumes of the root @@ -2255,6 +2249,12 @@ func (s *storageBtrfs) btrfsPoolVolumesSnapshot(source string, dest string, read logger.Warnf("Subvolumes detected, ignoring ro flag") } + // First snapshot the root + err = s.btrfsPoolVolumeSnapshot(source, dest, readonly) + if err != nil { + return err + } + for _, subsubvol := range subsubvols { // Clear the target for the subvol to use os.Remove(path.Join(dest, subsubvol)) @@ -2264,6 +2264,11 @@ func (s *storageBtrfs) btrfsPoolVolumesSnapshot(source string, dest string, read return err } } + } else { + err := s.btrfsPoolVolumeSnapshot(source, dest, readonly) + if err != nil { + return err + } } return nil
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
