fix(xo-server/xapi-stats): specify the wanted step when requesting the RRD (#3078)

Fixes #3026
Fixes #3075
This commit is contained in:
badrAZ 2018-06-18 18:32:16 +02:00 committed by Julien Fontanet
parent 58b1d0fba8
commit 4830ac9623
2 changed files with 7 additions and 3 deletions

View File

@ -19,6 +19,7 @@
- Fix the retry of a single failed/interrupted VM backup [#2912](https://github.com/vatesfr/xen-orchestra/issues/2912#issuecomment-395480321)
- New VM with Self: filter out networks that are not in the template's pool [#3011](https://github.com/vatesfr/xen-orchestra/issues/3011)
- [Backup NG] Auto-detect when a full export is necessary.
- Fix Load Balancer [#3075](https://github.com/vatesfr/xen-orchestra/issues/3075#event-1685469551) [#3026](https://github.com/vatesfr/xen-orchestra/issues/3026)
## **5.20.0** (2018-05-31)

View File

@ -98,7 +98,9 @@ const getValuesFromDepth = (obj, targetPath) => {
const testMetric = (test, type) =>
typeof test === 'string'
? test === type
: typeof test === 'function' ? test(type) : test.exec(type)
: typeof test === 'function'
? test(type)
: test.exec(type)
const findMetric = (metrics, metricType) => {
let testResult
@ -242,13 +244,14 @@ export default class XapiStats {
// Execute one http request on a XenServer for get stats
// Return stats (Json format) or throws got exception
@limitConcurrency(3)
_getJson (xapi, host, timestamp) {
_getJson (xapi, host, timestamp, step) {
return xapi
.getResource('/rrd_updates', {
host,
query: {
cf: 'AVERAGE',
host: 'true',
interval: step,
json: 'true',
start: timestamp,
},
@ -316,7 +319,7 @@ export default class XapiStats {
}
const timestamp = await this._getNextTimestamp(xapi, host, step)
const json = await this._getJson(xapi, host, timestamp)
const json = await this._getJson(xapi, host, timestamp, step)
if (json.meta.step !== step) {
throw new FaultyGranularity(
`Unable to get the true granularity: ${json.meta.step}`