CCI-MOC / openstack-billing-from-db

Simple billing from the database
Apache License 2.0
1 stars 3 forks source link

Remove dependence on flavor table and flavor cache #30

Closed knikolla closed 5 months ago

knikolla commented 5 months ago

The information related to which GPU is in use by an instance is available in the pci_requests column of the instance_extra table.

For example:

[
  {
    "count": 1,
    "spec": [
      {
        "product_id": "<REDACTED>",
        "vendor_id": "<REDACTED>",
        "dev_type": "type-PCI"
      }
    ],
    "alias_name": "V100",
    "is_new": false,
    "numa_policy": "legacy",
    "request_id": null,
    "requester_id": null
  }
]

If no PCI information the instance is assumed as CPU SU.

All flavors are 20GB, so that is hardcoded for the moment, and root disk storage is not to be taken into account for calculations of invoicing.

It is therefore unnecessary to fetch any flavor information and invoicing can be performed directly on the instance information.

I have compared the values of January's billing values before and after the change and they are the same.

With all the information now being fetched from the instance, we don't need to persist flavor information anymore between runs nor fetch flavor information from the nova_api database.

knikolla commented 5 months ago

Just to make sure I understand: effectively with this change we're no longer billing based on flavors; we're billing on the cpu/memory/etc requests made by each specific instance (which may or may not correspond to an existing flavor).

Assuming I'm correct, that seems reasonable.

Correct. Flavors were an unreliable source of that information as they got deleted often leaving no traces behind as to what they might originally have been - this was especially tricky because GPU SUs were detected based on flavor name. The instance information is a much more reliable source of that same information.