RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1343858 - Guest image owner changes to root:root if kill source libvirtd in migration confirm phase.
Summary: Guest image owner changes to root:root if kill source libvirtd in migration c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: yafu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-08 07:47 UTC by Fangge Jin
Modified: 2017-08-01 23:51 UTC (History)
6 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:09:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirtd and qemu log on both source host and target host. (2.65 MB, application/x-gzip)
2016-06-08 07:47 UTC, Fangge Jin
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Fangge Jin 2016-06-08 07:47:58 UTC
Created attachment 1165856 [details]
libvirtd and qemu log on both source host and target host.

Description of problem:
Migrate a guest, and kill source libvirtd in migration confirm phase, the guest image owner will be changed to root:root. Guest is running on target host, but can't access disk, and guest is destroyed on source host.

Version-Release number of selected component (if applicable):
libvirt-1.3.5-1.el7.x86_64

How reproducible:
100% Bug it's hard to catch the point, because confirm phase is very short.

Steps to Reproduce:
1. # virsh start rhel7.2-min
Domain rhel7.2-min started

2. # virsh migrate-setspeed rhel7.2-min 10

3. Do migration, and do "pkill -9 libvirtd" on source host in confirm phase ( after memory is migration is 100% completed)

# virsh migrate rhel7.2-min qemu+ssh://hp-dl385g7-05.lab.eng.pek2.redhat.com/system --live --verbose 
Migration: [100 %]2016-06-08 07:23:02.007+0000: 16006: info : libvirt version: 1.3.5, package: 1.el7 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2016-06-07-09:10:22, x86-034.build.eng.bos.redhat.com)
2016-06-08 07:23:02.007+0000: 16006: info : hostname: hp-dl385g7-06.lab.eng.pek2.redhat.com
2016-06-08 07:23:02.007+0000: 16006: warning : virDomainMigrateVersion3Full:3253 : Guest rhel7.2-min probably left in 'paused' state on source
error: Disconnected from qemu:///system due to I/O error
Migration: [100 %]

4. On source host
# virsh list
 Id    Name                           State
----------------------------------------------------

5. On target host
# virsh list
 Id    Name                           State
----------------------------------------------------
 8    rhel7.2-min                    running


# ll /90121/fjin/rhel7.2-min.qcow2 
-rw-------. 1 root root 9665380352 6月   8 2016 /90121/fjin/rhel7.2-min.qcow2


Actual results:
As step 5 shows, guest image owner is changed to root:root

Expected results:
Guest image owner is qemu:qemu

Additional info:

Comment 2 Jiri Denemark 2016-11-29 11:40:39 UTC
This is now fixed upstream by

commit 0355de2e77fa8a11419fde5b0eb68458a7fb62ca
Refs: v2.5.0-rc1-2-g0355de2e7
Author:     Jiri Denemark <jdenemar>
AuthorDate: Wed Nov 23 14:07:53 2016 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Tue Nov 29 12:37:04 2016 +0100

    qemuProcessReconnect: Avoid relabeling images after migration

    Restarting libvirtd on the source host at the end of migration when a
    domain is already running on the destination would cause image labels to
    be reset effectively killing the domain. Commit e8d0166e1d fixed similar
    issue on the destination host, but kept the source always resetting the
    labels, which was mostly correct except for the specific case handled by
    this patch.

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

    Signed-off-by: Jiri Denemark <jdenemar>

Comment 4 yafu 2017-03-01 08:14:05 UTC
Reproduce the bug with libvirt-2.0.0-10.el7.x86_64:
steps:
1.gdb -p `pidof libvirtd`
(gdb) br qemuMigrationConfirmPhase
Breakpoint 1 at 0x7f60739a0f30: file qemu/qemu_migration.c, line 4173.
(gdb) c
Continuing.
[Switching to Thread 0x7f60b7be9700 (LWP 7881)]

Breakpoint 1, qemuMigrationConfirmPhase (driver=driver@entry=0x7f605417a150, conn=conn@entry=0x7f60a8001330, vm=0x7f60542ad210, 
    cookiein=cookiein@entry=0x7f60a80040b0 "<qemu-migration>\n  <name>rhel7.3-min</name>\n  <uuid>1b3268d6-b59c-406b-a14c-33b000b15b6c</uuid>\n  <hostname>dhcp-66-71-81.eng.nay.redhat.com</hostname>\n  <hostuuid>8b6f1788-6105-11e4-b60b-2248c3061500"..., cookieinlen=cookieinlen@entry=1128, flags=flags@entry=769, retcode=retcode@entry=0)
    at qemu/qemu_migration.c:4173
4173	{
(gdb) c

2.virsh migrate rhel7.3-min qemu+ssh://10.66.5.14/system --live --verbose

3.After step2 reached confirm phase, check the output in the step1 and kill libvirtd process on source host;
...

Breakpoint 1, qemuMigrationConfirmPhase (driver=driver@entry=0x7f09d8119440, 
    conn=conn@entry=0x7f0a30027700, vm=0x7f09d81e7b00, 
    cookiein=cookiein@entry=0x7f0a20005a50 "<qemu-migration>\n  <name>rhel7.3-min</name>\n  <uuid>1b3268d6-b59c-406b-a14c-33b000b15b6c</uuid>\n  <hostname>dhcp-66-71-81.eng.nay.redhat.com</hostname>\n  <hostuuid>8b6f1788-6105-11e4-b60b-2248c3061500"..., cookieinlen=cookieinlen@entry=1130, 
    flags=flags@entry=769, retcode=retcode@entry=0) at qemu/qemu_migration.c:4202
4202	{
(gdb) 
...

#pkill -9 libvirtd

4.Check the guest on source host:
# virsh list
 Id    Name                           State
----------------------------------------------------

5. Check the guest on target host
# virsh list
 Id    Name                           State
----------------------------------------------------
 8    rhel7.2-min                    running

6.Check the image owner on target host

# ll /nfs-images/yafu/rhel7.2.qcow2 
-rwxrwxrwx. 1 root root 12887130112 Mar  1  2017 /nfs-images/yafu/rhel7.2.qcow2

Verify the bug with libvirt-3.0.0-2.el7.x86_64.
steps:
1.Excute the step1-5 in the reproduce steps;
2.Check the image owner on target host:
# ll /nfs-images/yafu/rhel7*
-rwxrwxrwx. 1 qemu qemu 12887130112 Mar  2  2017 /nfs-images/yafu/rhel7.2.qcow2

As the result of step2 shows, the guest image owner did not change to root:root if kill source libvirtd in migration confirm phase.

Comment 5 errata-xmlrpc 2017-08-01 17:09:12 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 6 errata-xmlrpc 2017-08-01 23:51:16 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


Note You need to log in before you can comment on or make changes to this bug.