@xen-orchestra/rest-api 0.28.1 → 0.29.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/abstract-classes/base-controller.mjs +10 -0
- package/dist/abstract-classes/listener.mjs +8 -3
- package/dist/alarms/alarm.controller.mjs +3 -2
- package/dist/backup-archives/backup-archive.controller.mjs +3 -2
- package/dist/backup-jobs/backup-job.controller.mjs +15 -10
- package/dist/backup-logs/backup-log.controller.mjs +3 -2
- package/dist/backup-repositories/backup-repositories.controller.mjs +3 -2
- package/dist/events/event.class.mjs +12 -9
- package/dist/events/event.service.mjs +2 -3
- package/dist/groups/group.controller.mjs +9 -6
- package/dist/helpers/markdown.helper.mjs +20 -0
- package/dist/helpers/object-wrapper.helper.mjs +3 -3
- package/dist/hosts/host.controller.mjs +12 -8
- package/dist/messages/message.controller.mjs +3 -2
- package/dist/networks/network.controller.mjs +12 -8
- package/dist/open-api/routes/routes.js +182 -42
- package/dist/pbds/pbd.controller.mjs +3 -2
- package/dist/pcis/pci.controller.mjs +3 -2
- package/dist/pgpus/pgpu.controller.mjs +3 -2
- package/dist/pifs/pif.controller.mjs +12 -8
- package/dist/pools/pool.controller.mjs +12 -8
- package/dist/proxies/proxy.controller.mjs +3 -2
- package/dist/restore-logs/restore-log.controller.mjs +6 -4
- package/dist/schedules/schedule.controller.mjs +3 -2
- package/dist/servers/server.controller.mjs +6 -4
- package/dist/sms/sm.controller.mjs +3 -2
- package/dist/srs/sr.controller.mjs +12 -8
- package/dist/tasks/task.controller.mjs +3 -2
- package/dist/users/user.controller.mjs +9 -6
- package/dist/vbds/vbd.controller.mjs +12 -8
- package/dist/vdi-snapshots/vdi-snapshot.controller.mjs +12 -8
- package/dist/vdis/vdi.controller.mjs +12 -8
- package/dist/vifs/vif.controller.mjs +76 -10
- package/dist/vm-controller/vm-controller.controller.mjs +15 -10
- package/dist/vm-snapshots/vm-snapshot.controller.mjs +15 -10
- package/dist/vm-templates/vm-template.controller.mjs +15 -10
- package/dist/vms/vm.controller.mjs +18 -12
- package/dist/vms/vm.service.mjs +7 -2
- package/open-api/spec/swagger.json +1164 -231
- package/package.json +11 -11
|
@@ -35,7 +35,7 @@ let VdiController = class VdiController extends XapiXoController {
|
|
|
35
35
|
* @example filter "snapshots:length:>2"
|
|
36
36
|
* @example limit 42
|
|
37
37
|
*/
|
|
38
|
-
getVdis(req, fields, ndjson, filter, limit) {
|
|
38
|
+
getVdis(req, fields, ndjson, markdown, filter, limit) {
|
|
39
39
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -77,7 +77,7 @@ let VdiController = class VdiController extends XapiXoController {
|
|
|
77
77
|
* @example filter "time:>1747053793"
|
|
78
78
|
* @example limit 42
|
|
79
79
|
*/
|
|
80
|
-
getVdiAlarms(req, id, fields, ndjson, filter, limit) {
|
|
80
|
+
getVdiAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
81
81
|
const vdi = this.getObject(id);
|
|
82
82
|
const alarms = this.#alarmService.getAlarms({
|
|
83
83
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vdi.uuid}`,
|
|
@@ -117,7 +117,7 @@ let VdiController = class VdiController extends XapiXoController {
|
|
|
117
117
|
* @example filter "name:VM_STARTED"
|
|
118
118
|
* @example limit 42
|
|
119
119
|
*/
|
|
120
|
-
getVdiMessages(req, id, fields, ndjson, filter, limit) {
|
|
120
|
+
getVdiMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
121
121
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
122
122
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
123
123
|
}
|
|
@@ -127,7 +127,7 @@ let VdiController = class VdiController extends XapiXoController {
|
|
|
127
127
|
* @example filter "status:failure"
|
|
128
128
|
* @example limit 42
|
|
129
129
|
*/
|
|
130
|
-
async getVdiTasks(req, id, fields, ndjson, filter, limit) {
|
|
130
|
+
async getVdiTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
131
131
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
132
132
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
133
133
|
}
|
|
@@ -177,7 +177,8 @@ __decorate([
|
|
|
177
177
|
__param(1, Query()),
|
|
178
178
|
__param(2, Query()),
|
|
179
179
|
__param(3, Query()),
|
|
180
|
-
__param(4, Query())
|
|
180
|
+
__param(4, Query()),
|
|
181
|
+
__param(5, Query())
|
|
181
182
|
], VdiController.prototype, "getVdis", null);
|
|
182
183
|
__decorate([
|
|
183
184
|
Get('{id}.{format}'),
|
|
@@ -214,7 +215,8 @@ __decorate([
|
|
|
214
215
|
__param(2, Query()),
|
|
215
216
|
__param(3, Query()),
|
|
216
217
|
__param(4, Query()),
|
|
217
|
-
__param(5, Query())
|
|
218
|
+
__param(5, Query()),
|
|
219
|
+
__param(6, Query())
|
|
218
220
|
], VdiController.prototype, "getVdiAlarms", null);
|
|
219
221
|
__decorate([
|
|
220
222
|
Example(vdiId),
|
|
@@ -242,7 +244,8 @@ __decorate([
|
|
|
242
244
|
__param(2, Query()),
|
|
243
245
|
__param(3, Query()),
|
|
244
246
|
__param(4, Query()),
|
|
245
|
-
__param(5, Query())
|
|
247
|
+
__param(5, Query()),
|
|
248
|
+
__param(6, Query())
|
|
246
249
|
], VdiController.prototype, "getVdiMessages", null);
|
|
247
250
|
__decorate([
|
|
248
251
|
Example(taskIds),
|
|
@@ -255,7 +258,8 @@ __decorate([
|
|
|
255
258
|
__param(2, Query()),
|
|
256
259
|
__param(3, Query()),
|
|
257
260
|
__param(4, Query()),
|
|
258
|
-
__param(5, Query())
|
|
261
|
+
__param(5, Query()),
|
|
262
|
+
__param(6, Query())
|
|
259
263
|
], VdiController.prototype, "getVdiTasks", null);
|
|
260
264
|
__decorate([
|
|
261
265
|
Example(taskLocation),
|
|
@@ -13,14 +13,14 @@ import { json } from 'express';
|
|
|
13
13
|
import { escapeUnsafeComplexMatcher } from '../helpers/utils.helper.mjs';
|
|
14
14
|
import { provide } from 'inversify-binding-decorators';
|
|
15
15
|
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
16
|
-
import { badRequestResp, createdResp, internalServerErrorResp, invalidParameters as invalidParametersResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
16
|
+
import { asynchronousActionResp, badRequestResp, createdResp, internalServerErrorResp, invalidParameters as invalidParametersResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
17
17
|
import { invalidParameters } from 'xo-common/api-errors.js';
|
|
18
18
|
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
19
19
|
import { partialVifs, vif, vifId, vifIds } from '../open-api/oa-examples/vif.oa-example.mjs';
|
|
20
20
|
import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
|
|
21
21
|
import { AlarmService } from '../alarms/alarm.service.mjs';
|
|
22
22
|
import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
|
|
23
|
-
import { taskIds, partialTasks } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
23
|
+
import { taskIds, partialTasks, taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
24
24
|
let VifController = class VifController extends XapiXoController {
|
|
25
25
|
#alarmService;
|
|
26
26
|
constructor(restApi, alarmService) {
|
|
@@ -32,7 +32,7 @@ let VifController = class VifController extends XapiXoController {
|
|
|
32
32
|
* @example filter "attached?"
|
|
33
33
|
* @example limit 42
|
|
34
34
|
*/
|
|
35
|
-
getVifs(req, fields, ndjson, filter, limit) {
|
|
35
|
+
getVifs(req, fields, ndjson, markdown, filter, limit) {
|
|
36
36
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -47,7 +47,7 @@ let VifController = class VifController extends XapiXoController {
|
|
|
47
47
|
* @example filter "time:>1747053793"
|
|
48
48
|
* @example limit 42
|
|
49
49
|
*/
|
|
50
|
-
getVifAlarms(req, id, fields, ndjson, filter, limit) {
|
|
50
|
+
getVifAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
51
51
|
const vif = this.getObject(id);
|
|
52
52
|
const alarms = this.#alarmService.getAlarms({
|
|
53
53
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vif.uuid}`,
|
|
@@ -61,7 +61,7 @@ let VifController = class VifController extends XapiXoController {
|
|
|
61
61
|
* @example filter "name:VM_STARTED"
|
|
62
62
|
* @example limit 42
|
|
63
63
|
*/
|
|
64
|
-
getVifMessages(req, id, fields, ndjson, filter, limit) {
|
|
64
|
+
getVifMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
65
65
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
66
66
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
67
67
|
}
|
|
@@ -71,7 +71,7 @@ let VifController = class VifController extends XapiXoController {
|
|
|
71
71
|
* @example filter "status:failure"
|
|
72
72
|
* @example limit 42
|
|
73
73
|
*/
|
|
74
|
-
async getVifTasks(req, id, fields, ndjson, filter, limit) {
|
|
74
|
+
async getVifTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
75
75
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
76
76
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
77
77
|
}
|
|
@@ -106,6 +106,48 @@ let VifController = class VifController extends XapiXoController {
|
|
|
106
106
|
const xapi = this.getXapi(id);
|
|
107
107
|
await xapi.deleteVif(id);
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Hotplug the VIF, dynamically attaching it to the running VM
|
|
111
|
+
* Requires PV drivers to be installed on the VM
|
|
112
|
+
*
|
|
113
|
+
* @example id "f07ab729-c0e8-721c-45ec-f11276377030"
|
|
114
|
+
*/
|
|
115
|
+
async connectVif(id, sync) {
|
|
116
|
+
const vifId = id;
|
|
117
|
+
const action = async () => {
|
|
118
|
+
const xapi = this.getXapi(vifId);
|
|
119
|
+
await xapi.connectVif(vifId);
|
|
120
|
+
};
|
|
121
|
+
return this.createAction(action, {
|
|
122
|
+
sync,
|
|
123
|
+
statusCode: noContentResp.status,
|
|
124
|
+
taskProperties: {
|
|
125
|
+
name: 'connect VIF',
|
|
126
|
+
objectId: vifId,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Hot-unplug the VIF, dynamically detaching it from the running VM
|
|
132
|
+
* Requires PV drivers to be installed on the VM
|
|
133
|
+
*
|
|
134
|
+
* @example id "f07ab729-c0e8-721c-45ec-f11276377030"
|
|
135
|
+
*/
|
|
136
|
+
async disconnectVif(id, sync) {
|
|
137
|
+
const vifId = id;
|
|
138
|
+
const action = async () => {
|
|
139
|
+
const xapi = this.getXapi(vifId);
|
|
140
|
+
await xapi.disconnectVif(vifId);
|
|
141
|
+
};
|
|
142
|
+
return this.createAction(action, {
|
|
143
|
+
sync,
|
|
144
|
+
statusCode: noContentResp.status,
|
|
145
|
+
taskProperties: {
|
|
146
|
+
name: 'disconnect VIF',
|
|
147
|
+
objectId: vifId,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
}
|
|
109
151
|
};
|
|
110
152
|
__decorate([
|
|
111
153
|
Example(vifIds),
|
|
@@ -115,7 +157,8 @@ __decorate([
|
|
|
115
157
|
__param(1, Query()),
|
|
116
158
|
__param(2, Query()),
|
|
117
159
|
__param(3, Query()),
|
|
118
|
-
__param(4, Query())
|
|
160
|
+
__param(4, Query()),
|
|
161
|
+
__param(5, Query())
|
|
119
162
|
], VifController.prototype, "getVifs", null);
|
|
120
163
|
__decorate([
|
|
121
164
|
Example(vif),
|
|
@@ -133,7 +176,8 @@ __decorate([
|
|
|
133
176
|
__param(2, Query()),
|
|
134
177
|
__param(3, Query()),
|
|
135
178
|
__param(4, Query()),
|
|
136
|
-
__param(5, Query())
|
|
179
|
+
__param(5, Query()),
|
|
180
|
+
__param(6, Query())
|
|
137
181
|
], VifController.prototype, "getVifAlarms", null);
|
|
138
182
|
__decorate([
|
|
139
183
|
Example(messageIds),
|
|
@@ -146,7 +190,8 @@ __decorate([
|
|
|
146
190
|
__param(2, Query()),
|
|
147
191
|
__param(3, Query()),
|
|
148
192
|
__param(4, Query()),
|
|
149
|
-
__param(5, Query())
|
|
193
|
+
__param(5, Query()),
|
|
194
|
+
__param(6, Query())
|
|
150
195
|
], VifController.prototype, "getVifMessages", null);
|
|
151
196
|
__decorate([
|
|
152
197
|
Example(taskIds),
|
|
@@ -159,7 +204,8 @@ __decorate([
|
|
|
159
204
|
__param(2, Query()),
|
|
160
205
|
__param(3, Query()),
|
|
161
206
|
__param(4, Query()),
|
|
162
|
-
__param(5, Query())
|
|
207
|
+
__param(5, Query()),
|
|
208
|
+
__param(6, Query())
|
|
163
209
|
], VifController.prototype, "getVifTasks", null);
|
|
164
210
|
__decorate([
|
|
165
211
|
Example(vifId),
|
|
@@ -178,6 +224,26 @@ __decorate([
|
|
|
178
224
|
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
179
225
|
__param(0, Path())
|
|
180
226
|
], VifController.prototype, "destroyVif", null);
|
|
227
|
+
__decorate([
|
|
228
|
+
Example(taskLocation),
|
|
229
|
+
Post('{id}/actions/connect'),
|
|
230
|
+
SuccessResponse(asynchronousActionResp.status, asynchronousActionResp.description),
|
|
231
|
+
Response(noContentResp.status, noContentResp.description),
|
|
232
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
233
|
+
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
234
|
+
__param(0, Path()),
|
|
235
|
+
__param(1, Query())
|
|
236
|
+
], VifController.prototype, "connectVif", null);
|
|
237
|
+
__decorate([
|
|
238
|
+
Example(taskLocation),
|
|
239
|
+
Post('{id}/actions/disconnect'),
|
|
240
|
+
SuccessResponse(asynchronousActionResp.status, asynchronousActionResp.description),
|
|
241
|
+
Response(noContentResp.status, noContentResp.description),
|
|
242
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
243
|
+
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
244
|
+
__param(0, Path()),
|
|
245
|
+
__param(1, Query())
|
|
246
|
+
], VifController.prototype, "disconnectVif", null);
|
|
181
247
|
VifController = __decorate([
|
|
182
248
|
Route('vifs'),
|
|
183
249
|
Security('*'),
|
|
@@ -34,7 +34,7 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
34
34
|
* @example filter "power_state:Running"
|
|
35
35
|
* @example limit 42
|
|
36
36
|
*/
|
|
37
|
-
getVmControllers(req, fields, ndjson, filter, limit) {
|
|
37
|
+
getVmControllers(req, fields, ndjson, markdown, filter, limit) {
|
|
38
38
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -49,7 +49,7 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
49
49
|
* @example filter "time:>1747053793"
|
|
50
50
|
* @example limit 42
|
|
51
51
|
*/
|
|
52
|
-
getVmControllerAlarms(req, id, fields, ndjson, filter, limit) {
|
|
52
|
+
getVmControllerAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
53
53
|
const vmController = this.getObject(id);
|
|
54
54
|
const alarms = this.#alarmService.getAlarms({
|
|
55
55
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmController.uuid}`,
|
|
@@ -63,7 +63,7 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
63
63
|
* @example filter "VDI_type:user"
|
|
64
64
|
* @example limit 42
|
|
65
65
|
*/
|
|
66
|
-
getVmControllerVdis(req, id, fields, ndjson, filter, limit) {
|
|
66
|
+
getVmControllerVdis(req, id, fields, ndjson, markdown, filter, limit) {
|
|
67
67
|
const vdis = this.#vmService.getVmVdis(id, 'VM-controller');
|
|
68
68
|
return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
73
73
|
* @example filter "name:VM_STARTED"
|
|
74
74
|
* @example limit 42
|
|
75
75
|
*/
|
|
76
|
-
getVmControllerMessages(req, id, fields, ndjson, filter, limit) {
|
|
76
|
+
getVmControllerMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
77
77
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
78
78
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
79
79
|
}
|
|
@@ -83,7 +83,7 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
83
83
|
* @example filter "status:failure"
|
|
84
84
|
* @example limit 42
|
|
85
85
|
*/
|
|
86
|
-
async getVmControllerTasks(req, id, fields, ndjson, filter, limit) {
|
|
86
|
+
async getVmControllerTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
87
87
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
88
88
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
89
89
|
}
|
|
@@ -112,7 +112,8 @@ __decorate([
|
|
|
112
112
|
__param(1, Query()),
|
|
113
113
|
__param(2, Query()),
|
|
114
114
|
__param(3, Query()),
|
|
115
|
-
__param(4, Query())
|
|
115
|
+
__param(4, Query()),
|
|
116
|
+
__param(5, Query())
|
|
116
117
|
], VmControllerController.prototype, "getVmControllers", null);
|
|
117
118
|
__decorate([
|
|
118
119
|
Example(vmController),
|
|
@@ -130,7 +131,8 @@ __decorate([
|
|
|
130
131
|
__param(2, Query()),
|
|
131
132
|
__param(3, Query()),
|
|
132
133
|
__param(4, Query()),
|
|
133
|
-
__param(5, Query())
|
|
134
|
+
__param(5, Query()),
|
|
135
|
+
__param(6, Query())
|
|
134
136
|
], VmControllerController.prototype, "getVmControllerAlarms", null);
|
|
135
137
|
__decorate([
|
|
136
138
|
Example(vmControllerVdis),
|
|
@@ -142,7 +144,8 @@ __decorate([
|
|
|
142
144
|
__param(2, Query()),
|
|
143
145
|
__param(3, Query()),
|
|
144
146
|
__param(4, Query()),
|
|
145
|
-
__param(5, Query())
|
|
147
|
+
__param(5, Query()),
|
|
148
|
+
__param(6, Query())
|
|
146
149
|
], VmControllerController.prototype, "getVmControllerVdis", null);
|
|
147
150
|
__decorate([
|
|
148
151
|
Example(messageIds),
|
|
@@ -155,7 +158,8 @@ __decorate([
|
|
|
155
158
|
__param(2, Query()),
|
|
156
159
|
__param(3, Query()),
|
|
157
160
|
__param(4, Query()),
|
|
158
|
-
__param(5, Query())
|
|
161
|
+
__param(5, Query()),
|
|
162
|
+
__param(6, Query())
|
|
159
163
|
], VmControllerController.prototype, "getVmControllerMessages", null);
|
|
160
164
|
__decorate([
|
|
161
165
|
Example(taskIds),
|
|
@@ -168,7 +172,8 @@ __decorate([
|
|
|
168
172
|
__param(2, Query()),
|
|
169
173
|
__param(3, Query()),
|
|
170
174
|
__param(4, Query()),
|
|
171
|
-
__param(5, Query())
|
|
175
|
+
__param(5, Query()),
|
|
176
|
+
__param(6, Query())
|
|
172
177
|
], VmControllerController.prototype, "getVmControllerTasks", null);
|
|
173
178
|
__decorate([
|
|
174
179
|
Put('{id}/tags/{tag}'),
|
|
@@ -34,7 +34,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
|
34
34
|
* @example filter "snapshot_time:>1725020038"
|
|
35
35
|
* @example limit 42
|
|
36
36
|
*/
|
|
37
|
-
getVmSnapshots(req, fields, ndjson, filter, limit) {
|
|
37
|
+
getVmSnapshots(req, fields, ndjson, markdown, filter, limit) {
|
|
38
38
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -72,7 +72,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
|
72
72
|
* @example filter "time:>1747053793"
|
|
73
73
|
* @example limit 42
|
|
74
74
|
*/
|
|
75
|
-
getVmSnapshotAlarms(req, id, fields, ndjson, filter, limit) {
|
|
75
|
+
getVmSnapshotAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
76
76
|
const vmSnapshot = this.getObject(id);
|
|
77
77
|
const alarms = this.#alarmService.getAlarms({
|
|
78
78
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmSnapshot.uuid}`,
|
|
@@ -86,7 +86,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
|
86
86
|
* @example filter "VDI_type:user"
|
|
87
87
|
* @example limit 42
|
|
88
88
|
*/
|
|
89
|
-
getVmSnapshotVdis(req, id, fields, ndjson, filter, limit) {
|
|
89
|
+
getVmSnapshotVdis(req, id, fields, ndjson, markdown, filter, limit) {
|
|
90
90
|
const vdis = this.#vmService.getVmVdis(id, 'VM-snapshot');
|
|
91
91
|
return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
|
|
92
92
|
}
|
|
@@ -96,7 +96,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
|
96
96
|
* @example filter "name:VM_STARTED"
|
|
97
97
|
* @example limit 42
|
|
98
98
|
*/
|
|
99
|
-
getVmSnapshotsMessages(req, id, fields, ndjson, filter, limit) {
|
|
99
|
+
getVmSnapshotsMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
100
100
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
101
101
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
102
102
|
}
|
|
@@ -106,7 +106,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
|
106
106
|
* @example filter "status:failure"
|
|
107
107
|
* @example limit 42
|
|
108
108
|
*/
|
|
109
|
-
async getVmSnapshotTasks(req, id, fields, ndjson, filter, limit) {
|
|
109
|
+
async getVmSnapshotTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
110
110
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
111
111
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
112
112
|
}
|
|
@@ -135,7 +135,8 @@ __decorate([
|
|
|
135
135
|
__param(1, Query()),
|
|
136
136
|
__param(2, Query()),
|
|
137
137
|
__param(3, Query()),
|
|
138
|
-
__param(4, Query())
|
|
138
|
+
__param(4, Query()),
|
|
139
|
+
__param(5, Query())
|
|
139
140
|
], VmSnapshotController.prototype, "getVmSnapshots", null);
|
|
140
141
|
__decorate([
|
|
141
142
|
Get('{id}.{format}'),
|
|
@@ -171,7 +172,8 @@ __decorate([
|
|
|
171
172
|
__param(2, Query()),
|
|
172
173
|
__param(3, Query()),
|
|
173
174
|
__param(4, Query()),
|
|
174
|
-
__param(5, Query())
|
|
175
|
+
__param(5, Query()),
|
|
176
|
+
__param(6, Query())
|
|
175
177
|
], VmSnapshotController.prototype, "getVmSnapshotAlarms", null);
|
|
176
178
|
__decorate([
|
|
177
179
|
Example(vmSnapshotVdis),
|
|
@@ -183,7 +185,8 @@ __decorate([
|
|
|
183
185
|
__param(2, Query()),
|
|
184
186
|
__param(3, Query()),
|
|
185
187
|
__param(4, Query()),
|
|
186
|
-
__param(5, Query())
|
|
188
|
+
__param(5, Query()),
|
|
189
|
+
__param(6, Query())
|
|
187
190
|
], VmSnapshotController.prototype, "getVmSnapshotVdis", null);
|
|
188
191
|
__decorate([
|
|
189
192
|
Example(messageIds),
|
|
@@ -196,7 +199,8 @@ __decorate([
|
|
|
196
199
|
__param(2, Query()),
|
|
197
200
|
__param(3, Query()),
|
|
198
201
|
__param(4, Query()),
|
|
199
|
-
__param(5, Query())
|
|
202
|
+
__param(5, Query()),
|
|
203
|
+
__param(6, Query())
|
|
200
204
|
], VmSnapshotController.prototype, "getVmSnapshotsMessages", null);
|
|
201
205
|
__decorate([
|
|
202
206
|
Example(taskIds),
|
|
@@ -209,7 +213,8 @@ __decorate([
|
|
|
209
213
|
__param(2, Query()),
|
|
210
214
|
__param(3, Query()),
|
|
211
215
|
__param(4, Query()),
|
|
212
|
-
__param(5, Query())
|
|
216
|
+
__param(5, Query()),
|
|
217
|
+
__param(6, Query())
|
|
213
218
|
], VmSnapshotController.prototype, "getVmSnapshotTasks", null);
|
|
214
219
|
__decorate([
|
|
215
220
|
Put('{id}/tags/{tag}'),
|
|
@@ -33,7 +33,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
|
33
33
|
* @example filter "isDefaultTemplate?"
|
|
34
34
|
* @example limit 42
|
|
35
35
|
* */
|
|
36
|
-
getVmTemplates(req, fields, ndjson, filter, limit) {
|
|
36
|
+
getVmTemplates(req, fields, ndjson, markdown, filter, limit) {
|
|
37
37
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -71,7 +71,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
|
71
71
|
* @example filter "time:>1747053793"
|
|
72
72
|
* @example limit 42
|
|
73
73
|
*/
|
|
74
|
-
getVmTemplateAlarms(req, id, fields, ndjson, filter, limit) {
|
|
74
|
+
getVmTemplateAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
75
75
|
const vmTemplate = this.getObject(id);
|
|
76
76
|
const alarms = this.#alarmService.getAlarms({
|
|
77
77
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmTemplate.uuid}`,
|
|
@@ -85,7 +85,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
|
85
85
|
* @example filter "VDI_type:user"
|
|
86
86
|
* @example limit 42
|
|
87
87
|
*/
|
|
88
|
-
getVmTemplateVdis(req, id, fields, ndjson, filter, limit) {
|
|
88
|
+
getVmTemplateVdis(req, id, fields, ndjson, markdown, filter, limit) {
|
|
89
89
|
const vdis = this.#vmService.getVmVdis(id, 'VM-template');
|
|
90
90
|
return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
|
|
91
91
|
}
|
|
@@ -95,7 +95,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
|
95
95
|
* @example filter "name:VM_STARTED"
|
|
96
96
|
* @example limit 42
|
|
97
97
|
*/
|
|
98
|
-
getVmTemplateMessages(req, id, fields, ndjson, filter, limit) {
|
|
98
|
+
getVmTemplateMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
99
99
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
100
100
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
101
101
|
}
|
|
@@ -105,7 +105,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
|
105
105
|
* @example filter "status:failure"
|
|
106
106
|
* @example limit 42
|
|
107
107
|
*/
|
|
108
|
-
async getVmTemplateTasks(req, id, fields, ndjson, filter, limit) {
|
|
108
|
+
async getVmTemplateTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
109
109
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
110
110
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
111
111
|
}
|
|
@@ -134,7 +134,8 @@ __decorate([
|
|
|
134
134
|
__param(1, Query()),
|
|
135
135
|
__param(2, Query()),
|
|
136
136
|
__param(3, Query()),
|
|
137
|
-
__param(4, Query())
|
|
137
|
+
__param(4, Query()),
|
|
138
|
+
__param(5, Query())
|
|
138
139
|
], VmTemplateController.prototype, "getVmTemplates", null);
|
|
139
140
|
__decorate([
|
|
140
141
|
Get('{id}.{format}'),
|
|
@@ -170,7 +171,8 @@ __decorate([
|
|
|
170
171
|
__param(2, Query()),
|
|
171
172
|
__param(3, Query()),
|
|
172
173
|
__param(4, Query()),
|
|
173
|
-
__param(5, Query())
|
|
174
|
+
__param(5, Query()),
|
|
175
|
+
__param(6, Query())
|
|
174
176
|
], VmTemplateController.prototype, "getVmTemplateAlarms", null);
|
|
175
177
|
__decorate([
|
|
176
178
|
Example(vmTemplateVdis),
|
|
@@ -182,7 +184,8 @@ __decorate([
|
|
|
182
184
|
__param(2, Query()),
|
|
183
185
|
__param(3, Query()),
|
|
184
186
|
__param(4, Query()),
|
|
185
|
-
__param(5, Query())
|
|
187
|
+
__param(5, Query()),
|
|
188
|
+
__param(6, Query())
|
|
186
189
|
], VmTemplateController.prototype, "getVmTemplateVdis", null);
|
|
187
190
|
__decorate([
|
|
188
191
|
Example(messageIds),
|
|
@@ -195,7 +198,8 @@ __decorate([
|
|
|
195
198
|
__param(2, Query()),
|
|
196
199
|
__param(3, Query()),
|
|
197
200
|
__param(4, Query()),
|
|
198
|
-
__param(5, Query())
|
|
201
|
+
__param(5, Query()),
|
|
202
|
+
__param(6, Query())
|
|
199
203
|
], VmTemplateController.prototype, "getVmTemplateMessages", null);
|
|
200
204
|
__decorate([
|
|
201
205
|
Example(taskIds),
|
|
@@ -208,7 +212,8 @@ __decorate([
|
|
|
208
212
|
__param(2, Query()),
|
|
209
213
|
__param(3, Query()),
|
|
210
214
|
__param(4, Query()),
|
|
211
|
-
__param(5, Query())
|
|
215
|
+
__param(5, Query()),
|
|
216
|
+
__param(6, Query())
|
|
212
217
|
], VmTemplateController.prototype, "getVmTemplateTasks", null);
|
|
213
218
|
__decorate([
|
|
214
219
|
Put('{id}/tags/{tag}'),
|
|
@@ -40,7 +40,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
40
40
|
* @example filter "power_state:Running"
|
|
41
41
|
* @example limit 42
|
|
42
42
|
*/
|
|
43
|
-
getVms(req, fields, ndjson, filter, limit) {
|
|
43
|
+
getVms(req, fields, ndjson, markdown, filter, limit) {
|
|
44
44
|
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -376,7 +376,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
376
376
|
* @example filter "time:>1747053793"
|
|
377
377
|
* @example limit 42
|
|
378
378
|
*/
|
|
379
|
-
getVmAlarms(req, id, fields, ndjson, filter, limit) {
|
|
379
|
+
getVmAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
380
380
|
const alarms = this.#vmService.getVmAlarms(id, { filter, limit });
|
|
381
381
|
return this.sendObjects(Object.values(alarms), req, 'alarms');
|
|
382
382
|
}
|
|
@@ -386,7 +386,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
386
386
|
* @example filter "VDI_type:user"
|
|
387
387
|
* @example limit 42
|
|
388
388
|
*/
|
|
389
|
-
getVmVdis(req, id, fields, ndjson, filter, limit) {
|
|
389
|
+
getVmVdis(req, id, fields, ndjson, markdown, filter, limit) {
|
|
390
390
|
const vdis = this.#vmService.getVmVdis(id, 'VM');
|
|
391
391
|
return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
|
|
392
392
|
}
|
|
@@ -396,7 +396,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
396
396
|
* @example filter "mode:full"
|
|
397
397
|
* @example limit 42
|
|
398
398
|
*/
|
|
399
|
-
async vmGetVmBackupJobs(req, id, fields, ndjson, filter, limit) {
|
|
399
|
+
async vmGetVmBackupJobs(req, id, fields, ndjson, markdown, filter, limit) {
|
|
400
400
|
const backupJobs = await this.restApi.xoApp.getAllJobs('backup');
|
|
401
401
|
const vmBackupJobs = [];
|
|
402
402
|
for (const backupJob of backupJobs) {
|
|
@@ -412,7 +412,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
412
412
|
* @example filter "name:VM_STARTED"
|
|
413
413
|
* @example limit 42
|
|
414
414
|
*/
|
|
415
|
-
getVmMessages(req, id, fields, ndjson, filter, limit) {
|
|
415
|
+
getVmMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
416
416
|
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
417
417
|
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
418
418
|
}
|
|
@@ -422,7 +422,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
422
422
|
* @example filter "status:failure"
|
|
423
423
|
* @example limit 42
|
|
424
424
|
*/
|
|
425
|
-
async getVmTasks(req, id, fields, ndjson, filter, limit) {
|
|
425
|
+
async getVmTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
426
426
|
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
427
427
|
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
428
428
|
}
|
|
@@ -500,7 +500,8 @@ __decorate([
|
|
|
500
500
|
__param(1, Query()),
|
|
501
501
|
__param(2, Query()),
|
|
502
502
|
__param(3, Query()),
|
|
503
|
-
__param(4, Query())
|
|
503
|
+
__param(4, Query()),
|
|
504
|
+
__param(5, Query())
|
|
504
505
|
], VmController.prototype, "getVms", null);
|
|
505
506
|
__decorate([
|
|
506
507
|
Get('{id}.{format}'),
|
|
@@ -672,7 +673,8 @@ __decorate([
|
|
|
672
673
|
__param(2, Query()),
|
|
673
674
|
__param(3, Query()),
|
|
674
675
|
__param(4, Query()),
|
|
675
|
-
__param(5, Query())
|
|
676
|
+
__param(5, Query()),
|
|
677
|
+
__param(6, Query())
|
|
676
678
|
], VmController.prototype, "getVmAlarms", null);
|
|
677
679
|
__decorate([
|
|
678
680
|
Example(vmVdis),
|
|
@@ -684,7 +686,8 @@ __decorate([
|
|
|
684
686
|
__param(2, Query()),
|
|
685
687
|
__param(3, Query()),
|
|
686
688
|
__param(4, Query()),
|
|
687
|
-
__param(5, Query())
|
|
689
|
+
__param(5, Query()),
|
|
690
|
+
__param(6, Query())
|
|
688
691
|
], VmController.prototype, "getVmVdis", null);
|
|
689
692
|
__decorate([
|
|
690
693
|
Example(vmBackupJobIds),
|
|
@@ -697,7 +700,8 @@ __decorate([
|
|
|
697
700
|
__param(2, Query()),
|
|
698
701
|
__param(3, Query()),
|
|
699
702
|
__param(4, Query()),
|
|
700
|
-
__param(5, Query())
|
|
703
|
+
__param(5, Query()),
|
|
704
|
+
__param(6, Query())
|
|
701
705
|
], VmController.prototype, "vmGetVmBackupJobs", null);
|
|
702
706
|
__decorate([
|
|
703
707
|
Example(messageIds),
|
|
@@ -710,7 +714,8 @@ __decorate([
|
|
|
710
714
|
__param(2, Query()),
|
|
711
715
|
__param(3, Query()),
|
|
712
716
|
__param(4, Query()),
|
|
713
|
-
__param(5, Query())
|
|
717
|
+
__param(5, Query()),
|
|
718
|
+
__param(6, Query())
|
|
714
719
|
], VmController.prototype, "getVmMessages", null);
|
|
715
720
|
__decorate([
|
|
716
721
|
Example(taskIds),
|
|
@@ -723,7 +728,8 @@ __decorate([
|
|
|
723
728
|
__param(2, Query()),
|
|
724
729
|
__param(3, Query()),
|
|
725
730
|
__param(4, Query()),
|
|
726
|
-
__param(5, Query())
|
|
731
|
+
__param(5, Query()),
|
|
732
|
+
__param(6, Query())
|
|
727
733
|
], VmController.prototype, "getVmTasks", null);
|
|
728
734
|
__decorate([
|
|
729
735
|
Put('{id}/tags/{tag}'),
|
package/dist/vms/vm.service.mjs
CHANGED
|
@@ -104,13 +104,18 @@ export class VmService {
|
|
|
104
104
|
}
|
|
105
105
|
getVmVdis(id, vmType) {
|
|
106
106
|
const getObject = this.#restApi.getObject.bind(this.#restApi);
|
|
107
|
+
const vdiType = vmType === 'VM-snapshot' ? 'VDI-snapshot' : 'VDI';
|
|
107
108
|
const vdis = [];
|
|
108
109
|
const vm = getObject(id, vmType);
|
|
109
110
|
for (const vbdId of vm.$VBDs) {
|
|
110
111
|
const vbd = getObject(vbdId, 'VBD');
|
|
111
112
|
if (vbd.VDI !== undefined) {
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
// Search for all VDI types, then push only the VDIs associated with the VM type.
|
|
114
|
+
// This avoids the "no such VDI ..." error if the VM has faulty VDIs. (is_snapshot:false, $snapshot_of: <vdiId>)
|
|
115
|
+
const vdi = getObject(vbd.VDI, ['VDI-snapshot', 'VDI']);
|
|
116
|
+
if (vdi.type === vdiType) {
|
|
117
|
+
vdis.push(vdi);
|
|
118
|
+
}
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
return vdis;
|