handle vdi remove

This commit is contained in:
Olivier Lambert 2014-02-04 20:43:51 +01:00
parent c5a2d6a1eb
commit f90c236fa4

17
src/api/vdi.coffee Normal file
View File

@ -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