Bug 2097662

Summary: [Machines] The Target path is not listed correctly when creating storage pool
Product: Red Hat Enterprise Linux 9 Reporter: Xianghua Chen <xchen>
Component: cockpit-machinesAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: Xianghua Chen <xchen>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.1CC: kkoukiou, qzhang, wshi, ymao, yunyang
Target Milestone: rcKeywords: Triaged
Target Release: 9.3Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 288 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:24:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 288
Embargoed:

Description Xianghua Chen 2022-06-16 09:19:21 UTC
Description of problem:
[Machines] The Target path is not listed correctly when creating storage pool 
 
Packages:
cockpit-machines-269-1.el9.noarch
cockpit-269-1.el9.x86_64
libvirt-8.4.0-1.el9.x86_64

How reproducible:
100%

Steps:
1.  Create a user which is in libvirt group, such as test_libvirt:
# useradd -G libvirt test_libvirt
# passwd test_libvirt

2. Create two directories, such as:
mkdir /home/test
mkdir -p /home/test_libvirt/tmp

3. Use test_libvirt to log into the web console, enter Storage pools of Virtual Machines page

4. Click "Create storage pool" : 
Connection           System
Name                    test1
Type                      Filesystem directory
Target path           /home/test_libvirt/tmp

When entering part of the Target path, like /home/test , you will see /home/test_libvirt is not in the dropdown list.

Actual results:
Refer to step 4.

Expected results:
Should better list all the info in the list like :
/home/test/
/home/test_libvirt/

Additional info:

Comment 1 Xianghua Chen 2022-06-16 09:21:48 UTC
Actually this issue can be reproduced with root user too, so can skip step 1.

Comment 2 Katerina Koukiou 2023-01-24 18:34:42 UTC
Can you please let me know if you use 'Limited' or 'Privileged' mode when you login with the test_libvirt account?

When you create the /home/test_libvirt do you give it the correct permissions or it is root:root? 

You can maybe create the new user with `useradd -m -d /PATH/TO/FOLDER USERNAME`

Comment 3 Xianghua Chen 2023-02-06 03:26:56 UTC
Hi Katerina, sorry for late update. 
Yes when using the test_libvirt account, it's limited, and it can not change to Privileged with the create method "useradd -G libvirt test_libvirt".

Actually it's not permission issue I think, because when you  input each of following info you can see /home/test/ & /home/test_libvirt/: 
/home/
/home/t
/home/te
/home/tes

But when you input the last letter "t": /home/test , then /home/test_libvirt/ disappear in the dropdown list.

Comment 4 Katerina Koukiou 2023-02-09 22:33:52 UTC
Reproduceable more simple by the following steps:

[kkoukiou@192 ~]$ mkdir /tmp/test
[kkoukiou@192 ~]$ mkdir /tmp/test-1
[kkoukiou@192 ~]$ touch /tmp/test/test-content

In any dialog cockpit allows us using the FileAutoComplete component from pkg/lib type /tmp/test and expect /tmp/test-1 to be part of the dropdown. The bug is that it's not.

Comment 5 Simon Kobyda 2023-04-04 17:13:54 UTC
PR: https://github.com/cockpit-project/cockpit/pull/18606/

Comment 8 Xianghua Chen 2023-06-07 07:05:38 UTC
Verified with packages:
cockpit-machines-291-1.el9.noarch
cockpit-292-1.el9.x86_64
libvirt-dbus-1.4.1-5.el9.x86_64
libvirt-client-9.3.0-2.el9.x86_64

Steps:
1.  Create a user which is in libvirt group, such as test_libvirt:
# useradd -G libvirt test_libvirt
# passwd test_libvirt

2. Create two directories, such as:
mkdir /home/test
mkdir -p /home/test_libvirt/tmp

3. Use test_libvirt to log into the web console, enter Storage pools of Virtual Machines page

4. Click "Create storage pool" : 
Connection           System
Name                    test1
Type                      Filesystem directory
Target path           /home/test_libvirt/tmp

When entering part of the Target path, like /home/test , you can see all the dir in the list like :
/home/test/
/home/test_libvirt/

The /home/test_libvirt/ is not missing. So verified.

Comment 11 errata-xmlrpc 2023-11-07 08:24:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (cockpit-machines bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6336