Bug 1594985 - Renaming a virtual machine does not re-create autostart symlink
Summary: Renaming a virtual machine does not re-create autostart symlink
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Erik Skultety
QA Contact: Yanqiu Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-25 23:05 UTC by bugzilla
Modified: 2020-03-11 22:29 UTC (History)
7 users (show)

Fixed In Version: libvirt-5.0.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-11 22:29:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:
knoel: mirror+


Attachments (Terms of Use)

Description bugzilla 2018-06-25 23:05:16 UTC
Description of problem:

When renaming a virtual machine using `virsh domrename`, the autostart symlink in /etc/libvirt/qemu/autostart/ breaks.


Version-Release number of selected component (if applicable):

3.9.0-14.el7_5.5


How reproducible:

Very

Steps to Reproduce:
1. virsh autostart foo
2. virsh domrename foo bar
3. ls -l /etc/libvirt/qemu/autostart/

Actual results:

Symlink in /etc/libvirt/qemu/autostart/ is broken

Expected results:

Symlink would presumably be re-created on domrename

Comment 2 Erik Skultety 2018-07-19 09:32:37 UTC
Fixed upstream by:
commit 359b938b8b37254e3e714a2a50e4b9a444516133
Refs: v4.5.0-190-g359b938b8b
Author:     Julio Faracco <jcfaracco>
AuthorDate: Thu Jul 19 01:21:48 2018 -0300
Commit:     Erik Skultety <eskultet>
CommitDate: Thu Jul 19 11:22:28 2018 +0200

    qemu: Fix broken autostart symlink after renaming domain

    If a domain is configured to start on boot, it has a symlink to the
    domain definition inside the autostart directory. If you rename this
    domain, the definition is renamed too. The symlink need to be pointed to
    this renamed file. This commit recreates the symlink after renaming the
    XML file.

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

    Signed-off-by: Julio Faracco <jcfaracco>
    Signed-off-by: Erik Skultety <eskultet>

Comment 4 Yanqiu Zhang 2019-07-09 09:52:34 UTC
Reproduce this bug on rhel7.7 with:
libvirt-4.5.0-23.virtcov.el7.x86_64
qemu-kvm-rhev-2.12.0-33.el7.x86_64

Steps:
1.# virsh autostart yqz-7.7
Domain yqz-7.7 marked as autostarted

# virsh list --all --autostart
 Id    Name                           State
----------------------------------------------------
 -     yqz-7.7                        shut off

# ls -l /etc/libvirt/qemu/autostart/
total 0
lrwxrwxrwx. 1 root root 29 Jul  9 05:34 yqz-7.7.xml -> /etc/libvirt/qemu/yqz-7.7.xml

2.# virsh domrename yqz-7.7  new-7.7
Domain successfully renamed

# file /etc/libvirt/qemu/autostart/yqz-7.7.xml 
/etc/libvirt/qemu/autostart/yqz-7.7.xml: broken symbolic link to `/etc/libvirt/qemu/yqz-7.7.xml'

3.# systemctl restart libvirtd

# virsh list --all --autostart
 Id    Name                           State
----------------------------------------------------

# virsh domstate new-7.7
shut off


Verify this bug on rhel-av8.0.1 with:
libvirt-daemon-5.0.0-11.module+el8.0.1+3459+e357ef2f.x86_64
qemu-kvm-3.1.0-27.module+el8.0.1+3253+c5371cb3.x86_64

Steps:
1.# virsh autostart avocado-vt-vm1
Domain avocado-vt-vm1 marked as autostarted

# virsh list --all --autostart
 Id   Name             State
---------------------------------
 -    avocado-vt-vm1   shut off

# ls -l /etc/libvirt/qemu/autostart/
total 0
lrwxrwxrwx. 1 root root 36 Jul  9 05:29 avocado-vt-vm1.xml -> /etc/libvirt/qemu/avocado-vt-vm1.xml

2.# virsh domrename avocado-vt-vm1 new-vm1
Domain successfully renamed

# ls -l /etc/libvirt/qemu/autostart/
total 0
lrwxrwxrwx. 1 root root 29 Jul  9 05:30 new-vm1.xml -> /etc/libvirt/qemu/new-vm1.xml

# file  /etc/libvirt/qemu/autostart/new-vm1.xml 
/etc/libvirt/qemu/autostart/new-vm1.xml: symbolic link to /etc/libvirt/qemu/new-vm1.xml

3.# systemctl restart libvirtd

# virsh list --all --autostart
 Id   Name      State
-------------------------
 1    new-vm1   running

And no error or warning in libvirtd.log

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

Comment 5 Jeff Nelson 2020-03-11 22:29:10 UTC
This work was completed and shipped long ago. Closing the bug.


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