diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2015-12-01 15:09:10 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2015-12-01 15:09:10 -0400 |
commit | bd43109412c1477fde8152db7e84d73c857d544f (patch) | |
tree | deda8de71998f48f7030982d39ab74178f586444 /utils/src/ooinstall/oo_config.py | |
parent | d7ff5b10a3de3f7966148d9e08c0468ef3d6a7f0 (diff) | |
download | openshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.gz openshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.bz2 openshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.xz openshift-bd43109412c1477fde8152db7e84d73c857d544f.zip |
Centralize etcd/schedulability logic for each host.
Diffstat (limited to 'utils/src/ooinstall/oo_config.py')
-rw-r--r-- | utils/src/ooinstall/oo_config.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py index 37aaf9197..1be85bc1d 100644 --- a/utils/src/ooinstall/oo_config.py +++ b/utils/src/ooinstall/oo_config.py @@ -73,6 +73,32 @@ class Host(object): d[prop] = getattr(self, prop) return d + def is_etcd_member(self, all_hosts): + """ Will this host be a member of a standalone etcd cluster. """ + if not self.master: + return False + masters = [host for host in all_hosts if host.master] + if len(masters) > 1: + return True + return False + + def is_dedicated_node(self): + """ Will this host be a dedicated node. (not a master) """ + return self.node and not self.master + + def is_schedulable_node(self, all_hosts): + """ Will this host be a node marked as schedulable. """ + if not self.node: + return False + if not self.master: + return True + + masters = [host for host in all_hosts if host.master] + nodes = [host for host in all_hosts if host.node] + if len(masters) == len(nodes): + return True + return False + class OOConfig(object): default_dir = os.path.normpath( |