diff mbox series

[3/6] libvirt: use consistent pool path variables and use optional yaml output

Message ID 20250323115009.269172-4-mcgrof@kernel.org (mailing list archive)
State New
Headers show
Series debian / libvirt / devconfig fixes | expand

Checks

Context Check Description
mcgrof/vmtest-main-VM_Test-5 success Logs for Setup and Run Make Targets (fedora:latest)
mcgrof/vmtest-main-VM_Test-7 success Logs for Setup and Run Make Targets (opensuse/tumbleweed)
mcgrof/vmtest-main-VM_Test-3 success Logs for Setup and Run Make Targets (debian:testing)
mcgrof/vmtest-main-VM_Test-2 success Logs for Setup and Run Make Targets (debian:testing)
mcgrof/vmtest-main-VM_Test-6 success Logs for Setup and Run Make Targets (opensuse/tumbleweed)
mcgrof/vmtest-main-VM_Test-4 success Logs for Setup and Run Make Targets (fedora:latest)
mcgrof/vmtest-main-PR fail PR summary
mcgrof/vmtest-main-VM_Test-1 fail Logs for Run kdevops CI
mcgrof/vmtest-main-VM_Test-0 fail Logs for Run kdevops CI

Commit Message

Luis Chamberlain March 23, 2025, 11:50 a.m. UTC
Turns out we define CONFIG_KDEVOPS_STORAGE_POOL_PATH only to make it be the
same as generic     CONFIG_LIBVIRT_STORAGE_POOL_PATH only later to then
use the old GUESTFS_ARGS or VAGRANT_ARGS to define the yaml version with
a postfix "kdevops".

Fix all this mess by using yaml output and cleaing its use up.

This does not fix any bugs, it just make things consistent.

And so where you saw CONFIG_KDEVOPS_STORAGE_POOL_PATH we now just use
the generic version  CONFIG_LIBVIRT_STORAGE_POOL_PATH.

The kconfig symbol CONFIG_KDEVOPS_STORAGE_POOL_PATH gets promoted to be
what we expect it, that is:

  "{{ libvirt_storage_pool_path }}/kdevops"

This also ensure we will barf as we want to promote using ansible for
this anyway and do away with all of the CONFIG_KDEVOPS_STORAGE_POOL_PATH
uses in shell scripts.

This kills all use of CONFIG_KDEVOPS_STORAGE_POOL_PATH from shell
scripts too then.

The motivation for all this is to slowly trim away the large
error-prone script scripts/bringup_guestfs.sh into ansible. This
is just a small step towards making that easier.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 kconfigs/Kconfig.guestfs       |  5 +++++
 kconfigs/Kconfig.libvirt       | 11 ++++++++++-
 scripts/bringup_guestfs.sh     |  2 +-
 scripts/bringup_vagrant.sh     |  2 +-
 scripts/destroy_guestfs.sh     |  2 +-
 scripts/destroy_vagrant.sh     |  2 +-
 scripts/gen-nodes.Makefile     |  6 ------
 scripts/guestfs.Makefile       |  7 +------
 scripts/prune_stale_vagrant.sh |  2 +-
 scripts/vagrant.Makefile       |  5 -----
 10 files changed, 21 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
index f618fc30fe25..c6d2d1907dd5 100644
--- a/kconfigs/Kconfig.guestfs
+++ b/kconfigs/Kconfig.guestfs
@@ -1,5 +1,10 @@ 
 if GUESTFS
 
+config STORAGE_POOL_PATH
+	string
+	output yaml
+	default LIBVIRT_STORAGE_POOL_PATH
+
 config GUESTFS_HAS_CUSTOM_RAW_IMAGE
 	bool
 
diff --git a/kconfigs/Kconfig.libvirt b/kconfigs/Kconfig.libvirt
index 1ed967423096..cba8abf1e24b 100644
--- a/kconfigs/Kconfig.libvirt
+++ b/kconfigs/Kconfig.libvirt
@@ -155,13 +155,20 @@  config LIBVIRT_QEMU_GROUP
 	default "qemu" if !DISTRO_DEBIAN && !DISTRO_UBUNTU
 	default "libvirt-qemu" if DISTRO_DEBIAN || DISTRO_UBUNTU
 
-config KDEVOPS_STORAGE_POOL_PATH
+
+config LIBVIRT_STORAGE_POOL_PATH
 	string
+	output yaml
 	default LIBVIRT_STORAGE_POOL_PATH_AUTO if LIBVIRT && !LIBVIRT_STORAGE_POOL_PATH_CUSTOM_MANUAL
 	default LIBVIRT_STORAGE_POOL_PATH_AUTO if LIBVIRT && LIBVIRT_STORAGE_POOL_PATH_CUSTOM_CWD
 	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
@@ -1052,6 +1059,7 @@  endif
 
 config LIBVIRT_STORAGE_POOL_CREATE
 	bool "Should we build a custom storage pool for you?"
+	output yaml
 	default n if !LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
 	default $(shell, ./scripts/get_libvirsh_pool_enabled.sh) if LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
 	help
@@ -1063,6 +1071,7 @@  config LIBVIRT_STORAGE_POOL_CREATE
 
 config LIBVIRT_STORAGE_POOL_NAME
 	string "Libvirt storage pool name"
+	output yaml
 	depends on LIBVIRT_STORAGE_POOL_CREATE
 	default "default" if !LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
 	default $(shell, ./scripts/get_libvirsh_pool_name.sh) if LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index 1ba2c8c6ff9a..976d1e78ed6a 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -14,7 +14,7 @@  IMG_FMT="qcow2"
 if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
 	IMG_FMT="raw"
 fi
-STORAGETOPDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}"
+STORAGETOPDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}"
 STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
diff --git a/scripts/bringup_vagrant.sh b/scripts/bringup_vagrant.sh
index 4d30c2312000..4e163871d482 100755
--- a/scripts/bringup_vagrant.sh
+++ b/scripts/bringup_vagrant.sh
@@ -55,7 +55,7 @@  vagrant_check_dups()
 			# instances *and* we know one does not exist in another
 			# directory for this user.
 
-			kdevops_pool_path="$CONFIG_KDEVOPS_STORAGE_POOL_PATH"
+			kdevops_pool_path="$CONFIG_LIBVIRT_STORAGE_POOL_PATH"
 			# For libvirt we can do one more global sanity check
 			if [[ "$CONFIG_LIBVIRT" == "y" ]]; then
 				possible_image="${kdevops_pool_path}/vagrant_${instance}.img"
diff --git a/scripts/destroy_guestfs.sh b/scripts/destroy_guestfs.sh
index 58dca78d85cf..ee5dc2b57d6d 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_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
+STORAGEDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/kdevops/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
diff --git a/scripts/destroy_vagrant.sh b/scripts/destroy_vagrant.sh
index 4e5bb9d64bef..bd5e43d0044e 100755
--- a/scripts/destroy_vagrant.sh
+++ b/scripts/destroy_vagrant.sh
@@ -18,7 +18,7 @@  rm -rf .vagrant
 # doing so we don't check for global dups or anything like that.
 UNINIT_CURRENT_INSTANCES=$(vagrant status --machine-readable | grep ",state," | grep not_created | awk -F "," '{print $2}')
 for i in $UNINIT_CURRENT_INSTANCES; do
-	UNINIT_INSTANCE_SPARE_DRIVE_DIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/$i"
+	UNINIT_INSTANCE_SPARE_DRIVE_DIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/kdevops/$i"
 	if [[ -d $UNINIT_INSTANCE_SPARE_DRIVE_DIR ]]; then
 		echo "Found unitialized (possibly old) instance spare drive directory, removing it ... $i"
 		rm -rf $UNINIT_INSTANCE_SPARE_DRIVE_DIR
diff --git a/scripts/gen-nodes.Makefile b/scripts/gen-nodes.Makefile
index 8bee2db57591..775ec5c49808 100644
--- a/scripts/gen-nodes.Makefile
+++ b/scripts/gen-nodes.Makefile
@@ -42,12 +42,6 @@  GEN_NODES_EXTRA_ARGS += libvirt_session_management_network_device='$(subst ",,$(
 GEN_NODES_EXTRA_ARGS += libvirt_session_public_network_dev='$(subst ",,$(CONFIG_LIBVIRT_SESSION_PUBLIC_NETWORK_DEV))'
 endif
 
-ifeq (y,$(CONFIG_LIBVIRT_STORAGE_POOL_CREATE))
-GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_create='True'
-GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_name='$(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_NAME))'
-GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_path='$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))'
-endif
-
 GEN_NODES_EXTRA_ARGS += libvirt_extra_storage_aio_mode='$(subst ",,$(CONFIG_LIBVIRT_AIO_MODE))'
 GEN_NODES_EXTRA_ARGS += libvirt_extra_storage_aio_cache_mode='$(subst ",,$(CONFIG_LIBVIRT_AIO_CACHE_MODE))'
 
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 8b1b4e9fc7d5..d08e697f3cfb 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -18,11 +18,6 @@  QEMU_GROUP:=$(subst ",,$(CONFIG_LIBVIRT_QEMU_GROUP))
 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
-GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
-GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
-
 9P_HOST_CLONE :=
 ifeq (y,$(CONFIG_BOOTLINUX_9P))
 9P_HOST_CLONE := 9p_linux_clone
@@ -109,4 +104,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_LIBVIRT_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
diff --git a/scripts/prune_stale_vagrant.sh b/scripts/prune_stale_vagrant.sh
index 95b88911c0a6..61ac0e86b6c2 100755
--- a/scripts/prune_stale_vagrant.sh
+++ b/scripts/prune_stale_vagrant.sh
@@ -37,7 +37,7 @@  if [[ "$CONFIG_LIBVIRT" != "y" ]]; then
 fi
 
 if [[ $# -eq 0 ]]; then
-	KDEVOPS_POOL_PATH="$CONFIG_KDEVOPS_STORAGE_POOL_PATH"
+	KDEVOPS_POOL_PATH="$CONFIG_LIBVIRT_STORAGE_POOL_PATH"
 elif [[ $# -eq 1 ]]; then
 	if [[ "$1" == "--help" ]]; then
 		echo "Usage: $0"
diff --git a/scripts/vagrant.Makefile b/scripts/vagrant.Makefile
index 368c2f84aa89..664c8f9cfc5c 100644
--- a/scripts/vagrant.Makefile
+++ b/scripts/vagrant.Makefile
@@ -44,11 +44,6 @@  ifeq (y,$(CONFIG_VAGRANT_VIRTUALBOX))
 VAGRANT_ARGS += virtualbox_provider=True
 endif
 
-STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
-KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
-VAGRANT_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
-VAGRANT_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
-
 VAGRANT_9P_HOST_CLONE :=
 ifeq (y,$(CONFIG_BOOTLINUX_9P))
 VAGRANT_9P_HOST_CLONE := vagrant_9p_linux_clone