You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "rajujith (via GitHub)" <gi...@apache.org> on 2025/04/11 05:45:44 UTC
[I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
rajujith opened a new issue, #10697:
URL: https://github.com/apache/cloudstack/issues/10697
### problem
The usage_id in the cloud_usage table for the resource network offering for the default network offerings is always 1 and seems hardcoded.
```
mysql> select distinct usage_id from cloud_usage where usage_type=13;
+----------+
| usage_id |
+----------+
| 1 |
+----------+
```
```
mysql> select * from cloud_usage.cloud_usage where usage_type=13 and usage_id=1 order by id desc limit 2\G
*************************** 1. row ***************************
id: 11500
zone_id: 1
account_id: 2
domain_id: 1
description: Network offering:10 for Vm : 132 usage time
usage_display: 0.038889 Hrs
usage_type: 13
raw_usage: 0.038889169692993164
vm_instance_id: 132
vm_name: NULL
offering_id: 10
template_id: NULL
usage_id: 1
type: NULL
size: NULL
network_id: NULL
start_date: 2025-04-10 05:30:00
end_date: 2025-04-10 06:29:59
virtual_size: NULL
cpu_speed: NULL
cpu_cores: NULL
memory: NULL
quota_calculated: 0
is_hidden: 0
state: NULL
```
### versions
4.19.2
### The steps to reproduce the bug
1. Deploy instances
2. Check usage records
...
### What to do about it?
I am expecting the usage_id should be resource_id i.e, the offering id.
--
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: commits-unsubscribe@cloudstack.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2843989820
@sureshanaparti updating the documentation to match the actual response would definitely be good.
By the way, the Usage documentation seems to not have been update in quite some time. I noticed that it is missing a lot of usage types. Would be good to update it to include these too.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "rajujith (via GitHub)" <gi...@apache.org>.
rajujith commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2827514807
@DaanHoogland based on the discussions on the https://github.com/apache/cloudstack/pull/10721 I understand that fixing the inconsistency could break the existing integrations. If its about external integrations that consumes the usage API, we could still change the database to make consistent and make code changes to retain the current response ? while also considering upgrade scenarios. cc @sudo87 @winterhazel
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "rajujith (via GitHub)" <gi...@apache.org>.
rajujith commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2817714669
thanks @winterhazel
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2823760000
@rajujith , what do you want to do with this issue?
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2829166335
@rajujith yes, we have the NIC's ID in usage records for this type; thus, the `listUsageRecords` can be adapted to obtain `isDefault` from the NIC instead to retain the "same" response.
However, there's also external integrations that query the database directly. Changing what this column represents could break the integrations that expect it to contain a 0/1 indicating whether a NIC is the default one.
Honestly, I do not know any specific external integration that consumes the usage records directly from the database instead of consuming from the API, but I would not consider it as a scenario that does not exist, because this approach has been suggested some times before:
https://www.shapeblue.com/cloudstack-usage-service-deep-dive/
https://www.slideshare.net/slideshow/dag-sonstebo-cloudstack-usage-service/115784267
http://events17.linuxfoundation.org/sites/events/files/slides/CCCNA14%20presentation.pdf
As I said, I can not pinpoint an external solution that would break due to this, so maybe I'm being unnecessarily concerned, but I think it would be good to consider the impact this change could have before introducing it. I personally think that it's just not necessary or beneficial.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2829599675
@winterhazel , I think we shouldn’t humor direct access to the DB too much. If we can think of a workaround for people doing integration that way, fine. But the integrations should always use the API in principle. Worst case we can add a helper field to accomodate such (ab)use.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "sudo87 (via GitHub)" <gi...@apache.org>.
sudo87 commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2804086826
offering_id is present in the table, will adding it in usage_id help?
```
offering_id: 10
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2807176522
This is not a bug.
The naming is a bit confusing, but the `NETWORK_OFFERING` usage type is related to NICs, which is associated with a network offering. For instance, suppose we have a single network with 7 VMs: in this situation, Usage will generate 7 usage records, one for each NIC. The record's `usage_id` represents whether the NIC is a VM's default NIC.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Usage for Default Network offerings are created with usage_id 1 [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on issue #10697:
URL: https://github.com/apache/cloudstack/issues/10697#issuecomment-2841725452
the usage id for the network offering (usage type 13) is to is to indicate default Nic (1) or not (0).
https://github.com/apache/cloudstack/blob/9d9737ae040978d73a322479e16dd866a087dc10/usage/src/main/java/com/cloud/usage/parser/NetworkOfferingUsageParser.java#L158-L162
https://github.com/apache/cloudstack/blob/9d9737ae040978d73a322479e16dd866a087dc10/server/src/main/java/com/cloud/api/ApiResponseHelper.java#L4192-L4197
It is no where referenced as resource_id / offering id. Maybe, this requires some doc update as it returns as Default in the usage response ? what do you think, any thoughts @rajujith @winterhazel cc @DaanHoogland
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org