[lxc-devel] [lxd/master] lvm: use LXD pool name
brauner on Github
lxc-bot at linuxcontainers.org
Tue May 29 13:16:01 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 456 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180529/91f85807/attachment.bin>
-------------- next part --------------
From 9f95c20ab9da95a26ecbe3f1503aa42f8ddeea98 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 29 May 2018 15:12:13 +0200
Subject: [PATCH] lvm: use LXD pool name
For mountpoints we always use LXD's name for the storage pool and not the
on-disk name.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage_lvm_utils.go | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lxd/storage_lvm_utils.go b/lxd/storage_lvm_utils.go
index 38813386c..3355bb690 100644
--- a/lxd/storage_lvm_utils.go
+++ b/lxd/storage_lvm_utils.go
@@ -397,14 +397,13 @@ func (s *storageLvm) copyContainerLv(target container, source container, readonl
defer source.StorageStop()
}
- poolName := s.getOnDiskPoolName()
- sourceContainerMntPoint := getContainerMountPoint(poolName, sourceName)
+ sourceContainerMntPoint := getContainerMountPoint(s.pool.Name, sourceName)
if source.IsSnapshot() {
- sourceContainerMntPoint = getSnapshotMountPoint(poolName, sourceName)
+ sourceContainerMntPoint = getSnapshotMountPoint(s.pool.Name, sourceName)
}
- targetContainerMntPoint := getContainerMountPoint(poolName, targetName)
+ targetContainerMntPoint := getContainerMountPoint(s.pool.Name, targetName)
if target.IsSnapshot() {
- targetContainerMntPoint = getSnapshotMountPoint(poolName, targetName)
+ targetContainerMntPoint = getSnapshotMountPoint(s.pool.Name, targetName)
}
if source.IsRunning() {
@@ -423,7 +422,7 @@ func (s *storageLvm) copyContainerLv(target container, source container, readonl
if readonly {
targetLvmName := containerNameToLVName(targetName)
- output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeAPIEndpointContainers, targetLvmName))
+ output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", s.pool.Name, storagePoolVolumeAPIEndpointContainers, targetLvmName))
if err != nil {
logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s.", targetName, output)
return err
More information about the lxc-devel
mailing list