feat(xapi/VM_destroy): split bypassBlockedOperation out of force
This commit is contained in:
parent
67b905a757
commit
657935eba5
@ -270,10 +270,13 @@ module.exports = class Vm {
|
|||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
|
|
||||||
async destroy(vmRef, { deleteDisks = true, force = false, forceDeleteDefaultTemplate = force } = {}) {
|
async destroy(
|
||||||
|
vmRef,
|
||||||
|
{ deleteDisks = true, force = false, bypassBlockedOperation = force, forceDeleteDefaultTemplate = force } = {}
|
||||||
|
) {
|
||||||
const vm = await this.getRecord('VM', vmRef)
|
const vm = await this.getRecord('VM', vmRef)
|
||||||
|
|
||||||
if (!force && 'destroy' in vm.blocked_operations) {
|
if (!bypassBlockedOperation && 'destroy' in vm.blocked_operations) {
|
||||||
throw new Error('destroy is blocked')
|
throw new Error('destroy is blocked')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user