Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize dates in Usage and Quota APIs #8243

Merged
merged 11 commits into from
May 27, 2024

Conversation

winterhazel
Copy link
Collaborator

Description

Dates are always stored in GMT in the database. However, when using the Usage and Quota APIs, dates are manipulated according to the configuration usage.aggregation.timezone. Therefore, when informing a date, the user must consider the timezone defined in the configuration and the timezone of the server in order to specify a value. Furthermore, if the configuration and the server are not in the same timezone, ACS will not retrieve the data the user requested.

This PR changes the behavior of Usage and Quota APIs to consider dates as they were informed. Some examples showing how the current date manipulation may yield unexpected results and how this change fixes them can be found in the tests section.

The APIs affected by this change are:

  • listUsageRecords: the return of this API was also changed to always return the data in GMT, instead of depending on the timezone of the configuration. This way, it complies with the other APIs and allows users to handle the timezone in the frontend;
  • quotaCredits: when adding credits to an account, the deposit date is now stored in GMT;
  • quotaBalance: in addition, it is now possible to inform an enddate in the future;
  • quotaStatement: it is also now possible to inform an enddate in the future;
  • quotaTariffCreate;
  • quotaTariffDelete:
  • quotaTariffList;
  • quotaTariffUpdate.

With the extension that allows users to inform timezones on APIs that have the date parameter (#7032), it is recommended to inform dates in the format yyyy-MM-dd'T'HH:mm:ssz. When a date is informed in yyyy-MM-dd HH:mm:ss or yyyy-MM-dd, it will be considered that the date was informed in the timezone of the server.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

In a local lab, I defined usage.aggregation.timezone as GMT-3. Then, through CloudMonkey, I verified the behavior of the affected APIs:

listUsageRecords

(admin) 🐱 > list usagerecords startdate='2023-07-20T20:41:22+0200' enddate='2023-07-20T18:41:22-0150'

In this command, startdate is 2023-07-20 18:41:22 in GMT, and the enddate is 2023-07-20 20:31:22.

Current behavior:

2023-09-26 16:30:00,823 DEBUG [c.c.u.UsageServiceImpl] (qtp1955920234-21:ctx-8cc949c0 ctx-b22a8082) (logid:486992ba) getting usage records for account: 2, domainId: null, between Thu Jul 20 21:41:22 UTC 2023 and Thu Jul 20 23:31:22 UTC 2023, using pageSize: 500 and startIndex: 0

The dates get manipulated to 2023-07-20 21:41:22 GMT and 2023-07-20 23:31:22 GMT.

After applying the changes:

2023-09-26 16:26:20,172 DEBUG [c.c.u.UsageServiceImpl] (qtp1955920234-21:ctx-52f71b4c ctx-04cac325) (logid:a95c7352) Getting usage records for account [2] in domain [null], between [Thu Jul 20 18:41:22 UTC 2023] and [Thu Jul 20 20:31:22 UTC 2023], using pageSize [500] and startIndex [0].

The command uses the provided dates converted to GMT.

The full response of this command after applying the patch will be posted as a comment, because including it here made the description exceed the maximum amount of characters.

quotaStatement

(admin) 🐱 > quota statement account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac enddate='2023-07-24' startdate='2023-07-24T20:00:00-0300'

The startdate parameter is 2023-07-24 23:00:00 in GMT.

Current behavior:

2023-09-25 20:20:32,008 DEBUG [o.a.c.q.QuotaServiceImpl] (qtp1955920234-21:ctx-a9ea777b ctx-fb4ee927) (logid:359e3d33) Getting quota records for account: 2, domainId: 1, between Tue Jul 25 02:00:00 UTC 2023 and Tue Jul 25 03:00:00 UTC 2023

startdate gets manipulated to 2023-07-25 02:00:00 GMT.

After applying the changes:

2023-09-25 20:17:36,499 DEBUG [o.a.c.q.QuotaServiceImpl] (qtp1955920234-19:ctx-98fcebb7 ctx-d2a8f37f) (logid:6ec97910) Getting quota records of type [null] for account [2] in domain [1], between [Mon Jul 24 23:00:00 UTC 2023] and [Tue Jul 25 00:00:00 UTC 2023].

The command uses the provided startdate in GMT.

Below there is the full response:

(admin) 🐱 > quota statement account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac enddate=2023-08-23 startdate=2023-08-21
{
  "statement": {
    "currency": "$",
    "enddate": "2023-08-23T23:59:59+0000",
    "quotausage": [
      {
        "accountid": 2,
        "domain": 1,
        "name": "RUNNING_VM",
        "quota": 0,
        "type": 1,
        "unit": "Compute*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "ALLOCATED_VM",
        "quota": 0,
        "type": 2,
        "unit": "Compute*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "IP_ADDRESS",
        "quota": 0,
        "type": 3,
        "unit": "IP*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_BYTES_SENT",
        "quota": 0,
        "type": 4,
        "unit": "GB"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_BYTES_RECEIVED",
        "quota": 0,
        "type": 5,
        "unit": "GB"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VOLUME",
        "quota": 0,
        "type": 6,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "TEMPLATE",
        "quota": 0,
        "type": 7,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "ISO",
        "quota": 0,
        "type": 8,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "SNAPSHOT",
        "quota": 0,
        "type": 9,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "SECURITY_GROUP",
        "quota": 0,
        "type": 10,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "LOAD_BALANCER_POLICY",
        "quota": 0,
        "type": 11,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "PORT_FORWARDING_RULE",
        "quota": 0,
        "type": 12,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_OFFERING",
        "quota": 0,
        "type": 13,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VPN_USERS",
        "quota": 0,
        "type": 14,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_IO_READ",
        "quota": 0,
        "type": 21,
        "unit": "IOPS"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_IO_WRITE",
        "quota": 0,
        "type": 22,
        "unit": "IOPS"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_BYTES_READ",
        "quota": 0,
        "type": 23,
        "unit": "Bytes"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_BYTES_WRITE",
        "quota": 0,
        "type": 24,
        "unit": "Bytes"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_SNAPSHOT",
        "quota": 0,
        "type": 25,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VOLUME_SECONDARY",
        "quota": 0,
        "type": 26,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_SNAPSHOT_ON_PRIMARY",
        "quota": 0,
        "type": 27,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "BACKUP",
        "quota": 0,
        "type": 28,
        "unit": "GB*Month"
      }
    ],
    "startdate": "2023-08-21T00:00:00+0000",
    "totalquota": 0
  }
}

quotaCredits and quotaBalance

Current behavior:

(admin) 🐱 > quota credits account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac value=5
{
  "quotacredits": {
    "credits": 5,
    "currency": "$",
    "updated_by": "admin",
    "updated_on": "2023-09-25T19:33:33+0000"
  }
}


(admin) 🐱 > quota balance account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac startdate=2023-09-23 enddate=2023-09-25
{
  "balance": {
    "credits": [
      {
        "credits": 5,
        "updated_on": "2023-09-25T22:33:32+0000"
      }
    ],
    "currency": "$",
    "enddate": "2023-09-25T23:59:59+0000",
    "endquota": 5,
    "startdate": "2023-09-23T00:00:00+0000",
    "startquota": 0
  }
}

The time in GMT was 2023-09-25 19:33:33, but updated_on was stored as 2023-09-25 22:33:32 in the database.

After applying the changes:

(admin) 🐱 > quota credits account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac value=5
{
  "quotacredits": {
    "credits": 5,
    "currency": "$",
    "updated_by": "admin",
    "updated_on": "2023-09-26T16:15:35+0000"
  }
}


(admin) 🐱 > quota balance account=admin domainid=52d83793-26de-11ec-8dcf-5254005dcdac startdate=2023-09-25 enddate=2023-09-26
{
  "balance": {
    "credits": [
      {
        "credits": 5,
        "updated_on": "2023-09-26T16:15:35+0000"
      }
    ],
    "currency": "$",
    "enddate": "2023-09-26T23:59:59+0000",
    "endquota": 5,
    "startdate": "2023-09-25T00:00:00+0000",
    "startquota": 0
  }
}

The time in GMT was 2023-09-26 16:15:35, and the correct value of 2023-09-26 16:15:35 was stored in the database.

quotaTariffCreate

After applying the changes:

(admin) 🐱 > quota tariffcreate name="teste" value=2 usagetype=1 startdate="2023-09-27T23:00:00-0300"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2023-09-28T02:00:00+0000",
    "id": "327f84d1-1506-4366-8755-c4042057a93f",
    "name": "teste",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

(admin) 🐱 > quota tariffcreate name="teste2" value=2 usagetype=1 startdate="2023-09-30T23:00:00+0000" enddate="2023-10-02T14:00:00+0000"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2023-09-30T23:00:00+0000",
    "endDate": "2023-10-02T14:00:00+0000",
    "id": "962feae6-7947-45bb-8d55-ca9e90dcf6e2",
    "name": "teste2",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

quotaTariffUpdate

After applying the changes:

(admin) 🐱 > quota tariffupdate name=teste enddate=2023-09-29
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2023-09-28T02:00:00+0000",
    "endDate": "2023-09-29T23:59:59+0000",
    "id": "c2788963-26ae-4a2a-b955-8123c353b517",
    "name": "teste",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

quotaTariffList

After applying the changes:

(admin) 🐱 > quota tarifflist startdate='2023-09-24T01:00:00+0000' enddate=2023-10-03
{
  "count": 2,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2023-09-30T23:00:00+0000",
      "endDate": "2023-10-02T14:00:00+0000",
      "id": "962feae6-7947-45bb-8d55-ca9e90dcf6e2",
      "name": "teste2",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    },
    {
      "currency": "$",
      "effectiveDate": "2023-09-28T02:00:00+0000",
      "endDate": "2023-09-29T23:59:59+0000",
      "id": "c2788963-26ae-4a2a-b955-8123c353b517",
      "name": "teste",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

(admin) 🐱 > quota tarifflist startdate='2023-09-29T01:00:00-0300' enddate=2023-10-03
{
  "count": 1,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2023-09-30T23:00:00+0000",
      "endDate": "2023-10-02T14:00:00+0000",
      "id": "962feae6-7947-45bb-8d55-ca9e90dcf6e2",
      "name": "teste2",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

quotaTariffDelete

After applying the changes:

(admin) 🐱 > quota tariffdelete id=962feae6-7947-45bb-8d55-ca9e90dcf6e2
{
  "success": true
}

@winterhazel
Copy link
Collaborator Author

Here is the full response of the listUsageRecords API after applying the changes. I was not able to include it in the description because it exceeded the maximum amount of characters.

Response
(admin) 🐱 > list usagerecords startdate='2023-07-20T20:41:22+0200' enddate='2023-07-20T18:41:22-0150'
{
  "count": 68,
  "usagerecord": [
    {
      "account": "system",
      "accountid": "af159ea4-26de-11ec-8dcf-5254005dcdac",
      "description": "Template usage for CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac) with size (1.65 GB) 1769537536 and virtual size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 1769537536,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "usagetype": 7,
      "virtualsize": 8589934592,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for testeApi2 (i-2-179-VM) (4ca5b22e-6e8a-4bf1-9819-b980f826f05a) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi2",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "4ca5b22e-6e8a-4bf1-9819-b980f826f05a",
      "usagetype": 1,
      "virtualmachineid": "4ca5b22e-6e8a-4bf1-9819-b980f826f05a",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for testeApi (i-2-177-VM) (2e154790-48ea-4923-ba77-7288f01f9c02) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "2e154790-48ea-4923-ba77-7288f01f9c02",
      "usagetype": 1,
      "virtualmachineid": "2e154790-48ea-4923-ba77-7288f01f9c02",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for x (i-2-178-VM) (7093969e-fe33-4bd9-977d-41c6b424a927) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "x",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "7093969e-fe33-4bd9-977d-41c6b424a927",
      "usagetype": 1,
      "virtualmachineid": "7093969e-fe33-4bd9-977d-41c6b424a927",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for sem2 (i-2-175-VM) (639fa094-13c5-4e4f-99d3-5c2727710f96) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "sem2",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "639fa094-13c5-4e4f-99d3-5c2727710f96",
      "usagetype": 1,
      "virtualmachineid": "639fa094-13c5-4e4f-99d3-5c2727710f96",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for VM-445c705c-5c89-491c-a791-431417c8a9a4 (i-2-174-VM) (445c705c-5c89-491c-a791-431417c8a9a4) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-445c705c-5c89-491c-a791-431417c8a9a4",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "445c705c-5c89-491c-a791-431417c8a9a4",
      "usagetype": 1,
      "virtualmachineid": "445c705c-5c89-491c-a791-431417c8a9a4",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for VM-73680a37-cdb1-4860-91b3-268ba7d31b76 (i-2-182-VM) (73680a37-cdb1-4860-91b3-268ba7d31b76) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-73680a37-cdb1-4860-91b3-268ba7d31b76",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52e48fdf-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "CentOS",
      "osdisplayname": "CentOS 5.5 (64-bit)",
      "ostypeid": "5323a328-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "73680a37-cdb1-4860-91b3-268ba7d31b76",
      "usagetype": 1,
      "virtualmachineid": "73680a37-cdb1-4860-91b3-268ba7d31b76",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for VM-3d0a5c66-676a-4458-8c4d-ca74ad2d1a63 (i-2-183-VM) (3d0a5c66-676a-4458-8c4d-ca74ad2d1a63) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52e48fdf-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "CentOS",
      "osdisplayname": "CentOS 5.5 (64-bit)",
      "ostypeid": "5323a328-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "usagetype": 1,
      "virtualmachineid": "3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Running VM usage for testeApi3 (i-2-180-VM) (e595a667-9b3d-4e24-9383-3e69fc3f3c56) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi3",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "e595a667-9b3d-4e24-9383-3e69fc3f3c56",
      "usagetype": 1,
      "virtualmachineid": "e595a667-9b3d-4e24-9383-3e69fc3f3c56",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for x (i-2-178-VM) (7093969e-fe33-4bd9-977d-41c6b424a927) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "x",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "7093969e-fe33-4bd9-977d-41c6b424a927",
      "usagetype": 2,
      "virtualmachineid": "7093969e-fe33-4bd9-977d-41c6b424a927",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for testeApi2 (i-2-179-VM) (4ca5b22e-6e8a-4bf1-9819-b980f826f05a) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi2",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "4ca5b22e-6e8a-4bf1-9819-b980f826f05a",
      "usagetype": 2,
      "virtualmachineid": "4ca5b22e-6e8a-4bf1-9819-b980f826f05a",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for testeApi (i-2-177-VM) (2e154790-48ea-4923-ba77-7288f01f9c02) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "2e154790-48ea-4923-ba77-7288f01f9c02",
      "usagetype": 2,
      "virtualmachineid": "2e154790-48ea-4923-ba77-7288f01f9c02",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for VM-445c705c-5c89-491c-a791-431417c8a9a4 (i-2-174-VM) (445c705c-5c89-491c-a791-431417c8a9a4) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-445c705c-5c89-491c-a791-431417c8a9a4",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "445c705c-5c89-491c-a791-431417c8a9a4",
      "usagetype": 2,
      "virtualmachineid": "445c705c-5c89-491c-a791-431417c8a9a4",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for sem2 (i-2-175-VM) (639fa094-13c5-4e4f-99d3-5c2727710f96) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "sem2",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "639fa094-13c5-4e4f-99d3-5c2727710f96",
      "usagetype": 2,
      "virtualmachineid": "639fa094-13c5-4e4f-99d3-5c2727710f96",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for VM-3d0a5c66-676a-4458-8c4d-ca74ad2d1a63 (i-2-183-VM) (3d0a5c66-676a-4458-8c4d-ca74ad2d1a63) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52e48fdf-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "CentOS",
      "osdisplayname": "CentOS 5.5 (64-bit)",
      "ostypeid": "5323a328-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "usagetype": 2,
      "virtualmachineid": "3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for VM-73680a37-cdb1-4860-91b3-268ba7d31b76 (i-2-182-VM) (73680a37-cdb1-4860-91b3-268ba7d31b76) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "VM-73680a37-cdb1-4860-91b3-268ba7d31b76",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52e48fdf-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "CentOS",
      "osdisplayname": "CentOS 5.5 (64-bit)",
      "ostypeid": "5323a328-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "73680a37-cdb1-4860-91b3-268ba7d31b76",
      "usagetype": 2,
      "virtualmachineid": "73680a37-cdb1-4860-91b3-268ba7d31b76",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "cpunumber": 1,
      "cpuspeed": 500,
      "description": "Allocated VM usage for testeApi3 (i-2-180-VM) (e595a667-9b3d-4e24-9383-3e69fc3f3c56) using service offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702)",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "memory": 512,
      "name": "testeApi3",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "oscategoryid": "52ea89e0-26de-11ec-8dcf-5254005dcdac",
      "oscategoryname": "Ubuntu",
      "osdisplayname": "Ubuntu 18.04 LTS",
      "ostypeid": "681deab8-26de-11ec-8dcf-5254005dcdac",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "type": "KVM",
      "usage": "1 Hrs",
      "usageid": "e595a667-9b3d-4e24-9383-3e69fc3f3c56",
      "usagetype": 2,
      "virtualmachineid": "e595a667-9b3d-4e24-9383-3e69fc3f3c56",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-177 (b772a760-20ff-4a5b-9f36-ac574a0e5598) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "b772a760-20ff-4a5b-9f36-ac574a0e5598",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for x (c4f6758a-9ea9-4ff7-adb5-dbe01cd497bd) with disk offering Medium (bb9abd10-e445-4edd-a109-46eacde15793) and size (20.00 GB) 21474836480",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "bb9abd10-e445-4edd-a109-46eacde15793",
      "rawusage": "1",
      "size": 21474836480,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "c4f6758a-9ea9-4ff7-adb5-dbe01cd497bd",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-182 (801de6c3-dc9b-4061-8eb7-bf39a30a8eda) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "usage": "1 Hrs",
      "usageid": "801de6c3-dc9b-4061-8eb7-bf39a30a8eda",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-1361 (a4f978bb-24a1-459d-b549-45a7089d2f2b) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "usage": "1 Hrs",
      "usageid": "a4f978bb-24a1-459d-b549-45a7089d2f2b",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-183 (4cb81d5c-4366-4b58-8c95-3e6d8ac31095) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "usage": "1 Hrs",
      "usageid": "4cb81d5c-4366-4b58-8c95-3e6d8ac31095",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-175 (eb2f1450-0dee-4a1b-baf0-90f353c2d7af) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "eb2f1450-0dee-4a1b-baf0-90f353c2d7af",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-179 (cc8672a7-92d4-4ef7-bb9c-86742ee60e9b) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "cc8672a7-92d4-4ef7-bb9c-86742ee60e9b",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-99 (null) and template Vol B (7aa19f28-86d6-44bc-905a-6a6768e44306) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "7aa19f28-86d6-44bc-905a-6a6768e44306",
      "usage": "1 Hrs",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-96 (null) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-178 (f0d3ee40-32ba-4f18-8ac6-842a1c9a97b8) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "f0d3ee40-32ba-4f18-8ac6-842a1c9a97b8",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-174 (8d002b26-e7df-4f6f-b0d6-7a6b2bb1bd2c) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "8d002b26-e7df-4f6f-b0d6-7a6b2bb1bd2c",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for 8656f21b-e10d-4637-a82d-69d854760df2 (976ea7db-0207-41f2-bd83-5169ca92fb7b) with disk offering Small (19038d59-7fd9-402d-bbbb-ff3782251a19) and size (5.00 GB) 5368709120",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "19038d59-7fd9-402d-bbbb-ff3782251a19",
      "rawusage": "1",
      "size": 5368709120,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "976ea7db-0207-41f2-bd83-5169ca92fb7b",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Volume usage for ROOT-180 (44ac734b-5d22-4079-89c8-9810c76159f7) and template Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) and size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usage": "1 Hrs",
      "usageid": "44ac734b-5d22-4079-89c8-9810c76159f7",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Template usage for Ubuntu Bionic (bb4b7b6f-5249-4c18-a5f6-dd886683b702) with size (2.60 GB) 2787770368 and virtual size (8.00 GB) 8589934592",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 2787770368,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "bb4b7b6f-5249-4c18-a5f6-dd886683b702",
      "usagetype": 7,
      "virtualsize": 8589934592,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Template usage for systemvm-kvm-4.18.0 (26c260f1-d7e9-4330-9887-464cd6f97ffc) with size (439.19 MB) 460521472 and virtual size (4.88 GB) 5242880000",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 460521472,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "26c260f1-d7e9-4330-9887-464cd6f97ffc",
      "usagetype": 7,
      "virtualsize": 5242880000,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Template usage for systemvm-kvm-4.16.0 (1e25218a-3b25-493b-bbbf-389331ababb8) with size (513.04 MB) 537964544 and virtual size (3.91 GB) 4194304000",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "size": 537964544,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "1e25218a-3b25-493b-bbbf-389331ababb8",
      "usagetype": 7,
      "virtualsize": 4194304000,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM VM-3d0a5c66-676a-4458-8c4d-ca74ad2d1a63 (3d0a5c66-676a-4458-8c4d-ca74ad2d1a63) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "3d0a5c66-676a-4458-8c4d-ca74ad2d1a63",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM VM-445c705c-5c89-491c-a791-431417c8a9a4 (445c705c-5c89-491c-a791-431417c8a9a4) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "445c705c-5c89-491c-a791-431417c8a9a4",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM sem2 (639fa094-13c5-4e4f-99d3-5c2727710f96) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "639fa094-13c5-4e4f-99d3-5c2727710f96",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM VM-73680a37-cdb1-4860-91b3-268ba7d31b76 (73680a37-cdb1-4860-91b3-268ba7d31b76) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "73680a37-cdb1-4860-91b3-268ba7d31b76",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM testeApi3 (e595a667-9b3d-4e24-9383-3e69fc3f3c56) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "e595a667-9b3d-4e24-9383-3e69fc3f3c56",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM testeApi (2e154790-48ea-4923-ba77-7288f01f9c02) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "2e154790-48ea-4923-ba77-7288f01f9c02",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM x (7093969e-fe33-4bd9-977d-41c6b424a927) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "7093969e-fe33-4bd9-977d-41c6b424a927",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM testeApi2 (4ca5b22e-6e8a-4bf1-9819-b980f826f05a) ",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": true,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "4ca5b22e-6e8a-4bf1-9819-b980f826f05a",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "IPAddress: 172.16.200.98",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": true,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "a412731c-0841-41a7-ac57-932ea9fe75a0",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "IPAddress: 172.16.200.96",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": true,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "90f59d4f-c879-424d-a1d9-867364b86009",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "IPAddress: 172.16.200.97",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": true,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "cb973a92-91b3-4d47-9296-72850322e25b",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 207, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 207, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 207, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 207, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 209, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "admin",
      "accountid": "af16aaed-26de-11ec-8dcf-5254005dcdac",
      "description": "Network usage for network ID: 209, network offering: 8",
      "domain": "ROOT",
      "domainid": "52d83793-26de-11ec-8dcf-5254005dcdac",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Volume usage for aa (81d17d90-0b0f-42a9-b73e-5575366902cb) with disk offering Small (19038d59-7fd9-402d-bbbb-ff3782251a19) and size (5.00 GB) 5368709120",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "19038d59-7fd9-402d-bbbb-ff3782251a19",
      "rawusage": "1",
      "size": 5368709120,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "81d17d90-0b0f-42a9-b73e-5575366902cb",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Volume usage for ROOT-139 (244dd606-fbd9-40af-b081-fe959687201f) with disk offering Small Instance (ab647165-7a0a-4984-8452-7bfceb036528) and template CentOS 5.5(64-bit) no GUI (KVM) (52e1d1a5-26de-11ec-8dcf-5254005dcdac) and size (8.00 GB) 8589934592",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "ab647165-7a0a-4984-8452-7bfceb036528",
      "rawusage": "1",
      "size": 8589934592,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "templateid": "52e1d1a5-26de-11ec-8dcf-5254005dcdac",
      "usage": "1 Hrs",
      "usageid": "244dd606-fbd9-40af-b081-fe959687201f",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Volume usage for DATA-139 (e040fff3-783a-47bf-9fb6-963f894c4e07) with disk offering Small (19038d59-7fd9-402d-bbbb-ff3782251a19) and size (5.00 GB) 5368709120",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "19038d59-7fd9-402d-bbbb-ff3782251a19",
      "rawusage": "1",
      "size": 5368709120,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "e040fff3-783a-47bf-9fb6-963f894c4e07",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Network offering DefaultIsolatedNetworkOfferingWithSourceNatService (06e40866-5ffb-4e1e-a985-ad5fcff3ddc1) usage for VM x (ff718261-086b-4245-bd16-444ef08dd84a) ",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "isdefault": false,
      "offeringid": "06e40866-5ffb-4e1e-a985-ad5fcff3ddc1",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 13,
      "virtualmachineid": "ff718261-086b-4245-bd16-444ef08dd84a",
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.76",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": false,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "d5ed1304-4e2b-47fe-a17a-4d5b66283ba6",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.95",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": true,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "9cbe58be-3a87-4ee9-ad52-066cc9909f4f",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.79",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": false,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "ed10e53a-5179-4d81-9607-ffc6aaf41473",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.69",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": false,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "b1f2bf55-d564-448b-94e0-d5f39ab7db81",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.62",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": true,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "96892fdd-a548-4231-ae1e-8b5c9cd898d7",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "IPAddress: 172.16.200.63",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "issourcenat": false,
      "issystem": false,
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "ce872471-7654-4c93-b5cb-d6247dff7f1b",
      "usagetype": 3,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Network usage for network ID: 208, network offering: 8",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Network usage for network ID: 208, network offering: 8",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Network usage for network ID: 208, network offering: 8",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "Network usage for network ID: 208, network offering: 8",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste",
      "accountid": "8f839837-f5b8-48c2-8d6b-fbd0e5b98683",
      "description": "VPC usage for VPC ID: 4",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 29,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste2",
      "accountid": "e21597af-e98c-4f1d-b6cd-9e79e6b3a6d5",
      "description": "Network usage for network ID: 210, network offering: 8",
      "domain": "teste2",
      "domainid": "2c8f263c-3b07-4f70-a473-a2cd4154e302",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "teste2",
      "accountid": "e21597af-e98c-4f1d-b6cd-9e79e6b3a6d5",
      "description": "Network usage for network ID: 210, network offering: 8",
      "domain": "teste2",
      "domainid": "2c8f263c-3b07-4f70-a473-a2cd4154e302",
      "enddate": "2023-07-20T19:59:59+0000",
      "rawusage": "1",
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usagetype": 30,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    },
    {
      "account": "z",
      "accountid": "a7e67e12-f460-44d7-a3b0-5db5981154ef",
      "description": "Volume usage for 1cb53077-b0a5-4097-8584-5debb939f2fb (d537e128-a359-4097-9fdb-cb74f01225fd) with disk offering Small (19038d59-7fd9-402d-bbbb-ff3782251a19) and size (5.00 GB) 5368709120",
      "domain": "teste",
      "domainid": "27d26602-c941-4c5d-8a2c-cdfcb7ff3dce",
      "enddate": "2023-07-20T19:59:59+0000",
      "offeringid": "19038d59-7fd9-402d-bbbb-ff3782251a19",
      "rawusage": "1",
      "size": 5368709120,
      "startdate": "2023-07-20T19:00:00+0000",
      "tags": [],
      "usage": "1 Hrs",
      "usageid": "d537e128-a359-4097-9fdb-cb74f01225fd",
      "usagetype": 6,
      "zoneid": "8b2ceb16-a2f2-40ea-8968-9e08984bdb17"
    }
  ]
}

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: Patch coverage is 45.71429% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 31.12%. Comparing base (bb24484) to head (6f5fbfc).

Files Patch % Lines
...udstack/api/response/QuotaResponseBuilderImpl.java 40.00% 6 Missing ⚠️
.../org/apache/cloudstack/quota/QuotaServiceImpl.java 50.00% 4 Missing and 1 partial ⚠️
...rc/main/java/com/cloud/usage/UsageServiceImpl.java 0.00% 5 Missing ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 2 Missing ⚠️
...e/cloudstack/api/response/QuotaTariffResponse.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8243   +/-   ##
=========================================
  Coverage     31.11%   31.12%           
- Complexity    33926    33933    +7     
=========================================
  Files          5398     5398           
  Lines        379564   379509   -55     
  Branches      55380    55373    -7     
=========================================
+ Hits         118109   118110    +1     
+ Misses       245765   245745   -20     
+ Partials      15690    15654   -36     
Flag Coverage Δ
simulator-marvin-tests 24.73% <0.00%> (+0.01%) ⬆️
uitests 4.34% <ø> (ø)
unit-tests 16.89% <45.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure we should abandon private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ), this will have to be tested in strange scenarios. I've seen Cloudstack installations have trouble with a MS in Singapore and a DC in Australia. These kinds of situations can actually occur within a country easily.

@GutoVeronezi GutoVeronezi self-requested a review November 17, 2023 11:34
@GutoVeronezi
Copy link
Contributor

I'm not so sure we should abandon private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ), this will have to be tested in strange scenarios. I've seen Cloudstack installations have trouble with a MS in Singapore and a DC in Australia. These kinds of situations can actually occur within a country easily.

@DaanHoogland the use of the computeAdjustedTime causes a lot of problems, because the user passes a date parameter to the API, MS converts it to a time zone that the final user does not have knowledge, and returns a data set that does not match what was requested. As we have the possibility to inform the time zone in the parameter (by using the format yyyy-MM-dd'T'HH:mm:ssz), users can request to the API passing the time zone they want and will receive a data set that matches what was requested. Also, by normalizing everything to UTC (like we do in all the other APIs), the front end can easily handle the date to present it in a proper time zone for the final user.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs extensive testing

@DaanHoogland
Copy link
Contributor

@DaanHoogland the use of the computeAdjustedTime causes a lot of problems, because the user passes a date parameter to the API, MS converts it to a time zone that the final user does not have knowledge, and returns a data set that does not match what was requested. As we have the possibility to inform the time zone in the parameter (by using the format yyyy-MM-dd'T'HH:mm:ssz), users can request to the API passing the time zone they want and will receive a data set that matches what was requested. Also, by normalizing everything to UTC (like we do in all the other APIs), the front end can easily handle the date to present it in a proper time zone for the final user.

@winterhazel @GutoVeronezi , I would like to see extensive testing on this, but your explanation makes sense.
Thank you

@winterhazel
Copy link
Collaborator Author

winterhazel commented Jan 23, 2024

Hey @DaanHoogland, I tried to replicate the scenario you described here, with a MS in Singapore (MS and usage.execution.timezone set to GMT+8) and a DC in Australia (usage.aggregation.timezone set to GMT+11), and did some tests for this PR. Everything seems to be working as intended; in fact, considering dates as they were informed even fixes some issues in this scenario. Below are my results.

Some problems I have identified which this PR fixes:

Unable to add credits with quotaCredits

Before the changes:

The time in Singapore was 2024-01-23T00:22:55+0800. I tried to execute quotaCredits to add credits to an account:

(admin) 🐱 > quota credits account=admin domainid=72b54c4a-771d-11ee-8e59-5254003754dc value=5
🙈 Error: (HTTP 431, error code 4350) Incorrect deposit date: Mon Jan 22 21:22:55 SGT 2024 there are balance entries after this date

But the MS would not let me add credits to any account, since it incorrectly calculated the current date (deposit date) as being 3 hours before the actual date, and therefore detected balance entries after it.

After:

The time in Singapore was 2024-01-19T21:26:06+0800. I executed the same command:

(admin) 🐱 > quota credits account=admin domainid=72b54c4a-771d-11ee-8e59-5254003754dc value=5
{
  "quotacredits": {
    "credits": 5,
    "currency": "$",
    "updated_by": "admin",
    "updated_on": "2024-01-19T21:26:06+0800"
  }
}

And was able to successfully add credits to the account.

updated_on also had the expected value. Just to ensure that the date was indeed correct, I verified it through quotaBalance.

(admin) 🐱 > quota balance account=admin domainid=72b54c4a-771d-11ee-8e59-5254003754dc startdate=2024-01-18 enddate=2024-01-19
{
  "balance": {
    "credits": [
      {
        "credits": 5,
        "updated_on": "2024-01-19T21:26:06+0800"
      }
    ],
    "currency": "$",
    "enddate": "2024-01-19T23:59:59+0800",
    "endquota": 5,
    "startdate": "2024-01-18T00:00:00+0800",
    "startquota": 0
  }
}
listUsageRecords does not retrieve the requested data

Before the changes:

The current time in Australia was 2023-01-23T03:11:26+1100. I executed the command:

(admin) 🐱 > list usagerecords startdate='2024-01-22T19:00:00+1100' enddate='2024-01-23T04:00:00+1100'
2024-01-23 00:11:26,343 DEBUG [c.c.u.UsageServiceImpl] (qtp391630194-23:ctx-acf58df9 ctx-d3f654e9) (logid:ba781cb9) getting usage records for account: 2, domainId: null, between Mon Jan 22 13:00:00 SGT 2024 and Mon Jan 22 22:00:00 SGT 2024, using pageSize: 500 and startIndex: 0

MS queries for usage records between 2024-01-22T16:00:00+1100 and 2024-01-23T01:00:00+1100, which is not the provided range. I also verified that the last returned usage record had the startdate of 2024-01-23T00:00:00+1100.

After the changes:

The current time in Australia was 2023-01-23T05:10:21+1100. I executed the following command:

(admin) 🐱 > list usagerecords startdate='2024-01-22T19:00:00+1100' enddate='2024-01-23T07:59:00+1100'
2024-01-23 02:10:21,078 DEBUG [c.c.u.UsageServiceImpl] (qtp391630194-19:ctx-9e97b4a7 ctx-395a7f59) (logid:38101bda) Getting usage records for account [2] in domain [null], between [Mon Jan 22 16:00:00 SGT 2024] and [Tue Jan 23 04:59:00 SGT 2024], using pageSize [500] and startIndex [0].

MS queries for usage records between 2024-01-22T19:00:00+1100 and 2024-01-23T07:59:00+1100, which is the expected range. I also verified that the last returned usage record had the startdate of 2024-01-23T04:00:00+1100 and the enddate of 2024-01-23T04:59:59+1100.

Wrong dates in quotaTariffCreate

Before:

(admin) 🐱 > quota tariffcreate name="testA" value=2 usagetype=1 startdate="2024-01-24T01:00:00+1100"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-23T19:00:00+0800",
    "name": "testA",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month",
    "uuid": "b3074921-fd3d-46bd-a5e6-19c445c9a7d8"
  }
}

