Skip to contentSkip to conversation

Add uniquifier to storage pool path

PATCH Superseded [email protected] 3 participants 12 messages Apr 14, 2025 – Apr 23, 2025 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 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.

v2 introduces some additional clean-ups, and attempts to address review comments.

Chuck Lever (4):
guestfs: Fix definition of guestfs_storage_dir
install_vagrant: Remove this role
Replace STORAGE_POOL_PATH with LIBVIRT_STORAGE_POOL_PATH
guestfs: Per-user storage pools

 Makefile.kdevops                              |   6 -
 docs/ansible-roles.md                         |   1 -
 docs/kdevops-vagrant.md                       |   3 -
 kconfigs/Kconfig.guestfs                      |   7 +-
 kconfigs/Kconfig.libvirt                      |   2 +-
 playbooks/install_vagrant.yml                 |   4 -
 playbooks/roles/install_vagrant/README.md     |  46 ------
 playbooks/roles/install_vagrant/Vagrantfile   |   3 -
 .../roles/install_vagrant/defaults/main.yml   |  38 -----
 .../files/ruby_extensions_devel_key.pub       |  20 ---
 .../roles/install_vagrant/files/vagrant.pub   |  21 ---
 .../tasks/install-deps/debian/main.yml        |  86 ----------
 .../tasks/install-deps/fedora/main.yml        |  14 --
 .../tasks/install-deps/main.yml               |  27 ----
 .../tasks/install-deps/redhat/main.yml        | 148 ------------------
 .../tasks/install-deps/suse/add_obs_repo.yml  | 137 ----------------
 .../tasks/install-deps/suse/main.yml          | 119 --------------
 .../roles/install_vagrant/tasks/main.yml      |  43 -----
 .../tasks/enable-user/redhat/main.yml         |   8 +-
 scripts/bringup.Makefile                      |   1 -
 scripts/bringup_guestfs.sh                    |   3 +-
 scripts/destroy_guestfs.sh                    |   2 +-
 scripts/guestfs.Makefile                      |   2 +-
 23 files changed, 9 insertions(+), 732 deletions(-)
 delete mode 100644 playbooks/install_vagrant.yml
 delete mode 100644 playbooks/roles/install_vagrant/README.md
 delete mode 100644 playbooks/roles/install_vagrant/Vagrantfile
 delete mode 100644 playbooks/roles/install_vagrant/defaults/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/files/ruby_extensions_devel_key.pub
 delete mode 100644 playbooks/roles/install_vagrant/files/vagrant.pub
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/debian/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/fedora/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/redhat/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/suse/add_obs_repo.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/suse/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/main.yml
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/4 guestfs: Fix definition of guestfs_storage_dir

From: Chuck Lever <[email protected]>

{{ kdevops_storage_pool_path }} already ends with "/kdevops", so remove that string from the end of guestfs_storage_dir to ensure the permissions check is examining the correct directory.

---
 kconfigs/Kconfig.guestfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kconfigs/Kconfig.guestfs +1 -1
index d309436fa7c9..460ee703fd68 100644
@@ -8,7 +8,7 @@ config STORAGE_POOL_PATH
 config GUESTFS_STORAGE_DIR
 	string
 	output yaml
-	default "{{ kdevops_storage_pool_path }}/kdevops/guestfs"
+	default "{{ kdevops_storage_pool_path }}/guestfs"
 
 config GUESTFS_BASE_IMAGE_DIR
 	string
Signature · 1 line
2.49.0
#3 lore raw

PATCH v2 2/4 install_vagrant: Remove this role

In reply to [email protected]

From: Chuck Lever <[email protected]>

Now that vagrant can no longer be used, this role is never invoked and cannot be tested. Remove it so that it does not become a source of technical debt.

