diff mbox series

[v2,1/2] guestfs: Fix definition of guestfs_storage_dir

Message ID 20250409152335.890665-2-cel@kernel.org (mailing list archive)
State New
Headers show
Series Add uniquifier to storage pool path | expand

Commit Message

Chuck Lever April 9, 2025, 3:23 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

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

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 kconfigs/Kconfig.guestfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Gomez April 10, 2025, 8:41 a.m. UTC | #1
On Wed, Apr 09, 2025 at 11:23:34AM +0100, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> {{ kdevops_storage_pool_path }} already ends with "/kdevops", so
> remove that string from the end of guestfs_storage_dir to ensure
> the permissions checking is looking for the correct directory.

I'm currently getting this:

storage_pool_path: "/var/lib/libvirt/images"
libvirt_storage_pool_path: "/var/lib/libvirt/images"
kdevops_storage_pool_path: "{{ libvirt_storage_pool_path }}/kdevops"
"{{ kdevops_storage_pool_path }}/kdevops/guestfs"

guestfs_storage_dir resolves into:
/var/lib/libvirt/images/kdevops/kdevops/guestfs

Shall we also cleanup the STORAGE_POOL_PATH?

kconfigs/Kconfig.guestfs:config STORAGE_POOL_PATH
playbooks/roles/gen_nodes/templates/kdevops_nodes_split_start.j2.yaml:  storage_pool_path: "{{ kdevops_storage_pool_path }}"
playbooks/roles/install_vagrant/tasks/main.yml:    path: "{{ storage_pool_path }}"
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:- name: Test SELinux context of {{ storage_pool_path }}
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:  command: "/usr/bin/stat -c %C {{ storage_pool_path }}"
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:  register: storage_pool_path_ctx
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:- name: Set SELinux context on {{ storage_pool_path }}
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:    target: "{{ storage_pool_path }}(/.*)?"
playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:    - storage_pool_path_ctx.stdout.find(':svirt_home_t:') == -1

I think we should also remove it and replace it with kdevops_storage_pool_path
in the above playbooks.

> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Reviewed-by: Daniel Gomez <da.gomez@samsung.com>

> ---
>  kconfigs/Kconfig.guestfs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
> index d309436fa7c9..460ee703fd68 100644
> --- a/kconfigs/Kconfig.guestfs
> +++ b/kconfigs/Kconfig.guestfs
> @@ -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
> -- 
> 2.49.0
>
Chuck Lever April 10, 2025, 2:39 p.m. UTC | #2
On 4/10/25 4:41 AM, Daniel Gomez wrote:
> On Wed, Apr 09, 2025 at 11:23:34AM +0100, cel@kernel.org wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> {{ kdevops_storage_pool_path }} already ends with "/kdevops", so
>> remove that string from the end of guestfs_storage_dir to ensure
>> the permissions checking is looking for the correct directory.
> 
> I'm currently getting this:
> 
> storage_pool_path: "/var/lib/libvirt/images"
> libvirt_storage_pool_path: "/var/lib/libvirt/images"
> kdevops_storage_pool_path: "{{ libvirt_storage_pool_path }}/kdevops"
> "{{ kdevops_storage_pool_path }}/kdevops/guestfs"
> 
> guestfs_storage_dir resolves into:
> /var/lib/libvirt/images/kdevops/kdevops/guestfs

Yes, exactly.


> Shall we also cleanup the STORAGE_POOL_PATH?

Agreed, there is plenty of unnecessary redundancy.


> kconfigs/Kconfig.guestfs:config STORAGE_POOL_PATH
> playbooks/roles/gen_nodes/templates/kdevops_nodes_split_start.j2.yaml:  storage_pool_path: "{{ kdevops_storage_pool_path }}"
> playbooks/roles/install_vagrant/tasks/main.yml:    path: "{{ storage_pool_path }}"
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:- name: Test SELinux context of {{ storage_pool_path }}
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:  command: "/usr/bin/stat -c %C {{ storage_pool_path }}"
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:  register: storage_pool_path_ctx
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:- name: Set SELinux context on {{ storage_pool_path }}
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:    target: "{{ storage_pool_path }}(/.*)?"
> playbooks/roles/libvirt_user/tasks/enable-user/redhat/main.yml:    - storage_pool_path_ctx.stdout.find(':svirt_home_t:') == -1
> 
> I think we should also remove it and replace it with kdevops_storage_pool_path
> in the above playbooks.

I'll propose a second patch that attempts to clean these up.

Not sure I want to touch install_vagrant/tasks/main.yml ... Perhaps
I should remove that role first.


>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> 
> Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
> 
>> ---
>>  kconfigs/Kconfig.guestfs | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
>> index d309436fa7c9..460ee703fd68 100644
>> --- a/kconfigs/Kconfig.guestfs
>> +++ b/kconfigs/Kconfig.guestfs
>> @@ -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
>> -- 
>> 2.49.0
>>
diff mbox series

Patch

diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
index d309436fa7c9..460ee703fd68 100644
--- a/kconfigs/Kconfig.guestfs
+++ b/kconfigs/Kconfig.guestfs
@@ -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