Skip to content

Commit 869c8e0

Browse files
committed
libvirt: use consistent pool path variables and use optional yaml output
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 <[email protected]>
1 parent 4680fce commit 869c8e0

File tree

10 files changed

+21
-23
lines changed

10 files changed

+21
-23
lines changed

kconfigs/Kconfig.guestfs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
if GUESTFS
22

3+
config STORAGE_POOL_PATH
4+
string
5+
output yaml
6+
default LIBVIRT_STORAGE_POOL_PATH
7+
38
config GUESTFS_HAS_CUSTOM_RAW_IMAGE
49
bool
510

kconfigs/Kconfig.libvirt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,20 @@ config LIBVIRT_QEMU_GROUP
155155
default "qemu" if !DISTRO_DEBIAN && !DISTRO_UBUNTU
156156
default "libvirt-qemu" if DISTRO_DEBIAN || DISTRO_UBUNTU
157157

158-
config KDEVOPS_STORAGE_POOL_PATH
158+
159+
config LIBVIRT_STORAGE_POOL_PATH
159160
string
161+
output yaml
160162
default LIBVIRT_STORAGE_POOL_PATH_AUTO if LIBVIRT && !LIBVIRT_STORAGE_POOL_PATH_CUSTOM_MANUAL
161163
default LIBVIRT_STORAGE_POOL_PATH_AUTO if LIBVIRT && LIBVIRT_STORAGE_POOL_PATH_CUSTOM_CWD
162164
default LIBVIRT_STORAGE_POOL_PATH_CUSTOM if LIBVIRT && LIBVIRT_STORAGE_POOL_PATH_CUSTOM_MANUAL
163165
default VIRTUALBOX_STORAGE_POOL_PATH_CUSTOM if VAGRANT_VIRTUALBOX
164166

167+
config KDEVOPS_STORAGE_POOL_PATH
168+
string
169+
output yaml
170+
default "{{ libvirt_storage_pool_path }}/kdevops"
171+
165172
config QEMU_BIN_PATH
166173
string
167174
default QEMU_BIN_PATH_LIBVIRT if LIBVIRT
@@ -1052,6 +1059,7 @@ endif
10521059

10531060
config LIBVIRT_STORAGE_POOL_CREATE
10541061
bool "Should we build a custom storage pool for you?"
1062+
output yaml
10551063
default n if !LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
10561064
default $(shell, ./scripts/get_libvirsh_pool_enabled.sh) if LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
10571065
help
@@ -1063,6 +1071,7 @@ config LIBVIRT_STORAGE_POOL_CREATE
10631071

10641072
config LIBVIRT_STORAGE_POOL_NAME
10651073
string "Libvirt storage pool name"
1074+
output yaml
10661075
depends on LIBVIRT_STORAGE_POOL_CREATE
10671076
default "default" if !LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED
10681077
default $(shell, ./scripts/get_libvirsh_pool_name.sh) if LIBVIRT_STORAGE_POOL_PATH_INFER_ADVANCED

scripts/bringup_guestfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ IMG_FMT="qcow2"
1414
if [ "${CONFIG_LIBVIRT_EXTRA_DRIVE_FORMAT_RAW}" = "y" ]; then
1515
IMG_FMT="raw"
1616
fi
17-
STORAGETOPDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}"
17+
STORAGETOPDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}"
1818
STORAGEDIR="${STORAGETOPDIR}/kdevops/guestfs"
1919
QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
2020
GUESTFSDIR="${TOPDIR}/guestfs"

scripts/bringup_vagrant.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ vagrant_check_dups()
5555
# instances *and* we know one does not exist in another
5656
# directory for this user.
5757

58-
kdevops_pool_path="$CONFIG_KDEVOPS_STORAGE_POOL_PATH"
58+
kdevops_pool_path="$CONFIG_LIBVIRT_STORAGE_POOL_PATH"
5959
# For libvirt we can do one more global sanity check
6060
if [[ "$CONFIG_LIBVIRT" == "y" ]]; then
6161
possible_image="${kdevops_pool_path}/vagrant_${instance}.img"

scripts/destroy_guestfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source ${TOPDIR}/scripts/lib.sh
77

88
export LIBVIRT_DEFAULT_URI=$CONFIG_LIBVIRT_URI
99

10-
STORAGEDIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/guestfs"
10+
STORAGEDIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/kdevops/guestfs"
1111
GUESTFSDIR="${TOPDIR}/guestfs"
1212

1313
if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then

