@xen-orchestra/rest-api 0.22.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hosts/host.controller.mjs +48 -3
- package/dist/open-api/oa-examples/vbd.oa-example.mjs +3 -0
- package/dist/open-api/oa-examples/xoa.oa-example.mjs +30 -40
- package/dist/open-api/routes/routes.js +263 -21
- package/dist/pools/pool.controller.mjs +46 -1
- package/dist/vbds/vbd.controller.mjs +115 -4
- package/dist/vdis/vdi.controller.mjs +39 -4
- package/dist/vms/vm.controller.mjs +3 -1
- package/dist/vms/vm.service.mjs +11 -5
- package/dist/xoa/xoa.service.mjs +112 -91
- package/open-api/spec/swagger.json +1183 -635
- package/package.json +4 -4
|
@@ -7,8 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
|
|
10
|
+
import { Body, Delete, Example, Get, Middlewares, Path, Post, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags, } from 'tsoa';
|
|
11
|
+
import { json } from 'express';
|
|
11
12
|
import { inject } from 'inversify';
|
|
13
|
+
import { invalidParameters } from 'xo-common/api-errors.js';
|
|
12
14
|
import { pipeline } from 'node:stream/promises';
|
|
13
15
|
import { provide } from 'inversify-binding-decorators';
|
|
14
16
|
import { AlarmService } from '../alarms/alarm.service.mjs';
|
|
@@ -17,10 +19,10 @@ import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.m
|
|
|
17
19
|
import { host, hostIds, hostSmt, hostMissingPatches, hostStats, partialHosts, } from '../open-api/oa-examples/host.oa-example.mjs';
|
|
18
20
|
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
19
21
|
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
20
|
-
import { badRequestResp, featureUnauthorized, internalServerErrorResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
22
|
+
import { asynchronousActionResp, badRequestResp, featureUnauthorized, internalServerErrorResp, invalidParameters as invalidParametersResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
21
23
|
import { HostService } from './host.service.mjs';
|
|
22
24
|
import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
|
|
23
|
-
import { partialTasks, taskIds } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
25
|
+
import { partialTasks, taskIds, taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
24
26
|
let HostController = class HostController extends XapiXoController {
|
|
25
27
|
#alarmService;
|
|
26
28
|
#hostService;
|
|
@@ -155,6 +157,35 @@ let HostController = class HostController extends XapiXoController {
|
|
|
155
157
|
const host = this.getXapiObject(id);
|
|
156
158
|
await host.$call('remove_tags', tag);
|
|
157
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Reconfigure the management interface of the host to use the given PIF.
|
|
162
|
+
*
|
|
163
|
+
* The target PIF must already have an IP address configured.
|
|
164
|
+
*
|
|
165
|
+
* @example id "b61a5c92-700e-4966-a13b-00633f03eea8"
|
|
166
|
+
* @example body { "pif": "d9e42451-3794-089f-de81-4ee0e6137bee" }
|
|
167
|
+
*/
|
|
168
|
+
managementReconfigure(id, body, sync) {
|
|
169
|
+
const hostId = id;
|
|
170
|
+
const action = async () => {
|
|
171
|
+
const host = this.getObject(hostId);
|
|
172
|
+
const pif = this.restApi.getObject(body.pif, 'PIF');
|
|
173
|
+
if (pif.$host !== host.id) {
|
|
174
|
+
throw invalidParameters(`the PIF ${pif.uuid} does not belong to host ${host.uuid}`);
|
|
175
|
+
}
|
|
176
|
+
const xapiHost = this.getXapiObject(hostId);
|
|
177
|
+
await xapiHost.$xapi.callAsync('host.management_reconfigure', pif._xapiRef);
|
|
178
|
+
};
|
|
179
|
+
return this.createAction(action, {
|
|
180
|
+
sync,
|
|
181
|
+
statusCode: noContentResp.status,
|
|
182
|
+
taskProperties: {
|
|
183
|
+
name: 'reconfigure host management interface',
|
|
184
|
+
objectId: hostId,
|
|
185
|
+
args: body,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
}
|
|
158
189
|
};
|
|
159
190
|
__decorate([
|
|
160
191
|
Example(hostIds),
|
|
@@ -263,6 +294,20 @@ __decorate([
|
|
|
263
294
|
__param(0, Path()),
|
|
264
295
|
__param(1, Path())
|
|
265
296
|
], HostController.prototype, "deleteHostTag", null);
|
|
297
|
+
__decorate([
|
|
298
|
+
Example(taskLocation),
|
|
299
|
+
Post('{id}/actions/management_reconfigure'),
|
|
300
|
+
Middlewares(json()),
|
|
301
|
+
SuccessResponse(asynchronousActionResp.status, asynchronousActionResp.description),
|
|
302
|
+
Response(noContentResp.status, noContentResp.description),
|
|
303
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
304
|
+
Response(badRequestResp.status, badRequestResp.description),
|
|
305
|
+
Response(invalidParametersResp.status, invalidParametersResp.description),
|
|
306
|
+
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
307
|
+
__param(0, Path()),
|
|
308
|
+
__param(1, Body()),
|
|
309
|
+
__param(2, Query())
|
|
310
|
+
], HostController.prototype, "managementReconfigure", null);
|
|
266
311
|
HostController = __decorate([
|
|
267
312
|
Route('hosts'),
|
|
268
313
|
Security('*'),
|
|
@@ -2,60 +2,50 @@ export const xoaDashboard = {
|
|
|
2
2
|
nPools: 2,
|
|
3
3
|
nHosts: 5,
|
|
4
4
|
backupRepositories: {
|
|
5
|
-
|
|
6
|
-
size: {
|
|
7
|
-
backups: 286295393792,
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
other: {
|
|
11
|
-
size: {
|
|
12
|
-
available: 62630354944,
|
|
13
|
-
backups: 20684251648,
|
|
14
|
-
other: 66875031040,
|
|
15
|
-
total: 150189637632,
|
|
16
|
-
used: 87559282688,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
5
|
+
isEmpty: true,
|
|
19
6
|
},
|
|
20
7
|
resourcesOverview: {
|
|
21
8
|
nCpus: 52,
|
|
22
|
-
memorySize:
|
|
23
|
-
srSize:
|
|
9
|
+
memorySize: 111669149696,
|
|
10
|
+
srSize: 1132693933056,
|
|
24
11
|
},
|
|
25
12
|
poolsStatus: {
|
|
26
13
|
connected: 2,
|
|
27
|
-
|
|
14
|
+
disconnected: 1,
|
|
15
|
+
unreachable: 0,
|
|
28
16
|
unknown: 0,
|
|
17
|
+
total: 3,
|
|
29
18
|
},
|
|
30
|
-
nHostsEol: 0,
|
|
31
19
|
missingPatches: {
|
|
32
|
-
hasAuthorization:
|
|
33
|
-
nHostsFailed: 1,
|
|
34
|
-
nHostsWithMissingPatches: 4,
|
|
35
|
-
nPoolsWithMissingPatches: 2,
|
|
20
|
+
hasAuthorization: false,
|
|
36
21
|
},
|
|
37
22
|
storageRepositories: {
|
|
38
23
|
size: {
|
|
39
|
-
available:
|
|
40
|
-
other:
|
|
41
|
-
replicated:
|
|
42
|
-
total:
|
|
43
|
-
used:
|
|
24
|
+
available: 622560659456,
|
|
25
|
+
other: 494094312448,
|
|
26
|
+
replicated: 16038961152,
|
|
27
|
+
total: 1132693933056,
|
|
28
|
+
used: 510133273600,
|
|
44
29
|
},
|
|
45
30
|
},
|
|
46
31
|
backups: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
isEmpty: true,
|
|
33
|
+
},
|
|
34
|
+
hostsStatus: {
|
|
35
|
+
disabled: 0,
|
|
36
|
+
running: 4,
|
|
37
|
+
halted: 1,
|
|
38
|
+
unknown: 0,
|
|
39
|
+
total: 5,
|
|
40
|
+
},
|
|
41
|
+
vmsStatus: {
|
|
42
|
+
active: 11,
|
|
43
|
+
inactive: 39,
|
|
44
|
+
running: 11,
|
|
45
|
+
halted: 39,
|
|
46
|
+
paused: 0,
|
|
47
|
+
suspended: 0,
|
|
48
|
+
unknown: 0,
|
|
49
|
+
total: 50,
|
|
60
50
|
},
|
|
61
51
|
};
|