+ # Write ssconf files on all nodes (including locally)
+ if self._last_cluster_serial < self._config_data.cluster.serial_no:
+ if not self._offline:
+ result = rpc.RpcRunner.call_write_ssconf_files(\
+ self._UnlockedGetNodeList(),
+ self._UnlockedGetSsconfValues())
+ for nname, nresu in result.items():
+ msg = nresu.RemoteFailMsg()
+ if msg:
+ logging.warning("Error while uploading ssconf files to"
+ " node %s: %s", nname, msg)
+ self._last_cluster_serial = self._config_data.cluster.serial_no
+
+ def _UnlockedGetSsconfValues(self):
+ """Return the values needed by ssconf.
+
+ @rtype: dict
+ @return: a dictionary with keys the ssconf names and values their
+ associated value
+
+ """
+ fn = "\n".join
+ instance_names = utils.NiceSort(self._UnlockedGetInstanceList())
+ node_names = utils.NiceSort(self._UnlockedGetNodeList())
+ node_info = [self._UnlockedGetNodeInfo(name) for name in node_names]
+
+ instance_data = fn(instance_names)
+ off_data = fn(node.name for node in node_info if node.offline)
+ on_data = fn(node.name for node in node_info if not node.offline)
+ mc_data = fn(node.name for node in node_info if node.master_candidate)
+ node_data = fn(node_names)
+
+ cluster = self._config_data.cluster
+ cluster_tags = fn(cluster.GetTags())
+ return {
+ constants.SS_CLUSTER_NAME: cluster.cluster_name,
+ constants.SS_CLUSTER_TAGS: cluster_tags,
+ constants.SS_FILE_STORAGE_DIR: cluster.file_storage_dir,
+ constants.SS_MASTER_CANDIDATES: mc_data,
+ constants.SS_MASTER_IP: cluster.master_ip,
+ constants.SS_MASTER_NETDEV: cluster.master_netdev,
+ constants.SS_MASTER_NODE: cluster.master_node,
+ constants.SS_NODE_LIST: node_data,
+ constants.SS_OFFLINE_NODES: off_data,
+ constants.SS_ONLINE_NODES: on_data,
+ constants.SS_INSTANCE_LIST: instance_data,
+ constants.SS_RELEASE_VERSION: constants.RELEASE_VERSION,
+ }
+