Host Filter in provisioning dialog

Hello all,
I have two capablanca-2 installations, one with vpshere 5.5 provider and the other with vsphere 6 provider.
I’ve made an Automation Method to place the provisioned vms with my own crtiterias and it works right on one of the installation, the vsphere 5.5 one.
But on the other one with vsphere 6 I get an error “Destination placement_host_name not provided”.
I can see no reason for this except that on the one that the method works when I open de provision dialog, in the Environment’s Host Filter I get “ALL” by default:

But in the installation where I get the error, when I open de provision dialog, in the Environment’s Host Filter I get “Provisioning Scope/All” by default, and I must manually select “ALL” to see all hosts:

What can be the reason to obtain by default “Provisioning Scope/All” instead of “ALL” on Host Filter?


@gmccullough can you review this question from @mansuamen and forward to a SME if necessary.

I’ve found the reason of the method error.
In the manageiq with vsphere 6 it was set an incorrect filter (Provisioning Scope/All) in Infraestructure->Hosts:

I selected “ALL” and pressed button “Set as Default”

And now my placement method works as expected.

But users still have “Provisioning Scope/All” as default filter.
¿How can I force “ALL” host filter for all users?

Hi @gmccullough,

Any idea about how to force all users to “ALL” host filter?


@mansuamen Great to hear you found the root cause. My understanding is that this is a per-user setting and I am not sure how you would reset this for all users.

Maybe @dclarizio knows more on this topic.

From the automate side:
Are you using the eligible_hosts method to get the list of hosts?
That method uses the same workflow model as the UI which means it would apply the default filter. I am thinking the filter should not be applied in that scenario.

It would be helpful if you could open a git issue ( and we can look into it more.

Hi @gmccullough,
Yes, I use eligible_hosts, eligible_storages and eligible_folders methods.
With “Provisioning Scope/All” as default host filter they don’t work.

I will open a git issue.

¿Is there any other method that do not apply filters?


Hi @gmccullough,

Opened on git:


Yes, you can look at the host and storage objects through their relationships to other objects, like the provider.

If you look at the default VMware best-fit:

You could replace prov.eligible_hosts.each with ems.hosts.each and get something similar.

Thanks @gmccullough,
I will try it.
But I would like to know the reason why all my users changed from “All” Host filter to “Provisioning Scope/All” or if there is a way to revert this.

Hi @gmccullough,
If I use ems.hosts.each, what must I use instead of prov.eligilible_storages and prov.eligible_folders?
And what must I use instead of prov.set_host(host), prov.set_option(:placement_folder_name… and prov.set_storage(storage)?

@mansuamen This feels like we are going down a bad path now and I think we should focus on fixing the root cause.

It is still not clear how it is getting set for everyone. My guess is that the setting is getting store somewhere and those settings are used for any new users added to the system.

What I would suggest doing is logging into the appliance and running the rails console where we can fix the issue with a few commands.

Recommended steps:

1. Load Rails console on the appliance
cd /var/www/miq/vmdb bundle exec rails console

2. List the current user default search settings:

User.all.each {|u| puts "#{}:#{} - #{u.settings[:default_search].inspect}"}; nil

Example Output:
2:Consumption Administrator - nil 1:Administrator - {:Host=>43}

3. Clear the Host default search setting:

User.all.each {|u| u.settings[:default_search].try(:delete, :Host);}; nil

4. List user default search settings to verify changes:

User.all.each {|u| puts "#{}:#{} - #{u.settings[:default_search].inspect}"}; nil

Example Output:
2:Consumption Administrator - nil 1:Administrator - {}

Hi @gmccullough,

Thanks for your answer, but I’m afraid the command to clear the Host default search setting does not work, as you can see below:

[root@mycloud ~]# cd /var/www/miq/vmdb
[root@mycloud vmdb]# bundle exec rails console
/var/www/miq/vmdb/gems/pending/util/extensions/miq-yaml.rb:9: warning: already initialized constant Psych::Visitors::ToRuby::SHOVEL
/opt/rubies/ruby-2.2.4/lib/ruby/gems/2.2.0/gems/psych-2.0.17/lib/psych/visitors/to_ruby.rb:333: warning: previous definition of SHOVEL was here
Loading production environment (Rails 4.2.5)
irb(main):001:0> User.all.each {|u| puts “#{}:#{} - #{u.settings[:default_search].inspect}”}; nil
User Inst Including Associations (32.3ms - 4rows)
7:user1 - {:Host=>28}
1:Administrator - {:Host=>0}
4:user2 - nil
2:user3 - nil
=> nil
irb(main):002:0> User.all.each {|u| u.settings[:default_search].try(:delete, :Host)}; nil
User Inst Including Associations (0.5ms - 4rows)
=> nil
irb(main):003:0> User.all.each {|u| puts “#{}:#{} - #{u.settings[:default_search].inspect}”}; nil
User Inst Including Associations (0.5ms - 4rows)
7:user1 - {:Host=>28}
1:Administrator - {:Host=>0}
4:user2 - nil
2:user3 - nil
=> nil

I’ve did it deleting all data on field settings on table users and now I have no settings value.

irb(main):004:0> User.all.each {|u| puts “#{}:#{} - #{u.settings[:default_search].inspect}”}; nil
User Inst Including Associations (0.7ms - 5rows)
1:Administrator - nil
10:user4 - nil
7:user1 - nil
4:user2 - nil
2:user3 - nil
=> nil

I’ve created a new user (user4) and it has no value on settings field on users table, but when I login with this user and try to provision a vm from a template in environment tab in provision from the value for Host Filter is “Provisioning Scope/All” again.

@mansuamen I updated step #3 above to include a save of the user instance which was missing previously.

I am not aware of anyone running into this new issues and it seems you are not hitting it in your other environment either.

If this is a small environment would it make sense to export some of your customizations (automate model, reports, etc) and reset this environment?

Otherwise, I will need to find time when I can research it more.