From 473348107492c7f76c06c3096deb138245faf5fb Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 19 Mar 2012 14:27:08 +0100
Subject: [PATCH] Export the AF_INET/AF_INET6 constants
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These are needed to ensure that htools uses the same numeric values as
Python.

By the way, I'm not sure what's the best option: importing socket into
constants (this patch), or adding custom exports to
autotools/convert-constants.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/constants.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/constants.py b/lib/constants.py
index 1a20c22a3..906665650 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -22,6 +22,7 @@
 """Module holding different constants."""
 
 import re
+import socket
 
 from ganeti import _autoconf
 from ganeti import _vcsversion
@@ -636,6 +637,10 @@ IP6_ADDRESS_ANY = "::"
 IP4_VERSION = 4
 IP6_VERSION = 6
 VALID_IP_VERSIONS = frozenset([IP4_VERSION, IP6_VERSION])
+# for export to htools
+IP4_FAMILY = socket.AF_INET
+IP6_FAMILY = socket.AF_INET6
+
 TCP_PING_TIMEOUT = 10
 GANETI_RUNAS = "root"
 DEFAULT_VG = "xenvg"
-- 
GitLab