How to get instance info on instance termination

asked 2016-05-18 07:03:16 -0600

MarcoM gravatar image

Hi everyone! I'm trying to get as much information I can about an instance when that instance has to be terminated (IPs, security groups, name, userdata, etc...). Ideally I'd like to provide the instance metadata to external services: for example a decommission service, a notification service and whatever your imagination can think of.

So far i tried (tested on Kilo and Liberty):

  • hooks (deprecated): I get some interesting data (ie. the IP) in the PRE creation hook... not enough complete and given the fact that hooks are deprecated there's no point in working on this solution anymore
  • listening to the nova notification queue (amqp) and unpacking the oslo.message payload (on create/delete events): the same not-so-complete data
  • asking for instance info via nova compute API: complete data but not in sync with the delete/termination event so you can ask info for an instance ID that is no longer there.

What you would suggest to be able to get instance metadata just before removing it from the system (in a "supported" way so for example I'm avoiding poking the database)?

Thanks in advance

edit retag flag offensive close merge delete