def list_nodes()

in libcloud/compute/drivers/vsphere.py [0:0]


    def list_nodes(self, enhance=True, max_properties=20):
        """
        List nodes, excluding templates
        """

        vm_properties = [
            "config.template",
            "summary.config.name",
            "summary.config.vmPathName",
            "summary.config.memorySizeMB",
            "summary.config.numCpu",
            "summary.storage.committed",
            "summary.config.guestFullName",
            "summary.runtime.host",
            "summary.config.instanceUuid",
            "summary.config.annotation",
            "summary.runtime.powerState",
            "summary.runtime.bootTime",
            "summary.guest.ipAddress",
            "summary.overallStatus",
            "customValue",
            "snapshot",
        ]
        content = self.connection.RetrieveContent()
        view = content.viewManager.CreateContainerView(
            content.rootFolder, [vim.VirtualMachine], True
        )
        i = 0
        vm_dict = {}

        while i < len(vm_properties):
            vm_list = self._collect_properties(
                content,
                view,
                vim.VirtualMachine,
                path_set=vm_properties[i : i + max_properties],
                include_mors=True,
            )
            i += max_properties

            for vm in vm_list:
                if not vm_dict.get(vm["obj"]):
                    vm_dict[vm["obj"]] = vm
                else:
                    vm_dict[vm["obj"]].update(vm)

        vm_list = [vm_dict[k] for k in vm_dict]
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
        nodes = loop.run_until_complete(self._to_nodes(vm_list))

        if enhance:
            nodes = self._enhance_metadata(nodes, content)

        return nodes