feat(xo-server-usage-report): add top 3 IOPS VM usage (#3463)

Fixes #3308
This commit is contained in:
badrAZ
2018-10-10 16:40:26 +02:00
committed by Julien Fontanet
parent 39728974b1
commit f077528936
3 changed files with 22 additions and 6 deletions

View File

@@ -10,6 +10,7 @@
- [New VM] Display a warning when the memory is below the template memory static min [#3496](https://github.com/vatesfr/xen-orchestra/issues/3496) (PR [#3513](https://github.com/vatesfr/xen-orchestra/pull/3513))
- [Backup NG form] Add link to plugins setting [#3457](https://github.com/vatesfr/xen-orchestra/issues/3457) (PR [#3514](https://github.com/vatesfr/xen-orchestra/pull/3514))
- [Backup reports] Add job and run ID [#3488](https://github.com/vatesfr/xen-orchestra/issues/3488) (PR [#3516](https://github.com/vatesfr/xen-orchestra/pull/3516))
- [Usage Report] Add top 3 VMs which use the most IOPS read/write/total [#3308](https://github.com/vatesfr/xen-orchestra/issues/3308) (PR [#3463](https://github.com/vatesfr/xen-orchestra/pull/3463))
### Bug fixes

View File

@@ -235,6 +235,9 @@
<td>{{normaliseValue this.value}} MiB</td>
</tr>
{{/each}}
{{getTopIops topVms}}
<tr>
<td rowspan='{{math topVms.netReception.length "+" 1}}' class="tableHeader">Network RX</td>
</tr>

View File

@@ -176,21 +176,30 @@ const getBody = ({ uuid, name, value }, transformValue, unit) => `
</tr>
`
const getTopIops = ({ iopsRead, iopsWrite, iopsTotal }) => `
${getHeader('IOPS read', iopsRead.length)}
${iopsRead.map(obj => getBody(obj, formatIops)).join('')}
${getHeader('IOPS write', iopsWrite.length)}
${iopsWrite.map(obj => getBody(obj, formatIops)).join('')}
${getHeader('IOPS total', iopsTotal.length)}
${iopsTotal.map(obj => getBody(obj, formatIops)).join('')}
`
Handlebars.registerHelper(
'getTopSrs',
({ usedSpace, iopsRead, iopsWrite, iopsTotal }) =>
new Handlebars.SafeString(`
${getHeader('Used space', usedSpace.length)}
${usedSpace.map(obj => getBody(obj, normaliseValue, 'GiB')).join('')}
${getHeader('IOPS read', iopsRead.length)}
${iopsRead.map(obj => getBody(obj, formatIops)).join('')}
${getHeader('IOPS write', iopsWrite.length)}
${iopsWrite.map(obj => getBody(obj, formatIops)).join('')}
${getHeader('IOPS total', iopsTotal.length)}
${iopsTotal.map(obj => getBody(obj, formatIops)).join('')}
${getTopIops({ iopsRead, iopsWrite, iopsTotal })}
`)
)
Handlebars.registerHelper(
'getTopIops',
props => new Handlebars.SafeString(getTopIops(props))
)
// ===================================================================
function computeMean (values) {
@@ -419,6 +428,9 @@ function getTopVms ({ vmsStats, xo }) {
'ram',
'diskRead',
'diskWrite',
'iopsRead',
'iopsWrite',
'iopsTotal',
'netReception',
'netTransmission',
])