The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8133
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) ===
From c6084f03be3efe425b10edcc190bcb33e8c2474d Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Tue, 10 Nov 2020 10:26:34 +0000 Subject: [PATCH 1/2] lxd/db/storage/pools: Adds isRemoteStorage function Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/db/storage_pools.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go index 14f72683d6..4a07bdbef4 100644 --- a/lxd/db/storage_pools.go +++ b/lxd/db/storage_pools.go @@ -869,3 +869,20 @@ var StoragePoolNodeConfigKeys = []string{ "lvm.thinpool_name", "lvm.vg_name", } + +func (c *Cluster) isRemoteStorage(poolID int64) (bool, error) { + isRemoteStorage := false + + err := c.Transaction(func(tx *ClusterTx) error { + driver, err := tx.GetStoragePoolDriver(poolID) + if err != nil { + return err + } + + isRemoteStorage = shared.StringInSlice(driver, StorageRemoteDriverNames()) + + return nil + }) + + return isRemoteStorage, err +} From 91c72686fcbe3e5c155f8e9e9c50e1d7e413f6f8 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Tue, 10 Nov 2020 10:26:52 +0000 Subject: [PATCH 2/2] lxd/db/storage/volumes: Updates storagePoolVolumeGetType to not populate Location when driver is remote Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/db/storage_volumes.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lxd/db/storage_volumes.go b/lxd/db/storage_volumes.go index 240a33556b..19ba3a3045 100644 --- a/lxd/db/storage_volumes.go +++ b/lxd/db/storage_volumes.go @@ -241,11 +241,20 @@ func (c *Cluster) storagePoolVolumeGetType(project string, volumeName string, vo return -1, nil, err } - volumeNode, err := c.storageVolumeNodeGet(volumeID) + isRemoteStorage, err := c.isRemoteStorage(poolID) if err != nil { return -1, nil, err } + volumeNode := "" + + if !isRemoteStorage { + volumeNode, err = c.storageVolumeNodeGet(volumeID) + if err != nil { + return -1, nil, err + } + } + volumeConfig, err := c.storageVolumeConfigGet(volumeID, isSnapshot) if err != nil { return -1, nil, err
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel