mirror of
https://github.com/mclueppers/xo-server.git
synced 2025-04-08 20:55:02 +02:00
add unpause action
This commit is contained in:
parent
e384c8f5a7
commit
0b9f8b8340
26
src/api.js
26
src/api.js
@ -619,6 +619,32 @@ Api.fn.xapi = {
|
||||
|
||||
return xapi.call('VM.pause', vm.get('ref'));
|
||||
}).thenResolve(true);
|
||||
},
|
||||
'unpause': function (session, req) {
|
||||
var p_id = req.params.id;
|
||||
if (!p_id)
|
||||
{
|
||||
throw Api.err.INVALID_PARAMS;
|
||||
}
|
||||
|
||||
var xo = this.xo;
|
||||
var vm;
|
||||
return this.checkPermission(session, 'write').then(function () {
|
||||
return xo.vms.first(p_id);
|
||||
}).then(function (tmp) {
|
||||
vm = tmp;
|
||||
|
||||
if (!vm)
|
||||
{
|
||||
throw Api.err.NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
return xo.pools.first(vm.get('pool_uuid'));
|
||||
}).then(function (pool) {
|
||||
var xapi = xo.connections[pool.get('uuid')];
|
||||
|
||||
return xapi.call('VM.unpause', vm.get('ref'));
|
||||
}).thenResolve(true);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user