def _get_vm_for_uuid(self, uuid, datacenter=None):
        server = self.connection.client

        dc_list = []
        if datacenter and VIMor.is_mor(datacenter):
            dc_list.append(datacenter)
        else:
            dc = server.get_datacenters()
            if datacenter:
                dc_list = [k for k, v in dc.iteritems() if v == datacenter]
            else:
                dc_list = list(dc.iterkeys())

        for mor_dc in dc_list:
            request = VI.FindByUuidRequestMsg()
            search_index = server._do_service_content.SearchIndex
            mor_search_index = request.new__this(search_index)
            mor_search_index.set_attribute_type(MORTypes.SearchIndex)
            request.set_element__this(mor_search_index)

            mor_datacenter = request.new_datacenter(mor_dc)
            mor_datacenter.set_attribute_type(MORTypes.Datacenter)
            request.set_element_datacenter(mor_datacenter)

            request.set_element_vmSearch(True)
            request.set_element_uuid(uuid)

            try:
                vm = server._proxy.FindByUuid(request)._returnval
            except VI.ZSI.FaultException:
                pass
            else:
                if vm:
                    return VIVirtualMachine(server, vm)

            return None
Retrieve VM for the provided UUID.
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/vsphere.py/VSphereNodeDriver._get_vm_for_uuid