fix(xapi): allow to unplug VBDs when VM is running
This commit is contained in:
parent
db4d46a584
commit
290cc146c8
@ -1839,9 +1839,16 @@ export default class Xapi extends XapiBase {
|
|||||||
await this.call('VBD.plug', vbdId)
|
await this.call('VBD.plug', vbdId)
|
||||||
}
|
}
|
||||||
|
|
||||||
_disconnectVbd (vbd) {
|
async _disconnectVbd (vbd) {
|
||||||
// TODO: check if VBD is attached before
|
// TODO: check if VBD is attached before
|
||||||
return this.call('VBD.unplug_force', vbd.$ref)
|
try {
|
||||||
|
await this.call('VBD.unplug_force', vbd.$ref)
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === 'VBD_NOT_UNPLUGGABLE') {
|
||||||
|
await this.call('VBD.set_unpluggable', vbd.$ref, true)
|
||||||
|
return this.call('VBD.unplug_force', vbd.$ref)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async disconnectVbd (vbdId) {
|
async disconnectVbd (vbdId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user