diff --git a/lib/config.py b/lib/config.py index c0dc69d469e328b8c00768c005979a03d09e7777..15fc1f64bcc1192419256d171b4e6ad580f57b79 100644 --- a/lib/config.py +++ b/lib/config.py @@ -1369,6 +1369,9 @@ class ConfigWriter: cluster = self._config_data.cluster cluster_tags = fn(cluster.GetTags()) + + hypervisor_list = fn(cluster.enabled_hypervisors) + return { constants.SS_CLUSTER_NAME: cluster.cluster_name, constants.SS_CLUSTER_TAGS: cluster_tags, @@ -1385,6 +1388,7 @@ class ConfigWriter: constants.SS_ONLINE_NODES: on_data, constants.SS_INSTANCE_LIST: instance_data, constants.SS_RELEASE_VERSION: constants.RELEASE_VERSION, + constants.SS_HYPERVISOR_LIST: hypervisor_list, } @locking.ssynchronized(_config_lock, shared=1) diff --git a/lib/constants.py b/lib/constants.py index f841471102253247fcd8d8d08fdae0b3acd829c2..0691a2011d29a98389c95af4b47ccb360e30310a 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -660,6 +660,7 @@ SS_OFFLINE_NODES = "offline_nodes" SS_ONLINE_NODES = "online_nodes" SS_INSTANCE_LIST = "instance_list" SS_RELEASE_VERSION = "release_version" +SS_HYPERVISOR_LIST = "hypervisor_list" # cluster wide default parameters DEFAULT_ENABLED_HYPERVISOR = HT_XEN_PVM diff --git a/lib/ssconf.py b/lib/ssconf.py index ffb2ddfe8f0a747a2259e212e735906b220972fa..4bee1a64436c39b23dbe89d6f9a342158155054b 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -282,6 +282,7 @@ class SimpleStore(object): constants.SS_ONLINE_NODES, constants.SS_INSTANCE_LIST, constants.SS_RELEASE_VERSION, + constants.SS_HYPERVISOR_LIST, ) _MAX_SIZE = 131072 @@ -423,6 +424,14 @@ class SimpleStore(object): nl = data.splitlines(False) return nl + def GetHypervisorList(self): + """Return the list of enabled hypervisors. + + """ + data = self._ReadFile(constants.SS_HYPERVISOR_LIST) + nl = data.splitlines(False) + return nl + def GetMasterAndMyself(ss=None): """Get the master node and my own hostname.