When creating a Quota tariff, effectiveDate does not get set to the provided startDate.

(admin) 🐱 > quota tariffcreate name="test2A" value=2 usagetype=1 startdate="2024-01-25T01:00:00+1100" enddate="2024-01-25T04:00:00+1100"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-24T19:00:00+0800",
    "endDate": "2024-01-24T22:00:00+0800",
    "name": "test2A",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month",
    "uuid": "c22ac24b-45ea-4ba2-8dc2-533592ac46ca"
  }
}

Both effectiveDate and endDate do not get set to the expected value.

Just to ensure that this is not a problem only with the API's response, I verified that they are indeed wrong in the database:

+----+------------------------+---------------------+---------------------+
| id | name                   | effective_on        | end_date            |
+----+------------------------+---------------------+---------------------+
| 26 | testA                  | 2024-01-23 11:00:00 | NULL                |
| 27 | test2A                 | 2024-01-24 11:00:00 | 2024-01-24 14:00:00 |
+----+------------------------+---------------------+---------------------+

After:

(admin) 🐱 > quota tariffcreate name="testB" value=2 usagetype=1 startdate="2024-01-24T01:00:00+1100"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-23T22:00:00+0800",
    "id": "201b2163-8194-48ff-a048-c36453677538",
    "name": "testB",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

