Quota charges attached volumes twice since 4.22.1 (cumulative + per-VM usage_volume records from #11531)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
The double charge comes from two usage_volume helper rows per attached volume, one with vm_id NULL and one with vm_id set, which each produce a usage_type = 6 record in cloud_usage. Start by reproducing the row counts in usage_volume, cloud_usage and quota_usage after a Usage run, then trace how #11531 introduced the per-VM row. Done means each attached volume is billed once per hour, and the choice of which record kind Quota bills is settled with the maintainers first.
由索引模型根據 Issue 內容生成。
描述
problem
Since #11531 (4.22.1), Usage intentionally writes two kinds of usage_volume helper rows for an attached volume: a cumulative row (vm_id NULL) and a per-VM row (vm_id set). Both generate an hourly usage_type = 6 (VOLUME) record in cloud_usage, one with and one without vm_instance_id.
The Quota plugin treats both records as billable, so every attached volume is charged twice.
versions
- CloudStack 4.22.1.1 (management, usage)
- KVM, Ceph RBD primary storage
- Quota enabled with a volume tariff (
usage_type = 6)
steps to reproduce
- Enable Quota and configure a tariff for usage type 6.
- Create a data volume and attach it to a running VM (events
VOLUME.CREATE, thenVOLUME.ATTACH). - After the next Usage run, check
cloud_usage.usage_volume. There are two rows withdeleted IS NULL, one withvm_idNULL and one withvm_idset to the VM. - Check
cloud_usage.cloud_usagefor that volume and hour. There are twousage_type = 6records with the sameraw_usage: one withvm_instance_idNULL and one withvm_instance_idset. - Check
cloud_usage.quota_usage. There is one row percloud_usagerecord, both with the samequota_used, so the account balance is debited twice.
Example, one volume and one hour:
| cloud_usage.vm_instance_id | records | quota_used |
|---|---|---|
| NULL (cumulative) | 1 | 0.0081 |
| set (per-VM) | 1 | 0.0081 |
expected
A volume should be charged once per hour. Quota should bill only one of the two record kinds, for example the cumulative record (vm_instance_id NULL), since that is the one that is consistent with pre-#11531 behaviour.
notes
- Today, root volumes on new VMs don't show the double charge, because the second
usage_volumeinsert fails on the old(volume_id, created)unique key (#13909 / #13933). Once that key is widened in 4.22.2, root volumes will get both rows too, and will also be double-charged by Quota. - Our workaround: an hourly job sets
deleted = createdon per-VMusage_volumerows whenever an active cumulative row exists for the same volume. Per-VM records then stop being generated for that volume, and the cumulative row keeps billing it through detach and re-attach. Records written before we found this had to be removed by hand.
- 主要語言
- Java
- 星號
- 3.1k
- 分支
- 1.4k
- 平均合併
- 9 天 23 小時
- 30 天內合併 PR
- 19
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/cloudstack 的其他 Issue
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
apache/cloudstack#14545 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
apache/cloudstack#14530 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug status:has-work-around
難度 2/5 1-3 小時 新手友好度 78/100
apache/cloudstack#14465 · 1 則留言 ·
維護者通常 1 天內回覆
-
4.23.0.0: restartVPC cleanup=true with public IPs on two VLANs fails with UnsupportedOperationException and leaves the VPC without a backup router可能已有人在做 @bernardodemarco 於 6 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 78/100
apache/cloudstack#14430 · 4 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 77/100
apache/cloudstack#14427 · 1 則留言 ·
維護者通常 1 天內回覆
查看 apache/cloudstack 的全部 Issue
相似的 Issue
-
5.0.x backport enhancement
難度 2/5 1-3 小時 新手友好度 63/100
spring-cloud/spring-cloud-function#1507 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
open-learning-exchange/myplanet#18484 ·
維護者通常 1 天內回覆
-
ai-driven-fuzzing bug claude Minor
難度 2/5 1-3 小時 新手友好度 66/100
linagora/twake-calendar-side-service#1417 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
line/armeria#7109 · 3 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
open-feature/java-sdk-contrib#1966 ·
維護者通常 1 天內回覆