From 0007f3ab7d3c6f7a5fc67c3264aa6f5c0d9cd2f8 Mon Sep 17 00:00:00 2001
From: Andrea Spadaccini <spadaccio@google.com>
Date: Fri, 4 Nov 2011 15:27:14 +0000
Subject: [PATCH] Add master_netmask to Cluster.UpgradeConfig

And also suppress pylint R0902 error about an object instance having
more than 20 attributes.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/objects.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/objects.py b/lib/objects.py
index 24679685b..0c56620cc 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -26,13 +26,15 @@ pass to and from external parties.
 
 """
 
-# pylint: disable=E0203,W0201
+# pylint: disable=E0203,W0201,R0902
 
 # E0203: Access to member %r before its definition, since we use
 # objects.py which doesn't explicitely initialise its members
 
 # W0201: Attribute '%s' defined outside __init__
 
+# R0902: Allow instances of these objects to have more than 20 attributes
+
 import ConfigParser
 import re
 import copy
@@ -41,6 +43,7 @@ from cStringIO import StringIO
 
 from ganeti import errors
 from ganeti import constants
+from ganeti import netutils
 
 from socket import AF_INET
 
@@ -1189,6 +1192,10 @@ class Cluster(TaggableObject):
     if self.primary_ip_family is None:
       self.primary_ip_family = AF_INET
 
+    if self.master_netmask is None:
+      ipcls = netutils.IPAddress.GetClassFromIpFamily(self.primary_ip_family)
+      self.master_netmask = ipcls.iplen
+
     if self.prealloc_wipe_disks is None:
       self.prealloc_wipe_disks = False
 
-- 
GitLab