[libvirt] How does libvirt 0.6.3 load kvm driver

Dear all, I found that libvirt 0.6.3 seems does not load KVM driver while libvirt 0.3.3 does. Situation description: I am using CentOS 5.3, and the kernel I used is 2.6.30. I downloaded the kernel from kernel.org andcompile it. KVM was compiled as a module. libvirt: libvirt 0.6.3, released by Eucalyptus(a cloud computing infrastructure software which supports KVM as well) (1) libvirt 0.6.3 does not load KVM driver After booting the machine with kernel 2.6.30 and probe KVM related module. I started libvirtd 0.6.3 and set LD_LIBRARY_PATH to "$LIBVIRT_063_HOME/lib:$LIBVIRT_063_HOME/usr/lib:$LD_LIBRARY_PATH". I found that I am not able to connect to libvirtd using "virsh --connect qemu:///system"(the virsh used is virsh 0.6.3 that shipped with libvirt 0.6.3), here is the debug message: ======================================= debug message ========================================= 17:41:11.219: debug : virInitialize:290 : register drivers 17:41:11.219: debug : virRegisterDriver:667 : registering Test as driver 0 17:41:11.219: debug : virRegisterNetworkDriver:567 : registering Test as network driver 0 17:41:11.219: debug : virRegisterStorageDriver:598 : registering Test as storage driver 0 17:41:11.219: debug : virRegisterDeviceMonitor:629 : registering Test as device driver 0 17:41:11.219: debug : virRegisterDriver:667 : registering Xen as driver 1 17:41:11.219: debug : vboxRegister:68 : VBoxCGlueInit failed: 0.0.0, errorval=-1 17:41:11.219: debug : virRegisterDriver:667 : registering VBOX as driver 2 17:41:11.219: debug : virConnectOpen:1050 : name=qemu:///system 17:41:11.219: debug : do_open:920 : name "qemu:///system" to URI components: scheme qemu opaque (null) authority (null) server (null) user (null) port 0 path /system 17:41:11.219: debug : do_open:930 : trying driver 0 (Test) ... 17:41:11.219: debug : do_open:936 : driver 0 Test returned DECLINED 17:41:11.219: debug : do_open:930 : trying driver 1 (Xen) ... 17:41:11.219: debug : do_open:936 : driver 1 Xen returned DECLINED 17:41:11.219: debug : do_open:930 : trying driver 2 (VBOX) ... 17:41:11.219: debug : do_open:936 : driver 2 VBOX returned DECLINED libvir: error : could not connect to qemu:///system 17:41:11.219: debug : virUnrefConnect:210 : unref connection 0x60dd00 1 17:41:11.219: debug : virReleaseConnect:171 : release connection 0x60dd00 libvirt error: could not connect to qemu:///system (code=5) error: failed to connect to hypervisor ================================end of debug message ========================================= It seems that libvirt 0.6.3 does not load QEMU driver. (2) libvirt 0.3.3 does load KVM driver However, when I run the command "lsmod | grep kvm". I found KVM module was present: ================================= result of lsmod ============================================== [root@node2 ~]# lsmod | grep kvm kvm_intel 46664 0 kvm 166224 1 kvm_intel [root@node2 ~]# ================================= end of result of lsmod ========================================= I stopped libvirtd 0.6.3 and then started libvirtd 0.3.3(the one shipped with CentOS 5.3). The virtual machine manager works well and I can use "virsh --connect qemu:///system"(the virsh used is virsh 0.3.3 that shipped with CentOS 5.3) to connect to libvirtd. I dig into libvirt source code. I found that in libvirt 0.3.3: There is qemudRegister() in libvirt.c. I think this function call is responsible for loading qemu(kvm) driver. And in libvirt 0.6.3: I cannot found qemudRegister() or virDriverLoadModule("qemu") in the source code. My question is: Does libvirt 0.6.3 support KVM? If yes, how does it load KVM driver? I want to find out why libvirt 0.3.3 works well while libvirt 0.6.3 does not work in my computer. Thanks. -- Jason Wong System engineer Cluster Technology Limited Email: hcwong@clustertech.com Direct Line: (852) 2655-6129 Tel: (852) 2655-6100 Fax: (852) 2994-2101 Website: www.clustertech.com ------------------------------ ************************************************************************** The information and attachment contained in this e-mail originating from Cluster Technology Limited is confidential and intended solely for the specified addressees. If you have received this email in error, please do not read, copy, distribute, disclose or use any information of this email in any way and please immediately notify the sender and delete this email. Thank you for your cooperation. **************************************************************************

On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
Dear all,
I found that libvirt 0.6.3 seems does not load KVM driver while libvirt 0.3.3 does.
Situation description:
I am using CentOS 5.3, and the kernel I used is 2.6.30. I downloaded the kernel from kernel.org andcompile it. KVM was compiled as a module. libvirt: libvirt 0.6.3, released by Eucalyptus(a cloud computing infrastructure software which supports KVM as well)
(1) libvirt 0.6.3 does not load KVM driver
No libvirt release has ever loaded the KVM kernel modules. This is left upto the OS distribution vendor to deal with. In Fedora, the KVM RPM installs a script that loads them upon boot. I'm not sure what CentOS does. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
Dear all,
I found that libvirt 0.6.3 seems does not load KVM driver while libvirt 0.3.3 does.
Situation description:
I am using CentOS 5.3, and the kernel I used is 2.6.30. I downloaded the kernel from kernel.org andcompile it. KVM was compiled as a module. libvirt: libvirt 0.6.3, released by Eucalyptus(a cloud computing infrastructure software which supports KVM as well)
(1) libvirt 0.6.3 does not load KVM driver
No libvirt release has ever loaded the KVM kernel modules. This is left upto the OS distribution vendor to deal with. In Fedora, the KVM RPM installs a script that loads them upon boot. I'm not sure what CentOS does.
Daniel
Dear Daniel, Let me clarify, the KVM qemu driver, in my understanding is the part that responsible for the communication between KVM hypervisor and libvirt (I think it is in the source code qemu_driver.c). For KVM kernel module, I have manually use "modprobe kvm" command into kernel. Perhaps I should use the term "qemu driver" instead of "kvm driver". -- Jason Wong System engineer Cluster Technology Limited Email: hcwong@clustertech.com Direct Line: (852) 2655-6129 Tel: (852) 2655-6100 Fax: (852) 2994-2101 Website: www.clustertech.com ------------------------------ ************************************************************************** The information and attachment contained in this e-mail originating from Cluster Technology Limited is confidential and intended solely for the specified addressees. If you have received this email in error, please do not read, copy, distribute, disclose or use any information of this email in any way and please immediately notify the sender and delete this email. Thank you for your cooperation. **************************************************************************

On Tue, Jun 30, 2009 at 06:38:35PM +0800, Jason Wong wrote:
Daniel P. Berrange wrote:
On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
Let me clarify, the KVM qemu driver, in my understanding is the part that responsible for the communication between KVM hypervisor and libvirt (I think it is in the source code qemu_driver.c). For KVM kernel module, I have manually use "modprobe kvm" command into kernel.
Perhaps I should use the term "qemu driver" instead of "kvm driver".
Ah, so you mean the libvirt QEMU driver isn't working. The best first step to diagnosing those problems is to stop the libvirtd daemon, and run it manually with debugging enabled LIBVIRT_DEBUG=1 /usr/sbin/libvirtd with any luck there will be some failure reported explaining why the QEMU driver didn't activate. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Tue, Jun 30, 2009 at 06:38:35PM +0800, Jason Wong wrote:
Daniel P. Berrange wrote:
On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
Let me clarify, the KVM qemu driver, in my understanding is the part that responsible for the communication between KVM hypervisor and libvirt (I think it is in the source code qemu_driver.c). For KVM kernel module, I have manually use "modprobe kvm" command into kernel.
Perhaps I should use the term "qemu driver" instead of "kvm driver".
Ah, so you mean the libvirt QEMU driver isn't working. The best first step to diagnosing those problems is to stop the libvirtd daemon, and run it manually with debugging enabled
LIBVIRT_DEBUG=1 /usr/sbin/libvirtd
with any luck there will be some failure reported explaining why the QEMU driver didn't activate.
Daniel
Dear Daniel, I have enable the libvirt debug mode by setting LIBVIRT_DEBUG=1 and here is the debug message: ======================================= debug message ========================================= 17:41:11.219: debug : virInitialize:290 : register drivers 17:41:11.219: debug : virRegisterDriver:667 : registering Test as driver 0 17:41:11.219: debug : virRegisterNetworkDriver:567 : registering Test as network driver 0 17:41:11.219: debug : virRegisterStorageDriver:598 : registering Test as storage driver 0 17:41:11.219: debug : virRegisterDeviceMonitor:629 : registering Test as device driver 0 17:41:11.219: debug : virRegisterDriver:667 : registering Xen as driver 1 17:41:11.219: debug : vboxRegister:68 : VBoxCGlueInit failed: 0.0.0, errorval=-1 17:41:11.219: debug : virRegisterDriver:667 : registering VBOX as driver 2 17:41:11.219: debug : virConnectOpen:1050 : name=qemu:///system 17:41:11.219: debug : do_open:920 : name "qemu:///system" to URI components: scheme qemu opaque (null) authority (null) server (null) user (null) port 0 path /system 17:41:11.219: debug : do_open:930 : trying driver 0 (Test) ... 17:41:11.219: debug : do_open:936 : driver 0 Test returned DECLINED 17:41:11.219: debug : do_open:930 : trying driver 1 (Xen) ... 17:41:11.219: debug : do_open:936 : driver 1 Xen returned DECLINED 17:41:11.219: debug : do_open:930 : trying driver 2 (VBOX) ... 17:41:11.219: debug : do_open:936 : driver 2 VBOX returned DECLINED libvir: error : could not connect to qemu:///system 17:41:11.219: debug : virUnrefConnect:210 : unref connection 0x60dd00 1 17:41:11.219: debug : virReleaseConnect:171 : release connection 0x60dd00 libvirt error: could not connect to qemu:///system (code=5) error: failed to connect to hypervisor ================================end of debug message ========================================= From the debug message, it seems that libvirt does not load qemu drivr but it load Xen and VBOX driver........ However, the fact is that I have load KVM kernel module into kernel by using "modprobe kvm" and "modprobe kvm_intel" And the result of "lsmod|grep kvm" shows: ================================= result of lsmod ============================================== [root@node2 ~]# lsmod | grep kvm kvm_intel 46664 0 kvm 166224 1 kvm_intel [root@node2 ~]# ================================= end of result of lsmod ========================================= -- Jason Wong System engineer Cluster Technology Limited Email: hcwong@clustertech.com Direct Line: (852) 2655-6129 Tel: (852) 2655-6100 Fax: (852) 2994-2101 Website: www.clustertech.com ------------------------------ ************************************************************************** The information and attachment contained in this e-mail originating from Cluster Technology Limited is confidential and intended solely for the specified addressees. If you have received this email in error, please do not read, copy, distribute, disclose or use any information of this email in any way and please immediately notify the sender and delete this email. Thank you for your cooperation. **************************************************************************
participants (2)
-
Daniel P. Berrange
-
Jason Wong