Bug 1278068 - cannot start virtual machine after renaming it
cannot start virtual machine after renaming it
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
All Linux
low Severity medium
: rc
: ---
Assigned To: Martin Kletzander
Virtualization Bugs
: Upstream
: 1308903 (view as bug list)
Depends On:
Blocks: 1295396
  Show dependency treegraph
 
Reported: 2015-11-04 11:11 EST by Jeff Bastian
Modified: 2016-11-03 14:29 EDT (History)
11 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:29:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Bastian 2015-11-04 11:11:16 EST
Description of problem:
I created a virtual machine named "rhel6.6" and installed RHEL 6.7.  I saw the typo in the name, so I shut down the VM and renamed it to "rhel6.7" using virt-manager, and then the VM would no longer start.  I got this error:

error: Failed to start domain rhel6.7
error: internal error: process exited while connecting to monitor: 2015-11-04T16:04:12.597653Z qemu-kvm: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-rhel6.6/org.qemu.guest_agent.0,server,nowait: Failed to bind socket: No such file or directory
2015-11-04T16:04:12.597772Z qemu-kvm: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-rhel6.6/org.qemu.guest_agent.0,server,nowait: chardev: opening backend "socket" failed


I used virsh edit to change the "rhel6.6" to "rhel6.7" in this bit of the xml and that fixed the problem:

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-rhel6.6/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>


Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7.x86_64
virt-manager-1.2.1-8.el7.noarch

How reproducible:
always?

Steps to Reproduce:
1. shutdown a VM
2. rename the VM
3. start the VM

Actual results:
the VM fails to start: Failed to bind socket: No such file or directory

Expected results:
the VM starts

Additional info:
Comment 1 Martin Kletzander 2015-11-12 06:32:01 EST
We need not to keep the libvirt-generated socket paths in the inactive XML.  I'll post a patch for that later on.
Comment 2 Martin Kletzander 2016-01-06 11:51:33 EST
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2016-January/msg00103.html
Comment 3 Martin Kletzander 2016-01-07 05:31:28 EST
Fixed upstream with v1.3.0-175-g714080791778:

commit 714080791778e3dfbd484ccb3953bffd820b8ba9
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Wed Jan 6 17:35:04 2016 +0100

    qemu: Don't bother user with libvirt-internal paths
Comment 4 Martin Kletzander 2016-01-11 04:57:26 EST
Also need v1.3.0-224-g93103da84bf9 and v1.3.0-225-g8223bd22ed90:

commit 93103da84bf938f419b400a5c40898bd1b816331
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Fri Jan 8 14:00:56 2016 +0100

    Provide parse flags to PostParse functions

commit 8223bd22ed90680544ce153da0001376b58a7cf8
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Fri Jan 8 13:59:20 2016 +0100

    Don't clear libvirt-internal paths when parsing status XML
Comment 6 Pavel Hrdina 2016-03-18 04:28:38 EDT
*** Bug 1308903 has been marked as a duplicate of this bug. ***
Comment 7 zhenfeng wang 2016-03-25 04:59:22 EDT
Could reproduce this bug with libvirt-1.2.17-13.el7_2.2.x86_64
1.Prepare a guest with guest agent configured
#virsh dumxpml virt-tests-vm1
--
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-virt-tests-vm1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

2.Change the guest name with virsh edit , additional guest will be added
#virsh edit virt-tests-vm1
<name>virt-tests-vm2</name>
--
wq:

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     virt-tests-vm1                 shut off
 -     virt-tests-vm2                 shut off

3.Start the guest virt-tests-vm2, guest will fail to start
# virsh start virt-tests-vm2
error: Failed to start domain virt-tests-vm2
error: internal error: process exited while connecting to monitor: 2016-03-25T07:48:34.546196Z qemu-kvm: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-virt-tests-vm1/org.qemu.guest_agent.0,server,nowait: Failed to bind socket to /var/lib/libvirt/qemu/channel/target/domain-virt-tests-vm1/org.qemu.guest_agent.0: No such file or directory

Verify this bug with libvirt-1.3.2-1.el7.x86_64
1.Update the libvirt to the libvirt-1.3.2-1.el7.x86_64, then check the guest's xml, found the inactive guest won't generate the agent socket
#virsh dumpxml virt-tests-vm2
--
    <channel type='unix'>
      <source mode='bind'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

2.Start guest, the guest could start successfully, also guest agent work expectly
# virsh start virt-tests-vm2
Domain virt-tests-vm2 started

#virsh dumpxml virt-tests-vm2

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-virt-tests-vm2/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

# virsh domtime virt-tests-vm2 --pretty
Time: 2016-03-25 08:13:30

3.Destroy the guest, then, recheck the guest's xml
#virsh dumpxml virt-tests-vm2
--
    <channel type='unix'>
      <source mode='bind'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

4.Rename the virt-tests-vm2 to virt-tests-vm3
# virsh domrename virt-tests-vm2 virt-tests-vm3
Domain successfully renamed

5.Start the guest, guest could be started successfully, also guest agent works expectly
# virsh start virt-tests-vm3
Domain virt-tests-vm3 started

# virsh domtime virt-tests-vm3 --pretty
Time: 2016-03-25 08:20:50

6.Restart the libvirtd service, still work expectly
# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service
# virsh domtime virt-tests-vm3 --pretty
Time: 2016-03-25 08:21:12
Comment 8 zhenfeng wang 2016-03-25 05:12:25 EDT
Hi Martin
Just try to hotplug the guest agent with the latest libvirt packet, found it fail to hotplug. BTW, it works well in rhel7.2.z. so please help check  whether we need file seperate bug to track it or just fix it in this bug? thanks


1.Prepare a running guest without guest agent configured
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     virt-tests-vm3                 shut of

2.Prepare a guest agent xml
# cat agent.xml 
   <channel type='unix'>
      <source mode='bind'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

3.Hotplug the guest agent, will report the following error
# virsh attach-device virt-tests-vm3 agent.xml 
error: Failed to attach device from agent.xml
error: internal error: unable to execute QEMU command 'chardev-add': Invalid parameter type for 'path', expected: string

4.Check the loginfo, found following messages
#cat /var/log/libvirt/libvirtd.log
--
2016-03-25 09:02:22.847+0000: 10269: debug : qemuMonitorJSONCheckError:374 : unable to execute QEMU command {"execute":"chardev-add","arguments":{"id":"charchannel0","backend":{"type":"socket","data":{"addr":{"type":"unix","data":{"path":null}},"wait":false,"server":true}}},"id":"libvirt-12"}: {"id":"libvirt-12","error":{"class":"GenericError","desc":"Invalid parameter type for 'path', expected: string"}}
Comment 9 Martin Kletzander 2016-03-29 05:03:10 EDT
Good catch, but please create new bug for that, thanks.
Comment 10 zhenfeng wang 2016-03-30 01:01:24 EDT
Thanks Martin's response, have filed new bug 1322210 for the guest agent hotplug issue and mark this bug verified according to the upper comments
Comment 12 errata-xmlrpc 2016-11-03 14:29:42 EDT
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

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