benj-n opened a new pull request, #7007:
URL: https://github.com/apache/cloudstack/pull/7007
### Description
This PR...
<!--- Describe your changes in DETAIL - And how has behaviour functionally
changed. -->
Fixes: #7000
It makes prometheus integration returns the same value ("0") when a capacity
is explicitly "Disabled" or non-existent.
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to
reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be
closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!---
*********************************************************************************
-->
<!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE
DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!---
*********************************************************************************
-->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [X] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to
-->
<!-- see how your change affects other areas of the code, etc. -->
Set a host in maintenance.
Restart the cloudstack-management service.
Capacities are set to Disabled in table "op_host_capacity".
```
MariaDB [cloud]> SELECT
id,host_id,used_capacity,reserved_capacity,total_capacity,capacity_type,capacity_state
FROM op_host_capacity WHERE `host_id`=1;
+----+---------+---------------+-------------------+----------------+---------------+----------------+
| id | host_id | used_capacity | reserved_capacity | total_capacity |
capacity_type | capacity_state |
+----+---------+---------------+-------------------+----------------+---------------+----------------+
| 11 | 1 | 196640 | 0 | 105419636736 |
3 | Enabled |
| 18 | 1 | 0 | 0 | 2 |
90 | Disabled |
| 19 | 1 | 0 | 0 | 3048968192 |
0 | Disabled |
| 20 | 1 | 0 | 0 | 4394 |
1 | Disabled |
+----+---------+---------------+-------------------+----------------+---------------+----------------+
4 rows in set (0.00 sec)
```
For the three disabled capacity types, Prometheus exporter returns a total
capacity value of "0".
```
~# curl -s localhost:9595/metrics | grep node01 | grep
"vms_cores_total\|cpu_usage_mhz\|memory_usage_mibs" | grep 'filter="total"'
cloudstack_host_cpu_usage_mhz_total{zone="testZone1",hostname="node01",ip="redacted",overprovisioningfactor="1.0",filter="total",tags=""}
0.00
cloudstack_host_memory_usage_mibs_total{zone="testZone1",hostname="node01",ip="redacted",overprovisioningfactor="1.0",filter="total",dedicated="0",tags=""}
0.00
cloudstack_host_vms_cores_total{zone="testZone1",hostname="node01",ip="redacted",filter="total",dedicated="0",tags=""}
0
```
<!-- Please read the
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]