Discussion:
[libvirt-users] Unable to detach disk using 'virsh detach-disk'
Andre Goree
2018-04-30 15:48:00 UTC
Permalink
I'm unable to detach a disk from a Windows guest using the 'virsh
detach-disk' command.

Even though 'domblklist' shows the disk attached, and on the FIRST
iteration, it says the command "completed successfully," 'domblklist
will still show the disk attached and subsequent 'detach-disk' commands
fail with 'no disk found whose source path or target is ${location}'



~ # virsh domblklist 31907-1063435
Target Source
------------------------------------------------
vda ${concatenated}/31907-1063435/2018-04-28-190529
vdb
${concatenated}/31907-67863/2018-03-21-033216.2018-04-28-190529

~ # virsh detach-disk --domain 31907-1063435
/var/lib/libvirt/images/instances/31907-67863/2018-03-21-033216.2018-04-28-190529
--persistent
error: No disk found whose source path or target is
/var/lib/libvirt/images/instances/31907-67863/2018-03-21-033216.2018-04-28-190529



Any ideas as to why this happens?
--
Andre Goree
-=-=-=-=-=-
Email - andre at drenet.net
Website - http://blog.drenet.net
PGP key - http://www.drenet.net/pubkey.html
-=-=-=-=-=-
Michal Privoznik
2018-05-09 13:26:41 UTC
Permalink
Post by Andre Goree
I'm unable to detach a disk from a Windows guest using the 'virsh
detach-disk' command.
Even though 'domblklist' shows the disk attached, and on the FIRST
iteration, it says the command "completed successfully," 'domblklist
will still show the disk attached and subsequent 'detach-disk' commands
fail with 'no disk found whose source path or target is ${location}'
~ # virsh domblklist 31907-1063435
Target     Source
------------------------------------------------
vda        ${concatenated}/31907-1063435/2018-04-28-190529
vdb        ${concatenated}/31907-67863/2018-03-21-033216.2018-04-28-190529
~ # virsh detach-disk --domain 31907-1063435
/var/lib/libvirt/images/instances/31907-67863/2018-03-21-033216.2018-04-28-190529
--persistent
error: No disk found whose source path or target is
/var/lib/libvirt/images/instances/31907-67863/2018-03-21-033216.2018-04-28-190529
Any ideas as to why this happens?
Sure. There's a difference between live and config XML

https://wiki.libvirt.org/page/VM_lifecycle

detach-disk --persistent removes disk from config XML and domblklist
prints out disks from current state of domain (i.e. if it's running it
prints out disks from live XML).

Michal

Loading...