@xen-orchestra/rest-api 0.9.0 → 0.11.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.
@@ -1,10 +1,12 @@
1
1
  import { Controller } from 'tsoa';
2
+ import { createGzip } from 'node:zlib';
3
+ import { pipeline } from 'node:stream/promises';
2
4
  import { Readable } from 'node:stream';
3
5
  import { BASE_URL } from '../index.mjs';
4
6
  import { makeNdJsonStream } from '../helpers/stream.helper.mjs';
5
7
  import { makeObjectMapper } from '../helpers/object-wrapper.helper.mjs';
8
+ import { NDJSON_CONTENT_TYPE } from '../helpers/utils.helper.mjs';
6
9
  const noop = () => { };
7
- const NDJSON_CONTENT_TYPE = 'application/x-ndjson';
8
10
  export class BaseController extends Controller {
9
11
  restApi;
10
12
  constructor(restApi) {
@@ -46,4 +48,27 @@ export class BaseController extends Controller {
46
48
  return location;
47
49
  }
48
50
  }
51
+ getXapi(maybeId) {
52
+ return this.restApi.xoApp.getXapi(maybeId);
53
+ }
54
+ maybeCompressResponse(req, res) {
55
+ let transform;
56
+ let acceptEncoding = req.headers['accept-encoding'];
57
+ acceptEncoding = Array.isArray(acceptEncoding) ? acceptEncoding : acceptEncoding?.split(',');
58
+ if (acceptEncoding !== undefined &&
59
+ acceptEncoding.some(encoding => {
60
+ const value = encoding.split(';')[0].trim().toLowerCase();
61
+ // support `x-gzip` as an alias for `gzip`
62
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Encoding#gzip
63
+ return value === 'gzip' || value === 'x-gzip';
64
+ })) {
65
+ res.setHeader('Content-Encoding', 'gzip');
66
+ transform = createGzip();
67
+ }
68
+ if (transform !== undefined) {
69
+ pipeline(transform, res).catch(noop);
70
+ return transform;
71
+ }
72
+ return res;
73
+ }
49
74
  }
