Bug 822068

Summary: libvirtd will crash when hotplug attah-disk to guest
Product: Red Hat Enterprise Linux 6 Reporter: Huang Wenlong <whuang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.4CC: acathrow, cwei, dallan, dyasny, dyuan, gsun, mzhan, rwu, weizhan, zpeng
Target Milestone: rc   
Target Release: 6.4   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.13-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:13:10 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
libvirtd crash log
none
gdb backtrace none

Description Huang Wenlong 2012-05-16 09:02:09 UTC
Description of problem:
libvirtd will crash when attah-disk to guest

Version-Release number of selected component (if applicable):
libvirt-0.9.11.3-1.el7.x86_64
qemu-kvm-1.0-17.1.el7.x86_64

How reproducible:
90%

Steps to Reproduce:
1. virsh attach-disk copy /dev/sda1 vda
error: Failed to attach disk
error: End of file while reading data: Input/output error

[root@intel-q9400-4-7 tmp]# virsh list
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': 
Connection refused


Actual results:
attach disk will crash libvirtd

Expected results:
attach disk successfully  and libvirtd is alive

Additional info:
I will attach libvirtd debug log when it crash

Comment 1 Huang Wenlong 2012-05-16 09:04:15 UTC
Created attachment 584905 [details]
libvirtd crash log

Comment 2 Peter Krempa 2012-05-18 12:36:25 UTC
Hi Huang,
could you please provide a full backtrace of the crashed daemon? I'm not able to reproduce this.

Peter

Comment 3 Huang Wenlong 2012-05-21 05:10:57 UTC
Created attachment 585716 [details]
gdb backtrace

Hi,Peter

I attached the gdb all backtrace ,thanks .


Wenlong

Comment 6 Peter Krempa 2012-06-14 11:52:43 UTC
Fixed upstream:

commit 0f4660c8787cc41fe67f869984c0ae11d680037e
Author: Peter Krempa <pkrempa>
Date:   Thu Jun 14 10:29:36 2012 +0200

    qemu: Fix off-by-one error while unescaping monitor strings
    
    While unescaping the commands the commands passed through to the monitor
    function qemuMonitorUnescapeArg() initialized lenght of the input string
    to strlen()+1 which is fine for alloc but not for iteration of the
    string.
    
    This patch fixes the off-by-one error and drops the pointless check for
    a single trailing slash that is automaticaly handled by the default
    branch of switch.

Comment 9 zhe peng 2012-07-31 10:20:39 UTC
I can reproduce this with:
libvirt-0.9.11.3-1.el7.x86_64
qemu-kvm-1.0-17.1.el7.x86_64

verify with:
libvirt-0.9.13-3.el6.x86_64

step:
  1: run cmd:
#for i in {a..z}; do virsh attach-disk $guest_name /dev/zero vd$i; done
error: Failed to attach disk
error: operation failed: target vda already exists

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

Disk attached successfully

error: Failed to attach disk
error: internal error No more available PCI addresses

#virsh list --all
Id    Name                           State
----------------------------------------------------
 3     rhel6.3rcqcow2                 running
 -     rhel6.3c                       shut off
 -     rhel6.3rc                      shut off
 -     rhel6u2                        shut off

libvirt not crash, verification passed.

Comment 10 errata-xmlrpc 2013-02-21 07:13:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0276.html