chris1984
4/25/2019 - 6:35 PM

gistfile1.txt

  def associate_vm(vm)
    host = compute_resource.associated_host(vm)
    datacenter = compute_resource.uuid
    vm_datacenter = vm.datacenter
    if host.present?
      if vm_datacenter == datacenter
        host.associate!(compute_resource, vm)
        @hosts << host
      end
    end