effectiveDate gets set to the correct value.

(admin) 🐱 > quota tariffcreate name="test2B" value=2 usagetype=1 startdate="2024-01-25T01:00:00+1100" enddate="2024-01-25T04:00:00+1100"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-24T22:00:00+0800",
    "endDate": "2024-01-25T01:00:00+0800",
    "id": "6f7f9250-425b-493d-8cc0-7b5158d73ea4",
    "name": "test2B",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

Both effectiveDate and endDate get set to the provided values.

In the database:

+----+------------------------+---------------------+---------------------+
| id | name                   | effective_on        | end_date            |
+----+------------------------+---------------------+---------------------+
| 30 | testB                  | 2024-01-23 14:00:00 | NULL                |
| 31 | test2B                 | 2024-01-24 14:00:00 | 2024-01-24 17:00:00 |
+----+------------------------+---------------------+---------------------+

I also verified that this issue was present in quotaTariffUpdate, and that it has been fixed.

Other tests:

listUsageRecords
(admin) 🐱 > list usagerecords startdate='2024-01-22 19:00:00' enddate='2024-01-23 07:59:00'
...
2024-01-24 00:07:06,185 DEBUG [c.c.u.UsageServiceImpl] (qtp391630194-15:ctx-49d437aa ctx-40c137c4) (logid:a6160874) Getting usage records for account [2] in domain [null], between [Mon Jan 22 19:00:00 SGT 2024] and [Tue Jan 23 07:59:00 SGT 2024], using pageSize [500] and startIndex [0].

