Bug 954247

Summary: error/debug messages throw out when start guest with static label + relabel='no' and libvirtd log_level=1
Product: Red Hat Enterprise Linux 7 Reporter: yanbing du <ydu>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, cwei, dyuan, gsun, mzhan, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.0.5-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 954248 (view as bug list) Environment:
Last Closed: 2014-06-13 12:22:51 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 954248    

Description yanbing du 2013-04-22 04:07:03 UTC
Description of problem:
Config libvirtd log_level=1, and set lable for a guest with static type 
<seclabel>, and relabel='no', when start the guest, error/debug messages 
throw out.
If set log_level=3, then this bug gone.


Version-Release number of selected component (if applicable):
libvirt-1.0.4-1.el7.x86_64
libvirt-0.10.2-18.el6_4.4.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Config libvirtd log level:

log_level = 1
log_outputs="1:file:/var/log/libvirt/libvirtd.log"

2. Make sure selinux is enforcing.
3. Config the <seclabel> element, and start it.
......
   <seclabel type='static' model='selinux' relabel='ynoes'>
     <label>system_u:system_r:svirt_t:s0:c392,c662</label>
   </seclabel>
......
On rhel7 host:
# virsh start kvm-rhel6.4-x86_64-qcow2-virtio
error: Failed to start domain kvm-rhel6.4-x86_64-qcow2-virtio
error: internal error process exited while connecting to monitor: 2013-04-19 10:36:20.886+0000: 3635: debug : virFileClose:72 : Closed fd 23
2013-04-19 10:36:20.886+0000: 3635: debug : virFileClose:72 : Closed fd 30
2013-04-19 10:36:20.888+0000: 3635: debug : virFileClose:72 : Closed fd 3
2013-04-19 10:36:20.888+0000: 3636: debug : virExec:602 : Run hook 0x7fca68d9b630 0x7fca6e0953a0
2013-04-19 10:36:20.888+0000: 3636: debug : qemuProcessHook:2505 : Obtaining domain lock
2013-04-19 10:36:20.888+0000: 3636: debug : virSecuritySELinuxSetSecuritySocketLabel:2016 : Setting VM kvm-rhel6.4-x86_64-qcow2-virtio socket context system_u:system_r:svirt_t:s0:c392,c662
2013-04-19 10:36:20.888+0000: 3636: debug : virDomainLockProcessStart:170 : plugin=0x7fca6001e0d0 dom=0x7fca602df720 paused=1 fd=0x7fca6e094f4c
2013-04-19 10:36:20.888+0000: 3636: debug : virDomainLockManagerNew:128 : plugin=0x7fca6001e0d0 dom=0x7fca602df720 withResources=1
2013-04-19 10:36:20.888+0000: 3636: debug : virLockManagerPluginGetDriver:297 : plugin=0x7fca6001e0d0
20


On rhel6 host:
# virsh start kvm-rhel6.4-x86_64-qcow2-virtio
error: Failed to start domain kvm-rhel6.4-x86_64-qcow2-virtio
error: internal error process exited while connecting to monitor: 2013-04-19 10:42:30.147+0000: 19121: debug : virFileClose:72 : Closed fd 21
2013-04-19 10:42:30.147+0000: 19121: debug : virFileClose:72 : Closed fd 28
2013-04-19 10:42:30.147+0000: 19121: debug : virFileClose:72 : Closed fd 3
char device redirected to /dev/pts/1
qemu-kvm: -drive file=/var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none: could not open disk image /var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img: Permission denied

4. If set log_level = 3, and restart libvirtd:
On rhel7 host:
# virsh start kvm-rhel6.4-x86_64-qcow2-virtio
error: Failed to start domain kvm-rhel6.4-x86_64-qcow2-virtio
error: internal error process exited while connecting to monitor: char device redirected to /dev/pts/3 (label charserial0)
qemu-kvm: -drive file=/var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none: could not open disk image /var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img: Permission denied

On rhel6 host:
# virsh start kvm-rhel6.4-x86_64-qcow2-virtio
error: Failed to start domain kvm-rhel6.4-x86_64-qcow2-virtio
error: internal error process exited while connecting to monitor: char device redirected to /dev/pts/1
qemu-kvm: -drive file=/var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none: could not open disk image /var/lib/libvirt/images/kvm-rhel6.4-x86_64-qcow2.img: Permission denied

  
Actual results:
Step4 outputs are expected results, but step3 need fix

