Bug 957276 - Cannot launch instances if Compute Node is a VM (SELinux)
Summary: Cannot launch instances if Compute Node is a VM (SELinux)
Keywords:
Status: CLOSED DUPLICATE of bug 915349
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-selinux
Version: 2.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: async
: 2.1
Assignee: Lon Hohberger
QA Contact: Ami Jeain
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-26 19:53 UTC by Forrest Taylor
Modified: 2016-04-27 02:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-27 14:54:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Forrest Taylor 2013-04-26 19:53:34 UTC
Description of problem:
If the compute node is a VM, instances will fail to launch because SELinux blocks access to the image file.


Version-Release number of selected component (if applicable):
On the VM (not working):
selinux-policy-3.7.19-195.el6_4.3.noarch
openstack-selinux-0.1.2-10.el6ost.noarch

On the physical machine (working):
selinux-policy-3.7.19-195.el6.noarch
package openstack-selinux is not installed

How reproducible:
Always

Steps to Reproduce:
1. Install RHEL physical machine with RHEL VM.
2. Use packstack --gen-answer-file/--answer-file to install RHOS on the RHEL VM.  I changed the NTP server, SSH keys, floating IPs and Horizon SSL.  All other options were left at their defaults.
3. Manually add the physical machine as a nova compute node.
4. Add QCOW2 image and launch instances.
  
Actual results:
The physical machine works fine; instances can be created.  The VM fails to generate working instances (the status shows error).

I get these errors in the audit.log:

type=AVC msg=audit(1366998480.516:23372): avc:  denied  { read } for
pid=32383 comm="qemu-kvm"
name="64b951fc68d1c11fe1abf1c06e8e4198745135a7" dev=dm-1 ino=393831
scontext=unconfined_u:system_r:svirt_t:s0:c356,c996
tcontext=unconfined_u:object_r:nova_var_lib_t:s0 tclass=file

type=AVC msg=audit(1366998480.516:23373): avc:  denied  { getattr } for
pid=32383 comm="qemu-kvm"
path="/var/lib/nova/instances/_base/64b951fc68d1c11fe1abf1c06e8e4198745135a7" dev=dm-1 ino=393831 scontext=unconfined_u:system_r:svirt_t:s0:c356,c996 tcontext=unconfined_u:object_r:nova_var_lib_t:s0 tclass=file

type=AVC msg=audit(1366998480.516:23374): avc:  denied  { read } for
pid=32383 comm="qemu-kvm"
name="64b951fc68d1c11fe1abf1c06e8e4198745135a7" dev=dm-1 ino=393831
scontext=unconfined_u:system_r:svirt_t:s0:c356,c996
tcontext=unconfined_u:object_r:nova_var_lib_t:s0 tclass=file


Expected results:
I should be able to instantiate instances on the VM compute node.

Additional info:
Listing of the directory mentioned above on both machines.  Notice the different permissions (user and SELinux):

VM (not working):
# ls -Z /var/lib/nova/instances/_base/
-rw-r--r--. nova nova unconfined_u:object_r:nova_var_lib_t:s0
64b951fc68d1c11fe1abf1c06e8e4198745135a7

Physical (working):
# ls -Z /var/lib/nova/instances/_base/
-rw-r--r--. qemu qemu system_u:object_r:virt_content_t:s0
64b951fc68d1c11fe1abf1c06e8e4198745135a7


Workarounds:
1. setenforce 0
2. chcon -t virt_content_t /var/lib/nova/instances/_base/*

Running either of these on the VM allows an instance to be created properly.

Comment 2 Lon Hohberger 2013-04-26 20:34:00 UTC
This looks like a 6.4.z libvirt update is somehow missing.  Can you check 'rpm -q libvirt' in the physical host?

Comment 3 Lon Hohberger 2013-04-26 20:35:35 UTC
libvirt is supposed to transition things to the right contexts; a bug was fixed in 6.4.z which was preventing this from occurring.

# rpm -q libvirt
libvirt-0.10.2-18.el6_4.4.x86_64

Comment 4 Forrest Taylor 2013-04-27 01:01:10 UTC
Ah, I should have mentioned that this was on RHEL 6.4 GA except for the SELinux policy updates required by RHOS.  I'll grab libvirt and test again.

Comment 5 Forrest Taylor 2013-04-27 14:54:56 UTC
Updating libvirt to the version mentioned above does fix the issue.

Comment 6 Alan Pevec 2013-04-29 08:40:52 UTC

*** This bug has been marked as a duplicate of bug 915349 ***


Note You need to log in before you can comment on or make changes to this bug.