How to refresh ManageIQ::Providers::Microsoft::InfraManager provider internally by using ruby method

Hi Team,

Can you please suggest me a way of refreshing the SCVMM (Microsoft Hypervisor) provider by using ruby method and not rest-api.
I have done many researches but no luck.

Thanks & Regards
Sonam Verma

Hi @Sonam if you want to refresh your SCVMM provider with the rails console you can do this:

cd /var/www/miq/vmdb
bin/rails console
# This will refresh then on the queue which will work if you have the whole server running

Hi @agrare ,

Thanks for your response.
How can I do this by using Ruby method created inside CloudForms and invoking that in the State machine workflow so that after the VM is provisioned, I can refresh the provider also to update the entries overthere.

Previously I was using Rest Api and that was working, but I think there are inbuilt ruby methods that we can use to refresh the providers internally.

Please let me know the solution.


When you provision a VM it should already be refreshing the provider for you.

Hi @agrare,

We are provisioning the vm by using Service Request and passing all the parameters to Ansible Tower. By using the variables the Ansible tower is executing its task and the vm is created in the specified vmm server.
We have also configured the vmm server provider in the cloudforms to check the entries but we are not doing anything over there. It just a record of vms.
So how can we explicitly refresh the provider in the Cloudforms if required by using ruby method and calling it at the time of workflow.


If you don’t use MIQ provisioning then yes you’re on your own as far as kicking off a refresh. The code above should work but you want to pass in specifically the ext_management_system that your VM is on. If you have a vm object you can do EmsRefresh.queue_refresh(vm.ext_management_system) or if you have an ems object you can just pass that in directly.