add enable and disable method

This commit is contained in:
Olivier Lambert
2014-08-05 12:41:18 +02:00
parent 9d35295b47
commit edfbbe8c5a

View File

@@ -100,3 +100,35 @@ exports.detach.permission = 'admin'
exports.detach.params = {
id: { type: 'string' }
}
exports.enable = ({id}) ->
try
host = @getObject id
catch
@throw 'NO_SUCH_OBJECT'
xapi = @getXAPI host
$wait xapi.call 'host.enable', host.ref
return true
exports.stop.permission = 'admin'
exports.stop.params = {
id: { type: 'string' }
}
exports.disable = ({id}) ->
try
host = @getObject id
catch
@throw 'NO_SUCH_OBJECT'
xapi = @getXAPI host
$wait xapi.call 'host.disable', host.ref
return true
exports.stop.permission = 'admin'
exports.stop.params = {
id: { type: 'string' }
}