[
https://issues.apache.org/jira/browse/CLOUDSTACK-2128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mice Xia resolved CLOUDSTACK-2128.
----------------------------------
Resolution: Fixed
[change]
1) add UsageEvent generation for addNictoVM and removeNicFromVM, insert nic id
into usage_event.resource_name (otherwise, usage server cannot correctly
aggregate usage time)
before change (two rows have same data, which will cause usage server lost data
stat)
mysql> select id,type,resource_id,resource_name,offering_id, size,
resource_type from usage_event;
+----+-------------------------+-------------+--------------------------------------+-------------+------+---------------+
| id | type | resource_id | resource_name
| offering_id | size | resource_type |
+----+-------------------------+-------------+--------------------------------------+-------------+------+---------------+
| 84 | VM.STOP | 17 |
d162f3d3-9146-4e61-a103-1c0796cf0eaa | NULL | NULL | NULL |
| 85 | NETWORK.OFFERING.REMOVE | 17 |
d162f3d3-9146-4e61-a103-1c0796cf0eaa | 8 | 0 | NULL |
| 86 | NETWORK.OFFERING.REMOVE | 17 |
d162f3d3-9146-4e61-a103-1c0796cf0eaa | 8 | 0 | NULL |
| 87 | NETWORK.OFFERING.REMOVE | 17 |
d162f3d3-9146-4e61-a103-1c0796cf0eaa | 7 | 0 | NULL |
+----+-------------------------+-------------+--------------------------------------+-------------+------+---------------+
after change:
mysql> select id,type,resource_id,resource_name,offering_id, size,
resource_type from usage_event where id>118;
+-----+-------------------------+-------------+--------------------------------------+-------------+------+----------------+
| id | type | resource_id | resource_name
| offering_id | size | resource_type |
+-----+-------------------------+-------------+--------------------------------------+-------------+------+----------------+
| 119 | NETWORK.OFFERING.ASSIGN | 17 | 51
| 8 | 1 | NULL |
| 120 | NETWORK.OFFERING.ASSIGN | 17 | 52
| 8 | 0 | NULL |
| 121 | VM.START | 17 |
d162f3d3-9146-4e61-a103-1c0796cf0eaa | 1 | NULL | VMware |
| 122 | NET.IPASSIGN | 205 | 192.168.1.97
| NULL | 0 | DirectAttached |
| 123 | NETWORK.OFFERING.ASSIGN | 17 | 61
| 206 | 0 | NULL |
+-----+-------------------------+-------------+--------------------------------------+-------------+------+----------------+
5 rows in set (0.00 sec)
2) change usage server, add a column 'nic_id' to table
cloud_usage.usage_network_offering and modify aggregation logic
[test]
test with mgmt server:
start VM with mutiple nic, usageEvents NETWORK.OFFERING.ASSIGN were generated
in cloud.usage_event
stop VM with mutiple nic, usageEvents NETWORK.OFFERING.REMOVE were generated.
add nic to a running VM, usageEvents NETWORK.OFFERING.ASSIGN were generated
remove nic from a running VM, usageEvents NETWORK.OFFERING.REMOVE were
generated.
[have not test]
usage server aggregation
> usage event network.offerings.assign should be generated when
> addNicToVirtualMachine api is called
> --------------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-2128
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2128
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Network Controller, Usage
> Affects Versions: 4.2.0
> Environment: build: CloudStack-non-OSS-MASTER-232-rhel6.3.tar.gz
> Reporter: shweta agarwal
> Assignee: Mice Xia
> Priority: Critical
> Fix For: 4.2.0
>
>
> When we call addNicToVirtualMachine api it adds a new network /nic to a VM .
> Presently we just register this in events . however we need to add this event
> in usage event for correct tracking of network we need to create a
> corresponding network.offerings.assign event in usage events table as well
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira