__all__ = ["ConfigObject", "ConfigData", "NIC", "Disk", "Instance",
"OS", "Node", "Cluster", "FillDict"]
+_TIMESTAMPS = ["ctime", "mtime"]
def FillDict(defaults_dict, custom_dict):
"""Basic function to apply settings on top a default dict.
class ConfigData(ConfigObject):
"""Top-level config object."""
- __slots__ = ["version", "cluster", "nodes", "instances", "serial_no"]
+ __slots__ = (["version", "cluster", "nodes", "instances", "serial_no"] +
+ _TIMESTAMPS)
def ToDict(self):
"""Custom function for top-level config data.
"disk_template",
"network_port",
"serial_no",
- ]
+ ] + _TIMESTAMPS
def _ComputeSecondaryNodes(self):
"""Compute the list of secondary nodes.
"master_candidate",
"offline",
"drained",
- ]
+ ] + _TIMESTAMPS
class Cluster(TaggableObject):
"nicparams",
"candidate_pool_size",
"modify_etc_hosts",
- ]
+ ] + _TIMESTAMPS
def UpgradeConfig(self):
"""Fill defaults for missing configuration values.
# default_hypervisor is just the first enabled one in 2.1
if self.default_hypervisor is not None:
- self.enabled_hypervisors = [self.default_hypervisor] + \
+ self.enabled_hypervisors = ([self.default_hypervisor] +
[hvname for hvname in self.enabled_hypervisors
- if hvname != self.default_hypervisor]
+ if hvname != self.default_hypervisor])
self.default_hypervisor = None
-
def ToDict(self):
"""Custom function for cluster.