@@ -85,7 +85,7 @@ let AlarmController = class AlarmController extends XapiXoController {
85
85
  getObject(id) {
86
86
  const maybeAlarm = this.restApi.getObject(id, 'message');
87
87
  if (!alarmPredicate(maybeAlarm)) {
88
- /* throw */ noSuchObject(id, 'alarm');
88
+ throw noSuchObject(id, 'alarm');
89
89
  }
90
90
  return this.#parseAlarm(maybeAlarm);
91
91
  }
@@ -1,3 +1,4 @@
1
+ export const NDJSON_CONTENT_TYPE = 'application/x-ndjson';
1
2
  export const isSrWritable = (sr) => sr.content_type !== 'iso' && sr.size > 0;
2
3
  export const isReplicaVm = (vm) => 'start' in vm.blockedOperations && vm.other['xo:backup:job'] !== undefined;
3
4
  export const vmContainsNoBakTag = (vm) => vm.tags.some(t => t.split('=', 1)[0] === 'xo:no-bak');
@@ -7,8 +7,9 @@ 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 { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
10
+ import { Example, Get, Path, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
11
11
  import { inject } from 'inversify';
12
+ import { pipeline } from 'node:stream/promises';
12
13
  import { provide } from 'inversify-binding-decorators';
13
14
  import { host, hostIds, hostStats, partialHosts } from '../open-api/oa-examples/host.oa-example.mjs';
14
15
  import { RestApi } from '../rest-api/rest-api.mjs';
@@ -39,6 +40,26 @@ let HostController = class HostController extends XapiXoController {
39
40
  getHostStats(id, granularity) {
40
41
  return this.restApi.xoApp.getXapiHostStats(id, granularity);
41
42
  }
43
+ /**
44
+ * Host must be running
45
+ *
46
+ * Download the audit log of a host.
47
+ *
48
+ * @example id "b61a5c92-700e-4966-a13b-00633f03eea8"
49
+ *
50
+ */
51
+ async getAuditLog(req, id) {
52
+ const xapiHost = this.getXapiObject(id);
53
+ const res = req.res;
54
+ const response = await xapiHost.$xapi.getResource('/audit_log', { host: xapiHost });
55
+ const date = new Date().toISOString();
56
+ const headers = new Headers({
57
+ 'Content-Type': 'application/octet-stream',
58
+ 'Content-Disposition': `attachment; filename="${host.name_label}-${date}-audit.txt"`,
59
+ });
60
+ res.setHeaders(headers);
61
+ await pipeline(response.body, this.maybeCompressResponse(req, res));
62
+ }
42
63
  };
43
64
  __decorate([
44
65
  Example(hostIds),
@@ -65,6 +86,14 @@ __decorate([
65
86
  __param(0, Path()),
66
87
  __param(1, Query())
67
88
  ], HostController.prototype, "getHostStats", null);
89
+ __decorate([
90
+ Get('{id}/audit.txt'),
91
+ SuccessResponse(200, 'Download started', 'application/octet-stream'),
92
+ Response(notFoundResp.status, notFoundResp.description),
93
+ Response(internalServerErrorResp.status, internalServerErrorResp.description),
94
+ __param(0, Request()),
95
+ __param(1, Path())
96
+ ], HostController.prototype, "getAuditLog", null);
68
97
  HostController = __decorate([
69
98
  Route('hosts'),
70
99
  Security('*'),
package/dist/ioc/ioc.mjs CHANGED
@@ -2,6 +2,7 @@ import { buildProviderModule } from 'inversify-binding-decorators';
2
2
  import { Container, decorate, injectable } from 'inversify';
3
3
  import { Controller } from 'tsoa';
4
4
  import { RestApi } from '../rest-api/rest-api.mjs';
5
+ import { VmService } from '../vms/vm.service.mjs';
5
6
  import { XoaService } from '../xoa/xoa.service.mjs';
6
7
  const iocContainer = new Container();
7
8
  decorate(injectable(), Controller);
@@ -21,5 +22,12 @@ export function setupContainer(xoApp) {
21
22
  return new XoaService(restApi);
22
23
  })
23
24
  .inSingletonScope();
25
+ iocContainer
26
+ .bind(VmService)
27
+ .toDynamicValue(ctx => {
28
+ const restApi = ctx.container.get(RestApi);
29
+ return new VmService(restApi);
30
+ })
31
+ .inSingletonScope();
24
32
  }
25
33
  export { iocContainer };
@@ -38,7 +38,7 @@ let MessageController = class MessageController extends XapiXoController {
38
38
  getObject(id) {
39
39
  const message = super.getObject(id);
40
40
  if (alarmPredicate(message)) {
41
- /* throw */ noSuchObject(id, 'message');
41
+ throw noSuchObject(id, 'message');
42
42
  }
43
43
  return message;
44
44
  }
@@ -10,39 +10,43 @@ export default function genericErrorHandler(error, req, res, _next) {
10
10
  return;
11
11
  }
12
12
  const responseError = { error: error.message };
13
+ let statusCode;
13
14
  if (noSuchObject.is(error)) {
14
- res.status(404);
15
+ statusCode = 404;
15
16
  }
16
17
  else if (unauthorized.is(error) || forbiddenOperation.is(error)) {
17
- res.status(403);
18
+ statusCode = 403;
18
19
  }
19
20
  else if (featureUnauthorized.is(error)) {
20
- res.status(403);
21
+ statusCode = 403;
21
22
  responseError.data = error.data;
22
23
  }
23
24
  else if (invalidCredentials.is(error)) {
24
- res.status(401);
25
+ statusCode = 401;
25
26
  }
26
27
  else if (objectAlreadyExists.is(error)) {
27
- res.status(409);
28
+ statusCode = 409;
28
29
  }
29
30
  else if (invalidParameters.is(error)) {
30
- res.status(422);
31
+ statusCode = 422;
31
32
  }
32
33
  else if (notImplemented.is(error)) {
33
- res.status(501);
34
+ statusCode = 501;
34
35
  }
35
36
  else if (incorrectState.is(error)) {
36
- res.status(409);
37
+ statusCode = 409;
37
38
  responseError.data = error.data;
38
39
  }
39
40
  else {
40
41
  if (error.name === 'XapiError') {
41
42
  responseError.info = 'This is a XenServer/XCP-ng error, not an XO error';
42
43
  }
43
- res.status(500);
44
+ statusCode = 500;
44
45
  log.error(error);
45
46
  }
46
- log.info(`[${req.method}] ${req.path} (${res.statusCode})`);
47
- res.json(responseError);
47
+ log.info(`[${req.method}] ${req.path} (${statusCode})`);
48
+ if (res.headersSent) {
49
+ return;
50
+ }
51
+ res.status(statusCode).json(responseError);
48
52
  }
@@ -2,7 +2,7 @@ import { invalidParameters } from 'xo-common/api-errors.js';
2
2
  import { ValidateError } from 'tsoa';
3
3
  export default function tsoaToXoErrorHandler(error, _req, _res, next) {
4
4
  if (error instanceof ValidateError) {
5
- /* throw */ invalidParameters(error.fields);
5
+ throw invalidParameters(error.fields);
6
6
  }
7
7
  return next(error);
8
8
  }
@@ -68,3 +68,207 @@ export const pool = {
68
68
  $poolId: '355ee47d-ff4c-4924-3db2-fd86ae629676',
69
69
  _xapiRef: 'OpaqueRef:1c3f19c8-f80a-464d-9c48-a2c19d4e4fc3',
70
70
  };
71
+ export const importVm = { id: '9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f' };
72
+ export const createVm = {
73
+ id: '8279e670-cb58-c048-7007-230f075becfb',
74
+ };
75
+ export const poolStats = {
76
+ '6278d39b-f972-43b0-a1f8-d31dc2beb923': {
77
+ error: {
78
+ code: 'HOST_OFFLINE',
79
+ params: ['OpaqueRef:9a9b0a02-e888-4eaf-9d8c-127cfd8e5d9e'],
80
+ call: {
81
+ duration: 158,
82
+ method: 'host.get_servertime',
83
+ params: ['* session id *', 'OpaqueRef:9a9b0a02-e888-4eaf-9d8c-127cfd8e5d9e'],
84
+ },
85
+ },
86
+ },
87
+ '0e21d25b-4487-4f63-b0d1-2d0f6bf5aa7f': {
88
+ endTimestamp: 1751031135,
89
+ interval: 5,
90
+ stats: {
91
+ memory: [
92
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
93
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
94
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
95
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
96
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
97
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
98
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
99
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
100
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
101
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
102
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
103
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
104
+ 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280, 4286177280,
105
+ 4286177280,
106
+ ],
107
+ memoryFree: [
108
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
109
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
110
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
111
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
112
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
113
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
114
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
115
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
116
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
117
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
118
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
119
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
120
+ 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816, 2670882816,
121
+ 2670882816,
122
+ ],
123
+ cpus: {
124
+ '0': [
125
+ 10.07, 9.56, 8.88, 9.6, 10.31, 8.88, 9.36, 9.84, 10.459999999999999, 10.299999999999999, 11.48,
126
+ 9.719999999999999, 8.35, 8.63, 9.44, 10.059999999999999, 10.34, 8.81, 8.5, 8.89, 10, 11.12,
127
+ 12.120000000000001, 9.92, 9.21, 9.58, 9.719999999999999, 9.85, 10.979999999999999, 9.950000000000001, 10.54,
128
+ 10.84, 10.290000000000001, 11.74, 12.18, 10.22, 8.559999999999999, 9.25, 9.53, 11.64, 15.24, 9.82, 9.78, 9.19,
129
+ 9.71, 10.040000000000001, 11.129999999999999, 9.06, 9.28, 9.53, 9.629999999999999, 9.77, 10.96, 10.32, 9.3,
130
+ 9.65, 14.41, 26.479999999999997, 30.159999999999997, 20.29, 17.09, 15.43, 14.37, 11.23, 10.27, 9.4,
131
+ 8.649999999999999, 13.020000000000001, 18.86, 9.27, 11.27, 10.81, 11.23, 12.85, 11.19, 9.370000000000001,
132
+ 10.59, 10.39, 10.82, 10.79, 14.04, 10.83, 11.83, 9.5, 9.77, 9.48, 9.59, 13.36, 20.49, 8.57, 11.03, 17.01,
133
+ 18.05, 10.549999999999999, 13.100000000000001, 10.18, 10.38, 9.27, 10.93, 11.05, 11.59, 12.11,
134
+ 15.459999999999999, 10.290000000000001, 11.469999999999999, 20.5, 12.36, 10.31, 9.27, 8.97, 10.51,
135
+ 9.959999999999999, 11.4, 10.65, 8.82, 8.67, 9.93, 16.12,
136
+ ],
137
+ '1': [
138
+ 9.04, 8.57, 8.52, 9.44, 10.15, 9.790000000000001, 9.53, 9.120000000000001, 8.75, 9.47, 9.8, 8.82,
139
+ 9.959999999999999, 10.03, 9.01, 9.36, 10.23, 10.36, 10.68, 9.62, 9.25, 9.26, 9.29, 9.34, 9.120000000000001,
140
+ 9.139999999999999, 9.520000000000001, 9.47, 9.78, 8.09, 7.7299999999999995, 7.430000000000001, 8.35, 8.73,
141
+ 9.85, 9.6, 9.82, 9.04, 8.93, 11.12, 14.17, 7.86, 8.59, 9.35, 8.34, 9.47, 10.620000000000001, 9.75,
142
+ 9.629999999999999, 9.34, 9.94, 9.73, 9.86, 8.57, 9.04, 9.22, 12.24, 21.93, 21.59, 13.19, 18.529999999999998,
143
+ 12, 11.200000000000001, 10.94, 10.26, 9.87, 9.879999999999999, 9.83, 15.18, 9.520000000000001,
144
+ 11.129999999999999, 11.84, 11.05, 9.66, 8.18, 7.91, 10.33, 9.120000000000001, 9.3, 9.92, 15.290000000000001,
145
+ 9.049999999999999, 9.17, 9.180000000000001, 8.37, 9.11, 9.54, 11, 18.32, 9.049999999999999, 11.51,
146
+ 15.939999999999998, 11.08, 9.41, 10.780000000000001, 9.51, 8.37, 9.180000000000001, 9.39, 8.03, 9.85, 10.36,
147
+ 13.98, 9.39, 9.950000000000001, 10.84, 10.280000000000001, 8.12, 9.69, 8.780000000000001, 9.69, 9.48, 9.34,
148
+ 7.79, 9.47, 9.29, 10.7, 17.66,
149
+ ],
150
+ },
151
+ load: [
152
+ 0.1463, 0.1364, 0.1264, 0.1164, 0.135, 0.1729, 0.1565, 0.1465, 0.1365, 0.1265, 0.1165, 0.1065, 0.0966, 0.0866,
153
+ 0.08, 0.0766, 0.0666, 0.06, 0.0567, 0.05, 0.0467, 0.04, 0.04, 0.0368, 0.03, 0.03, 0.03, 0.0268, 0.02, 0.02,
154
+ 0.02, 0.02, 0.0169, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.0332, 0.1101, 0.1571, 0.1443, 0.1272,
155
+ 0.1172, 0.1072, 0.1, 0.0972, 0.131, 0.2346, 0.2146, 0.1973, 0.1846, 0.1886, 0.2347, 0.2358, 0.2748, 0.2548,
156
+ 0.2555, 0.2923, 0.2649, 0.245, 0.225, 0.2274, 0.2726, 0.2451, 0.2446, 0.2851, 0.2652, 0.2452, 0.2253, 0.2053,
157
+ 0.1877, 0.1754, 0.1554, 0.156, 0.2055, 0.1855, 0.1678, 0.1578, 0.1478, 0.1356, 0.1178, 0.1079, 0.1, 0.0979,
158
+ 0.0879, 0.0779, 0.07, 0.0843, 0.138, 0.128, 0.118, 0.108, 0.0981, 0.0881, 0.08, 0.0781, 0.07, 0.0682, 0.06,
159
+ 0.0582, 0.05, 0.0482, 0.04, 0.04, 0.0383, 0.03, 0.03, 0.0283, 0.02, 0.033, 0.0984, 0.0884, 0.08, 0.1033,
160
+ ],
161
+ pifs: {
162
+ rx: {
163
+ '0': [
164
+ 177.1505, 146.0538, 65.197, 161.1729, 140.153, 133.3197, 95.6565, 254.4575, 622.2478, 613.8387, 154.9934,
165
+ 124.0258, 187.5361, 198.7337, 166.6895, 197.9211, 159.0272, 138.8176, 177.7427, 138.8519, 138.6663,
166
+ 149.9577, 156.1524, 165.8935, 173.4432, 160.3388, 233.173, 260.8957, 139.7597, 169.8137, 113.6127, 421.4655,
167
+ 817.7339, 266.2525, 520.4689, 150.6032, 190.2794, 193.0448, 160.5704, 182.0646, 110.6279, 62.0256, 237.651,
168
+ 297.4287, 248.6124, 124.6001, 135.1613, 127.4922, 137.3023, 186.3178, 215.8744, 176.2602, 166.0728,
169
+ 177.0399, 122.5788, 225.3141, 622.6523, 548.8357, 122.3089, 195.4243, 276.8979, 193.8274, 190.4752,
170
+ 156.2348, 199.6902, 156.4138, 136.0526, 149.4206, 142.098, 165.8939, 112.3953, 125.9506, 178.4714, 262.318,
171
+ 207.2666, 200.2995, 174.3736, 205.5677, 18.7483, 97.1194, 370.3324, 917.407, 128.3314, 175.9807, 112.3198,
172
+ 111.9657, 145.1591, 140.079, 218.2649, 214.8196, 192.7014, 175.0843, 119.3893, 121.1903, 144.0656, 188.201,
173
+ 120.877, 157.461, 133.2787, 168.9598, 166.4183, 193.7425, 218.7006, 312.7589, 965.4944, 155.9674, 342.8991,
174
+ 296.6323, 591.9749, 166.365, 112.7707, 167.502, 160.8092, 223.3223, 211.1992, 177.7079, 20.2051, 127.1545,
175
+ ],
176
+ '1': [
177
+ 189.4876, 116.8431, 63.3135, 181.0414, 553.2811, 838.5921, 192.277, 199.4739, 177.2014, 184.4713, 513.2862,
178
+ 757.6664, 177.6102, 180.5172, 191.3914, 263.0015, 591.4913, 791.7061, 298.3245, 419.0697, 231.2719,
179
+ 223.6201, 489.2033, 780.8646, 183.6428, 204.0968, 230.1329, 239.0858, 655.997, 980.0488, 180.0527, 192.8379,
180
+ 282.7487, 656.5881, 784.7719, 183.571, 186.4121, 190.1587, 208.6954, 611.2658, 1019.4175, 55.8925, 187.4972,
181
+ 179.731, 192.0186, 188.1511, 479.8468, 952.6181, 216.3036, 233.8062, 240.7673, 272.0145, 512.7843, 687.7659,
182
+ 224.8852, 217.9776, 206.3708, 8436.2803, 26685.4648, 12811.7305, 10669.3057, 6786.4961, 7084.0381,
183
+ 4580.3521, 545.4028, 864.8164, 202.1622, 505.0804, 1147.189, 452.3743, 1086.2987, 894.4191, 1005.7607,
184
+ 2717.6548, 245.2338, 451.8658, 987.2057, 163.0364, 1074.0902, 3796.7485, 784.3134, 1258.4941, 430.8885,
185
+ 887.2435, 218.9164, 206.8704, 191.4602, 330.3448, 809.7494, 883.0421, 194.0328, 208.9014, 484.3492,
186
+ 1186.8184, 440.232, 987.4225, 220.3967, 218.6031, 212.9356, 246.0948, 520.4993, 1043.0072, 194.5119,
187
+ 198.7182, 419.5035, 1362.4612, 680.6985, 555.4032, 201.996, 206.6911, 220.3556, 352.4922, 1076.2238,
188
+ 200.6009, 189.8869, 146.8022, 27.4213, 365.4701,
189
+ ],
190
+ },
191
+ tx: {
192
+ '0': [
193
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
194
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
195
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
196
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
197
+ ],
198
+ '1': [
199
+ 0, 0, 0, 0, 558.8698, 1005.7303, 6.3661, 11.6339, 0, 0, 541.6819, 1022.9182, 0, 0, 0, 0, 643.691, 1278.509,
200
+ 0, 0, 0, 0, 516.5421, 1075.058, 0, 0, 0, 0, 766.8823, 1675.5177, 0, 0, 0, 474.9793, 1089.6207, 0, 0, 0, 0,
201
+ 473.7006, 1144.8994, 0, 0, 0, 0, 0, 619.1703, 1591.2296, 0, 0, 0, 0, 454.2817, 1231.9594, 13.159, 0, 0,
202
+ 54619.0508, 191640.25, 150561.125, 138005.5469, 74966.125, 85759.9531, 56211.7656, 390.0007, 1174.5992, 0,
203
+ 400.7921, 1237.8263, 376.2454, 1520.9313, 1188.0049, 3194.2131, 10315.5859, 20.2006, 355.7656, 1181.8344, 0,
204
+ 4256.373, 14544.3926, 454.6388, 1551.9141, 347.2362, 1200.6456, 0, 0, 0, 0, 326.7213, 1237.8787, 3.6863,
205
+ 14.3137, 335.0124, 1330.0206, 376.2695, 1487.8975, 0, 0, 0, 0, 368.2305, 1615.5696, 0, 0, 347.7944,
206
+ 1874.757, 1260.453, 21.7956, 0, 0, 0, 258.9554, 1305.6447, 0, 0, 0, 0, 266.3527,
207
+ ],
208
+ },
209
+ },
210
+ ioThroughput: {
211
+ r: {
212
+ a152347d: [
213
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
214
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
215
+ 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261
+ ],
262
+ },
263
+ w: {
264
+ a152347d: [
265
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
267
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
268
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269
+ ],
270
+ },
271
+ },
272
+ },
273
+ },
274
+ };
@@ -0,0 +1,58 @@
1
+ export const smIds = [
2
+ '/rest/v0/sms/5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
3
+ '/rest/v0/sms/d3df5d0f-bac8-ed31-22e9-b7d89fb39e0e',
4
+ ];
5
+ export const partialSms = [
6
+ {
7
+ uuid: '5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
8
+ name_label: 'Local EXT4 VHD and QCOW2',
9
+ SM_type: 'ext',
10
+ href: '/rest/v0/sms/5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
11
+ },
12
+ {
13
+ uuid: '0d48516d-f7ad-1c36-39ea-17cfb16e04ab',
14
+ name_label: 'Local EXT4 VHD and QCOW2',
15
+ SM_type: 'ext',
16
+ href: '/rest/v0/sms/0d48516d-f7ad-1c36-39ea-17cfb16e04ab',
17
+ },
18
+ ];
19
+ export const sm = {
20
+ type: 'SM',
21
+ uuid: '5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
22
+ name_description: 'SR plugin which represents disks as VHD and QCOW2 files stored on a local EXT4 filesystem, created inside an LVM volume',
23
+ name_label: 'Local EXT4 VHD and QCOW2',
24
+ SM_type: 'ext',
25
+ configuration: {
26
+ device: 'local device path (required) (e.g. /dev/sda3)',
27
+ },
28
+ vendor: 'Citrix Systems Inc',
29
+ features: {
30
+ SR_PROBE: 1,
31
+ SR_SUPPORTS_LOCAL_CACHING: 1,
32
+ SR_UPDATE: 1,
33
+ THIN_PROVISIONING: 1,
34
+ VDI_ACTIVATE: 1,
35
+ VDI_ATTACH: 1,
36
+ VDI_CLONE: 1,
37
+ VDI_CONFIG_CBT: 1,
38
+ VDI_CREATE: 1,
39
+ VDI_DEACTIVATE: 1,
40
+ VDI_DELETE: 1,
41
+ VDI_DETACH: 1,
42
+ VDI_GENERATE_CONFIG: 1,
43
+ VDI_MIRROR: 1,
44
+ VDI_READ_CACHING: 1,
45
+ VDI_RESET_ON_BOOT: 2,
46
+ VDI_RESIZE: 1,
47
+ VDI_SNAPSHOT: 1,
48
+ VDI_UPDATE: 1,
49
+ },
50
+ driver_filename: '/opt/xensource/sm/EXTSR',
51
+ required_cluster_stack: [],
52
+ supported_image_formats: [],
53
+ id: '5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
54
+ pool: 'd6ba2603-7f16-0261-a33f-6e91d3aa0ec7',
55
+ poolId: 'd6ba2603-7f16-0261-a33f-6e91d3aa0ec7',
56
+ _xapiRef: 'OpaqueRef:27086ace-74d7-9f68-7465-346c7249b799',
57
+ href: '/rest/v0/sms/5bfb2f8a-70f3-8cff-1748-3cd4de2153da',
58
+ };