Bug 676563

Summary: libvirtd refuses to start after an ancient qemu package is installed
Product: Red Hat Enterprise Linux 6 Reporter: zhanghaiyan <yoyzhang>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: berrange, dallan, dyuan, eblake, jdenemar, jyang, llim, mjenner, vbian, xen-maint
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.8.7-16.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:26:59 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 zhanghaiyan 2011-02-10 09:03:28 UTC
Description of problem:
libvirtd crashes after an ancient qemu package is installed

Version-Release number of selected component (if applicable):
- kernel-2.6.32-94.el6.x86_64
- qemu-img-0.12.1.2-2.144.el6.x86_64
- qemu-kvm-0.12.1.2-2.144.el6.x86_64
- qemu-0.6.0-2.x86_64
- libvirt-0.8.7-5.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. Libvirtd is working well
# virsh list --all
 Id Name                 State
----------------------------------
  - rhel6                shut off
# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
# virsh list --all
 Id Name                 State
----------------------------------
  - rhel6                shut off
2. Install a qemu package
# rpm -ivh qemu-0.6.0-2.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:qemu                   ########################################### [100%]
3. # virsh list --all
 Id Name                 State
----------------------------------
  - rhel6                shut off
4. # service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
# service libvirtd restart
Stopping libvirtd daemon:                                  [FAILED]
Starting libvirtd daemon:                                  [  OK  ]
# service libvirtd status
libvirtd dead but subsys locked
# virsh list --all
error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No such file or directory
error: failed to connect to the hypervisor
5. After remove qemu package and restart libvirtd service, it works well as before  
Actual results:
Libvirtd crashes after qemu package is installed

Expected results:
Libvirtd should not crash after qemu package is installed

Additional info:

Comment 2 Osier Yang 2011-02-10 09:35:53 UTC
It's caused by the ancient qemu doesn't support "qemu -M ?", which is used to probe the machine types to construct guest capabilities, and the failure to contruct the guest capabilities then cause qemu state driver initialization failed.

Comment 3 Dave Allan 2011-02-11 21:54:20 UTC
Is libvirt crashing or just exiting normally?

Comment 4 Osier Yang 2011-02-12 07:50:44 UTC
not crashing(no coredump), but exit alnormally, it didn't release subsys lock on shutdown event, useful logs pasted following:


Feb 10 00:33:38 dhcp-65-132 libvirtd: 00:33:38.733: 5342: error : virStateInitialize:1022 : Initialization of QEMU state driver failed
Feb 10 00:33:38 dhcp-65-132 kernel: lo: Disabled Privacy Extensions
Feb 10 00:33:38 dhcp-65-132 libvirtd: 00:33:38.749: 5342: info : virDomainLoadAllConfigs:8248 : Scanning for configs in /etc/libvirt/lxc
Feb 10 00:33:38 dhcp-65-132 libvirtd: 00:33:38.755: 5342: error : main:3305 : Driver state initialization failed
Feb 10 00:33:38 dhcp-65-132 libvirtd: 00:33:38.756: 5343: warning : qemudDispatchSignalEvent:403 : Shutting down on signal 3

Comment 5 Dave Allan 2011-02-14 19:44:40 UTC
Sounds like we should simply be disabling the qemu driver.  What do you think?

Comment 6 Daniel Berrangé 2011-02-14 19:53:03 UTC
No, the QEMU driver is expected to successfully start regardless of what QEMU version is installed, or indeed even if no QEMU is installed yet.  We need to fix the code which deals with 'qemu -M ?' since libvirt in general needs to support QEMUs without this feature.

Comment 7 Eric Blake 2011-02-14 19:56:55 UTC
Looks like this is a regression in commit 2211518:
2011-01-12 16:26 Eric Blake         * qemu: convert capabilities to use virCommand

Prior to that point, qemuCapsProbeMachineTypes silently ignored failure of 'qemu -M ?'; therefore, the obvious fix would be to pass a dummy status instead of NULL to virCommandRun.

Comment 8 Eric Blake 2011-02-14 20:03:05 UTC
Proposed upstream patch:
https://www.redhat.com/archives/libvir-list/2011-February/msg00468.html

Comment 12 zhanghaiyan 2011-02-18 06:36:34 UTC
The bug is reproduced with libvirt-0.8.7-7.el6.x86_64
- kernel-2.6.32-113.el6.x86_64
- qemu-kvm-0.12.1.2-2.145.el6.x86_64

The same test step and actual result with Description

Comment 13 Jiri Denemark 2011-04-05 13:03:24 UTC
Additional patch needed to fix this issue was sent for review: http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-April/msg00082.html

Comment 15 zhanghaiyan 2011-04-08 02:23:48 UTC
Verified this bug pass with libvirt-0.8.7-16.el6.x86_64
1. # virsh list --all
 Id Name                 State
----------------------------------
  - a10                  shut off
  - a11                  shut off
  - a12                  shut off
2. # rpm -ivh qemu-0.6.0-2.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:qemu                   ########################################### [100%]
3. # virsh list --all
 Id Name                 State
----------------------------------
  - a10                  shut off
  - a11                  shut off
  - a12                  shut off
4. # for i in {1..10}; do service libvirtd restart; done
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
Stopping libvirtd daemon:                                  [  OK  ]
...
5. # virsh list --all
 Id Name                 State
----------------------------------
  - a10                  shut off
  - a11                  shut off
  - a12                  shut off
6. # service libvirtd status
libvirtd (pid  8332) is running...

Comment 18 errata-xmlrpc 2011-05-19 13:26:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html