---
 Makefile.kdevops                              |   6 -
 docs/ansible-roles.md                         |   1 -
 docs/kdevops-vagrant.md                       |   3 -
 playbooks/install_vagrant.yml                 |   4 -
 playbooks/roles/install_vagrant/README.md     |  46 ------
 playbooks/roles/install_vagrant/Vagrantfile   |   3 -
 .../roles/install_vagrant/defaults/main.yml   |  38 -----
 .../files/ruby_extensions_devel_key.pub       |  20 ---
 .../roles/install_vagrant/files/vagrant.pub   |  21 ---
 .../tasks/install-deps/debian/main.yml        |  86 ----------
 .../tasks/install-deps/fedora/main.yml        |  14 --
 .../tasks/install-deps/main.yml               |  27 ----
 .../tasks/install-deps/redhat/main.yml        | 148 ------------------
 .../tasks/install-deps/suse/add_obs_repo.yml  | 137 ----------------
 .../tasks/install-deps/suse/main.yml          | 119 --------------
 .../roles/install_vagrant/tasks/main.yml      |  43 -----
 scripts/bringup.Makefile                      |   1 -
 17 files changed, 717 deletions(-)
 delete mode 100644 playbooks/install_vagrant.yml
 delete mode 100644 playbooks/roles/install_vagrant/README.md
 delete mode 100644 playbooks/roles/install_vagrant/Vagrantfile
 delete mode 100644 playbooks/roles/install_vagrant/defaults/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/files/ruby_extensions_devel_key.pub
 delete mode 100644 playbooks/roles/install_vagrant/files/vagrant.pub
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/debian/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/fedora/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/redhat/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/suse/add_obs_repo.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/install-deps/suse/main.yml
 delete mode 100644 playbooks/roles/install_vagrant/tasks/main.yml
Makefile.kdevops +0 -6
index 2c36dce47eb1..60d79a5a3e48 100644
@@ -14,11 +14,6 @@ kdevops_terraform_deps:
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml
 PHONY += kdevops_terraform_deps
 