When not adding a timezone, startdate and enddate are considered in the MS's timezone. I verified that the last usage record had the startdate of 2024-01-23T06:00:00+0800 and enddate of 2024-01-23T06:59:59+0800.

quotaStatement
(admin) 🐱 > quota statement account=admin domainid=72b54c4a-771d-11ee-8e59-5254003754dc startdate=2024-01-19T13:00:00+1100 enddate=2024-01-20
{
  "statement": {
    "currency": "$",
    "enddate": "2024-01-20T23:59:59+0800",
    "quotausage": [
      {
        "accountid": 2,
        "domain": 1,
        "name": "RUNNING_VM",
        "quota": 0,
        "type": 1,
        "unit": "Compute*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "ALLOCATED_VM",
        "quota": 0,
        "type": 2,
        "unit": "Compute*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "IP_ADDRESS",
        "quota": 0,
        "type": 3,
        "unit": "IP*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_BYTES_SENT",
        "quota": 0,
        "type": 4,
        "unit": "GB"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_BYTES_RECEIVED",
        "quota": 0,
        "type": 5,
        "unit": "GB"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VOLUME",
        "quota": 0,
        "type": 6,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "TEMPLATE",
        "quota": 0,
        "type": 7,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "ISO",
        "quota": 0,
        "type": 8,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "SNAPSHOT",
        "quota": 0,
        "type": 9,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "SECURITY_GROUP",
        "quota": 0,
        "type": 10,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "LOAD_BALANCER_POLICY",
        "quota": 0,
        "type": 11,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "PORT_FORWARDING_RULE",
        "quota": 0,
        "type": 12,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "NETWORK_OFFERING",
        "quota": 0,
        "type": 13,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VPN_USERS",
        "quota": 0,
        "type": 14,
        "unit": "Policy*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_IO_READ",
        "quota": 0,
        "type": 21,
        "unit": "IOPS"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_IO_WRITE",
        "quota": 0,
        "type": 22,
        "unit": "IOPS"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_BYTES_READ",
        "quota": 0,
        "type": 23,
        "unit": "Bytes"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_DISK_BYTES_WRITE",
        "quota": 0,
        "type": 24,
        "unit": "Bytes"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_SNAPSHOT",
        "quota": 0,
        "type": 25,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VOLUME_SECONDARY",
        "quota": 0,
        "type": 26,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "VM_SNAPSHOT_ON_PRIMARY",
        "quota": 0,
        "type": 27,
        "unit": "GB*Month"
      },
      {
        "accountid": 2,
        "domain": 1,
        "name": "BACKUP",
        "quota": 0,
        "type": 28,
        "unit": "GB*Month"
      }
    ],
    "startdate": "2024-01-19T10:00:00+0800",
    "totalquota": 0
  }
}

