Bug 950855

Summary: Libvirtd will be crashed while connect the hypervisor with the remote host and with the wrong qemu URI
Product: Red Hat Enterprise Linux 7 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, cwei, dyuan, jtomko, mzhan, ydu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.0.5-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:15:56 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:
Attachments:
Description Flags
The gdb info about libvirtd crash none

Description zhenfeng wang 2013-04-11 05:49:44 UTC
Description of problem:
Libvirtd will be crashed while connect the hypervisor with the remote host and with the wrong qemu URI

Version-Release number of selected component (if applicable):
libvirt-1.0.4-1.el7.x86_64
qemu-kvm-1.4.0-2.el7.x86_64
kernel-3.9.0-0.rc3.44.el7.x86_64
How reproducible:
100%

Steps
1 Prepare two rhel7 host,HostA and HostB , then start the libvirtd service on the two hosts
2 Connect the hypervisor from HostA to HostB,the libvirtd service on HostB will be crashed
HostA# virsh -c qemu+ssh://xx.xx.xx.xx(HostB‘s ip)
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
root.xx.xx's password:
error: failed to connect to the hypervisor
error: no valid connection
error: End of file while reading data: : Input/output error
virsh # list --all
root.xx.xx's password: 
error: failed to connect to the hypervisor
error: no valid connection
error: End of file while reading data: 2013/04/11 13:25:41 socat[25004] E connect(3, AF=1 "/var/run/libvirt/libvirt-sock", 31): Connection refused: Input/output error

3.Check the libvirtd service on the hostB
HostB# virsh list --all
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

HostB# ps aux|grep libvirtd
root     23080  0.0  0.0 112632   916 pts/0    S+   11:24   0:00 grep --color=auto libvirtd
HostB# systemctl status libvirtd
libvirtd.service - Virtualization daemon
          Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled)
          Active: failed (Result: core-dump) since Thu 2013-04-11 11:23:56 CST; 22s ago
         Process: 22790 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=dumped, signal=SEGV)
          CGroup: name=systemd:/system/libvirtd.service
                  └─2585 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf

Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com libvirtd[22790]: 2013-04-11 03:23:56.207+000...
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com systemd[1]: libvirtd.service: main process ...V
Apr 11 11:23:56 intel-8400-8-1.englab.nay.redhat.com systemd[1]: Unit libvirtd.service entered f...e

4.Test this senario on two rhel6 hosts,the libvirtd won't be crashed, and it will report the following error
# virsh -c qemu+ssh://10.66.6.57
root.6.57's password:
error: internal error no QEMU URI path given, try qemu:///system
error: failed to connect to the hypervisor

5.Test this senario from rhel6 to rhel7 got the same result with step 3
6.Test this senario from rhel7 to rhel6 got the same result with step 4

Actual results:
The libvirtd crashed

Expected results:
The libvirtd shouldn't be crashed and should report an proper error

Comment 1 zhenfeng wang 2013-04-11 05:52:04 UTC
Created attachment 733993 [details]
The gdb info about libvirtd crash

Comment 3 Ján Tomko 2013-04-11 09:43:10 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2013-April/msg00857.html

Comment 4 Ján Tomko 2013-04-11 09:49:40 UTC
Fixed upstream by:
commit 74bff2509080912ea8abf1de8fd95fa2412b659a
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-04-11 11:37:25 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-04-11 11:41:22 +0200

    qemu: fix crash in qemuOpen
    
    If the path part of connection URI is not present, cfg is used
    unitialized.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=950855

Comment 5 zhe peng 2013-05-07 03:10:08 UTC
can reporduce with libvirt-1.0.4-1.el7.x86_64
verify with build:
libvirt-1.0.5-1.el7.x86_64

step:
1 Prepare two rhel7 host,HostA and HostB , then start the libvirtd service on the two hosts
2 Connect the hypervisor from HostA to HostB.
# virsh -c qemu+ssh://10.66.71.219
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
The authenticity of host '10.66.71.219 (10.66.71.219)' can't be established.
RSA key fingerprint is b6:3d:90:68:cf:11:39:67:12:68:16:09:3b:76:4e:48.
Are you sure you want to continue connecting (yes/no)? yes
root.71.219's password: 
error: failed to connect to the hypervisor
error: no valid connection
error: internal error no QEMU URI path given, try qemu:///system

virsh # list --all
root.71.219's password: 
error: failed to connect to the hypervisor
error: no valid connection
error: internal error no QEMU URI path given, try qemu:///system

check hostB libvirt:
#systemctl status libvirtd
libvirtd.service - Virtualization daemon
	  Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled)
	  Active: active (running) since Tue 2013-05-07 05:24:24 EDT; 2min 32s ago
	Main PID: 18748 (libvirtd)
	  CGroup: name=systemd:/system/libvirtd.service
		  ├─ 1407 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf
		  ├─11038 /usr/libexec/qemu-kvm -name win7 -S -M pc-i440fx-1.4 -m 2048 -smp 4,sockets=4,cores=1,threads=1 -uuid 8a66c9e4-78d7-7...
		  ├─13194 /usr/libexec/qemu-kvm -name demo1 -S -M pc-i440fx-1.4 -m 512 -smp 1,sockets=1,cores=1,threads=1 -uuid f7844589-5ec4-2...
		  ├─18708 /usr/libexec/qemu-kvm -name bb -S -machine pc-1.3,accel=kvm,usb=off -m 512 -smp 1,sockets=1,cores=1,threads=1 -uuid 3...
		  └─18748 /usr/sbin/libvirtd

libvirtd not crash. verification passed.

Comment 6 Ludek Smid 2014-06-13 10:15:56 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.