vatesfr / xen-orchestra

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

[VDI migration] DEVICE_ALREADY_EXISTS(0) #3426

Closed pdonias closed 5 years ago

pdonias commented 6 years ago

Sometimes happening when migrating a VDI. The VDI ends up not being attached to the VM anymore. The VDI seems to be correctly migrated to the destination SR.

vdi.migrate
{
  "id": "b21be66b-013b-4ae4-a1b0-1de57c3cec34",
  "sr_id": "14e7c2ed-42e1-84ad-330d-40b9f3ce8a53"
}
{
  "message": "DEVICE_ALREADY_EXISTS(0)",
  "stack": "XapiError: DEVICE_ALREADY_EXISTS(0)
    at wrapError (/home/pierre/Documents/vates/xen-orchestra/packages/xen-api/src/index.js:112:9)
    at _call.catch.error (/home/pierre/Documents/vates/xen-orchestra/packages/xen-api/src/index.js:1038:18)
    at run (/home/pierre/Documents/vates/xen-orchestra/node_modules/core-js/modules/es6.promise.js:75:22)
    at /home/pierre/Documents/vates/xen-orchestra/node_modules/core-js/modules/es6.promise.js:92:30
    at flush (/home/pierre/Documents/vates/xen-orchestra/node_modules/core-js/modules/_microtask.js:18:9)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)",
  "code": "DEVICE_ALREADY_EXISTS",
  "params": [
    "0"
  ],
  "method": "VBD.create"
}
julien-f commented 5 years ago

@pdonias Can you still reproduce it?

pdonias commented 5 years ago
Yes.
vdi.migrate
{
  "id": "1d6b432e-0fee-426a-96ac-ce321ff68c63",
  "sr_id": "a7c630bf-b38c-489e-d3c3-e62507948980"
}
{
  "message": "DEVICE_ALREADY_EXISTS(1)",
  "stack": "XapiError: DEVICE_ALREADY_EXISTS(1)
    at wrapError (/home/pierre/Documents/vates/xen-orchestra/packages/xen-api/src/index.js:112:9)
    at _call.catch.error (/home/pierre/Documents/vates/xen-orchestra/packages/xen-api/src/index.js:1072:18)
    at tryCatcher (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/promise.js:690:18)
    at _drainQueueStep (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/home/pierre/Documents/vates/xen-orchestra/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)",
  "code": "DEVICE_ALREADY_EXISTS",
  "params": [
    "1"
  ],
  "call": {
    "method": "VBD.create",
    "params": [
      "OpaqueRef:bd73371d-d03f-4f6c-bc8c-0e880a4aaa6c",
      {
        "bootable": false,
        "empty": false,
        "mode": "RW",
        "other_config": {},
        "qos_algorithm_params": {},
        "qos_algorithm_type": "",
        "type": "Disk",
        "unpluggable": false,
        "userdevice": "1",
        "VDI": "OpaqueRef:f7a6b813-f1b8-4ed5-87b8-d2d62a546290",
        "VM": "OpaqueRef:414a10ef-4b4f-4706-943c-00d10f1b667e"
      }
    ]
  }
}

Something I didn't notice the first time: the VDI is actually duplicated and is both on the source and destination SR.