fix(xapi): allow to unplug VBDs when VM is running
This commit is contained in:
parent
db4d46a584
commit
290cc146c8
@ -1839,10 +1839,17 @@ export default class Xapi extends XapiBase {
|
||||
await this.call('VBD.plug', vbdId)
|
||||
}
|
||||
|
||||
_disconnectVbd (vbd) {
|
||||
async _disconnectVbd (vbd) {
|
||||
// TODO: check if VBD is attached before
|
||||
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) {
|
||||
await this._disconnectVbd(this.getObject(vbdId))
|
||||
|
Loading…
Reference in New Issue
Block a user