-kdevops_vagrant_install_vagrant:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
-		$(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant.yml
-
 kdevops_install_libvirt:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
 		--inventory localhost, \
@@ -31,7 +26,6 @@ kdevops_configure_libvirt:
 		-e 'running_user=$(USER)'
 
 kdevops_vagrant_deps: \
-		kdevops_vagrant_install_vagrant \
 		kdevops_install_libvirt \
 		kdevops_configure_libvirt
 
docs/ansible-roles.md +0 -1
index d900fa458bfd..dfb05b9fd798 100644
@@ -7,7 +7,6 @@ The following local ansible roles are used:
   * [create_partition](./playbooks/roles/create_partition/README.md)
   * create_data_partition: creates the data partition, uses the `create_partition` role
   * [install_terraform/](./playbooks/roles/install_terraform/README.md)
-  * [install_vagrant/](./playbooks/roles/install_vagrant/README.md)
   * [install_vagrant_boxes](./playbooks/roles/install_vagrant_boxes/README.md)
   * [libvirt_user](./playbooks/roles/libvirt_user/README.md)
   * [update_ssh_config_vagrant](./playbooks/roles/update_ssh_config_vagrant/README.md)
docs/kdevops-vagrant.md +0 -3
index ae2ad831d21a..1e214d096d86 100644
@@ -1,8 +1,5 @@
 # Vagrant support - localized VMs
 
-Read the [kdevops_vagrant](playbooks/roles/install_vagrant/README.md)
-documentation, then come here and read this.
-
 Vagrant is used to easily deploy non-cloud virtual machines. Below are
 the list of providers supported:
 
playbooks/install_vagrant.yml deleted +0 -4
deleted file mode 100644
index af6bb5e1c406..000000000000
@@ -1,4 +0,0 @@
----
-- hosts: localhost
-  roles:
-    - role: install_vagrant
playbooks/roles/install_vagrant/README.md deleted +0 -46

46 lines not on this page · raw message

playbooks/roles/install_vagrant/Vagrantfile deleted +0 -3
deleted file mode 100644
index ef6b17fc13b1..000000000000
@@ -1,3 +0,0 @@
-unless Vagrant.has_plugin?("vagrant-libvirt")
-  raise 'vagrant-libvirt is not installed!'
-end
playbooks/roles/install_vagrant/defaults/main.yml deleted +0 -38
deleted file mode 100644
index 0941b97d0ca1..000000000000
@@ -1,38 +0,0 @@
-# SPDX-License-Identifier copyleft-next-0.3.1
----
-
-storage_pool_user: "root"
-storage_pool_group: "root"
-
-# kdevops *owns* this so we expect to set this to something
-# sensible with kconfig.
-kdevops_storage_pool_user: "root"
-kdevops_storage_pool_group: "root"
-
-libvirt_provider: False
-virtualbox_provider: False
-libvirt_storage_pool_create: False
-
-storage_pool_path: "/dev/null"
-kdevops_storage_pool_path: "/dev/null"
-
-# You can override these
-vagrant_version: "2.2.19"
-
-# Ignores using distro packages and installs from zip file instead
-force_install_zip: False
-
-# Forces to install even if it is already present
-force_install_if_present: False
-
-# Set this to True and create a map with the sle_distro_end_map variable
-# if you are working with unreleased distros, which have no public OBS URLs yet.
-sle_custom_repo_distro_end: False
-
-# Example boxes with URLs. You would override this.
-#
-# For instance, for SLE 15.2 we'd want to use:
-# https://download.opensuse.org/repositories/Virtualization:/vagrant/SLE_15-SP1/
-# for now, as we have no public release on obs for 15.2 yet.
-sle_distro_end_map:
-  - { obs_project_name: 'Virtualization:vagrant', ansible_distribution_version: '15.2', repo_distro_end: '15-SP1' }
playbooks/roles/install_vagrant/files/ruby_extensions_devel_key.pub deleted +0 -20
deleted file mode 100644
index e34b0c1fe170..000000000000
@@ -1,20 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.5 (GNU/Linux)
-
-mQGiBEh7UZcRBACLvGPkYIZVbMpfDmIwQ+Dv1mGuMZ2nRnWZSMfled6W+njVjCXV
-ogw1dOeR4guVADsTkkOXPGy9ehfBB0hLxQVVRIuZtsGY+SsqG8QhStmYkbm8hF8w
-V0OpVNYSHkkeCRkXba8xNQFtxP+7qqLcCIvsH5kkw5xtS9AgtKVUKARh+wCg90PK
-lVsDq3xlQy5Sxm7y1oVTY0UEAIK0Zkh0nVf5oaGeQ5ADXLxqGZHwzrUsX6otKl2M
-fAPHLF2d+W2IFCQg3vxok2ON1y0iaaT/lJTx345Eo0PTY7iUJz+lK4u3wvgHk/jN
-ZiMzZlRfZ5JKGph2kTw3rgXPc727a2tlGCaR56BtxMhGFs9pQzZt8w5vFVpJ456u
-pKNYA/9wyRFS/3gGzMfndM/qst8gJ8pLAa8omAyu4PXyZKcvNmq+YV6t/WXrt/wF
-mvEZwZzbPp5dwER6JKLW33N433a/h3ABT2nW1vapa4c78KfOyk3C+eY5mrH9UmhK
-nfRAacH6XOnLoDSRjfY2hbHZmeRGvaz237QkXk6ojGZ7x3chGLRKZGV2ZWw6bGFu
-Z3VhZ2VzOnJ1YnkgT0JTIFByb2plY3QgPGRldmVsOmxhbmd1YWdlczpydWJ5QGJ1
-aWxkLm9wZW5zdXNlLm9yZz6IZgQTEQIAJgUCW8Q6+AIbAwUJF2eZYQYLCQgHAwIE
-FQIIAwQWAgMBAh4BAheAAAoJEJrwyaIOmvEj75AAmwYlB0mYqsYycWJ77bl+oeiL
-sHjgAJ43giIbI7qOcxuTE+JmKeg8kfIyx4hGBBMRAgAGBQJIe1GXAAoJEDswEbdr
-nWUj2GkAn3w67FAdfBcX8/ax3PkgPeiLucqmAJ4m2LnytD9F1/oeRmOrBS8hgmIp
-5w==
-=fmVv
------END PGP PUBLIC KEY BLOCK-----
playbooks/roles/install_vagrant/files/vagrant.pub deleted +0 -21
deleted file mode 100644
index 13d9f438e9aa..000000000000
@@ -1,21 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.5 (GNU/Linux)
-
-mQENBFImAl0BCACkjaXGvVLHBGTVXVP0khtpUVHqFvCRtaIIMHaX/5oTr3nyehDQ
-Ex9VLsSRcNa0QxtnCHFRQzjWWqe+i6pBginnSjucgmjnIKyJsF4l6R+rwAiinHQX
-C4s6Lqg/wH9xDPRBrMYFqlc/7MVf0Glhk1+lAxgQjolMt+5AbbrWlBbwc/i+++zl
-ES3MaeH8aiwup/ogjhmk0SbCQQ/ib21p3XWBwx2oz/KM6Voq9tKDvMczjzNRY3ZT
-6Di3FsUSKI7kgljiNiuN+675YwqEqxWEJgdE5a7Zb67giH1Ik08b5wQiF5jSAICD
-DxW7/ibWBvZJnqhqQT2xJpLC5VaJqwkN8o83ABEBAAG0PlZpcnR1YWxpemF0aW9u
-IE9CUyBQcm9qZWN0IDxWaXJ0dWFsaXphdGlvbkBidWlsZC5vcGVuc3VzZS5vcmc+
-iQE8BBMBAgAmBQJaPd9XAhsDBQkMNoz6BgsJCAcDAgQVAggDBBYCAwECHgECF4AA
-CgkQoZP7tXIXT8JL9AgAmSAr5NOzSZ6HE6P8aEMMdH5gK3PWfBhIVUvnAql4/90Y
-0AnUXAFgwf4WS8qqd4s/yCoXKmQ/trEJINVIOcISYRmuZxZnO65AgYSUqcKa7M0X
-YJYCaEexML/AUqNjPPd7aoISxgxHPYF5rvKKq29Q5ORas5mDQGUWCcSo+Nx6twh1
-t+HJyhAK+CFRFDns57jXHf7QDlKGM0+9wfgwi7E61+bEbSIISEco/lyH1u1epqvN
-1SDXzauGZRi7nu39+DN8CJpw1l40GafB6KGkKQ0wQ1ORZP21LnQ2YCvniIeiZwEu
-5eVxIpoKOmIIzAk1DWLfelaFhM2bwpjRKScNbFikZohGBBMRAgAGBQJSJgJdAAoJ
-EDswEbdrnWUjucgAoK+hIu0GfjwJoODK+XW/uDN2nqQBAJ4lN90WkygQhpMEIupB
-6+FWiCNvxA==
-=yQVo
------END PGP PUBLIC KEY BLOCK-----
playbooks/roles/install_vagrant/tasks/install-deps/debian/main.yml deleted +0 -86

86 lines not on this page · raw message

playbooks/roles/install_vagrant/tasks/install-deps/fedora/main.yml deleted +0 -14
deleted file mode 100644
index 45cce5f7d8d2..000000000000
@@ -1,14 +0,0 @@
----
-- name: Install vagrant and vagrant-plugin-libvirt
-  become: yes
-  become_method: sudo
-  dnf:
-    name:
-      - vagrant
-      - vagrant-libvirt
-    state: present
-
-- name: Install the timezone vagrant plugin
-  command: "vagrant plugin install vagrant-timezone"
-  register: cmd_done
-  changed_when: "cmd_done.rc == 0"
playbooks/roles/install_vagrant/tasks/install-deps/main.yml deleted +0 -27
deleted file mode 100644
index 87b87f3b4ba2..000000000000
@@ -1,27 +0,0 @@
----
-- name: Import optional distribution specific variables
-  include_vars: "{{ item }}"
-  ignore_errors: yes
-  with_first_found:
-    - files:
-      - "{{ ansible_facts['os_family']|lower }}.yml"
-      skip: true
-  tags: vars
-
-- name: Debian-specific setup
-  include_tasks: debian/main.yml
-  when: ansible_facts['os_family']|lower == 'debian'
-
-- name: SuSE-specific setup
-  include_tasks: suse/main.yml
-  when: ansible_facts['os_family']|lower == 'suse'
-
-- name: Red Hat Enterprise-specific setup
-  include_tasks: redhat/main.yml
-  when:
-    - ansible_facts['os_family']|lower == 'redhat'
-    - ansible_facts['distribution']|lower != "fedora"
-
-- name: Fedora-specific setup
-  include_tasks: fedora/main.yml
-  when: ansible_facts['distribution']|lower == "fedora"
playbooks/roles/install_vagrant/tasks/install-deps/redhat/main.yml deleted +0 -148

148 lines not on this page · raw message

playbooks/roles/install_vagrant/tasks/install-deps/suse/add_obs_repo.yml deleted +0 -137

137 lines not on this page · raw message

playbooks/roles/install_vagrant/tasks/install-deps/suse/main.yml deleted +0 -119

119 lines not on this page · raw message

playbooks/roles/install_vagrant/tasks/main.yml deleted +0 -43

43 lines not on this page · raw message

scripts/bringup.Makefile +0 -1
index ad8e8d0aa750..5a04448e6970 100644
@@ -6,7 +6,6 @@ else
 stage-2-$(CONFIG_TERRAFORM)			+= kdevops_terraform_deps
 stage-2-$(CONFIG_LIBVIRT_INSTALL)	+= kdevops_install_libvirt
 stage-2-$(CONFIG_LIBVIRT_CONFIGURE)	+= kdevops_configure_libvirt
-stage-2-$(CONFIG_VAGRANT)			+= kdevops_vagrant_install_vagrant
 stage-2-$(CONFIG_VAGRANT_INSTALL_PRIVATE_BOXES)	+= kdevops_vagrant_boxes
 stage-2-$(CONFIG_LIBVIRT_VERIFY)	+= kdevops_verify_libvirt_user
 stage-2-$(CONFIG_LIBVIRT_STORAGE_POOL_CREATE)	+= kdevops_libvirt_storage_pool_create
Signature · 1 line
2.49.0
#5 lore raw

PATCH v2 3/4 Replace STORAGE_POOL_PATH with LIBVIRT_STORAGE_POOL_PATH

In reply to [email protected]

From: Chuck Lever <[email protected]>

Clean up.

---
 kconfigs/Kconfig.guestfs                                  | 5 -----
 .../roles/libvirt_user/tasks/enable-user/redhat/main.yml  | 8 ++++----
 2 files changed, 4 insertions(+), 9 deletions(-)
kconfigs/Kconfig.guestfs +0 -5
index 460ee703fd68..a2fddd691be9 100644
@@ -1,10 +1,5 @@
 if GUESTFS
 
-config STORAGE_POOL_PATH
-	string
-	output yaml
-	default LIBVIRT_STORAGE_POOL_PATH
-
 config GUESTFS_STORAGE_DIR
 	string
 	output yaml
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml +4 -4
index 1a18c4b4f29f..717d8ef68569 100644
@@ -35,16 +35,16 @@
   when:
     - only_verify_user|bool
 
-- name: Test SELinux context of {{ storage_pool_path }}
-  command: "/usr/bin/stat -c %C {{ storage_pool_path }}"
+- name: Test SELinux context of {{ libvirt_storage_pool_path }}
+  command: "/usr/bin/stat -c %C {{ libvirt_storage_pool_path }}"
   register: storage_pool_path_ctx
   when:
     - only_verify_user|bool
 
-- name: Set SELinux context on {{ storage_pool_path }}
+- name: Set SELinux context on {{ libvirt_storage_pool_path }}
   become: yes
   community.general.sefcontext:
-    target: "{{ storage_pool_path }}(/.*)?"
+    target: "{{ libvirt_storage_pool_path }}(/.*)?"
     setype: svirt_home_t
     state: present
   when:
Signature · 1 line
2.49.0
#7 lore raw

PATCH v2 4/4 guestfs: Per-user storage pools

In reply to [email protected]

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 | 3 +--
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 2 +-
 4 files changed, 4 insertions(+), 5 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 -2
index 94e0437192be..ea2ff5ee00a5 100755
@@ -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_KDEVOPS_STORAGE_POOL_PATH}/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..5e307429f20a 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_KDEVOPS_STORAGE_POOL_PATH}/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
scripts/guestfs.Makefile +1 -1
index 3dad6a14f0c5..3393fba3d520 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_KDEVOPS_STORAGE_POOL_PATH}/guestfs"))/guestfs/base_images/*
Signature · 1 line
2.49.0
#8 lore raw

