Commit 68ab64cf authored by René Nussbaumer's avatar René Nussbaumer
Browse files

LUGroupSetParams: Warn if the new ipolicy will violate some ipolicies

If we modify the ipolicy we need to verify if any instance would now
violate the new ipolicy and warn about it. Any instance which already
violates the old one is ignored.
Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarGuido Trotter <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 92ff96e8
......@@ -13437,14 +13437,32 @@ class LUGroupSetParams(LogicalUnit):
self.group_uuid = self.cfg.LookupNodeGroup(self.op.group_name)
self.needed_locks = {
locking.LEVEL_INSTANCE: [],
locking.LEVEL_NODEGROUP: [self.group_uuid],
self.share_locks[locking.LEVEL_INSTANCE] = 1
def DeclareLocks(self, level):
if level == locking.LEVEL_INSTANCE:
assert not self.needed_locks[locking.LEVEL_INSTANCE]
# Lock instances optimistically, needs verification once group lock has
# been acquired
self.needed_locks[locking.LEVEL_INSTANCE] = \
def CheckPrereq(self):
"""Check prerequisites.
owned_instances = frozenset(self.owned_locks(locking.LEVEL_INSTANCE))
# Check if locked instances are still correct
_CheckNodeGroupInstances(self.cfg, self.group_uuid, owned_instances) = self.cfg.GetNodeGroup(self.group_uuid)
cluster = self.cfg.GetClusterInfo()
if is None:
raise errors.OpExecError("Could not retrieve group '%s' (UUID: %s)" %
......@@ -13479,6 +13497,19 @@ class LUGroupSetParams(LogicalUnit):
new_ipolicy = cluster.SimpleFillIPolicy(self.new_ipolicy)
inst_filter = lambda inst: in owned_instances
instances = self.cfg.GetInstancesInfoByFilter(inst_filter).values()
violations = \
new_ipolicy, instances)
if violations:
self.LogWarning("After the ipolicy change the following instances"
" violate them: %s",
def BuildHooksEnv(self):
"""Build hooks env.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment