Vmware select resource pool

For a project I needed to select a vmware pool ressource when provisionning
an host so i'm sharing what i have done and some thoughts about it.

I managed to create an host in some resources pools of a cluster by adding
few code line since fog support the resource pools.

In app/views/compute_resources_vms/form/_vmware.html.erb

<%= selectable_f f, :resource_pool, compute_resource.resource_pools, { }, :
class => "col-md-2", :disabled => !new, :label => _("Ressource Pool") %>

In app/models/compute_resources/foreman/model/vmware.rb

    def resource_pools
      cluster = dc.clusters[0]
      cluster.resource_pools(:accessible =&gt; true)

It works for my use case where I have only one cluster in my vCenter
(because it's a really awful solution to only use the first cluster in the
array )

I think It would be better that the resource pool field were dynamic and
reuse the work done on #6756 for the API (def resource_pools(opts ={}) in
vmware.rb for exemple)

But because of my lack of skills in web development I have been unable to
have a dynamic selection of the cluster hosting the resource pool

A better solution would be to look only for the the resources pool of the
selected cluster and keep the possibility to provision without a selected
resource pool. But I have no idea at all to do this.

Related issues I think

#1946 Addition VMWare options required for VM creation
#6756 expose vmware resource pools and folders through API

Maybe someone will help improving this.