-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22354/
-----------------------------------------------------------
Review request for cloudstack and Kishan Kavala.
Bugs: CLOUDSTACK-6850
https://issues.apache.org/jira/browse/CLOUDSTACK-6850
Repository: cloudstack-git
Description
-------
This patch updates VMInstanceUsageParser to process usage details (cpu cores,
cpu speed and memory) for dynamic compute offering usages, in order to save
them in table cloud_usage.cloud_usage and return them with the API
(listUsageRecords).
See CLOUDSTACK-6850.
A change in database model is required for this patch (three new columns in
cloud_usage.cloud_usage).
The patch should apply on master and 4.4.
Diffs
-----
api/src/org/apache/cloudstack/api/response/UsageRecordResponse.java 5e2e85d
api/src/org/apache/cloudstack/usage/Usage.java 20dc189
engine/schema/src/com/cloud/usage/UsageVMInstanceVO.java 06d4876
engine/schema/src/com/cloud/usage/UsageVO.java 67014ef
engine/schema/src/com/cloud/usage/dao/UsageVMInstanceDaoImpl.java b94e12f
server/src/com/cloud/api/ApiResponseHelper.java 119f56d
setup/db/db/schema-430to440.sql d149a65
usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java ba0d4bf
Diff: https://reviews.apache.org/r/22354/diff/
Testing
-------
Packaged in RPMs, installed and manually tested.
1. Create a VM with compute offering "Small instance".
2. Stop the VM.
3. Change service offering to a custom offering, with cpu_number=1,
cpu_speed=500 MHz, memory=512 MB
4. Start the VM, wait... Stop the VM.
6. Change service offering to an other custom offering, with cpu_number=2,
cpu_speed=800 MHz, memory=1024 MB
7. Start the VM, wait... Stop the VM.
8. Change service offering to the first custom offering, with same "details"
(cpu_number=2, cpu_speed=800 MHz, memory=1024 MB)
9. Start the VM, wait... Stop the VM.
10. Change service offering to "Medium instance".
Usages and details are reflected in database and in API response. There is no
regression found for other usage types.
Details are returned (and saved in database) only for RUNNING_VM and
ALLOCATED_VM, only if the service offering is a custom one.
Example of response:
<usagerecord>
<account>admin</account>
<accountid>184a6564-edab-11e3-b629-0050569ed71c</accountid>
<domainid>fbc7578a-edaa-11e3-b629-0050569ed71c</domainid>
<zoneid>e5047089-c911-40ea-8251-4a76810ac1e0</zoneid>
<description>california allocated (ServiceOffering: 12) (Template:
5)</description>
<usage>0.098078 Hrs</usage>
<usagetype>2</usagetype>
<rawusage>0.098078</rawusage>
<virtualmachineid>e89c22af-65cf-42a2-8905-6f4bbd7d59a1</virtualmachineid>
<name>california</name>
<offeringid>b05b64e9-8e0f-4335-b0e0-acc5bad81938</offeringid>
<templateid>fbca2564-edaa-11e3-b629-0050569ed71c</templateid>
<usageid>e89c22af-65cf-42a2-8905-6f4bbd7d59a1</usageid>
<type>XenServer</type>
<cpunumber>1</cpunumber>
<cpuspeed>500</cpuspeed>
<memory>512</memory>
<startdate>2014-06-08'T'17:05:52+02:00</startdate>
<enddate>2014-06-08'T'17:15:52+02:00</enddate>
</usagerecord>
<usagerecord>
<account>admin</account>
<accountid>184a6564-edab-11e3-b629-0050569ed71c</accountid>
<domainid>fbc7578a-edaa-11e3-b629-0050569ed71c</domainid>
<zoneid>e5047089-c911-40ea-8251-4a76810ac1e0</zoneid>
<description>california allocated (ServiceOffering: 1) (Template:
5)</description>
<usage>0.068594 Hrs</usage>
<usagetype>2</usagetype>
<rawusage>0.068594</rawusage>
<virtualmachineid>e89c22af-65cf-42a2-8905-6f4bbd7d59a1</virtualmachineid>
<name>california</name>
<offeringid>84bbf38f-b582-440b-8a8d-20e63e0dbed7</offeringid>
<templateid>fbca2564-edaa-11e3-b629-0050569ed71c</templateid>
<usageid>e89c22af-65cf-42a2-8905-6f4bbd7d59a1</usageid>
<type>XenServer</type>
<startdate>2014-06-08'T'17:05:52+02:00</startdate>
<enddate>2014-06-08'T'17:15:52+02:00</enddate>
</usagerecord>
Thanks,
Olivier Lemasle