public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Add uniquifier to storage pool path
@ 2025-04-24 14:17 cel
  2025-04-24 14:17 ` [PATCH v4 1/3] scripts: Remove unused kdevops_storage_pool_user variable cel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cel @ 2025-04-24 14:17 UTC (permalink / raw)
  To: kdevops; +Cc: Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

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.

Changes since v3:
* Define and use CONFIG_KDEVOPS_STORAGE_POOL_USER

Chuck Lever (3):
  scripts: Remove unused kdevops_storage_pool_user variable
  Kconfig: Define KDEVOPS_STORAGE_POOL_USER via Kconfig
  guestfs: Per-user storage pools

 kconfigs/Kconfig.libvirt   | 52 ++++++++++++++++++++++++++++++++++----
 scripts/bringup_guestfs.sh |  3 +--
 scripts/destroy_guestfs.sh |  2 +-
 scripts/guestfs.Makefile   |  3 +--
 scripts/vagrant.Makefile   |  2 --
 5 files changed, 50 insertions(+), 12 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 1/3] scripts: Remove unused kdevops_storage_pool_user variable
  2025-04-24 14:17 [PATCH v4 0/3] Add uniquifier to storage pool path cel
@ 2025-04-24 14:17 ` cel
  2025-04-24 14:17 ` [PATCH v4 2/3] Kconfig: Define KDEVOPS_STORAGE_POOL_USER via Kconfig cel
  2025-04-24 14:17 ` [PATCH v4 3/3] guestfs: Per-user storage pools cel
  2 siblings, 0 replies; 4+ messages in thread
From: cel @ 2025-04-24 14:17 UTC (permalink / raw)
  To: kdevops; +Cc: Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

I would like to reuse this variable name. Two places define it,
currently, but otherwise it appears to be unused.

Clean up: Remove the places that define the variable.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 scripts/guestfs.Makefile | 1 -
 scripts/vagrant.Makefile | 2 --
 2 files changed, 3 deletions(-)

diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 3dad6a14f0c5..43bbea4fda2e 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -10,7 +10,6 @@ export KDEVOPS_PROVISIONED_SSH := $(KDEVOPS_PROVISIONED_SSH_DEFAULT_GUARD)
 GUESTFS_ARGS += guestfs_path='$(TOPDIR_PATH)/guestfs'
 GUESTFS_ARGS += data_home_dir=/home/kdevops
 GUESTFS_ARGS += virtbuilder_os_version=$(CONFIG_VIRT_BUILDER_OS_VERSION)
-GUESTFS_ARGS += kdevops_storage_pool_user='$(USER)'
 
 GUESTFS_ARGS += libvirt_provider=True
 
diff --git a/scripts/vagrant.Makefile b/scripts/vagrant.Makefile
index fc69fb91f53f..e43a21d3c056 100644
--- a/scripts/vagrant.Makefile
+++ b/scripts/vagrant.Makefile
@@ -30,8 +30,6 @@ else
 VAGRANT_PRIVATE_BOX_DEPS :=
 endif
 
-VAGRANT_ARGS += kdevops_storage_pool_user='$(USER)'
-
 ifeq (y,$(CONFIG_LIBVIRT))
 VAGRANT_ARGS += libvirt_provider=True
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 2/3] Kconfig: Define KDEVOPS_STORAGE_POOL_USER via Kconfig
  2025-04-24 14:17 [PATCH v4 0/3] Add uniquifier to storage pool path cel
  2025-04-24 14:17 ` [PATCH v4 1/3] scripts: Remove unused kdevops_storage_pool_user variable cel
@ 2025-04-24 14:17 ` cel
  2025-04-24 14:17 ` [PATCH v4 3/3] guestfs: Per-user storage pools cel
  2 siblings, 0 replies; 4+ messages in thread
From: cel @ 2025-04-24 14:17 UTC (permalink / raw)
  To: kdevops; +Cc: Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

Prepare to replace the "kdevops" string in the storage pool path
with the name of the user account running kdevops. First step is to
define a Kconfig variable for the storage pool user. For the moment,
the storage pool user name defaults to the same string it is
currently.

I would love for there to be a way to provide an actual pathname in
CONFIG_KDEVOPS_STORAGE_POOL_PATH. I haven't found a way so far.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.libvirt   | 15 ++++++++++-----
 scripts/bringup_guestfs.sh |  3 +--
 scripts/destroy_guestfs.sh |  2 +-
 scripts/guestfs.Makefile   |  2 +-
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/kconfigs/Kconfig.libvirt b/kconfigs/Kconfig.libvirt
index cba8abf1e24b..04abadff4e5b 100644
--- a/kconfigs/Kconfig.libvirt
+++ b/kconfigs/Kconfig.libvirt
@@ -164,11 +164,6 @@ config LIBVIRT_STORAGE_POOL_PATH
 	default LIBVIRT_STORAGE_POOL_PATH_CUSTOM if LIBVIRT && LIBVIRT_STORAGE_POOL_PATH_CUSTOM_MANUAL
 	default VIRTUALBOX_STORAGE_POOL_PATH_CUSTOM if VAGRANT_VIRTUALBOX
 
-config KDEVOPS_STORAGE_POOL_PATH
-	string
-	output yaml
-	default "{{ libvirt_storage_pool_path }}/kdevops"
-
 config QEMU_BIN_PATH
 	string
 	default QEMU_BIN_PATH_LIBVIRT if LIBVIRT
@@ -1104,6 +1099,16 @@ config LIBVIRT_STORAGE_POOL_NAME
 	  For instance you may want to use a volume name of "data2" for a path
 	  on a partition on /data2/ or something like that.
 
+config KDEVOPS_STORAGE_POOL_USER
+	string
+	output yaml
+	default "kdevops"
+
+config KDEVOPS_STORAGE_POOL_PATH
+	string
+	output yaml
+	default "{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}"
+
 source "kconfigs/Kconfig.libvirt.zns"
 source "kconfigs/Kconfig.libvirt.largeio"
 source "kconfigs/Kconfig.libvirt.cxl"
diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 94e0437192be..3ac99bf9f22a 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -14,8 +14,7 @@ IMG_FMT="qcow2"
 if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
-STORAGETOPDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}"
-STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
+STORAGEDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/${CONFIG_KDEVOPS_STORAGE_POOL_USER}/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
diff --git a/scripts/destroy_guestfs.sh b/scripts/destroy_guestfs.sh
index ee5dc2b57d6d..dfbb4f15f4ca 100755
--- a/scripts/destroy_guestfs.sh
+++ b/scripts/destroy_guestfs.sh
@@ -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}/${CONFIG_KDEVOPS_STORAGE_POOL_USER}/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 43bbea4fda2e..8d4aac3e3669 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -99,4 +99,4 @@ destroy_guestfs:
 PHONY += destroy_guestfs
 
 cleancache:
-	$(Q)rm -f $(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
+	$(Q)rm -f $(CONFIG_LIBVIRT_STORAGE_POOL_PATH)/$(CONFIG_KDEVOPS_STORAGE_POOL_USER)/guestfs/base_images/*
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 3/3] guestfs: Per-user storage pools
  2025-04-24 14:17 [PATCH v4 0/3] Add uniquifier to storage pool path cel
  2025-04-24 14:17 ` [PATCH v4 1/3] scripts: Remove unused kdevops_storage_pool_user variable cel
  2025-04-24 14:17 ` [PATCH v4 2/3] Kconfig: Define KDEVOPS_STORAGE_POOL_USER via Kconfig cel
@ 2025-04-24 14:17 ` cel
  2 siblings, 0 replies; 4+ messages in thread