Re: [PATCH v2 4/4] guestfs: Per-user storage pools

Quoted 40 lines · On 4/14/25 1:05 PM, [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 | 3 +--
 scripts/destroy_guestfs.sh | 2 +-
 scripts/guestfs.Makefile   | 2 +-
 4 files changed, 4 insertions(+), 5 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 +0 -0
index 94e0437192be..ea2ff5ee00a5 100755

scripts/bringup_guestfs.sh IMG_FMT="qcow2" · line 17

Quoted 6 lines
scripts/bringup_guestfs.sh +1 -2
@@ -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_KDEVOPS_STORAGE_POOL_PATH}/guestfs"

This by itself will not work. KDEVOPS_STORAGE_POOL_PATH contains a template string:

{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}

not a file pathname.

Quoted 26 lines
scripts/bringup_guestfs.sh +0 -0
 QEMU_GROUP=$CONFIG_LIBVIRT_QEMU_GROUP
 GUESTFSDIR="${TOPDIR}/guestfs"
 OS_VERSION=${CONFIG_VIRT_BUILDER_OS_VERSION}
scripts/destroy_guestfs.sh +1 -1
index ee5dc2b57d6d..5e307429f20a 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_KDEVOPS_STORAGE_POOL_PATH}/guestfs"
 GUESTFSDIR="${TOPDIR}/guestfs"
 
 if [ -f "$GUESTFSDIR/kdevops_nodes.yaml" ]; then
