Convert get_available_resources to use an object instead of dict

Registered by Daniel Berrange

The nova.virt.Driver class defines a get_available_resources method. This returns a dict whose contents are essentially undocumented and can only be inferred by looking at the code. Of course each virt driver returns semantically different data for the same fields.

The goal is to add an object in nova/virt/hardware.py to record the data that is currently provided in the dict in a typesafe & documented manner. The resource tracker itself will undergo minimal change, it will simply convert from the new object into the dict it currently works with, before populating its DB objects. The new VirtHostResources object is not intended to be stored in the database / transmitted over RPC itself. It is merely formalizing the interface between the virt drivers and the caller of the get_available_resources method.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Daniel Berrange
Direction:
Needs approval
Assignee:
Daniel Berrange
Definition:
Superseded
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Daniel Berrange

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/virt-driver-get-available-resources-object,n,z

Addressed by: https://review.openstack.org/53746
    libvirt: fix overly strict CPU model comparison in live migration

Addressed by: https://review.openstack.org/127569
    libvirt: remove pointless HostState class

Addressed by: https://review.openstack.org/127570
    libvirt: fully parse PCI addresses to integer data type

Addressed by: https://review.openstack.org/127571
    libvirt: fully parse PCI vendor/product IDs to integer data type

Addressed by: https://review.openstack.org/127572
    pci: move filtering of devices up into resource tracker

Addressed by: https://review.openstack.org/127573
    vmware: delete cpu_info data from get_available_resource

Addressed by: https://review.openstack.org/127574
    ironic: delete cpu_info data from get_available_resource

Addressed by: https://review.openstack.org/127575
    xenapi: fix structure of data reported for cpu_info

Addressed by: https://review.openstack.org/127576
    hyperv: use standard architecture constants for CPU model

Addressed by: https://review.openstack.org/127577
    ironic: remove non-standard info in get_available_resource dict

Addressed by: https://review.openstack.org/127578
    virt: introduce VirtInstanceInfo object

Addressed by: https://review.openstack.org/127579
    virt: introduce VirtPCIDeviceInfo & VirtPCIAddressInfo classes

Addressed by: https://review.openstack.org/127580
    virt: introduce VirtCPUModel object

Addressed by: https://review.openstack.org/127581
    virt: introduce VirtHostResources object

Addressed by: https://review.openstack.org/127582
    virt: switch get_available_resource to use VirtInstanceInfo

Addressed by: https://review.openstack.org/127583
    virt: switch get_available_resource to use VirtPCIDeviceInfo

Addressed by: https://review.openstack.org/127584
    virt: switch get_available_resource to use VirtNUMATopology

Addressed by: https://review.openstack.org/127585
    virt: switch get_available_resource to use VirtCPUModel

Addressed by: https://review.openstack.org/127586
    virt: switch get_available_resource to use VirtHostResources

Gerrit topic: https://review.openstack.org/#/q/status:open+project:openstack/nova+branch:master+topic:bp/virt-driver-get-available-resources-object,n,z

This seems to conflict with the work the scheduler sub group are already doing, I think this needs a spec to try and reduce duplicate efforts --johnthetubaguy 14th October 2014

Speaking with Paul Murray / Sylvain Bauza their work is focused on the resource tracker, while this work is entirely focused on the virt drivers. These are complementary efforts to each other.

This is really just a straight conversion of the dict into an class with attributes. It isn't attempting to make any semantic changes to the virt driver API, so I don't think it needs to go through the full spec process. It is really just a simple cleanup IMHO.

Addressed by: https://review.openstack.org/128232
    compute: rename hvtype.py to hv_type.py

It was more in reference to your comments here: https://review.openstack.org/#/c/127609 It would be good to make it clear who is changing what, thats all. Once thats resolved, I am happy to approve the BP without a spec. Its just a little lightweight spec might mean you get a quicker answer here. --johnthetubaguy 15th October 2014

I actually think this needs a spec. There is some discussion going on on the list right now, but it also intertwines tightly with the scheduler work. --dansmith 21-Oct-2014

Gerrit topic: https://review.openstack.org/#q,topic:bug/1082414,n,z

Gerrit topic: https://review.openstack.org/#q,topic:bp/aims,n,z

Addressed by: https://review.openstack.org/133728
    virt: Convert get_available_resources to use an object instead of dict

This work will be tracked as part of https://blueprints.launchpad.net/nova/+spec/resource-objects work

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.