vatesfr / xen-orchestra

The global orchestration solution to manage and backup XCP-ng and XenServer.
https://xen-orchestra.com
Other
767 stars 262 forks source link

Error: vm.attachDisk(...) #241

Closed neaai closed 5 years ago

neaai commented 9 years ago

Hello, I have come across this message in XenOrchestra.

 xo:api vm.attachDisk(...) +2s
  xen-api root@192.168.20.251: VBD.create(...) +2ms
  xo:api Error: vm.attachDisk(...) → XapiError: DEVICE_ALREADY_EXISTS +50ms
XapiError: DEVICE_ALREADY_EXISTS
    at /home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:288:4
From previous event:
    at Xapi._rawCall (/home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:278:11)
    at Xapi._transportCall (/home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:240:30)
    at /home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:224:14
    at processImmediate [as _immediateCallback] (timers.js:358:17)
From previous event:
    at Xapi._sessionCall (/home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:223:42)
    at Xapi.call (/home/enkel/XO/xo-server/node_modules/xen-api/src/index.js:207:5)
    at $XO.<anonymous> (/source/api/vm.coffee:898:24)
    at /source/fibers-utils.coffee:76:22
From previous event:
    at $XO.<anonymous> (/source/fibers-utils.coffee:73:16)
    at /source/api.js:308:24
    at processImmediate [as _immediateCallback] (timers.js:358:17)
From previous event:
    at Api.call (/source/api.js:304:8)
    at JsonRpcServer.<anonymous> (/source/index.js:223:5)
From previous event:
    at JsonRpcServer$exec (/home/enkel/XO/xo-server/node_modules/json-rpc/index.js:248:22)
From previous event:
    at JsonRpcServer._write (/home/enkel/XO/xo-server/node_modules/json-rpc/index.js:193:8)
    at doWrite (/home/enkel/XO/xo-server/node_modules/json-rpc/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/home/enkel/XO/xo-server/node_modules/json-rpc/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at JsonRpcServer.Writable.write (/home/enkel/XO/xo-server/node_modules/json-rpc/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at WebSocket.<anonymous> (/source/index.js:242:9)
    at WebSocket.emit (events.js:110:17)
    at Receiver.ontext (/home/enkel/XO/xo-server/node_modules/ws/lib/WebSocket.js:798:10)
    at /home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:473:18
    at Receiver.applyExtensions (/home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:360:5)
    at /home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:462:14
    at Receiver.flush (/home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:336:3)
    at Receiver.opcodes.1.finish (/home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:478:12)
    at Receiver.<anonymous> (/home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:447:33)
    at Receiver.add (/home/enkel/XO/xo-server/node_modules/ws/lib/Receiver.js:91:24)
    at Socket.firstHandler (/home/enkel/XO/xo-server/node_modules/ws/lib/WebSocket.js:775:22)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)

It happens when I try to attach a disk in XO to an existing machine. This is what I do to come tho this situation:

  1. Create a new virtual disk using XenCenter application. Leave it unattached to any machine.
  2. Using XenOrchestra, select a virtual machine and try to attach the disk to it. You will see that: (a) The process is a success if the virtual machine is a windows vm. (b) The process fails with a red box in upper-right corner of the screen with the message:
vm.attachDisk {"message":"unknown error from the server","code":-32000}

In the logs I see the lines that are shown in the section above.

This happens only when I use XO and a linux running vm. If I use XenCenter application, disk attaching works fine.

Thank you.

olivierlambert commented 9 years ago

@neaai always the same error even with the 4.0 release?

olivierlambert commented 8 years ago

Closing until a new report about this.

spangenberg commented 6 years ago

New report is here for xo-server 5.21.0 and xo-web 5.20.2

Have a linux vm which a couple more disks. When I attach trough XenOrchestra I get this in the XO logs:

vm.attachDisk
{
  "mode": "RW",
  "vdi": "...",
  "vm": "...",
  "id": "..."
}
{
  "message": "DEVICE_ALREADY_EXISTS(2)",
  "stack": "XapiError: DEVICE_ALREADY_EXISTS(2)
    at wrapError (/opt/xen-orchestra/packages/xen-api/src/index.js:112:9)
    at /opt/xen-orchestra/packages/xen-api/src/index.js:974:18
    at run (/opt/xen-orchestra/node_modules/core-js/modules/es6.promise.js:75:22)
    at /opt/xen-orchestra/node_modules/core-js/modules/es6.promise.js:92:30
    at flush (/opt/xen-orchestra/node_modules/core-js/modules/_microtask.js:18:9)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)",
  "code": "DEVICE_ALREADY_EXISTS",
  "params": [
    "2"
  ],
  "method": "VBD.create"
}

fdisk on linux guest:

# fdisk -l | grep -E /dev/xvd[a-z]: | cut -d : -f 1 | cut -d ' ' -f 2 | sort
/dev/xvda
/dev/xvdb
/dev/xvdc
/dev/xvde
/dev/xvdf
/dev/xvdg
/dev/xvdh
/dev/xvdi
/dev/xvdj
/dev/xvdk
/dev/xvdl
/dev/xvdm
/dev/xvdn
/dev/xvdo
/dev/xvdp
olivierlambert commented 6 years ago

Hi,

Before posting, double check you are up-to-date, which is not the case here (current is 5.22 and 5.22.1). Also, if your VM is PV, you have a lower limitation regarding number of disk that can be plugged.

edit: nice to see a RH dev playing around with XO :smile: Hope you are also testing XCP-ng :wink:

spangenberg commented 6 years ago

Hi, thanks for the quick reply.

Updated to 5.22/5.22.1 and I still see the same behaviour, the VM is HVM. Any ideas?

Of course I'm trying to use XCP-ng whenever possible 😏. It's not RH related what I'm doing with XO although I try to sneak it in where possible.

olivierlambert commented 6 years ago

It seems you have problem after are going further than 15 disks. This is not an usual scenario. I'm assigning someone to make tests on our side and see if we can reproduce this!

spangenberg commented 6 years ago

Thanks for reopening, I'm also going to test on my side on different clusters XenServer and XCP-ng. If I can assist in any way let me know @badrAZ @olivierlambert I discovered this trough my custom Kubernetes XenServer Storage implementation.

xe vbd-create vm-uuid=f53d72d4-4375-6729-4ff3-e11779245f03 vdi-uuid=6eef817d-47d9-4571-8ecb-1826a010a4df device=xvdq type=Disk mode=RW
The device name is invalid
device: xvdq

Then I went to XenOrchestra and got the same problem trough attaching.

olivierlambert commented 6 years ago

FYI, device should be a number (it's a position, from 0 to n), not a device name.

badrAZ commented 5 years ago

Hi!

Is still an issue ?

spangenberg commented 5 years ago

I think the issue resolved itself over time, it's at least not a concern anymore for me. Not sure though what was the fix for it. You can close the issue if you want.