From 956c5c3a8be6b885821cb1dee496c8fad7555943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sun, 11 Aug 2024 17:05:09 -0400 Subject: [PATCH] incusd/storage: Fix UsedBy values for sub-directory volumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1103 Signed-off-by: Stéphane Graber --- internal/server/storage/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/server/storage/utils.go b/internal/server/storage/utils.go index f24ddec501d..62237a1b626 100644 --- a/internal/server/storage/utils.go +++ b/internal/server/storage/utils.go @@ -868,7 +868,7 @@ func VolumeUsedByProfileDevices(s *state.State, poolName string, projectName str continue } - if dev["source"] == vol.Name { + if strings.Split(dev["source"], "/")[0] == vol.Name { usedByDevices = append(usedByDevices, name) } } @@ -937,7 +937,7 @@ func VolumeUsedByInstanceDevices(s *state.State, poolName string, projectName st continue } - if dev["source"] == vol.Name { + if strings.Split(dev["source"], "/")[0] == vol.Name { usedByDevices = append(usedByDevices, devName) } }