Vmware Auto Placement

Hello !

I already create a Service Dialog where i specify Cluster, Host and Datastore for the placement, but now i want only provide the cluster, and vmware_best_fit_least_utilized do the rest for me but there is something i don’t understand when i tried to modify it or not i have an empty return in log :
vm=[template1] host=[ ] storage=[ ]

So i got an error.
I think when the provisioning reach this step it’s skip the whole selection of the host and storage.
I don’t know why and i’m a beginner with ManageIQ, i keep trying to find a solution.

These is what i’m trying to do but i don’t know why it’s doesn’t work i just add some output log and some if and loop

def best_fit_least_utilized

            host = storage = min_registered_vms = nil
            clust_id = request.get_option(:placement_cluster_name)
            @handle.log("info", "clust_id=[#{clust_id}]")
            request.eligible_hosts.select { |h| !h.maintenance && h.power_state == "on" }.each do |h|
              next if min_registered_vms && h.vms.size >= min_registered_vms
              @handle.log("info", "clust_id=[#{h.name}]")
              if clust_id == h.ems_cluster_id
              # Setting the host to filter eligible storages
                request.set_host(h)

              end
              # Filter out storages that do not have enough free space for the Vm
              storages = request.eligible_storages.find_all { |s| s.free_space > vm.provisioned_storage }
              storages.select! { |s| s.storage_profiles.pluck(:id).include?(storage_profile_id) } if storage_profile_id
                
              storages.each do |sto|
                @handle.log("info", "Stockage=[#{sto.name}]")
                if sto.host_storages.host == h.id     
                  s = storages.max_by(&:free_space)
                  next if s.nil?
                  host    = h
                  storage = s
                  min_registered_vms = h.vms.size
                end
              end
            end

            # Set host and storage
            host ? request.set_host(host) : clear_host
            request.set_storage(storage) if storage

            @handle.log("info", "vm=[#{vm.name}] host=[#{host}] storage=[#{storage}]")
          end`

I noticed something i have values in log (vmware_best_fit_least_utilized: vm=[template1] host=[value] storage=[value]) only when i use my service dialog with Host and datastore provided.

I think, i miss something with the VMware’s placement.

This is my Dialog :

when arrive the placement step in Vm Provision, vmware_best_fit_least_utilized, this method is not supposed provide the host and datastore when it’s not provide ?

If someone has an idea or can explain me how the vmware placement work.

Thanks !

Hi Gregoire

for VMware placement, you need to either specify host and datastore, or if your cluster is DRS-enabled you can specify cluster and datastore. You can use the drs_enabled boolean attribute on a cluster, so something like the following to find DRS-enabled clusters:

#############################
# Find a DRS-enabled cluster
#############################
drs_clusters = []
ems.ems_clusters.each do |c|
  if c.drs_enabled
    ...

Hope this helps,
pemcg

1 Like

Can i provide a storage cluster in placement_ds_name or with another name instead of a datastore ?
I checked my hosts they are Drs-enabled clusters, and in each cluster i have a datastore cluster

At the end i want a service dialog with only a cluster field and in the method i provide datastore value with a datastore cluster and vmware do the rest for me.

I hope i’m understandable, if you need more information do not hesitate to ask me

I don’t believe that MIQ can use datastore clusters for placement, but I’m a couple of versions out of date. @agrare may know whether this has been implemented in the most recent versions of MIQ.

The naming methods are only run if auto placement has been specified in the provision request, but you could probably modify the vmware_best_fit_least_utilized method to accept your user-provided cluster name (from the service dialog), and enumerate suitable attached Datastores according to least utilised (or whatever) criteria.

pemcg

1 Like

Ok thanks for your reply !

It’s working like you said. But i would like to know if we can use directly Datastore cluster because it’s less confusing for users.

if @agrare can provide me a little bit more information when he had time.

It seems that storage cluster support was added for the Darga release (ManageIQ - Darga GA Release).

Adam however noted back in May '18 that “…we don’t currently detect if a storage cluster has drs enabled and so you have to pick a specific datastore in a cluster when provisioning. The datastores that you can select are however filtered down to just the ones in that cluster”.

Here are a couple of relevant posts, one seemingly with a workaround:

pemcg

Came here to say exactly Vmware Auto Placement - #8 by pemcg :smiley: thanks @pemcg

We have a tracking issue to remodel datastore clusters so that we could more easily track details like storage DRS enabled Review modeling of StorageCluster · Issue #498 · ManageIQ/manageiq-providers-vmware · GitHub

1 Like