Unable to hot detach virtio datadisk

Hello,

I have installed 4.14.2 and trying to detach disk from a Windows VM and unable to do so, I am able to attach a disk to running VM however detaching gives a following error -

Wed Dec 9 21:21:55 2015 [Z0][VMM][I]: VM Disk successfully attached.
Wed Dec 9 21:21:55 2015 [Z0][VM][I]: New LCM state is RUNNING
Wed Dec 9 21:24:30 2015 [Z0][VM][I]: New LCM state is HOTPLUG
Wed Dec 9 21:24:36 2015 [Z0][VMM][I]: Command execution fail: /var/tmp/one/vmm/kvm/detach_disk ‘one-17’ ‘/var/lib/one//datastores/0/17/disk.2’ ‘vdb’ ‘1’ 17 kvmnode1.local
Wed Dec 9 21:24:36 2015 [Z0][VMM][E]: Could not detach vdb from one-17
Wed Dec 9 21:24:36 2015 [Z0][VMM][I]: ExitCode: 255
Wed Dec 9 21:24:36 2015 [Z0][VMM][I]: Failed to execute virtualization driver operation: detach_disk.
Wed Dec 9 21:24:36 2015 [Z0][VMM][E]: Error detaching VM Disk: Could not detach vdb from one-17
Wed Dec 9 21:24:36 2015 [Z0][VM][I]: New LCM state is RUNNING

Powering off the VM and then detaching the disk removes the disk from sunstone however it still shows in the datastore VM folder -

/var/lib/one/datastores/0/17$ ls -lh
total 368K
-rw-rw-r-- 1 oneadmin oneadmin 1.1K Dec 9 19:09 deployment.0
lrwxrwxrwx 1 oneadmin oneadmin 58 Dec 9 19:09 disk.0 -> /var/lib/one/datastores/1/e3cc8a9714df4c67109666a621e70338
-rw-rw-r-- 1 oneadmin oneadmin 364K Dec 9 19:09 disk.1
lrwxrwxrwx 1 oneadmin oneadmin 35 Dec 9 19:09 disk.1.iso -> /var/lib/one/datastores/0/17/disk.1
lrwxrwxrwx 1 oneadmin oneadmin 58 Dec 9 21:21 disk.2 -> /var/lib/one/datastores/1/486d8facef952a897e378069fc503cf6

I tried it on different VM and having same issue while detaching.

Do you have any suggestions on this or anyone have encountered this.

Regards
Kiran Ranjane

[quote=“kiranranjane, post:1, topic:1573”]
I have installed 4.14.2 and trying to detach disk from a Windows VM and unable to do so
[/quote] As far as i know, you can only detach “SD” type of disk.[quote=“kiranranjane, post:1, topic:1573”]
Powering off the VM and then detaching the disk removes the disk from sunstone however it still shows in the datastore VM folder
[/quote] It will only remove from the VM template, not delete the file from filesystem.

Hello Anandharaj,

I am using vd - virtio disk with virtio drivers installed on the virtual machine and they support hot detach but it not working and cannot find any relevant logs related to it.

Regards
Kiran Ranjane

Hello,

I found these errors in /var/log/libvirt logs and it seems to be related to disk detach issue :-

2015-12-09 17:40:18.341+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:19.341+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:20.341+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:20.341+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:21.356+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:22.372+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:23.388+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:24.403+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:24.404+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:25.403+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:26.419+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:27.435+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias
2015-12-09 17:40:28.450+0000: 9448: error : qemuProcessFindDomainDiskByAlias:405 : internal error: no disk found with alias

The detach was working fine until I powered off the VM and then detached both the disk, bootdisk and datadisk from the VM, changed IO and cache setting of the disk and atached it back to the VM and powered it on.

After that the detach never worked. I ran ondb fsck command and did not find any errors. So not sure what to do next

I also ran the command directly

/var/tmp/one/vmm/kvm/detach_disk ‘one-17’ ‘/var/lib/one//datastores/0/17/disk.3’ ‘vdb’ ‘1’ 17 kvmnode1.local
ERROR MESSAGE --8<------
Could not detach vdb from one-17
ERROR MESSAGE ------>8–

Regards
Kiran Ranjane

Is this problem still happening? Can you send us the output of this command in the node for a VM that is giving you this problem?

$ vish -c qemu:///system dumpxml one-<vmid>

The output of onevm show -x <vmid> will also be helpful.

Hi Javi,

The issue is still happening, I have attached the output to a txt file Detach output (19.3 KB)

Let me know if you need anything else.

Thanks

Regards
Kiran Ranjane