nova/doc/v3/api_samples/os-pci/hypervisors-pci-show-resp.json
Paul Murray f1a0d852c8 Cleanups for pci stats in preparation for RT using ComputeNode
While converting the resource tracker to use the ComputeNode
object it became apparent that there was a trivial bug in the
way tags were assigned in PciDevicePool.from_dict() and that
the format for pci stats in the examples is wrong.

The bug was that a dict was assigned to the tags field and then
items were added to it as follows:

pool.tags = {}
pool.tags.update(pool_dict)

The setter for objects is over ridden to perform type checking
and coercion for fields. In the above case the tags field is
a dict of strings, so the coercion converts all values in
the dict to be strings (if it can). In the above snippet
the values of pool_dict are not type checked or coerced because
they are added directly to the dict. The correct way to do this
is (it just so happens that pool_dict again here):

pool.tags = pool_dict

The format of the pci stats does not include an extra_info
field as was originally planned by the author. Instead tags
that would have been in extra_info are included as additional
fields. The phys_function tag was intended to have particular
meaning but has now been dropped.

The api samples and related tests for hypervisors-pci-detail-resp
and hypervisors-pci-show-resp do include extra_info, so the
samples and tests are incorrect. This patch corrects them.

The change in the samples is not an API change, only
a correction, so there is no change to the API version. However,
the api samples are included in documentation so this patch is
marked with with a document impact.

DocImpact

Change-Id: I8730f18d660777e23637b4846e06af1c3e14238e
2015-05-23 03:41:19 +01:00

39 lines
1.1 KiB
JSON

{
"hypervisor": {
"cpu_info": "{\"arch\": \"x86_64\", \"model\": \"Nehalem\", \"vendor\": \"Intel\", \"features\": [\"pge\", \"clflush\"], \"topology\": {\"cores\": 1, \"threads\": 1, \"sockets\": 4}}",
"current_workload": 0,
"disk_available_least": 0,
"host_ip": "1.1.1.1",
"state": "up",
"status": "enabled",
"free_disk_gb": 1028,
"free_ram_mb": 7680,
"hypervisor_hostname": "fake-mini",
"hypervisor_type": "fake",
"hypervisor_version": 1000,
"id": 1,
"local_gb": 1028,
"local_gb_used": 0,
"memory_mb": 8192,
"memory_mb_used": 512,
"os-pci:pci_stats": [
{
"count": 5,
"key1": "value1",
"keya": "valuea",
"product_id": "1520",
"vendor_id": "8086",
"numa_node": 1
}
],
"running_vms": 0,
"service": {
"host": "043b3cacf6f34c90a7245151fc8ebcda",
"id": 2,
"disabled_reason": null
},
"vcpus": 1,
"vcpus_used": 0
}
}