guestfs: Per-user storage pools
RFC PATCH 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.
--- scripts/bringup_guestfs.sh | 2 +- scripts/destroy_guestfs.sh | 2 +- scripts/guestfs.Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
I'm not sure this is the best way to go about it, but this has worked well for several weeks. Looking for comments and suggestions!
scripts/bringup_guestfs.sh +1 -1
@@ -24,7 +24,7 @@ IMG_FMT="qcow2" if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then IMG_FMT="raw" fi -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP GUESTFSDIR="${TOPDIR}/guestfs" OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
scripts/destroy_guestfs.sh +1 -1
@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" GUESTFSDIR="${TOPDIR}/guestfs" if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
scripts/guestfs.Makefile +2 -2
@@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)' GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)' STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH)) -KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops +KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER) GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH) GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
@@ -84,4 +84,4 @@ destroy_guestfs: PHONY += destroy_guestfs cleancache: - $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/* + $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*
Signature · 1 line
2.46.0
Quoted 8 lines · On Fri, 06 Sep 2024, [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.
Quoted 7 lines
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.
Signed-off-by Chuck Lever <[email protected]>
Why don't you just include your user id in CONFIG_KDEVOPS_STORAGE_POOL_PATH? That's what Jeff and I did when he was still at Red Hat and we never ran into issues.
-Scott
Quoted 60 lines
--- scripts/bringup_guestfs.sh | 2 +- scripts/destroy_guestfs.sh | 2 +- scripts/guestfs.Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)I'm not sure this is the best way to go about it, but this has worked well for several weeks. Looking for comments and suggestions!
scripts/bringup_guestfs.sh +1
-1@@ -24,7 +24,7 @@ IMG_FMT="qcow2" if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then IMG_FMT="raw" fi -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP GUESTFSDIR="${TOPDIR}/guestfs" OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}scripts/destroy_guestfs.sh +1
-1@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" GUESTFSDIR="${TOPDIR}/guestfs" if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; thenscripts/guestfs.Makefile +2
-2@@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)' GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)' STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH)) -KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops +KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER) GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH) GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)@@ -84,4 +84,4 @@ destroy_guestfs: PHONY += destroy_guestfs cleancache: - $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/* + $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*Signature · 1 line
2.46.0
Quoted 13 lines · Scott Mayhew
Quoted 11 lines · On Fri, 06 Sep 2024, [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.
Quoted 8 lines
Quoted 4 lines
Instead, replace the "kdevops" string in the storage pool path with the name of the user account running kdevops.
Signed-off-by Chuck Lever <[email protected]>Why don't you just include your user id in
CONFIG_KDEVOPS_STORAGE_POOL_PATH? That's what Jeff and I did when he was still at Red Hat and we never ran into issues.
I did try that, IIRC, and it didn't work. I can give it another try to mine some details about the failure mode.
Quoted 61 lines
Quoted 60 lines
--- scripts/bringup_guestfs.sh | 2 +- scripts/destroy_guestfs.sh | 2 +- scripts/guestfs.Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)I'm not sure this is the best way to go about it, but this has worked well for several weeks. Looking for comments and suggestions!
scripts/bringup_guestfs.sh +1
-1@@ -24,7 +24,7 @@ IMG_FMT="qcow2" if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then IMG_FMT="raw" fi -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP GUESTFSDIR="${TOPDIR}/guestfs" OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}scripts/destroy_guestfs.sh +1
-1@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI -STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs" +STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/${USER}/guestfs" GUESTFSDIR="${TOPDIR}/guestfs" if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; thenscripts/guestfs.Makefile +2
-2@@ -20,7 +20,7 @@ GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)' GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)' STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH)) -KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops +KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/$(USER) GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH) GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)@@ -84,4 +84,4 @@ destroy_guestfs: PHONY += destroy_guestfs cleancache: - $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/* + $(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/$(USER)/guestfs/base_images/*Signature · 1 line
2.46.0
Signature · 1 line
Chuck Lever