+#: Valid ssconf keys
+_VALID_KEYS = compat.UniqueFrozenset([
+ constants.SS_CLUSTER_NAME,
+ constants.SS_CLUSTER_TAGS,
+ constants.SS_FILE_STORAGE_DIR,
+ constants.SS_SHARED_FILE_STORAGE_DIR,
+ constants.SS_MASTER_CANDIDATES,
+ constants.SS_MASTER_CANDIDATES_IPS,
+ constants.SS_MASTER_IP,
+ constants.SS_MASTER_NETDEV,
+ constants.SS_MASTER_NETMASK,
+ constants.SS_MASTER_NODE,
+ constants.SS_NODE_LIST,
+ constants.SS_NODE_PRIMARY_IPS,
+ constants.SS_NODE_SECONDARY_IPS,
+ constants.SS_OFFLINE_NODES,
+ constants.SS_ONLINE_NODES,
+ constants.SS_PRIMARY_IP_FAMILY,
+ constants.SS_INSTANCE_LIST,
+ constants.SS_RELEASE_VERSION,
+ constants.SS_HYPERVISOR_LIST,
+ constants.SS_MAINTAIN_NODE_HEALTH,
+ constants.SS_UID_POOL,
+ constants.SS_NODEGROUPS,
+ constants.SS_NETWORKS,
+ ])
+
+#: Maximum size for ssconf files
+_MAX_SIZE = 128 * 1024
+
+
+def ReadSsconfFile(filename):
+ """Reads an ssconf file and verifies its size.
+
+ @type filename: string
+ @param filename: Path to file
+ @rtype: string
+ @return: File contents without newlines at the end
+ @raise RuntimeError: When the file size exceeds L{_MAX_SIZE}