Jump to: navigation, search

Nova/ExternalEventAPI

< Nova
Revision as of 00:55, 26 February 2014 by Dan Smith (talk | contribs)

Use-cases

  1. Neutron needs to notify Nova that a new floating IP has been allocated to an instance. Neutron sends an event of "network-changed" to Nova for the affected instance. Nova then refreshes the Instance's info_cache from neutron.
  2. Nova is booting a guest and asks Neutron to plumb the VIFs. It makes that request and then blocks the boot while waiting for the callback from Neutron. When Neutron has completed, it sends an event of type "network-vif-plugged" with the tag set to the port_id of the relevant VIF for the affected instance. When all of the vif-plugged events have been received, Nova continues the boot process.
  3. Nova needs Cinder to do a coordinated snapshot of a volume. Nova asks Cinder to do this and then blocks. When Cinder has completed, it sends an event of volume-snapshotted with the tag set to the volume_id for the affected Instance. Nova then unblocks the snapshotting process and continues.

API Sample

Request

To send the "test-event" with tag "foo" to a server, POST to /os-server-external-events something like:

{
 "events": [
   {
     "name": "test-event",
     "tag": "foo",
     "server_uuid": "71b20737-7f90-4513-abde-4a2dfd8ae97e",
     "status": "completed"
   },
   {
     "name": "other-event",
     "server_uuid": "0239e1f3-2603-4426-b1e4-786e0eaee2c3",
     "status": "failed"
   }
  ]
}

Where:

  • "name" is one of the events defined in nova/objects/external_event.py
  • "status" is one of the statuses defined in nova/objects/external_event.py
  • "server_uuid" is the uuid of the server that the event is for
  • "tag" is an optional unique tag that identifies the event. In the case of network-vif-plugged it is the port_id, for example.

Response

The response is the same as the request, except that any events which cannot be delivered (because they refer to a non-present server, for example) will be returned with a status set to "failed".