fix(xapi/VBD_create): don't fail if the VBD could not be plugged

Otherwise, the creation method would have failed but the VBD would still exist, violating the principle of least surprise.
This commit is contained in:
Julien Fontanet 2022-06-02 16:26:29 +02:00
parent 3ef6adfd02
commit d353dc622c

View File

@ -6,6 +6,8 @@ const { Ref } = require('xen-api')
const isVmRunning = require('./_isVmRunning.js')
const { warn } = require('@xen-orchestra/log').createLogger('xo:xapi:vbd')
const noop = Function.prototype
module.exports = class Vbd {
@ -66,7 +68,7 @@ module.exports = class Vbd {
})
if (isVmRunning(powerState)) {
await this.callAsync('VBD.plug', vbdRef)
this.callAsync('VBD.plug', vbdRef).catch(warn)
}
return vbdRef