feat(xapi/VM_destroy): split bypassBlockedOperation out of force

This commit is contained in:
Julien Fontanet 2021-03-24 15:12:25 +01:00
parent 67b905a757
commit 657935eba5

View File

@ -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')
} }