scripts/guestfs.Makefile +1 -1
index 3dad6a14f0c5..3393fba3d520 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_KDEVOPS_STORAGE_POOL_PATH}/guestfs"))/guestfs/base_images/*
Signature · 1 line
Chuck Lever
#9 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, Apr 14, 2025 at 01:05:42PM -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, OS base images, and block devices will interfere with each other.

Quoted 5 lines

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

v2 introduces some additional clean-ups, and attempts to address review comments.

I gave this a spin to see if exisitng deployments won't break but they would right away:

Here is me running on a debian system where we had the old setup:

make defconfig-seltests-radix-tree KDEVOPS_HOSTS_PREFIX=x2 make -j128
make bringup

User mcgrof is part of the libvirt-qemu group.
.//scripts/bringup_guestfs.sh: line 276: [: too many arguments
cp: target '}}/guestfs/x2-maple/root.raw': No such file or directory
Extra parameter on the command line: ‘libvirt_storage_pool_path’.
Try ‘virt-sysprep --help’ or consult virt-sysprep(1) for more information.
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra0.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra0.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra1.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra1.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra2.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra2.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra3.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra3.raw': No such file or directory
Domain 'x2-maple' defined from .//guestfs/x2-maple/x2-maple.xml

error: Failed to start domain 'x2-maple'
error: Cannot access storage file '/xfs1/libvirt/mcgrof/guestfs/x2-maple/root.raw': No such file or directory