startdate and enddate use the provided values (enddate gets set to the end of a day according to the MS's timezone).

quotaTariffCreate
(admin) 🐱 > quota tariffcreate name="testtimezonenotprovided" value=2 usagetype=1 startdate="2024-01-24 10:00:00" enddate="2024-01-25 12:00:00"
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-24T10:00:00+0800",
    "endDate": "2024-01-25T12:00:00+0800",
    "id": "ef836a1d-958a-4113-a9da-3121986628a4",
    "name": "testtimezonenotprovided",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

The tariff is created with the provided dates in the MS's timezone.

quotaTariffUpdate
(admin) 🐱 > quota tariffupdate name=testB enddate=2024-01-26
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-23T22:00:00+0800",
    "endDate": "2024-01-26T23:59:59+0800",
    "id": "7fc5f42a-bc0e-4848-89d7-35eacc64504d",
    "name": "testB",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

(admin) 🐱 > quota tariffupdate name=testB enddate=2024-01-26T23:59:59+1100
{
  "quotatariff": {
    "currency": "$",
    "effectiveDate": "2024-01-23T22:00:00+0800",
    "endDate": "2024-01-26T20:59:59+0800",
    "id": "a2e323b7-10b5-4018-aa9d-e50bbee079ff",
    "name": "testB",
    "tariffValue": 2,
    "usageDiscriminator": "None",
    "usageName": "RUNNING_VM",
    "usageType": 1,
    "usageTypeDescription": "Running Vm Usage",
    "usageUnit": "Compute*Month"
  }
}

Dates are updated according to the provided values.

quotaTariffList
(admin) 🐱 > quota tarifflist startdate=2024-01-25 enddate=2024-01-26
{
  "count": 1,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2024-01-25T00:00:00+0800",
      "endDate": "2024-01-25T23:59:59+0800",
      "id": "473451f8-b895-49d5-801c-c4eeea242ec0",
      "name": "test3B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

(admin) 🐱 > quota tarifflist startdate=2024-01-25 enddate=2024-01-25T23:59:59+0800
{
  "count": 1,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2024-01-25T00:00:00+0800",
      "endDate": "2024-01-25T23:59:59+0800",
      "id": "473451f8-b895-49d5-801c-c4eeea242ec0",
      "name": "test3B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

(admin) 🐱 > quota tarifflist startdate=2024-01-25 enddate=2024-01-25T23:59:58+0800
<nothing>

(admin) 🐱 > quota tarifflist startdate=2024-01-24T01:00:00+1100 enddate=2024-01-26
{
  "count": 3,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2024-01-25T00:00:00+0800",
      "endDate": "2024-01-25T23:59:59+0800",
      "id": "473451f8-b895-49d5-801c-c4eeea242ec0",
      "name": "test3B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    },
    {
      "currency": "$",
      "effectiveDate": "2024-01-24T22:00:00+0800",
      "endDate": "2024-01-25T01:00:00+0800",
      "id": "6f7f9250-425b-493d-8cc0-7b5158d73ea4",
      "name": "test2B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    },
    {
      "currency": "$",
      "effectiveDate": "2024-01-23T22:00:00+0800",
      "endDate": "2024-01-26T23:59:59+0800",
      "id": "aa615bcb-a9af-4b2c-8806-6711b8c13623",
      "name": "testB",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

(admin) 🐱 > quota tarifflist startdate=2024-01-24T02:00:00+1100 enddate=2024-01-26
{
  "count": 2,
  "quotatariff": [
    {
      "currency": "$",
      "effectiveDate": "2024-01-25T00:00:00+0800",
      "endDate": "2024-01-25T23:59:59+0800",
      "id": "473451f8-b895-49d5-801c-c4eeea242ec0",
      "name": "test3B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    },
    {
      "currency": "$",
      "effectiveDate": "2024-01-24T22:00:00+0800",
      "endDate": "2024-01-25T01:00:00+0800",
      "id": "6f7f9250-425b-493d-8cc0-7b5158d73ea4",
      "name": "test2B",
      "tariffValue": 2,
      "usageDiscriminator": "None",
      "usageName": "RUNNING_VM",
      "usageType": 1,
      "usageTypeDescription": "Running Vm Usage",
      "usageUnit": "Compute*Month"
    }
  ]
}

Tariffs are filtered by startdate and enddate as expected.

quotaTariffDelete
(admin) 🐱 > quota tariffdelete id=ef836a1d-958a-4113-a9da-3121986628a4
{
  "success": true
}

Working as expected.


Also, could someone else take a look at this PR? @shwstppr @rohityadavcloud

@DaanHoogland DaanHoogland added this to the 4.20.0.0 milestone Jan 24, 2024
@DaanHoogland
Copy link
Contributor

@andrijapanicsb I know you have some experience with this, can you comment on this change?

Copy link
Contributor

@GutoVeronezi GutoVeronezi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLGTM; I just pointed out some adjusts.

I will try to test it soon.

Copy link

github-actions bot commented Feb 8, 2024

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8639

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-9192)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43243 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8243-t9192-kvm-centos7.zip
Smoke tests completed. 128 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_trigger_shutdown Failure 341.73 test_safe_shutdown.py

Copy link

github-actions bot commented Mar 4, 2024

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>
@winterhazel
Copy link
Collaborator Author

@blueorangutan package

@blueorangutan
Copy link

@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9197

@GutoVeronezi
Copy link
Contributor

The Simulator CI / build is passing; however, Codecov is struggling with something during the report upload; thus the errors in the checks.

@DaanHoogland, can we do a last CI run for this one?

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-9822)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 48900 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8243-t9822-kvm-centos7.zip
Smoke tests completed. 128 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_list_cpvm_vm Failure 0.04 test_ssvm.py
test_04_cpvm_internals Failure 0.05 test_ssvm.py

@DaanHoogland
Copy link
Contributor

@winterhazel I think the smoke test results are environmental, but all but the most trivial GHI tests fail. Can you have a look?

@winterhazel
Copy link
Collaborator Author

winterhazel commented Apr 15, 2024

@DaanHoogland the test failures are unrelated to the changes in this PR.

Most of the GHI tests are failing due to an error with Codecov, which is also happening in other PRs, such as #8890.

[2024-04-13T09:52:32.198Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io/: Error: There was an error fetching the storage URL during POST: 404 - {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}

The only exceptions are two failures in test_network_permissions, but this same test has finished successfully in the last CI run.

Testing network permissions on project network ... === TestName: test_01_network_permission_on_project_network | Status : SUCCESS ===
ok
Testing network permissions on user network ... === TestName: test_02_network_permission_on_user_network | Status : SUCCESS ===
ok
Testing network operations on a create vm owned by other user ... === TestName: test_03_network_operations_on_created_vm_of_otheruser | Status : SUCCESS ===
ok
Deploy VM for other user and test VM operations by vm owner, network owner and domain admin ... === TestName: test_04_deploy_vm_for_other_user_and_test_vm_operations | Status : SUCCESS ===
ok
Testing list networks under a project ... === TestName: test_05_list_networks_under_project | Status : SUCCESS ===
ok
Testing list networks under a domain admin account and user account ... === TestName: test_06_list_networks_under_account | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 6 tests in 348.471s

OK

And the two tests that failed in the last run are failing in other unrelated PRs as well: #8511 (comment).

@winterhazel
Copy link
Collaborator Author

@blueorangutan package

@blueorangutan
Copy link

@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9425

@winterhazel
Copy link
Collaborator Author

@DaanHoogland GHI tests are passing now ;)

Can you run the CI one last time so we can proceed with this PR?

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-10052)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 51115 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8243-t10052-kvm-centos7.zip
Smoke tests completed. 128 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 436.58 test_events_resource.py
test_02_trigger_shutdown Failure 357.31 test_safe_shutdown.py

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-10070)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 50826 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8243-t10070-kvm-centos7.zip
Smoke tests completed. 128 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 424.17 test_events_resource.py
test_02_list_cpvm_vm Failure 0.04 test_ssvm.py
test_04_cpvm_internals Failure 0.05 test_ssvm.py

@winterhazel
Copy link
Collaborator Author

@DaanHoogland there seems to be a problem with test_events_resource.py. It's failing in other PRs recently too: #8981 (comment)

@DaanHoogland
Copy link
Contributor

@DaanHoogland there seems to be a problem with test_events_resource.py. It's failing in other PRs recently too: #8981 (comment)

yes, see #8931 (comment) and replies

@GutoVeronezi
Copy link
Contributor

Merging as the tests errors are not related to the PR.

@GutoVeronezi GutoVeronezi merged commit 371ce12 into apache:main May 27, 2024
24 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 17, 2024
* Normalize dates in Usage and Quota APIs

* Apply Daan's sugestions

Co-authored-by: dahn <[email protected]>

* Restore removed sinces

* Add missing space

* Change param descriptions for quotaBalance and quotaStatement

* Apply Daniel's suggestions

Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>

---------

Co-authored-by: dahn <[email protected]>
Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants