How could we look for a specific vm in provider and register it in vmdb


We have an OpenStack provider in which we create new instances also outside of ManageIQ.
We would like to create a service which would be launched after these instances creation.
The purpose of this service is search for these new VM’s (using their ems_ref attribute) and apply some tags and other stuff via automate engine.

We think that the way to discover new instances is through EMS refresh (please, correct me if I am wrong).
It’s very probable that this service is requested several times at the same time so we have the doubt about how to manage these refresh tasks.

We don’t want to saturate ManageIQ with several refresh tasks so we think that a proper way to achieve this could be with the following steps:

Check if there is some refresh task active or queued for this provider:
  if true: wait for finish and search for the VM. If the VM is not found, launch another refresh task.
  if false: launch a refresh task.

So, after all, my question is: how could we check if a provider is running a refresh task or it has this task queued?

Another option that occurs to us is: is there some way to send an event, task or something similar to search for an instance in the provider using the ems_ref attribute and if it’s found, register it in vmdb?

Thanks a lot,


I think the flow you probably want would look like:

  1. ManageIQ is configured to receive events via Ceilometer or AMQP so it sees an event for the instance being created.
  2. ManageIQ will then automatically do a refresh to bring the instance into ManageIQ. See /System/Event/EmsEvent/OpenStack/compute.instance.create.end. It triggers a refresh.
  3. If you want to do more, you should be able to add to the compute.instance.create.end after the refresh, might require a retry if it steps through before refresh completes.



Thank you very much for your reply @jcutter.

We can’t connect to ceilometer or AMQP due to access rights so we haven’t events for the provider.
This is why I need to run the refresh manually but I would like to avoid that several refresh tasks are run at the same time.