[lxc-devel] [lxd/master] Various storage cleanups

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Aug 12 10:55:41 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190812/4aa4ccb5/attachment-0001.bin>
-------------- next part --------------
From 3d78fd7951483dd740c569112d5a0f7d497600b9 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 2 May 2019 14:51:19 +0200
Subject: [PATCH 1/5] storage: Remove shared code from backends

This removes common code from the storage backends to the shared code
section.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/storage_btrfs.go  | 28 ----------------------------
 lxd/storage_ceph.go   | 29 -----------------------------
 lxd/storage_dir.go    | 29 -----------------------------
 lxd/storage_lvm.go    | 29 -----------------------------
 lxd/storage_shared.go | 28 ++++++++++++++++++++++++++++
 lxd/storage_zfs.go    | 29 -----------------------------
 6 files changed, 28 insertions(+), 144 deletions(-)

diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index d323f14f4a..8553e9259a 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -537,14 +537,6 @@ func (s *storageBtrfs) StoragePoolUpdate(writable *api.StoragePoolPut,
 	return nil
 }
 
-func (s *storageBtrfs) GetStoragePoolWritable() api.StoragePoolPut {
-	return s.pool.Writable()
-}
-
-func (s *storageBtrfs) SetStoragePoolWritable(writable *api.StoragePoolPut) {
-	s.pool.StoragePoolPut = *writable
-}
-
 func (s *storageBtrfs) GetContainerPoolInfo() (int64, string, string) {
 	return s.poolID, s.pool.Name, s.pool.Name
 }
@@ -806,14 +798,6 @@ func (s *storageBtrfs) StoragePoolVolumeRename(newName string) error {
 	return nil
 }
 
