The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6390
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) === The recently added project logic in the volume code incorrectly assumes that underscores are only valid as separate between project names and volume names. This isn't true for custom volumes which may already have undercores in their names despite us not having support for custom volumes in projects. When we do implement custom volumes in projects, we will rename all volumes to include the project prefix at which point we will be able to always split those and extract the project. Until then, only do project splitting on containers. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From a7e28cb25a40116e30c832fee3b22ee3768bce99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sun, 3 Nov 2019 19:32:45 -0500 Subject: [PATCH] lxd/storage: Fix custom volume with underscores MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recently added project logic in the volume code incorrectly assumes that underscores are only valid as separate between project names and volume names. This isn't true for custom volumes which may already have undercores in their names despite us not having support for custom volumes in projects. When we do implement custom volumes in projects, we will rename all volumes to include the project prefix at which point we will be able to always split those and extract the project. Until then, only do project splitting on containers. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/storage/load.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lxd/storage/load.go b/lxd/storage/load.go index 725a0bf2b7..4cb903baff 100644 --- a/lxd/storage/load.go +++ b/lxd/storage/load.go @@ -34,10 +34,12 @@ func volIDFuncMake(state *state.State, poolID int64) func(volType drivers.Volume // encoding format, so if there is no underscore in the volume name then we assume // the project is default. project := "default" - volParts := strings.SplitN(volName, "_", 2) - if len(volParts) > 1 { - project = volParts[0] - volName = volParts[1] + if volType == drivers.VolumeTypeContainer || volType == drivers.VolumeTypeVM { + volParts := strings.SplitN(volName, "_", 2) + if len(volParts) > 1 { + project = volParts[0] + volName = volParts[1] + } } volID, _, err := state.Cluster.StoragePoolNodeVolumeGetTypeByProject(project, volName, volTypeID, poolID)
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel