diff options
| author | Martin Schwenke <martin@meltin.net> | 2011-07-28 12:09:39 +1000 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2011-07-29 14:32:07 +1000 |
| commit | 7fcfea6141072c85e317cb4c13ddaefaa8f4a165 (patch) | |
| tree | 0b6e33f939101ae5ae939ff6fd589028d667cd97 | |
| parent | 0a96e936f2c24d3f9bceb29ab378c0e99cc8ece4 (diff) | |
| download | samba-7fcfea6141072c85e317cb4c13ddaefaa8f4a165.tar.gz samba-7fcfea6141072c85e317cb4c13ddaefaa8f4a165.tar.xz samba-7fcfea6141072c85e317cb4c13ddaefaa8f4a165.zip | |
IP allocation simulation - Pad IPv4 addresses in LCP2 algorithm.
This makes IPv4 addresses comparable with IPv6 but reduces the overall
effectiveness of the algorithm. The alternative would be to treat
these addresses separately while trying to keep all the IPs in overall
balance... which is basically the problem that LCP2 solves. :-)
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 3a7624f9d468b99714a7b6a45313f9e7f66011ed)
| -rwxr-xr-x | ctdb/tests/takeover/ctdb_takeover.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ctdb/tests/takeover/ctdb_takeover.py b/ctdb/tests/takeover/ctdb_takeover.py index 42feeb5b71..c8c0ed6e33 100755 --- a/ctdb/tests/takeover/ctdb_takeover.py +++ b/ctdb/tests/takeover/ctdb_takeover.py @@ -143,7 +143,13 @@ def ip_to_list_of_ints(ip): try: l = socket.inet_pton(socket.AF_INET6, ip) except: - l = socket.inet_pton(socket.AF_INET, ip) + # Pad with leading 0s. This makes IPv4 addresses comparable + # with IPv6 but reduces the overall effectiveness of the + # algorithm. The alternative would be to treat these + # addresses separately while trying to keep all the IPs in + # overall balance. + l = "".join(itertools.repeat("\0", 12)) + \ + socket.inet_pton(socket.AF_INET, ip) return map(lambda x: struct.unpack('B', x)[0], l) |
