Host Filter in provisioning dialog


#1

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?

Thanks!


#2

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


#3

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?


#4

Hi @gmccullough,

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

Thanks!


#5

@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 (https://github.com/ManageIQ/manageiq/issues) and we can look into it more.


#6

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?

Thanks!


#7

Hi @gmccullough,

Opened on git:

https://github.com/ManageIQ/manageiq/issues/8652

Thanks!


#8

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:
https://github.com/ManageIQ/manageiq/blob/cff1f9c0411fc0505e67a7ed972e623972dc2496/db/fixtures/ae_datastore/ManageIQ/Infrastructure/VM/Provisioning/Placement.class/methods/vmware_best_fit_least_utilized.rb#L18

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


#9

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.


#10

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)?


Hosts are not longer "eligible_hosts" during placement, why?
#11

@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.id}:#{u.name} - #{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); u.save}; nil

4. List user default search settings to verify changes:

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

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


#12

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.id}:#{u.name} - #{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.id}:#{u.name} - #{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
irb(main):004:0>


#13

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.id}:#{u.name} - #{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.


#14

@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.