scripts/destroy_vagrant.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rm -rf .vagrant
1818
# doing so we don't check for global dups or anything like that.
1919
UNINIT_CURRENT_INSTANCES=$(vagrant status --machine-readable | grep ",state," | grep not_created | awk -F "," '{print $2}')
2020
for i in $UNINIT_CURRENT_INSTANCES; do
21-
UNINIT_INSTANCE_SPARE_DRIVE_DIR="${CONFIG_KDEVOPS_STORAGE_POOL_PATH}/kdevops/$i"
21+
UNINIT_INSTANCE_SPARE_DRIVE_DIR="${CONFIG_LIBVIRT_STORAGE_POOL_PATH}/kdevops/$i"
2222
if [[ -d $UNINIT_INSTANCE_SPARE_DRIVE_DIR ]]; then
2323
echo "Found unitialized (possibly old) instance spare drive directory, removing it ... $i"
2424
rm -rf $UNINIT_INSTANCE_SPARE_DRIVE_DIR

scripts/gen-nodes.Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ GEN_NODES_EXTRA_ARGS += libvirt_session_management_network_device='$(subst ",,$(
4242
GEN_NODES_EXTRA_ARGS += libvirt_session_public_network_dev='$(subst ",,$(CONFIG_LIBVIRT_SESSION_PUBLIC_NETWORK_DEV))'
4343
endif
4444

45-
ifeq (y,$(CONFIG_LIBVIRT_STORAGE_POOL_CREATE))
46-
GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_create='True'
47-
GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_name='$(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_NAME))'
48-
GEN_NODES_EXTRA_ARGS += libvirt_storage_pool_path='$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))'
49-
endif
50-
5145
GEN_NODES_EXTRA_ARGS += libvirt_extra_storage_aio_mode='$(subst ",,$(CONFIG_LIBVIRT_AIO_MODE))'
5246
GEN_NODES_EXTRA_ARGS += libvirt_extra_storage_aio_cache_mode='$(subst ",,$(CONFIG_LIBVIRT_AIO_CACHE_MODE))'
5347

scripts/guestfs.Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ QEMU_GROUP:=$(subst ",,$(CONFIG_LIBVIRT_QEMU_GROUP))
1818
GUESTFS_ARGS += kdevops_storage_pool_group='$(QEMU_GROUP)'
1919
GUESTFS_ARGS += storage_pool_group='$(QEMU_GROUP)'
2020

21-
STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
22-
KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
23-
GUESTFS_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
24-
GUESTFS_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
25-
2621
9P_HOST_CLONE :=
2722
ifeq (y,$(CONFIG_BOOTLINUX_9P))
2823
9P_HOST_CLONE := 9p_linux_clone
@@ -109,4 +104,4 @@ destroy_guestfs:
109104
PHONY += destroy_guestfs
110105

111106
cleancache:
112-
$(Q)rm -f $(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*
107+
$(Q)rm -f $(subst ",,$(CONFIG_LIBVIRT_STORAGE_POOL_PATH))/kdevops/guestfs/base_images/*

scripts/prune_stale_vagrant.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if [[ "$CONFIG_LIBVIRT" != "y" ]]; then
3737
fi
3838

3939
if [[ $# -eq 0 ]]; then
40-
KDEVOPS_POOL_PATH="$CONFIG_KDEVOPS_STORAGE_POOL_PATH"
40+
KDEVOPS_POOL_PATH="$CONFIG_LIBVIRT_STORAGE_POOL_PATH"
4141
elif [[ $# -eq 1 ]]; then
4242
if [[ "$1" == "--help" ]]; then
4343
echo "Usage: $0"

scripts/vagrant.Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ ifeq (y,$(CONFIG_VAGRANT_VIRTUALBOX))
4444
VAGRANT_ARGS += virtualbox_provider=True
4545
endif
4646

47-
STORAGE_POOL_PATH:=$(subst ",,$(CONFIG_KDEVOPS_STORAGE_POOL_PATH))
48-
KDEVOPS_STORAGE_POOL_PATH:=$(STORAGE_POOL_PATH)/kdevops
49-
VAGRANT_ARGS += storage_pool_path=$(STORAGE_POOL_PATH)
50-
VAGRANT_ARGS += kdevops_storage_pool_path=$(KDEVOPS_STORAGE_POOL_PATH)
51-
5247
VAGRANT_9P_HOST_CLONE :=
5348
ifeq (y,$(CONFIG_BOOTLINUX_9P))
5449
VAGRANT_9P_HOST_CLONE := vagrant_9p_linux_clone

0 commit comments

Comments
 (0)