Bug 1446205

Summary: libvirtd crashes when migrate a transient domain created by 'virsh create' with --persistent option
Product: Red Hat Enterprise Linux 7 Reporter: Yanqiu Zhang <yanqzhan>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Yanqiu Zhang <yanqzhan>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: dyuan, fjin, lcheng, lizhu, mzhan, rbalakri, xuzhang, yafu, yanqzhan, zpeng
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.2.0-4.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:08:25 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
bt.txt
none
gdb.txt none

Description Yanqiu Zhang 2017-04-27 12:45:08 UTC
Created attachment 1274626 [details]
bt.txt

Description of problem:
libvirtd crashes when migrate a transient domain created by 'virsh create' with --persistent option.
can't reproduce when define->start-> undefine a domain

Version-Release number of selected component (if applicable):
libvirt-3.2.0-3.el7.x86_64
qemu-kvm-rhev-2.9.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.create a transient domain by 'virsh create'
# virsh create V.xml
Domain V created from V.xml

2. try to migrate the transient domain with --persistent option
# virsh migrate V --live qemu+ssh://{target_ip}/system   --persistent
error: Disconnected from qemu:///system due to I/O error
error: End of file while reading data: Input/output error

3.check abrt
# abrt-cli list|head
id b455e7a03f1332f1bf4bcf4827d0ef5bbfff1b32
reason:         libvirtd killed by SIGSEGV
time:           Thu 27 Apr 2017 07:48:55 PM CST
cmdline:        /usr/sbin/libvirtd
package:        libvirt-daemon-3.2.0-3.virtcov.el7
uid:            0 (root)
Directory:      /var/spool/abrt/ccpp-2017-04-27-19:48:55-15299
Run 'abrt-cli report /var/spool/abrt/ccpp-2017-04-27-19:48:55-15299' for creating a case in Red Hat Customer Portal


Actual results:
libvirtd crashes when migrate a transient domain created by 'virsh create' with --persistent option.

Expected results:
libvirtd should not crash, and migration should succeed.


Additional info:
1.Not reproduces on rhel7.3 with:
libvirt-2.0.0-10.virtcov.el7_3.7.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.9.x86_64

2.For backtrace info, pls refer to attachment 'bt.txt'.

Comment 3 Yanqiu Zhang 2017-04-27 12:47:33 UTC
Created attachment 1274627 [details]
gdb.txt

Comment 4 Jaroslav Suchanek 2017-04-28 07:48:00 UTC
Strange that the crash points to libvirt-daemon-3.2.0-3.virtcov.el7 package.
Can you please double check which packages were installed? I guess libvirt
debug logs would help too. Anyway worth investigating...

Comment 5 Jiri Denemark 2017-05-02 16:36:14 UTC
Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2017-May/msg00040.html

Comment 6 Jiri Denemark 2017-05-02 16:55:01 UTC
This is now fixed upstream by

commit 59307fade86fb74db1f8f572433962233f7ac123
Refs: v3.3.0-rc1-4-g59307fade
Author:     Jiri Denemark <jdenemar>
AuthorDate: Tue May 2 18:01:04 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Tue May 2 18:53:19 2017 +0200

    qemu: Fix persistent migration of transient domains

    While fixing a bug with incorrectly freed memory in commit
    v3.1.0-399-g5498aa29a, I accidentally broke persistent migration of
    transient domains. Before adding qemuDomainDefCopy in the path, the code
    just took NULL from vm->newDef and used it as the persistent def, which
    resulted in no persistent XML being sent in the migration cookie. This
    scenario is perfectly valid and the destination correctly handles it by
    using the incoming live definition and storing it as the persistent one.

    After the mentioned commit libvirtd would just segfault in the described
    scenario.

    https://bugzilla.redhat.com/show_bug.cgi?id=1446205

    Signed-off-by: Jiri Denemark <jdenemar>

Comment 9 Yanqiu Zhang 2017-05-11 10:59:17 UTC
Verified with libvirt-3.2.0-4.el7.x86_64

Steps:
1.# virsh create V.xml
Domain V created from V.xml

2.# virsh migrate V --live qemu+ssh://{target_ip}/system --persistent --verbose
Migration: [100 %]

And no libvirtd crash.

3.On target:
# virsh list --all --persistent
 Id    Name                           State
----------------------------------------------------
 12    V                              running

And target xml is almost same with step 1.

Since the result is as expected, mark this bug as verified.

Comment 10 errata-xmlrpc 2017-08-02 00:08:25 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.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 11 errata-xmlrpc 2017-08-02 01:32:35 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.

https://access.redhat.com/errata/RHEA-2017:1846