VMware {code}

 View Only

RecommendDatastores NoCompatibleHost

  • 1.  RecommendDatastores NoCompatibleHost

    Posted Jun 06, 2014 06:47 PM

    I am changing over from placing VMs on random datastores and letting DRS sort things out to a strategy based on Datastore Clusters.

    I go to the selected datastore cluster, get a recommendation for where to clone a VM, then apply that recommendation.  The problem I have occurs when I run the command several times in a row, it stops giving a recommendation and starts throwing NoCompatibleHost.

    How can I troubleshoot this or drive toward a resolution?

            storageMgr = @vim.serviceContent.storageResourceManager

            podSpec = RbVmomi::VIM.StorageDrsPodSelectionSpec(:storagePod => dscluster)

            storageSpec = RbVmomi::VIM.StoragePlacementSpec(:type => 'clone', :cloneName => hostname, :folder => folder, :podSelectionSpec => podSpec, :vm => template, :cloneSpec => spec)

            begin

              result = storageMgr.RecommendDatastores(:storageSpec => storageSpec)

              #retrieve SDRS recommendation

              key = result.recommendations[0].key ||= ''

              if key == ''

                abort("\n\n>>> ERROR: NO DATASTORE RECOMMENDATION WAS RETURNED IN #{environment} FOR #{@datastore_cluster}\n\n")

              end

              if async

                storageMgr.ApplyStorageDrsRecommendation_Task(:key => [key])

              else

                storageMgr.ApplyStorageDrsRecommendation_Task(:key => [key]).wait_for_completion

                hostname

              end

            rescue Exception => e

                   puts e

                    abort("no recommendation returned")

            end


    Returns:

    SystemError: vim.fault.NoCompatibleHost


    after starting the placement of the first 2 VMs or so.