]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuDomainAttachDeviceMknodHelper: Remove symlink before creating it
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jan 2018 10:11:53 +0000 (11:11 +0100)
committerCole Robinson <crobinso@redhat.com>
Tue, 13 Feb 2018 19:14:34 +0000 (14:14 -0500)
commit979a7b3feba1f03e124d62fe0116e8c6f8073b90
tree191d73cf0d4e02287986a6a50559a4c2e72ad3c7
parentee54b0bd7faa3e211346b367f64e502af6442e07
qemuDomainAttachDeviceMknodHelper: Remove symlink before creating it

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

So imagine you have /dev/blah symlink which points to /dev/sda.
You attach /dev/blah as disk to your domain. Libvirt correctly
creates the /dev/blah -> /dev/sda symlink in the qemu namespace.
However, then you detach the disk, change the symlink so that it
points to /dev/sdb and tries to attach the disk again. This time,
however, the attach fails (well, qemu attaches wrong disk)
because the code assumes that symlinks don't change. Well they
do.

This is inspired by test fix written by Eduardo Habkost.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit db98e7f67ea0d7699410f514f01947cef5128a6c)
src/qemu/qemu_domain.c