Attach disk to vm failed

I use onevm disk-attach 19 --image 4 cmd line attach success, but in the sunstone i attach the same image failed, here is the one log:

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 Command execution fail: /var/tmp/one/vmm/kvm/attach_disk ‘one-20’ ‘/var/lib/one//datastores/0/20/disk.2’ ‘hdc’ ‘2’ …

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG E 20 attach_disk: Command “virsh --connect qemu:///system attach-device one-20 /var/lib/one//datastores/0/20/disk.2.attach” failed: error: Failed to attach device from /var/lib/one//datastores/0/20/disk.2.attach

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 error: unsupported configuration: disk bus ‘ide’ cannot be hotplugged.

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG E 20 Could not attach /var/lib/one//datastores/0/20/disk.2 (hdc) to one-20

Mon Jun 15 15:18:37 2015 [Z0][VMM][D]: Message received: LOG I 20 ExitCode: 1

I found that by default OpenNebula is attaching images as “ide” drives with prefix “hd”. Try changing “DEVICE_PREFIX” when attaching the image to “sd” or even “vd” and the attach command should succeed.

To change globally the default DEVICE_PREFIX, edit a line in /etc/one/oned.conf:

DEFAULT_DEVICE_PREFIX=“hd”

and restart the opennebula service

With hope this helps
Anton Todorov