Skip to contentSkip to conversation

Add uniquifier to storage pool path

PATCH Superseded [email protected] 2 participants 3 messages Apr 23, 2025

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add uniquifier to storage pool path

From: Chuck Lever <[email protected]>

I'd like to be able to run more than one instance of kdevops per physical host. Currently the kdevops guestfs set-up steers all storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which means there's a good change that two different logged-in users will create virtual machines whose names, OS base images, and block devices will interfere with each other.

So far I haven't been able to get the other storage pool-related settings to add sufficient uniqueness to prevent this conflict.

The other patches in v2 of this series have been committed. v3 contains the single patch that remains.

Chuck Lever (1):
guestfs: Per-user storage pools

 kconfigs/Kconfig.libvirt   | 2 +-
 scripts/bringup_guestfs.sh | 2 +-
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH v3 1/1 guestfs: Per-user storage pools

From: Chuck Lever <[email protected]>

I'd like to be able to run more than one instance of kdevops per physical host. Currently the kdevops guestfs set-up steers all storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which means there's a good change that two different logged-in users will create virtual machines whose names (and block devices) conflict.

So far I haven't been able to get the other storage pool-related settings to add sufficient uniqueness to prevent this conflict.

Instead, replace the "kdevops" string in the storage pool path with the name of the user account running kdevops.

---
 kconfigs/Kconfig.libvirt   | 2 +-
 scripts/bringup_guestfs.sh | 2 +-
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
kconfigs/Kconfig.libvirt +1 -1
index cba8abf1e24b..74a93f177732 100644
@@ -167,7 +167,7 @@ config LIBVIRT_STORAGE_POOL_PATH
 config KDEVOPS_STORAGE_POOL_PATH
 	string
 	output yaml
-	default "{{ libvirt_storage_pool_path }}/kdevops"
+	default "{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}"
 
 config QEMU_BIN_PATH
 	string
scripts/bringup_guestfs.sh +1 -1
index 94e0437192be..7997002826dd 100755
@@ -15,7 +15,7 @@ if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
 STORAGETOPDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}"
-STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
+STORAGEDIR="${STORAGETOPDIR}/${USER}/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
scripts/destroy_guestfs.sh +1 -1
index ee5dc2b57d6d..8cf58e4d91c8 100755
@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh
 
 export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
 
-STORAGEDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGEDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/${USER}/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
scripts/guestfs.Makefile +1 -1
index 3dad6a14f0c5..03bd582ff1f2 100644
@@ -100,4 +100,4 @@ destroy_guestfs:
 PHONY += destroy_guestfs
 
 cleancache:
-	$(Q)rm -f $(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
+	$(Q)rm -f $(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH v3 1/1] guestfs: Per-user storage pools

Quoted 27 lines · On Wed, Apr 23, 2025 at 10:20:09AM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>

I'd like to be able to run more than one instance of kdevops per physical host. Currently the kdevops guestfs set-up steers all storage pool activity into ${STORAGE_POOL}/kdevops/guestfs, which means there's a good change that two different logged-in users will create virtual machines whose names (and block devices) conflict.

So far I haven't been able to get the other storage pool-related settings to add sufficient uniqueness to prevent this conflict.

Instead, replace the "kdevops" string in the storage pool path with the name of the user account running kdevops.

---
 kconfigs/Kconfig.libvirt   | 2 +-
 scripts/bringup_guestfs.sh | 2 +-
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
kconfigs/Kconfig.libvirt +0 -0
index cba8abf1e24b..74a93f177732 100644

kconfigs/Kconfig.libvirt config LIBVIRT_STORAGE_POOL_PATH · line 170

Quoted 5 lines
kconfigs/Kconfig.libvirt +1 -1
@@ -167,7 +167,7 @@ config LIBVIRT_STORAGE_POOL_PATH
 config KDEVOPS_STORAGE_POOL_PATH
 	string
 	output yaml
-	default "{{ libvirt_storage_pool_path }}/kdevops"
+	default "{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}"

So what I meant with my feedbakc was to make this an option. So for instance you can add a new Kconfig choice and the default KDEVOPS_STORAGE_POOL_USER_COMPAT and when that's true we default KDEVOPS_STORAGE_POOL_USER to "kdevops", otherwise it calls if KDEVOPS_STORAGE_POOL_USER_AUTO is set then the default is $USER.

Then you can wackamole these two lines too:

scripts/guestfs.Makefile:GUESTFS_ARGS += kdevops_storage_pool_user='$(USER)' scripts/vagrant.Makefile:VAGRANT_ARGS += kdevops_storage_pool_user='$(USER)'

By making KDEVOPS_STORAGE_POOL_USER_COMPAT default it would work with existing deployments.

Luis