Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 790045

Summary: New storage pool creation doesn't correctly set owner and group when running as non-root user
Product: Red Hat Enterprise Linux 6 Reporter: Jonathan Underwood <jonathan.underwood>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: acathrow, dallan, dyuan, mzhan, rwu, whuang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-13 16:22:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Underwood 2012-02-13 14:42:53 UTC
Description of problem:
If one sets up PolicyKit rules to allow non-root users to manage virtual
machines, then when creating a new storage pool (directory based) via
virsh pool-define-as, then the new storage pool directory is created with owner and group still as root, and not the user that virt-manager is running under. As a result, that user can't use the storage pool just created for new VMs.


Version-Release number of selected component (if applicable):
libvirt-client-0.8.7-18.el6_1.4.x86_64

How reproducible:
Everytime

Steps to Reproduce:
1. Create the file /etc/polkit-1/localauthority/50-local.d/50-virt.pkla with
the following contents to allow non-root users to run virt-manager:

[Allow all users libvirt management permissions but require password]
Identity=*
Action=org.libvirt.unix.manage
ResultAny=auth_self_keep
ResultInactive=auth_self_keep
ResultActive=auth_self_keep

2. As a non-root user create a new storage pool:
virsh --connect qemu:///system "pool-define-as jgu-vmstore  --type=dir --target=/scratch/virt/jgu/images ; pool-build jgu-vmstore ; pool-start jgu-vmstore ; pool-autostart jgu-vmstore"


3. Examine ownership of the directory just provisioned as a storage pool:
$ ls -ldZ /scratch/virt/jgu/images
drwx------. root root unconfined_u:object_r:default_t:s0 /scratch/virt/jgu/images

  
Actual results:
See above

Expected results:
I would expect the owner and group of the directory to be set to the user running virsh, rather than root.


More info on the use case for this:
http://stuckinadoloop.wordpress.com/2012/02/13/multi-user-use-of-virt-manager/

Comment 2 Dave Allan 2012-02-13 16:22:12 UTC
From reading your blog, it looks like you're now using pool-define and passing the user and group in the XML, which is the right thing to do in this situation.  I understand that the behavior of pool-define-as was surprising to you, but that's the way it's intended to work.  pool-define gives you the full control that you're looking for.  If you believe that this behavior should be changed, you should take this discussion to the upstream libvirt list, as the community might be willing to take patches to implement the behavior you want.

Comment 3 Jonathan Underwood 2012-02-13 16:28:49 UTC
I think what's actually missing is that the pool-define-as command should really have --owner and --group options. But yes, more of an upstream thing, agreed.