diff --git a/src/api/vdi.coffee b/src/api/vdi.coffee new file mode 100644 index 000000000..71b88f3d4 --- /dev/null +++ b/src/api/vdi.coffee @@ -0,0 +1,17 @@ +exports.delete = -> + params = @getParams { + id: { type: 'string' } + } + + # Current user must be an administrator. + @checkPermission 'admin' + + try + VDI = @getObject params.id + catch + @throw 'NO_SUCH_OBJECT' + + xapi = @getXAPI VDI + + # TODO: check if VDI is attached before + xapi.call "VDI.destroy", VDI.ref