On Tue, Dec 06, 2011 at 06:52:15PM +0100, Agata Murawska wrote: > Introduction of instance policy on node group level. Since we want the > nodegroup ipolicy to inherit some values from cluster's ipolicy, > calculation function is provided. > > Signed-off-by: Agata Murawska <[email protected]> > --- > lib/cmdlib.py | 8 ++++++++ > lib/config.py | 5 ++++- > lib/objects.py | 3 +++ > 3 files changed, 15 insertions(+), 1 deletions(-) > > diff --git a/lib/cmdlib.py b/lib/cmdlib.py > index c1140cf..d686136 100644 > --- a/lib/cmdlib.py > +++ b/lib/cmdlib.py > @@ -1164,6 +1164,14 @@ def _DecideSelfPromotion(lu, exceptions=None): > return mc_now < mc_should > > > +def _CalculateGroupIPolicy(cfg, group): > + """Calculate instance policy for group. > + > + """ > + cluster = cfg.GetClusterInfo() > + return cluster.SimpleFillIPolicy(group.ipolicy) > + > + > def _CheckNicsBridgesExist(lu, target_nics, target_node): > """Check that the brigdes needed by a list of nics exist. > > diff --git a/lib/config.py b/lib/config.py > index 13e00ad..03a3d5a 100644 > --- a/lib/config.py > +++ b/lib/config.py > @@ -561,8 +561,11 @@ class ConfigWriter: > result.append("duplicate node group name '%s'" % nodegroup.name) > else: > nodegroups_names.add(nodegroup.name) > + group_name = "group %s" % nodegroup.name > + _helper_ipolicy(group_name, > cluster.SimpleFillIPolicy(nodegroup.ipolicy)) > + _helper_ispecs(group_name, > cluster.SimpleFillIPolicy(nodegroup.ipolicy)) > if nodegroup.ndparams: > - _helper("group %s" % nodegroup.name, "ndparams", > + _helper(group_name, "ndparams", > cluster.SimpleFillND(nodegroup.ndparams), > constants.NDS_PARAMETER_TYPES) > > diff --git a/lib/objects.py b/lib/objects.py > index fed3f93..7e7a429 100644 > --- a/lib/objects.py > +++ b/lib/objects.py > @@ -1260,6 +1260,7 @@ class NodeGroup(TaggableObject): > "members", > "ndparams", > "diskparams", > + "ipolicy", > "serial_no", > "alloc_policy", > ] + _TIMESTAMPS + _UUID > @@ -1305,6 +1306,8 @@ class NodeGroup(TaggableObject): > self.mtime = time.time() > > self.diskparams = UpgradeDiskParams(self.diskparams) > + if self.ipolicy is None: > + self.ipolicy = constants.IPOLICY_EMPTY
This again :) rest LGTM. thanks, iustin