-func (s *storageBtrfs) GetStoragePoolVolumeWritable() api.StorageVolumePut {
-	return s.volume.Writable()
-}
-
-func (s *storageBtrfs) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
-	s.volume.StorageVolumePut = *writable
-}
-
 // Functions dealing with container storage.
 func (s *storageBtrfs) ContainerStorageReady(container container) bool {
 	containerMntPoint := getContainerMountPoint(container.Project(), s.pool.Name, container.Name())
@@ -3158,18 +3142,6 @@ func (s *storageBtrfs) StorageMigrationSink(conn *websocket.Conn, op *operation,
 	return rsyncStorageMigrationSink(conn, op, args)
 }
 
-func (s *storageBtrfs) GetStoragePool() *api.StoragePool {
-	return s.pool
-}
-
-func (s *storageBtrfs) GetStoragePoolVolume() *api.StorageVolume {
-	return s.volume
-}
-
-func (s *storageBtrfs) GetState() *state.State {
-	return s.s
-}
-
 func (s *storageBtrfs) StoragePoolVolumeSnapshotCreate(target *api.StorageVolumeSnapshotsPost) error {
 	logger.Infof("Creating BTRFS storage volume snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 279ea043a8..ff0fd419e4 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -15,7 +15,6 @@ import (
 
 	"github.com/lxc/lxd/lxd/db"
 	"github.com/lxc/lxd/lxd/project"
-	"github.com/lxc/lxd/lxd/state"
 	"github.com/lxc/lxd/shared"
 	"github.com/lxc/lxd/shared/api"
 	"github.com/lxc/lxd/shared/ioprogress"
@@ -297,22 +296,6 @@ func (s *storageCeph) StoragePoolUmount() (bool, error) {
 	return true, nil
 }
 
-func (s *storageCeph) GetStoragePoolWritable() api.StoragePoolPut {
-	return s.pool.StoragePoolPut
-}
-
-func (s *storageCeph) GetStoragePoolVolumeWritable() api.StorageVolumePut {
-	return s.volume.Writable()
-}
-
-func (s *storageCeph) SetStoragePoolWritable(writable *api.StoragePoolPut) {
-	s.pool.StoragePoolPut = *writable
-}
-
-func (s *storageCeph) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
-	s.volume.StorageVolumePut = *writable
-}
-
 func (s *storageCeph) GetContainerPoolInfo() (int64, string, string) {
 	return s.poolID, s.pool.Name, s.OSDPoolName
 }
@@ -2712,18 +2695,6 @@ func (s *storageCeph) StorageMigrationSink(conn *websocket.Conn, op *operation,
 	return rsyncStorageMigrationSink(conn, op, args)
 }
 
-func (s *storageCeph) GetStoragePool() *api.StoragePool {
-	return s.pool
-}
-
-func (s *storageCeph) GetStoragePoolVolume() *api.StorageVolume {
-	return s.volume
-}
-
-func (s *storageCeph) GetState() *state.State {
-	return s.s
-}
-
 func (s *storageCeph) StoragePoolVolumeSnapshotCreate(target *api.StorageVolumeSnapshotsPost) error {
 	logger.Debugf("Creating RBD storage volume snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 	sourcePath := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 40ee902a0c..fd0239f575 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -14,7 +14,6 @@ import (
 
 	"github.com/lxc/lxd/lxd/migration"
 	"github.com/lxc/lxd/lxd/project"
-	"github.com/lxc/lxd/lxd/state"
 	"github.com/lxc/lxd/lxd/storage/quota"
 	"github.com/lxc/lxd/shared"
 	"github.com/lxc/lxd/shared/api"
@@ -279,22 +278,6 @@ func (s *storageDir) StoragePoolUmount() (bool, error) {
 	return true, nil
 }
 
-func (s *storageDir) GetStoragePoolWritable() api.StoragePoolPut {
-	return s.pool.Writable()
-}
-
-func (s *storageDir) GetStoragePoolVolumeWritable() api.StorageVolumePut {
-	return s.volume.Writable()
-}
-
-func (s *storageDir) SetStoragePoolWritable(writable *api.StoragePoolPut) {
-	s.pool.StoragePoolPut = *writable
-}
-
-func (s *storageDir) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
-	s.volume.StorageVolumePut = *writable
-}
-
 func (s *storageDir) GetContainerPoolInfo() (int64, string, string) {
 	return s.poolID, s.pool.Name, s.pool.Name
 }
@@ -1466,18 +1449,6 @@ func (s *storageDir) StorageMigrationSink(conn *websocket.Conn, op *operation, a
 	return rsyncStorageMigrationSink(conn, op, args)
 }
 
-func (s *storageDir) GetStoragePool() *api.StoragePool {
-	return s.pool
-}
-
-func (s *storageDir) GetStoragePoolVolume() *api.StorageVolume {
-	return s.volume
-}
-
-func (s *storageDir) GetState() *state.State {
-	return s.s
-}
-
 func (s *storageDir) StoragePoolVolumeSnapshotCreate(target *api.StorageVolumeSnapshotsPost) error {
 	logger.Infof("Creating DIR storage volume snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index ae851fbcd9..0dfd90c906 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -15,7 +15,6 @@ import (
 
 	"github.com/lxc/lxd/lxd/migration"
 	"github.com/lxc/lxd/lxd/project"
-	"github.com/lxc/lxd/lxd/state"
 	"github.com/lxc/lxd/shared"
 	"github.com/lxc/lxd/shared/api"
 	"github.com/lxc/lxd/shared/ioprogress"
@@ -681,22 +680,6 @@ func (s *storageLvm) StoragePoolVolumeUmount() (bool, error) {
 	return ourUmount, nil
 }
 
-func (s *storageLvm) GetStoragePoolWritable() api.StoragePoolPut {
-	return s.pool.Writable()
-}
-
-func (s *storageLvm) GetStoragePoolVolumeWritable() api.StorageVolumePut {
-	return s.volume.Writable()
-}
-
-func (s *storageLvm) SetStoragePoolWritable(writable *api.StoragePoolPut) {
-	s.pool.StoragePoolPut = *writable
-}
-
-func (s *storageLvm) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
-	s.volume.StorageVolumePut = *writable
-}
-
 func (s *storageLvm) GetContainerPoolInfo() (int64, string, string) {
 	return s.poolID, s.pool.Name, s.getOnDiskPoolName()
 }
@@ -2289,18 +2272,6 @@ func (s *storageLvm) StorageMigrationSink(conn *websocket.Conn, op *operation, a
 	return rsyncStorageMigrationSink(conn, op, args)
 }
 
-func (s *storageLvm) GetStoragePool() *api.StoragePool {
-	return s.pool
-}
-
-func (s *storageLvm) GetStoragePoolVolume() *api.StorageVolume {
-	return s.volume
-}
-
-func (s *storageLvm) GetState() *state.State {
-	return s.s
-}
-
 func (s *storageLvm) StoragePoolVolumeSnapshotCreate(target *api.StorageVolumeSnapshotsPost) error {
 	logger.Debugf("Creating LVM storage volume for snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
diff --git a/lxd/storage_shared.go b/lxd/storage_shared.go
index 8fb89b2da6..11875f06ec 100644
--- a/lxd/storage_shared.go
+++ b/lxd/storage_shared.go
@@ -30,6 +30,34 @@ func (s *storageShared) GetStorageTypeVersion() string {
 	return s.sTypeVersion
 }
 
+func (s *storageShared) GetStoragePool() *api.StoragePool {
+	return s.pool
+}
+
+func (s *storageShared) GetStoragePoolVolume() *api.StorageVolume {
+	return s.volume
+}
+
+func (s *storageShared) GetState() *state.State {
+	return s.s
+}
+
+func (s *storageShared) GetStoragePoolWritable() api.StoragePoolPut {
+	return s.pool.Writable()
+}
+
+func (s *storageShared) GetStoragePoolVolumeWritable() api.StorageVolumePut {
+	return s.volume.Writable()
+}
+
+func (s *storageShared) SetStoragePoolWritable(writable *api.StoragePoolPut) {
+	s.pool.StoragePoolPut = *writable
+}
+
+func (s *storageShared) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
+	s.volume.StorageVolumePut = *writable
+}
+
 func (s *storageShared) createImageDbPoolVolume(fingerprint string) error {
 	// Fill in any default volume config.
 	volumeConfig := map[string]string{}
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 23176d87ec..2d671d667c 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -16,7 +16,6 @@ import (
 
 	"github.com/lxc/lxd/lxd/migration"
 	"github.com/lxc/lxd/lxd/project"
-	"github.com/lxc/lxd/lxd/state"
 	"github.com/lxc/lxd/lxd/util"
 	"github.com/lxc/lxd/shared"
 	"github.com/lxc/lxd/shared/api"
@@ -622,22 +621,6 @@ func (s *storageZfs) StoragePoolVolumeUmount() (bool, error) {
 	return ourUmount, nil
 }
 
-func (s *storageZfs) GetStoragePoolWritable() api.StoragePoolPut {
-	return s.pool.Writable()
-}
-
-func (s *storageZfs) GetStoragePoolVolumeWritable() api.StorageVolumePut {
-	return s.volume.Writable()
-}
-
-func (s *storageZfs) SetStoragePoolWritable(writable *api.StoragePoolPut) {
-	s.pool.StoragePoolPut = *writable
-}
-
-func (s *storageZfs) SetStoragePoolVolumeWritable(writable *api.StorageVolumePut) {
-	s.volume.StorageVolumePut = *writable
-}
-
 func (s *storageZfs) GetContainerPoolInfo() (int64, string, string) {
 	return s.poolID, s.pool.Name, s.getOnDiskPoolName()
 }
@@ -3369,18 +3352,6 @@ func (s *storageZfs) StorageMigrationSink(conn *websocket.Conn, op *operation, a
 	return rsyncStorageMigrationSink(conn, op, args)
 }
 
-func (s *storageZfs) GetStoragePool() *api.StoragePool {
-	return s.pool
-}
-
-func (s *storageZfs) GetStoragePoolVolume() *api.StorageVolume {
-	return s.volume
-}
-
-func (s *storageZfs) GetState() *state.State {
-	return s.s
-}
-
 func (s *storageZfs) StoragePoolVolumeSnapshotCreate(target *api.StorageVolumeSnapshotsPost) error {
 	logger.Infof("Creating ZFS storage volume snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 

From d6c92ea7f13b67b4a10c085a70a050aaf351c42a Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 2 May 2019 14:55:54 +0200
Subject: [PATCH 2/5] lxd: Remove ContainerCanRestore from storage interface

The function ContainerCanRestore is only used by zfs, and therefore
should be zfs specific.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/container_lxc.go |  6 ------
 lxd/storage.go       |  1 -
 lxd/storage_btrfs.go |  4 ----
 lxd/storage_ceph.go  |  4 ----
 lxd/storage_dir.go   |  4 ----
 lxd/storage_lvm.go   |  4 ----
 lxd/storage_mock.go  |  4 ----
 lxd/storage_zfs.go   | 48 ++++++++++++++++++--------------------------
 8 files changed, 19 insertions(+), 56 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index d59356fc5c..e9e6b8f9a1 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3724,12 +3724,6 @@ func (c *containerLXC) Restore(sourceContainer container, stateful bool) error {
 		defer c.StorageStop()
 	}
 
-	// Check if we can restore the container
-	err = c.storage.ContainerCanRestore(c, sourceContainer)
-	if err != nil {
-		return err
-	}
-
 	/* let's also check for CRIU if necessary, before doing a bunch of
 	 * filesystem manipulations
 	 */
diff --git a/lxd/storage.go b/lxd/storage.go
index 6786c190db..7593ef7a6f 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -182,7 +182,6 @@ type storage interface {
 
 	// ContainerCreateFromImage creates a container from a image.
 	ContainerCreateFromImage(c container, fingerprint string, tracker *ioprogress.ProgressTracker) error
-	ContainerCanRestore(target container, source container) error
 	ContainerDelete(c container) error
 	ContainerCopy(target container, source container, containerOnly bool) error
 	ContainerRefresh(target container, source container, snapshots []container) error
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 8553e9259a..cf094c145b 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -937,10 +937,6 @@ func (s *storageBtrfs) ContainerCreateFromImage(container container, fingerprint
 	return nil
 }
 
-func (s *storageBtrfs) ContainerCanRestore(container container, sourceContainer container) error {
-	return nil
-}
-
 func (s *storageBtrfs) ContainerDelete(container container) error {
 	logger.Debugf("Deleting BTRFS storage volume for container \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index ff0fd419e4..ec4bd72736 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -941,10 +941,6 @@ func (s *storageCeph) ContainerCreateFromImage(container container, fingerprint
 	return nil
 }
 
-func (s *storageCeph) ContainerCanRestore(container container, sourceContainer container) error {
-	return nil
-}
-
 func (s *storageCeph) ContainerDelete(container container) error {
 	containerName := container.Name()
 	logger.Debugf(`Deleting RBD storage volume for container "%s" on storage pool "%s"`, containerName, s.pool.Name)
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index fd0239f575..87e5261ee4 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -585,10 +585,6 @@ func (s *storageDir) ContainerCreateFromImage(container container, imageFingerpr
 	return nil
 }
 
-func (s *storageDir) ContainerCanRestore(container container, sourceContainer container) error {
-	return nil
-}
-
 func (s *storageDir) ContainerDelete(container container) error {
 	logger.Debugf("Deleting DIR storage volume for container \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index 0dfd90c906..eac2d7780c 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -1062,10 +1062,6 @@ func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint s
 	return nil
 }
 
-func (s *storageLvm) ContainerCanRestore(container container, sourceContainer container) error {
-	return nil
-}
-
 func lvmContainerDeleteInternal(projectName, poolName string, ctName string, isSnapshot bool, vgName string, ctPath string) error {
 	containerMntPoint := ""
 	containerLvmName := containerNameToLVName(ctName)
diff --git a/lxd/storage_mock.go b/lxd/storage_mock.go
index 58c993f511..950aa4d215 100644
--- a/lxd/storage_mock.go
+++ b/lxd/storage_mock.go
@@ -123,10 +123,6 @@ func (s *storageMock) ContainerCreateFromImage(
 	return nil
 }
 
-func (s *storageMock) ContainerCanRestore(container container, sourceContainer container) error {
-	return nil
-}
-
 func (s *storageMock) ContainerDelete(container container) error {
 	return nil
 }
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 2d671d667c..5338226bbc 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -915,29 +915,6 @@ func (s *storageZfs) ContainerCreateFromImage(container container, fingerprint s
 	return nil
 }
 
-func (s *storageZfs) ContainerCanRestore(container container, sourceContainer container) error {
-	snaps, err := container.Snapshots()
-	if err != nil {
-		return err
-	}
-
-	if snaps[len(snaps)-1].Name() != sourceContainer.Name() {
-		if s.pool.Config["volume.zfs.remove_snapshots"] != "" {
-			zfsRemoveSnapshots = s.pool.Config["volume.zfs.remove_snapshots"]
-		}
-		if s.volume.Config["zfs.remove_snapshots"] != "" {
-			zfsRemoveSnapshots = s.volume.Config["zfs.remove_snapshots"]
-		}
-		if !shared.IsTrue(zfsRemoveSnapshots) {
-			return fmt.Errorf("ZFS can only restore from the latest snapshot. Delete newer snapshots or copy the snapshot into a new container instead")
-		}
-
-		return nil
-	}
-
-	return nil
-}
-
 func (s *storageZfs) ContainerDelete(container container) error {
 	err := s.doContainerDelete(container.Project(), container.Name())
 	if err != nil {
@@ -1503,6 +1480,25 @@ func (s *storageZfs) ContainerRename(container container, newName string) error
 func (s *storageZfs) ContainerRestore(target container, source container) error {
 	logger.Debugf("Restoring ZFS storage volume for container \"%s\" from %s to %s", s.volume.Name, source.Name(), target.Name())
 
+	snaps, err := target.Snapshots()
+	if err != nil {
+		return err
+	}
+
+	if snaps[len(snaps)-1].Name() != source.Name() {
+		if s.pool.Config["volume.zfs.remove_snapshots"] != "" {
+			zfsRemoveSnapshots = s.pool.Config["volume.zfs.remove_snapshots"]
+		}
+
+		if s.volume.Config["zfs.remove_snapshots"] != "" {
+			zfsRemoveSnapshots = s.volume.Config["zfs.remove_snapshots"]
+		}
+
+		if !shared.IsTrue(zfsRemoveSnapshots) {
+			return fmt.Errorf("ZFS can only restore from the latest snapshot. Delete newer snapshots or copy the snapshot into a new container instead")
+		}
+	}
+
 	// Start storage for source container
 	ourSourceStart, err := source.StorageStart()
 	if err != nil {
@@ -1521,12 +1517,6 @@ func (s *storageZfs) ContainerRestore(target container, source container) error
 		defer target.StorageStop()
 	}
 
-	// Remove any needed snapshot
-	snaps, err := target.Snapshots()
-	if err != nil {
-		return err
-	}
-
 	for i := len(snaps) - 1; i != 0; i-- {
 		if snaps[i].Name() == source.Name() {
 			break

From 2efbf7e587bde2e3c1cc4a92e3ad8709fc15b5ea Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 2 May 2019 16:05:56 +0200
Subject: [PATCH 3/5] lxd: Remove Image{Umount,Mount} from storage interface

These functions are not called from anywhere outside of the actual
storage backend code.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/storage.go | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lxd/storage.go b/lxd/storage.go
index 7593ef7a6f..a880b1aae4 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -208,8 +208,6 @@ type storage interface {
 	// Functions dealing with image storage volumes.
 	ImageCreate(fingerprint string, tracker *ioprogress.ProgressTracker) error
 	ImageDelete(fingerprint string) error
-	ImageMount(fingerprint string) (bool, error)
-	ImageUmount(fingerprint string) (bool, error)
 
 	// Storage type agnostic functions.
 	StorageEntitySetQuota(volumeType int, size int64, data interface{}) error

From a20ac15da114897bb0d270990e3505810487d572 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Fri, 14 Jun 2019 20:21:51 +0200
Subject: [PATCH 4/5] test: Remove the attached testvolume

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 test/suites/storage_volume_attach.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/suites/storage_volume_attach.sh b/test/suites/storage_volume_attach.sh
index 22c73f3d11..3a737deb80 100644
--- a/test/suites/storage_volume_attach.sh
+++ b/test/suites/storage_volume_attach.sh
@@ -57,6 +57,7 @@ test_storage_volume_attach() {
   if [ "${UIDs}" -lt 500000 ] || [ "${GIDs}" -lt 500000 ]; then
     echo "==> SKIP: The storage volume attach test requires at least 500000 uids and gids"
     lxc rm -f c1 c2
+    lxc storage volume delete "lxdtest-$(basename "${LXD_DIR}")" testvolume
     return
   fi
 

From 605a51ed0e0d71da0995b2c2651be129edc99447 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 2 May 2019 15:13:48 +0200
Subject: [PATCH 5/5] migration: Remove unused Snapshots() function from
 interface

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/storage_btrfs.go     | 4 ----
 lxd/storage_migration.go | 7 -------
 lxd/storage_zfs.go       | 4 ----
 3 files changed, 15 deletions(-)

diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index cf094c145b..e4b0328ed5 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -2438,10 +2438,6 @@ type btrfsMigrationSourceDriver struct {
 	stoppedSnapName    string
 }
 
-func (s *btrfsMigrationSourceDriver) Snapshots() []container {
-	return s.snapshots
-}
-
 func (s *btrfsMigrationSourceDriver) send(conn *websocket.Conn, btrfsPath string, btrfsParent string, readWrapper func(io.ReadCloser) io.ReadCloser) error {
 	args := []string{"send"}
 	if btrfsParent != "" {
diff --git a/lxd/storage_migration.go b/lxd/storage_migration.go
index 7767f0eafa..13716a39b9 100644
--- a/lxd/storage_migration.go
+++ b/lxd/storage_migration.go
@@ -18,9 +18,6 @@ import (
 // MigrationStorageSourceDriver defines the functions needed to implement a
 // migration source driver.
 type MigrationStorageSourceDriver interface {
-	/* snapshots for this container, if any */
-	Snapshots() []container
-
 	/* send any bits of the container/snapshots that are possible while the
 	 * container is still running.
 	 */
@@ -47,10 +44,6 @@ type rsyncStorageSourceDriver struct {
 	rsyncFeatures []string
 }
 
-func (s rsyncStorageSourceDriver) Snapshots() []container {
-	return s.snapshots
-}
-
 func (s rsyncStorageSourceDriver) SendStorageVolume(conn *websocket.Conn, op *operation, bwlimit string, storage storage, volumeOnly bool) error {
 	ourMount, err := storage.StoragePoolVolumeMount()
 	if err != nil {
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 5338226bbc..1d1a892b91 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -2515,10 +2515,6 @@ type zfsMigrationSourceDriver struct {
 	zfsFeatures      []string
 }
 
-func (s *zfsMigrationSourceDriver) Snapshots() []container {
-	return s.snapshots
-}
-
 func (s *zfsMigrationSourceDriver) send(conn *websocket.Conn, zfsName string, zfsParent string, readWrapper func(io.ReadCloser) io.ReadCloser) error {
 	sourceParentName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
 	poolName := s.zfs.getOnDiskPoolName()


More information about the lxc-devel mailing list