Revision cf572b13
b/lib/cmdlib.py | ||
---|---|---|
3789 | 3789 |
# all nodes to be modified. |
3790 | 3790 |
self.needed_locks = { |
3791 | 3791 |
locking.LEVEL_NODE: locking.ALL_SET, |
3792 |
locking.LEVEL_INSTANCE: locking.ALL_SET, |
|
3793 |
locking.LEVEL_NODEGROUP: locking.ALL_SET, |
|
3794 |
} |
|
3795 |
self.share_locks = { |
|
3796 |
locking.LEVEL_NODE: 1, |
|
3797 |
locking.LEVEL_INSTANCE: 1, |
|
3798 |
locking.LEVEL_NODEGROUP: 1, |
|
3792 | 3799 |
} |
3793 |
self.share_locks[locking.LEVEL_NODE] = 1 |
|
3794 | 3800 |
|
3795 | 3801 |
def BuildHooksEnv(self): |
3796 | 3802 |
"""Build hooks env. |
... | ... | |
3897 | 3903 |
self.new_ipolicy = _GetUpdatedIPolicy(cluster.ipolicy, self.op.ipolicy, |
3898 | 3904 |
group_policy=False) |
3899 | 3905 |
|
3906 |
all_instances = self.cfg.GetAllInstancesInfo().values() |
|
3907 |
violations = set() |
|
3908 |
for group in self.cfg.GetAllNodeGroupsInfo().values(): |
|
3909 |
instances = frozenset([inst for inst in all_instances |
|
3910 |
if compat.any(node in group.members |
|
3911 |
for node in inst.all_nodes)]) |
|
3912 |
new_ipolicy = objects.FillIPolicy(self.new_ipolicy, group.ipolicy) |
|
3913 |
new = _ComputeNewInstanceViolations(_CalculateGroupIPolicy(cluster, |
|
3914 |
group), |
|
3915 |
new_ipolicy, instances) |
|
3916 |
if new: |
|
3917 |
violations.update(new) |
|
3918 |
|
|
3919 |
if violations: |
|
3920 |
self.LogWarning("After the ipolicy change the following instances" |
|
3921 |
" violate them: %s", |
|
3922 |
utils.CommaJoin(violations)) |
|
3923 |
|
|
3900 | 3924 |
if self.op.nicparams: |
3901 | 3925 |
utils.ForceDictType(self.op.nicparams, constants.NICS_PARAMETER_TYPES) |
3902 | 3926 |
self.new_nicparams = cluster.SimpleFillNIC(self.op.nicparams) |
Also available in: Unified diff