From: cel @ 2025-04-24 14:17 UTC (permalink / raw)
  To: kdevops; +Cc: Chuck Lever, Luis Chamberlain

From: Chuck Lever <chuck.lever@oracle.com>

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 chance 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, optionally replace the "kdevops" string in the storage pool
path with the name of the user account running kdevops. Default
behavior is to continue using "kdevops".

Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.libvirt | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/kconfigs/Kconfig.libvirt b/kconfigs/Kconfig.libvirt
index 04abadff4e5b..14620c9d21c4 100644
--- a/kconfigs/Kconfig.libvirt
+++ b/kconfigs/Kconfig.libvirt
@@ -1099,10 +1099,47 @@ config LIBVIRT_STORAGE_POOL_NAME
 	  For instance you may want to use a volume name of "data2" for a path
 	  on a partition on /data2/ or something like that.
 
+choice
+	prompt "Storage pool user name to use"
+	default KDEVOPS_STORAGE_POOL_USER_DEFAULT
+	help
+	  The storage pool user is name of the local user ID that has
+	  access to the libvirt storage pool to be used by kdevops.
+
+	  When there is only one user running kdevops on a system,
+	  the default setting should work. To enable multiple users
+	  to run kdevops on the same system, select
+	  KDEVOPS_STORAGE_POOL_USER_AUTO.
+
+config KDEVOPS_STORAGE_POOL_USER_DEFAULT
+	bool "default"
+	help
+	  The default storage pool user name is always "kdevops".
+
+config KDEVOPS_STORAGE_POOL_USER_AUTO
+	bool "auto"
+	help
+	  Kdevops selects the storage pool user name.
+
+config KDEVOPS_STORAGE_POOL_USER_CUSTOM
+	bool "custom"
+	help
+	  Set a fixed custom storage pool user name.
+
+endchoice
+
+config KDEVOPS_STORAGE_POOL_USER_CUSTOM_NAME
+	string "Storage pool user name"
+	depends on KDEVOPS_STORAGE_POOL_USER_CUSTOM
+	help
+	  Set the name of the storage pool user.
+
 config KDEVOPS_STORAGE_POOL_USER
 	string
 	output yaml
-	default "kdevops"
+	default "kdevops" if KDEVOPS_STORAGE_POOL_USER_DEFAULT
+	default $(shell, echo $USER) if KDEVOPS_STORAGE_POOL_USER_AUTO
+	default KDEVOPS_STORAGE_POOL_USER_CUSTOM_NAME if KDEVOPS_STORAGE_POOL_USER_CUSTOM
 
 config KDEVOPS_STORAGE_POOL_PATH
 	string
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-24 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 14:17 [PATCH v4 0/3] Add uniquifier to storage pool path cel
2025-04-24 14:17 ` [PATCH v4 1/3] scripts: Remove unused kdevops_storage_pool_user variable cel
2025-04-24 14:17 ` [PATCH v4 2/3] Kconfig: Define KDEVOPS_STORAGE_POOL_USER via Kconfig cel
2025-04-24 14:17 ` [PATCH v4 3/3] guestfs: Per-user storage pools cel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox