feat(xo-server-usage-report): ignore replicated VMs (#5241)
Fixes #4778
This commit is contained in:
parent
6fd45a37e2
commit
c77016ea44
@ -7,6 +7,8 @@
|
||||
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Usage report] Exclude replicated VMs from the VMs evolution [#4778](https://github.com/vatesfr/xen-orchestra/issues/4778) (PR [#5241](https://github.com/vatesfr/xen-orchestra/pull/5241))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
@ -27,3 +29,5 @@
|
||||
> - major: if the change breaks compatibility
|
||||
>
|
||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||
|
||||
- xo-server-usage-report minor
|
||||
|
@ -405,16 +405,26 @@ async function getSrsStats({ xo, xoObjects }) {
|
||||
}
|
||||
|
||||
function computeGlobalVmsStats({ haltedVms, vmsStats, xo }) {
|
||||
const allVms = concat(
|
||||
map(vmsStats, vm => ({
|
||||
uuid: vm.uuid,
|
||||
name: vm.name,
|
||||
})),
|
||||
map(haltedVms, vm => ({
|
||||
uuid: vm.uuid,
|
||||
name: vm.name_label,
|
||||
}))
|
||||
)
|
||||
const allVms = vmsStats.map(vm => ({
|
||||
uuid: vm.uuid,
|
||||
name: vm.name,
|
||||
}))
|
||||
|
||||
haltedVms.forEach(vm => {
|
||||
const isReplication =
|
||||
'start' in vm.blockedOperations &&
|
||||
vm.tags.some(
|
||||
tag => tag === 'Disaster Recovery' || tag === 'Continuous Replication'
|
||||
)
|
||||
|
||||
// Exclude replicated VMs because they keep being created/destroyed due to the implementation
|
||||
if (!isReplication) {
|
||||
allVms.push({
|
||||
uuid: vm.uuid,
|
||||
name: vm.name_label,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return Object.assign(
|
||||
computeMeans(vmsStats, [
|
||||
@ -426,7 +436,7 @@ function computeGlobalVmsStats({ haltedVms, vmsStats, xo }) {
|
||||
'netTransmission',
|
||||
]),
|
||||
{
|
||||
number: allVms.length,
|
||||
number: vmsStats.length + haltedVms.length,
|
||||
allVms,
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user