Can't detach disk

Hello everyone,

I have installed opennebula and I can’t detach a disk form an instance that I have running. The VM has two disks attached, disk 0, a Debian ISO cd and disk 1,a 50GB volatile drive (where I installed Debian). The thing is that now that Debian is installed, I want to detach the CD ISO so the Debian OS that I installed can boot. So far it boots directly the CD ISO, not letting me detach it. I don’t get any errors, just a message saying “detaching”, then I refresh and it is as before. I tried to detach it via command line, and again, the command seems to execute with no errors, but when I list the disks I see the CD ISO still there. Could someone give me a hand with this?

Thanks a lot and regards

Hi,

You should check for clues what’s going on in the oned logfile /var/log/one/oned.log the reason for not detaching the disk should be logged there.

Best Regards,
Anton Todorov

Hello Anton,

Thanks for your answer. Here’s what the log says:

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG E 34 detach_disk: Command “virsh --connect qemu:///system detach-disk --domain one-34 --target hda” failed: error: Failed to detach disk

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 error: Operation not supported: This type of disk cannot be hot unplugged

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG E 34 Could not detach hda from one-34

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 ExitCode: 1

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: LOG I 34 Failed to execute virtualization driver operation: detach_disk.

Fri May 12 15:49:00 2017 [Z0][VMM][D]: Message received: DETACHDISK FAILURE 34 Could not detach hda from one-34

Any clues why this disk cannot be hot unplugged? Is there another way of unplugging? I’ve tried shutting the machine down and when doing so, the detach option dissapears

I also tried this, with same results:

virsh --connect qemu:///system detach-disk --domain one-34 --target hda

Hi Francisco,

The “hd” prefiexd devices are using virtio-ide interface which hasn’t hotplug option. You should be able to detach the disk while the VM is powered off though.

Best Regards,
Anton Todorov

Also you can change the boot order when the VM is in powered-off state: VM details -> Conf -> Update Configuration(green button)

Best,
Anton

Hi Anton,

thanks a lot for your prompt answer. I shutdown the machine and went to update configuration, but then I get the following error:
Configuration cannot be updated in status SHUTDOWN_POWEROFF

Should I put it in the “Terminate” or “Undeploy” state rather that shutdown?

Hm, you should definitely can attach/detach ide disk in powered off state. For changing boot options like boot order ‘undeploy’ should be ok. Terminate will delete the VM.

Best,
Anton

I tried again, and this time the machine is in state Poweroff. I no longer get the error form before, although the changes don’t apply when checking afterwards. The boot order remains the same

Instead of changing the order I removed the disk while Poweroff, and I can now boot correctly into my OS. Thanks a lot for the quick answers!

Francisco