diff --git a/lib/config.py b/lib/config.py
index c92dec9f8ec9e09d6caee8ca636f10490763200c..e620c2104d744ae2fe0a9765e932c79871479b67 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -827,6 +827,15 @@ class ConfigWriter:
     """
     return self._config_data.cluster.default_iallocator
 
+  @locking.ssynchronized(_config_lock, shared=1)
+  def GetPrimaryIPFamily(self):
+    """Get cluster primary ip family.
+
+    @return: primary ip family
+
+    """
+    return self._config_data.cluster.primary_ip_family
+
   @locking.ssynchronized(_config_lock)
   def AddInstance(self, instance, ec_id):
     """Add an instance to the config.
@@ -1407,6 +1416,7 @@ class ConfigWriter:
       constants.SS_NODE_SECONDARY_IPS: node_snd_ips_data,
       constants.SS_OFFLINE_NODES: off_data,
       constants.SS_ONLINE_NODES: on_data,
+      constants.SS_PRIMARY_IP_FAMILY: str(cluster.primary_ip_family),
       constants.SS_INSTANCE_LIST: instance_data,
       constants.SS_RELEASE_VERSION: constants.RELEASE_VERSION,
       constants.SS_HYPERVISOR_LIST: hypervisor_list,
diff --git a/lib/constants.py b/lib/constants.py
index 74495a97a5cb973922f74668f59bf6eece1681f8..ce68abdd9c9a130677e608c701a3a500655e6391 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -871,6 +871,7 @@ SS_NODE_PRIMARY_IPS = "node_primary_ips"
 SS_NODE_SECONDARY_IPS = "node_secondary_ips"
 SS_OFFLINE_NODES = "offline_nodes"
 SS_ONLINE_NODES = "online_nodes"
+SS_PRIMARY_IP_FAMILY = "primary_ip_family"
 SS_INSTANCE_LIST = "instance_list"
 SS_RELEASE_VERSION = "release_version"
 SS_HYPERVISOR_LIST = "hypervisor_list"
diff --git a/lib/ssconf.py b/lib/ssconf.py
index 6ed9d1232b1476c7423c12274be3c90bd502e31b..0449f808167230a49deef468b361b8889fbc3802 100644
--- a/lib/ssconf.py
+++ b/lib/ssconf.py
@@ -281,6 +281,7 @@ class SimpleStore(object):
     constants.SS_NODE_SECONDARY_IPS,
     constants.SS_OFFLINE_NODES,
     constants.SS_ONLINE_NODES,
+    constants.SS_PRIMARY_IP_FAMILY,
     constants.SS_INSTANCE_LIST,
     constants.SS_RELEASE_VERSION,
     constants.SS_HYPERVISOR_LIST,
@@ -460,6 +461,16 @@ class SimpleStore(object):
     data = self._ReadFile(constants.SS_UID_POOL)
     return data
 
+  def GetPrimaryIPFamily(self):
+    """Return the cluster-wide primary address family.
+
+    """
+    try:
+      return int(self._ReadFile(constants.SS_PRIMARY_IP_FAMILY))
+    except (ValueError, TypeError), err:
+      raise errors.ConfigurationError("Error while trying to parse primary ip"
+                                      " family: %s" % err)
+
 
 def GetMasterAndMyself(ss=None):
   """Get the master node and my own hostname.