Bug 1320470

Summary: Migrating guest with default guest agent socket path from 1.3.x to 1.2.17 failed
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: dyuan, libvirt-maint, mzhan, rbalakri, yafu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-2.0.0-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:40:24 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 log on source host
none
libvirtd log on target host none

Description Fangge Jin 2016-03-23 09:56:31 UTC
Created attachment 1139445 [details]
qemu log on target

Description of problem:
Try to migrate a guest with default guest agent socket path from 1.3.x to 1.2.17, it failed.

# virsh migrate rhel7.2-raw-2 qemu+ssh://10.66.82.251/system --live --verbose --unsafe
root.82.251's password:
error: internal error: process exited while connecting to monitor: 2016-03-22T12:28:10.951511Z qemu-kvm: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-1-rhel7.2-raw-2/org.qemu.guest_agent.0,server,nowait: Failed to bind socket to /var/lib/libvirt/qemu/channel/target/domain-1-rhel7.2-raw-2/org.qemu.guest_agent.0: No such file or directory


Version-Release number of selected component:
# git describe
v1.3.2-229-g0c72459


How reproducible:
100%

Steps to Reproduce:
0.On host A, install libvirt v1.3.2-229-g0c72459, and start a guest with default guest agent socket path:
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-1-rhel7.2-raw-2/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

1.On host B, install libvirt-1.2.17-13.el7.x86_64

2. Migrate guest to host B.

Actual results:
Migration failed.

Expected results:
Migration succeed.

Additional info:

Comment 1 Fangge Jin 2016-03-23 09:57:55 UTC
Created attachment 1139446 [details]
libvirtd log on source host

Comment 2 Fangge Jin 2016-03-23 09:58:41 UTC
Created attachment 1139447 [details]
libvirtd log on target host

Comment 4 Jiri Denemark 2016-07-08 15:40:30 UTC
Patches sent for review upstream: https://www.redhat.com/archives/libvir-list/2016-July/msg00239.html

Comment 5 Jiri Denemark 2016-07-18 07:24:07 UTC
This is now fixed upstream by

commit b1305a6b8fcb807296a00458c5495ef321553cd0
Refs: v2.0.0-148-gb1305a6
Author:     Jiri Denemark <jdenemar>
AuthorDate: Fri Jul 8 16:44:02 2016 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Jul 18 09:05:12 2016 +0200

    qemu: Copy complete domain def in qemuDomainDefFormatBuf

    Playing directly with our live definition, updating it, and reverting it
    back once we are done is very nice and it's quite dangerous too. Let's
    just make a copy of the domain definition if needed and do all tricks on
    the copy.

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

    Signed-off-by: Jiri Denemark <jdenemar>

commit 08d566a0cf7ed052b6ab3c9bd93f04156999d80b
Refs: v2.0.0-149-g08d566a
Author:     Jiri Denemark <jdenemar>
AuthorDate: Fri Jul 8 17:25:03 2016 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Jul 18 09:05:12 2016 +0200

    qemu: Drop default channel path during migration

    Migration to an older libvirt (pre v1.3.0-175-g7140807) is broken
    because older versions of libvirt generated different channel paths and
    they didn't drop the default paths when parsing domain XMLs. We'd get
    such a nice error message:

        internal error: process exited while connecting to monitor:
        2016-07-08T15:28:02.665706Z qemu-kvm: -chardev socket,
        id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/
        domain-3-nest/org.qemu.guest_agent.0,server,nowait: Failed to bind
        socket to /var/lib/libvirt/qemu/channel/target/domain-3-nest/
        org.qemu.guest_agent.0: No such file or directory

    That said, we should not even format the default paths when generating a
    migratable XML.

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

    Signed-off-by: Jiri Denemark <jdenemar>

Comment 8 yafu 2016-08-11 04:35:55 UTC
I can reproduce the bug with libvirt-1.3.5-1.el7.x86_64.

Verified pass with libvirt-2.0.0-5.el7.x86_64:

1.On source host,start a guest with default guest agent socket path:
   <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-4-mig1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

2.Do migration to a host installed libvirt-1.2.17-13.el7:
 #virsh migrate mig1 qemu+ssh://10.66.144.76/system --live --verbose
  root.144.76's password: 
  Migration: [100 %]

3.Check the guest agent socket of the guest after migration completed:
      <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-mig1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

Comment 10 errata-xmlrpc 2016-11-03 18:40:24 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://rhn.redhat.com/errata/RHSA-2016-2577.html