Expected results:
Step3 output should like steps4's

Additional info:

Comment 2 Jiri Denemark 2013-04-22 18:31:01 UTC
Fixed upstream by v1.0.4-232-ge4bdba8 and v1.0.4-233-g6d1b3ed:

commit 6d1b3edc6e3e86567bd88b3e5157a88e49f1b118
Author: Jiri Denemark <jdenemar>
Date:   Mon Apr 22 18:20:21 2013 +0200

    qemu: Ignore libvirt logs when reading QEMU error output
    
    When QEMU fails to start, libvirt read its error output and reports it
    back in an error message. However, when libvirtd is configured to log
    debug messages, one would get the following unhelpful garbage:
    
        virsh # start cd
        error: Failed to start domain cd
        error: internal error process exited while connecting to monitor: \
          2013-04-22 14:24:54.214+0000: 2194219: debug : virFileClose:72 : \
          Closed fd 21
        2013-04-22 14:24:54.214+0000: 2194219: debug : virFileClose:72 : \
          Closed fd 27
        2013-04-22 14:24:54.215+0000: 2194219: debug : virFileClose:72 : \
          Closed fd 3
        2013-04-22 14:24:54.215+0000: 2194220: debug : virExec:602 : Run \
          hook 0x7feb8f600bf0 0x7feb86ef9300
        2013-04-22 14:24:54.215+0000: 2194220: debug : qemuProcessHook:2507 \
          : Obtaining domain lock
        2013-04-22 14:24:54.216+0000: 2194220: debug : \
          virDomainLockProcessStart:170 : plugin=0x7feb780261f0 \
          dom=0x7feb7802a360 paused=1 fd=0x7feb86ef8ec4
        2013-04-22 14:24:54.216+0000: 2194220: debug : \
          virDomainLockManagerNew:128 : plugin=0x7feb780261f0 \
          dom=0x7feb7802a360 withResources=1
        2013-04-22 14:24:54.216+0000: 2194220: debug : \
          virLockManagerPluginGetDriver:297 : plugin=0x7feb780261f0
        2013-04-22 14:24:54.216+0000: 2194220: debug : \
          virLockManagerNew:321 : driver=0x7feb8ef08640 type=0 nparams=5 \
          params=0x7feb86ef8d60 flags=0
        2013-04-22 14:24:54.216+000
    
    instead of (the output with this patch applied):
    
        virsh # start cd
        error: Reconnected to the hypervisor
        error: Failed to start domain cd
        error: internal error process exited while connecting to monitor: \
          char device redirected to /dev/pts/33 (label charserial0)
        qemu-system-x86_64: -drive file=/home/vm/systemrescuecd-x86-1.2.0.\
          iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw,cache=none: \
          could not open disk image /home/vm/systemrescuecd-x86-1.2.0.iso: \
          Permission denied

commit e4bdba8d7f86d2b0ea224b64e336b36ef52f6276
Author: Jiri Denemark <jdenemar>
Date:   Mon Apr 22 18:16:57 2013 +0200

    qemu: Move QEMU log reading into a separate function

Comment 3 zhenfeng wang 2013-05-07 09:04:44 UTC
Verify this bug with :
libvirt-1.0.5-1.el7.x86_64
1. Config libvirtd log level:

log_level = 1
log_outputs="1:file:/var/log/libvirt/libvirtd.log"

2. Make sure selinux is enforcing.
3. Config the <seclabel> element, and start it.
......
   <seclabel type='static' model='selinux' relabel='no'>
     <label>system_u:system_r:svirt_t:s0:c392,c662</label>
   </seclabel>
......
4. start the guest on rhel7 host,got the expect error as comment 2
# virsh start rhelguest1
error: Failed to start domain rhelguest1
error: internal error process exited while connecting to monitor: char device redirected to /dev/pts/1 (label charserial0)
qemu-kvm: -drive file=/var/lib/libvirt/images/kvm-rhel6.4.z-x86_64-qcow2.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none: could not open disk image /var/lib/libvirt/images/kvm-rhel6.4.z-x86_64-qcow2.img: Permission denied

since we got the expect error which is the same with comment 2 ,so mark this bug verified

Comment 4 Ludek Smid 2014-06-13 12:22:51 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.