Failed to start x2-maple
make: *** [scripts/guestfs.Makefile:80: bringup_guestfs] Error 1

So, while I like the idea and approach, this would break tons of deployments right now.

Luis

Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] install_vagrant: Remove this role

In reply to [email protected]
Quoted 7 lines · On Mon, Apr 14, 2025 at 01:05:44PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>

Now that vagrant can no longer be used, this role is never invoked and cannot be tested. Remove it so that it does not become a source of technical debt.

This should already go in!

Luis

Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] guestfs: Fix definition of guestfs_storage_dir

In reply to [email protected]
Quoted 8 lines · On Mon, Apr 14, 2025 at 01:05:43PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>

{{ kdevops_storage_pool_path }} already ends with "/kdevops", so remove that string from the end of guestfs_storage_dir to ensure the permissions check is examining the correct directory.

Luis

#10 lore raw
In reply to Luis Chamberlain
Quoted 2 lines · Luis Chamberlain

So, while I like the idea and approach, this would break tons of deployments right now.

The first 3 patches work well though, so they should be just merged.

As for the last patch, it seems it would design a new world order, and its perfeclty fine, its the right thing to do. I'm convinced the debian system session crap as default is just crap and we need to phase it out. But in the meantime we can't break existing deployments, specially CIs. So what I can recommend is having a new kconfig symbol for this new option. If user session based distros (Fedora, RH) can take advantage of this patch without breaking exisiting systems then this can just be the new default for them. Otherwise this new world order will just be that, a new choice.

