Bug 460649

Summary: libvirtd requires restart in order to detect new capabilities like KVM support
Product: [Fedora] Fedora Reporter: Perry Myers <pmyers>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: berrange, clalance, crobinso, itamar, markmc, thoger, ToddAndMargo, veillard, virt-maint, waf
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-06 17:37:47 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 480594    

Description Perry Myers 2008-08-29 09:43:06 EDT
Description of problem:
If libvirt daemon is started before KVM package is installed or before kvm_intel/kvm_amd is loaded it does not list KVM in the capabilities call (this is correct).

But after loading the modules or installing the kvm package, libvirtd requires a restart to pick up this change.  libvirt should be changed to pick this up dynamically (i.e. check on capabilities call perhaps)

Version-Release number of selected component (if applicable):
0.4.4

How reproducible:
Every time

Steps to Reproduce:
1. rmmod kvm_intel (or rmmod kvm_amd)
2. service libvirtd restart
3. verify that qemu-kvm is not in capabilities
4. modprobe kvm_intel (or modprobe kvm_amd)
  
Actual results:
virsh capabilities will not list qemu-kvm even though the module is loaded and package is present

Expected results:
virsh capabilities lists qemu-kvm

Additional info:
Comment 1 Tomas Hoger 2008-10-03 13:02:23 EDT
Just a note, libvirtd reload does not refresh qemu/kvm capabilities as well:

# modprobe -r kvm-intel

# /etc/init.d/libvirtd start
Starting libvirtd daemon:                                  [  OK  ]

# virsh capabilities | grep kvm

# modprobe kvm-intel

# lsmod | grep kvm
kvm_intel              49953  0
kvm                   131889  1 kvm_intel

# virsh capabilities | grep kvm

# /etc/init.d/libvirtd reload
Reloading libvirtd configuration:                          [  OK  ]

# virsh capabilities | grep kvm

# /etc/init.d/libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

# virsh capabilities | grep kvm
      <domain type='kvm'>
        <emulator>/usr/bin/qemu-kvm</emulator>
Comment 2 Daniel Berrange 2009-01-22 07:48:18 EST
The forthcoming 0.6.0 release will allow for a full restart of the libvirtd daemon without killing active guests. We do still need to make it re-probe on the reload operation though.
Comment 3 Daniel Berrange 2009-01-28 12:22:12 EST
*** Bug 482876 has been marked as a duplicate of this bug. ***
Comment 4 Mark McLoughlin 2009-01-28 12:35:17 EST
(In reply to comment #2)
> We do still need to make it re-probe on the reload operation though.

I don't think re-probe on reload enough - it's not something we can expect anyone to think of doing really.

e.g. if you went to "Add/Remove Software", installed kvm and ran virt-manager, you'd never have any reason to think of restarting libvirtd
Comment 5 Daniel Berrange 2009-01-28 12:43:55 EST
Two semi-evil options

 - kvm's  %post could conditionally  do 'service libvirtd reload'
 - libvirt RPM could have  %trigger kvm  and do the same
Comment 6 Mark McLoughlin 2009-01-28 12:55:39 EST
Or just re-probe when capabilities are queried?

If the concern is that capabilities might be queried often, we could rate-limit the re-probes with e.g. "re-probe at most every 5 seconds"
Comment 7 Mark McLoughlin 2009-04-30 02:56:43 EDT
Cole has posted a patch for this to libvir-list:

  http://www.redhat.com/archives/libvir-list/2009-April/msg00533.html

Cole - this bug is on the F11 target tracker. It'd be great to get your patch into F-11/F-12 libvirt once its committed upstream
Comment 8 Cole Robinson 2009-05-04 15:17:04 EDT
Updated patch posted:

https://www.redhat.com/archives/libvir-list/2009-May/msg00035.html

I agree it would be nice to have this for F11: I think it's pretty low risk for the usability gain. Just needs to be ACK'd upstream.
Comment 10 Cole Robinson 2009-05-06 12:37:15 EDT
Being built into libvirt-0.6.2-6.fc11 atm.
Comment 11 Mark McLoughlin 2009-05-06 16:17:32 EDT
Tag request: https://fedorahosted.org/rel-eng/ticket/1748

* Wed May  6 2009 Cole Robinson <crobinso@redhat.com> - 0.6.2-6.fc11
- Refresh qemu caps when getCapabilities is called (bug #460649)
Comment 12 Mark McLoughlin 2009-05-06 17:37:47 EDT
Tagged now