def _GetQueryData(self, lu): """Computes the list of nodes and their attributes. """ # Locking is not used assert not (compat.any( lu.glm.is_owned(level) for level in locking.LEVELS if level != locking.LEVEL_CLUSTER) or self.do_locking or self.use_locking) valid_node_uuids = [ node.uuid for node in lu.cfg.GetAllNodesInfo().values() if not node.offline and node.vm_capable ] pol = self._DiagnoseByOS(lu.rpc.call_os_diagnose(valid_node_uuids)) cluster = lu.cfg.GetClusterInfo() data = {} for (os_name, os_data) in pol.items(): info = query.OsInfo(name=os_name, valid=True, node_status=os_data, hidden=(os_name in cluster.hidden_os), blacklisted=(os_name in cluster.blacklisted_os)) variants = set() parameters = set() api_versions = set() for idx, osl in enumerate(os_data.values()): info.valid = bool(info.valid and osl and osl[0][1]) if not info.valid: break (node_variants, node_params, node_api) = osl[0][3:6] if idx == 0: # First entry variants.update(node_variants) parameters.update(node_params) api_versions.update(node_api) else: # Filter out inconsistent values variants.intersection_update(node_variants) parameters.intersection_update(node_params) api_versions.intersection_update(node_api) info.variants = list(variants) info.parameters = list(parameters) info.api_versions = list(api_versions) data[os_name] = info # Prepare data in requested order return [ data[name] for name in self._GetNames(lu, pol.keys(), None) if name in data ]
def _GetQueryData(self, lu): """Computes the list of nodes and their attributes. """ valid_node_uuids = [ node.uuid for node in lu.cfg.GetAllNodesInfo().values() if not node.offline and node.vm_capable ] pol = self._DiagnoseByOS(lu.rpc.call_os_diagnose(valid_node_uuids)) cluster = lu.cfg.GetClusterInfo() data = {} for (os_name, os_data) in pol.items(): info = query.OsInfo(name=os_name, valid=True, node_status=os_data, hidden=(os_name in cluster.hidden_os), blacklisted=(os_name in cluster.blacklisted_os), os_hvp={}, osparams={}) variants = set() parameters = set() api_versions = set() trusted = True for idx, osl in enumerate(os_data.values()): info.valid = bool(info.valid and osl and osl[0][1]) if not info.valid: break (node_variants, node_params, node_api, node_trusted) = osl[0][3:7] if idx == 0: # First entry variants.update(node_variants) parameters.update(node_params) api_versions.update(node_api) else: # Filter out inconsistent values variants.intersection_update(node_variants) parameters.intersection_update(node_params) api_versions.intersection_update(node_api) if not node_trusted: trusted = False info.variants = list(variants) info.parameters = list(parameters) info.api_versions = list(api_versions) info.trusted = trusted for variant in variants: name = "+".join([os_name, variant]) if name in cluster.os_hvp: info.os_hvp[name] = cluster.os_hvp.get(name) if name in cluster.osparams: info.osparams[name] = cluster.osparams.get(name) data[os_name] = info # Prepare data in requested order return [ data[name] for name in self._GetNames(lu, list(pol), None) if name in data ]