listUsageRecords to return the physical size of VM snapshots on primary storage
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.4k
- Ø Merge
- 6 T. 19 Std.
- Gemergte PRs (30 T.)
- 32
Beschreibung
##### ISSUE TYPE
* Improvement Request
##### COMPONENT NAME
~~~
API, Usage
~~~
##### CLOUDSTACK VERSION
~~~
4.18.1
~~~
##### CONFIGURATION
VM snapshots , VMware
##### OS / ENVIRONMENT
##### SUMMARY
Currently cloudstack usage only returns the virtual size of the VM snapshot on primary storage i.e usage type 27. It would be useful to get the physical size as well in the API response.
```
cmk list usagerecords startdate=2023-12-06 09:00:00 type=27 enddate=2023-12-06 09:59:59
--
{
"account": "admin",
"accountid": "570917c5-8ddb-11ee-a6eb-1e002e000c9f",
"description": "VMSnapshot on primary storage usage Id: 0333f93b-fd60-42ad-a961-49b75df4313f for VM Rocky-2 (9058215a-d674-468d-ac61-449bd0593448) with size (50.00 GB) 53687091200",
"domain": "ROOT",
"domainid": "376e4be1-8ddb-11ee-a6eb-1e002e000c9f",
"enddate": "2023-12-06'T'09:59:59+00:00",
"name": "rocky-snapshot3",
"rawusage": "1",
"size": 53687091200,
"startdate": "2023-12-06'T'09:00:00+00:00",
"tags": [],
"usage": "1 Hrs",
"usageid": "0333f93b-fd60-42ad-a961-49b75df4313f",
"usagetype": 27,
"virtualmachineid": "9058215a-d674-468d-ac61-449bd0593448",
"zoneid": "771aecba-b1ef-4bfc-94e6-b325aa2a4c01"
},
--
{
"account": "admin",
"accountid": "570917c5-8ddb-11ee-a6eb-1e002e000c9f",
"description": "VMSnapshot on primary storage usage Id: 591a15ab-b0d0-465c-a30f-fe9c0785da88 for VM Rocky-2 (9058215a-d674-468d-ac61-449bd0593448) with size (50.00 GB) 53687091200",
"domain": "ROOT",
"domainid": "376e4be1-8ddb-11ee-a6eb-1e002e000c9f",
"enddate": "2023-12-06'T'09:59:59+00:00",
"name": "rocky-snapshot1",
"rawusage": "1",
"size": 53687091200,
"startdate": "2023-12-06'T'09:00:00+00:00",
"tags": [],
"usage": "1 Hrs",
"usageid": "591a15ab-b0d0-465c-a30f-fe9c0785da88",
"usagetype": 27,
"virtualmachineid": "9058215a-d674-468d-ac61-449bd0593448",
"zoneid": "771aecba-b1ef-4bfc-94e6-b325aa2a4c01"
},
{
"account": "admin",
"accountid": "570917c5-8ddb-11ee-a6eb-1e002e000c9f",
"description": "VMSnapshot on primary storage usage Id: e82b68a2-5e63-4509-9be0-48aedd822529 for VM Rocky-2 (9058215a-d674-468d-ac61-449bd0593448) with size (50.00 GB) 53687091200",
"domain": "ROOT",
"domainid": "376e4be1-8ddb-11ee-a6eb-1e002e000c9f",
"enddate": "2023-12-06'T'09:59:59+00:00",
"name": "rocky-snapshot2",
"rawusage": "1",
"size": 53687091200,
"startdate": "2023-12-06'T'09:00:00+00:00",
"tags": [],
"usage": "1 Hrs",
"usageid": "e82b68a2-5e63-4509-9be0-48aedd822529",
"usagetype": 27,
"virtualmachineid": "9058215a-d674-468d-ac61-449bd0593448",
"zoneid": "771aecba-b1ef-4bfc-94e6-b325aa2a4c01"
},
mysql> select id,usage_display,usage_type,format_bytes(size) as size,format_bytes(virtual_size) as virtual_size,start_date,end_date from cloud_usage.cloud_usage where usage_type=27 and vm_instance_id=2782 and start_date='2023-12-06 09:00:00';
+------+---------------+------------+-----------+--------------+---------------------+---------------------+
| id | usage_display | usage_type | size | virtual_size | start_date | end_date |
+------+---------------+------------+-----------+--------------+---------------------+---------------------+
| 9709 | 1 Hrs | 27 | 24.61 GiB | 50.00 GiB | 2023-12-06 09:00:00 | 2023-12-06 09:59:59 |
| 9713 | 1 Hrs | 27 | 50.00 GiB | 50.00 GiB | 2023-12-06 09:00:00 | 2023-12-06 09:59:59 |
| 9714 | 1 Hrs | 27 | 24.61 GiB | 50.00 GiB | 2023-12-06 09:00:00 | 2023-12-06 09:59:59 |
+------+---------------+------------+-----------+--------------+---------------------+---------------------+
```
Beitragsleitfaden
Rechercherichtung
Beginne mit der Verarbeitung der listUsageRecords API für den Nutzungstyp 27 und vergleiche ihre Antwort mit den Spalten cloud_usage und virtual_size, die im Bericht angezeigt werden. Verfolge, wie die Nutzung von VM-Snapshots für den primären VMware-Speicher ermittelt wird. Als abgeschlossen gilt die Arbeit, wenn die API für diese Nutzungsdatensätze sowohl die physische Größe als auch die virtuelle Größe bereitstellt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java, mysql
- Bereich
- api, cloud, databases
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100