The nova virt driver has a scale issue in that it makes way too many API calls, especially on behalf of spawn. I have submitted a review to remove at least 2 API calls by not having to re-query the node when plugging vifs. But after that, we are still left with for spawn:
spawn() gets node from Ironic
spawn() updates node
spawn() -> _add_driver_fields() updates node 'n' times where 'n' is # of required pxe fields
spawn() makes a node validate call
spawn() -> _plug_vifs() -> _unplug_vifs() lists ports.
spawn() -> _plug_vifs() -> _unplug_vifs() makes 'n' calls to update ports where 'n' is number of ports.
spawn() -> _plug_vifs() lists ports.
spawn() -> _plug_vifs() makes 'n' calls to update ports where 'n' is number of ports.
spawn() updates node to set 'active' provision state
We need to figure out a way to make batch calls for some of these, IMO.
Yes. The following is what it should look like:
- update node to set instance_uuid (this should return the node obj)
- set 'n' driver fields in one call (rather than 'n' separate calls)
- one call to validate
- one call to list ports
- one call per port that is plugged in (rather than one call for every port)
- one call for every port (since they all need to be plugged in)
- one call to set provision_state to active
This should result in a total of:
1 + 1 + 1 + 1 + p + P + 1
= 5 + p + P
calls, where p is "number of already plugged in ports" (often zero) and P is number of ports that need to be plugged in (often the actual number of physical ports).