mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
IP allocation simulation - add LCP2 imbalance metric to node state output.
Print the LCP imbalance metric after the list of IPs. To make this more sensible, but most of the printing logic into the Node class. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 2e680e6b421d72cf2d217d3c3c1564da0bb19633)
This commit is contained in:
parent
04196c78c7
commit
0829e1a22b
@ -210,6 +210,13 @@ class Node(object):
|
||||
self.healthy = True
|
||||
self.imbalance = -1
|
||||
|
||||
def __str__(self):
|
||||
return "%s %s%s" % \
|
||||
("*" if len(self.public_addresses) == 0 else \
|
||||
(" " if self.healthy else "#"),
|
||||
sorted(list(self.current_addresses)),
|
||||
" %d" % self.imbalance if options.lcp2 else "")
|
||||
|
||||
def can_node_serve_ip(self, ip):
|
||||
return ip in self.public_addresses
|
||||
|
||||
@ -249,12 +256,8 @@ class Cluster(object):
|
||||
self.prev = None
|
||||
|
||||
def __str__(self):
|
||||
return "\n".join(["%2d %s %s" %
|
||||
(i,
|
||||
"*" if len(n.public_addresses) == 0 else \
|
||||
(" " if n.healthy else "#"),
|
||||
sorted(list(n.current_addresses)))
|
||||
for (i, n) in enumerate(self.nodes)])
|
||||
return "\n".join(["%2d %s" % (i, n) \
|
||||
for (i, n) in enumerate(self.nodes)])
|
||||
|
||||
# This is naive. It assumes that IP groups are indicated by the
|
||||
# 1st node having IP groups.
|
||||
|
Loading…
x
Reference in New Issue
Block a user