That is, with a new kconfig option to make this a new option (could be a default for the distros where this does not break their existing deployments) this seems sensible to merge. But for debian based systems, this can't be a default.

Luis

#11 lore raw
In reply to Luis Chamberlain
Quoted 59 lines · Luis Chamberlain
Quoted 9 lines · On Mon, Apr 14, 2025 at 01:05:42PM -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, OS base images, and block devices will interfere with each other.

Quoted 5 lines

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

v2 introduces some additional clean-ups, and attempts to address review comments.

I gave this a spin to see if exisitng deployments won't break but they would right away:

Here is me running on a debian system where we had the old setup:

make defconfig-seltests-radix-tree KDEVOPS_HOSTS_PREFIX=x2 make -j128
make bringup

User mcgrof is part of the libvirt-qemu group.
.//scripts/bringup_guestfs.sh: line 276: [: too many arguments
cp: target '}}/guestfs/x2-maple/root.raw': No such file or directory
Extra parameter on the command line: ‘libvirt_storage_pool_path’.
Try ‘virt-sysprep --help’ or consult virt-sysprep(1) for more information.
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra0.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra0.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra1.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra1.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra2.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra2.raw': No such file or directory
Formatting '{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}/guestfs/x2-maple/extra3.raw', fmt=raw size=107374182400
chmod: cannot access '{{': No such file or directory
chmod: cannot access 'libvirt_storage_pool_path': No such file or directory
chmod: cannot access '}}/{{': No such file or directory
chmod: cannot access 'kdevops_storage_pool_user': No such file or directory
chmod: cannot access '}}/guestfs/x2-maple/extra3.raw': No such file or directory
Domain 'x2-maple' defined from .//guestfs/x2-maple/x2-maple.xml

error: Failed to start domain 'x2-maple'
error: Cannot access storage file '/xfs1/libvirt/mcgrof/guestfs/x2-maple/root.raw': No such file or directory

Quoted 7 lines

Failed to start x2-maple
make: *** [scripts/guestfs.Makefile:80: bringup_guestfs] Error 1

So, while I like the idea and approach, this would break tons of deployments right now.

Luis

As I mentioned here [1], because KDEVOPS_STORAGE_POOL_PATH contains a template string:

{{ libvirt_storage_pool_path }}/{{ kdevops_storage_pool_user }}

not a file pathname, 4/4 won't work.

I've committed 1/4 through 3/4 to linux-kdevops, and can post an updated version of 4/4 that might work better for you. But if it doesn't, then I'm open to adding a Kconfig option as you suggested.

Signature · 4 lines
Chuck Lever

[1]
https://lore.kernel.org/kdevops/[email protected]/