From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 1D9491FF13F for ; Thu, 21 May 2026 16:20:59 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 438671ABDE; Thu, 21 May 2026 16:20:56 +0200 (CEST) From: Dominik Rusovac To: pve-devel@lists.proxmox.com Subject: [PATCH manager 2/2] test: rules_cfg: declare explicitly not disabled rules Date: Thu, 21 May 2026 16:20:45 +0200 Message-ID: <20260521142045.1131408-2-d.rusovac@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260521142045.1131408-1-d.rusovac@proxmox.com> References: <20260521142045.1131408-1-d.rusovac@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779373233242 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.319 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: A45AYYI4DOL52PMF4OAZNORHKINL4GRE X-Message-ID-Hash: A45AYYI4DOL52PMF4OAZNORHKINL4GRE X-MailFrom: d.rusovac@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Adopt tests 'rules_cfgs/inconsistent*' and explicitly set 'disabled' to false for any enabled rule to check that rules are still compiled correctly. Signed-off-by: Dominik Rusovac --- ...-disabled-node-resource-affinity-rules.cfg | 88 ++++++++++++ ...ed-node-resource-affinity-rules.cfg.expect | 133 ++++++++++++++++++ ...y-not-disabled-resource-affinity-rules.cfg | 32 +++++ ...isabled-resource-affinity-rules.cfg.expect | 22 +++ 4 files changed, 275 insertions(+) create mode 100644 src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg create mode 100644 src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg.expect create mode 100644 src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg create mode 100644 src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg.expect diff --git a/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg b/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg new file mode 100644 index 0000000..e5a158a --- /dev/null +++ b/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg @@ -0,0 +1,88 @@ +# Case 1: Do not remove a positive resource affinity rule, where there is exactly one node to keep them together. +node-affinity: vm101-vm102-must-be-on-node1 + resources vm:101,vm:102 + nodes node1 + strict 1 + disable 0 + +resource-affinity: vm101-vm102-must-be-kept-together + resources vm:101,vm:102 + affinity positive + disable 0 + +# Case 2: Do not remove a negative resource affinity rule, where there are exactly enough nodes available to keep them apart. +node-affinity: vm201-must-be-on-node1 + resources vm:201 + nodes node1 + strict 1 + disable 0 + +node-affinity: vm202-must-be-on-node2 + resources vm:202 + nodes node2 + strict 1 + disable 0 + +resource-affinity: vm201-vm202-must-be-kept-separate + resources vm:201,vm:202 + affinity negative + disable 0 + +# Case 3: Remove positive resource affinity rules, where two resources are restricted to different nodes. +node-affinity: vm301-must-be-on-node1 + resources vm:301 + nodes node1 + strict 1 + disable 0 + +node-affinity: vm301-must-be-on-node2 + resources vm:302 + nodes node2 + strict 1 + disable 0 + +resource-affinity: vm301-vm302-must-be-kept-together + resources vm:301,vm:302 + affinity positive + disable 0 + +# Case 4: Remove negative resource affinity rules, where two resources are restricted to less nodes than needed to keep them apart. +node-affinity: vm401-must-be-on-node1 + resources vm:401 + nodes node1 + strict 1 + disable 0 + +node-affinity: vm402-must-be-on-node1 + resources vm:402 + nodes node1 + strict 1 + disable 0 + +resource-affinity: vm401-vm402-must-be-kept-separate + resources vm:401,vm:402 + affinity negative + disable 0 + +# Case 5: Remove positive resource affinity rules, which have overlapping HA resources, and are restricted with two different node affinity rules. +node-affinity: vm501-must-be-on-node1 + resources vm:501 + nodes node1 + strict 1 + disable 0 + +node-affinity: vm503-must-be-on-node2 + resources vm:503 + nodes node2 + strict 1 + disable 0 + +resource-affinity: vm501-vm502-must-be-kept-together + resources vm:501,vm:502 + affinity positive + disable 0 + +resource-affinity: vm502-vm503-must-be-kept-together + resources vm:502,vm:503 + affinity positive + disable 0 diff --git a/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg.expect b/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg.expect new file mode 100644 index 0000000..5e32e06 --- /dev/null +++ b/src/test/rules_cfgs/explicitly-not-disabled-node-resource-affinity-rules.cfg.expect @@ -0,0 +1,133 @@ +--- Log --- +Drop rule 'vm301-must-be-on-node1', because at least one resource is in a positive resource affinity rule and there are other resources in at least one other node affinity rule already. +Drop rule 'vm301-must-be-on-node2', because at least one resource is in a positive resource affinity rule and there are other resources in at least one other node affinity rule already. +Drop rule 'vm301-vm302-must-be-kept-together', because resources are in multiple node affinity rules. +Drop rule 'vm401-must-be-on-node1', because at least one resource is in a negative resource affinity rule and this rule would restrict these to less nodes than available to the resources. +Drop rule 'vm401-vm402-must-be-kept-separate', because two or more resources are restricted to less nodes than available to the resources. +Drop rule 'vm402-must-be-on-node1', because at least one resource is in a negative resource affinity rule and this rule would restrict these to less nodes than available to the resources. +Drop rule 'vm501-must-be-on-node1', because at least one resource is in a positive resource affinity rule and there are other resources in at least one other node affinity rule already. +Drop rule 'vm501-vm502-must-be-kept-together', because resources are in multiple node affinity rules. +Drop rule 'vm502-vm503-must-be-kept-together', because resources are in multiple node affinity rules. +Drop rule 'vm503-must-be-on-node2', because at least one resource is in a positive resource affinity rule and there are other resources in at least one other node affinity rule already. +--- Config --- +{ + "digest" : "0c16b9fb9c5a0f7824f1bfbd13b1bd96010d7550", + "ids" : { + "vm101-vm102-must-be-kept-together" : { + "affinity" : "positive", + "disable" : 0, + "resources" : { + "vm:101" : 1, + "vm:102" : 1 + }, + "type" : "resource-affinity" + }, + "vm101-vm102-must-be-on-node1" : { + "disable" : 0, + "nodes" : { + "node1" : { + "priority" : 0 + } + }, + "resources" : { + "vm:101" : 1, + "vm:102" : 1 + }, + "strict" : 1, + "type" : "node-affinity" + }, + "vm201-must-be-on-node1" : { + "disable" : 0, + "nodes" : { + "node1" : { + "priority" : 0 + } + }, + "resources" : { + "vm:201" : 1 + }, + "strict" : 1, + "type" : "node-affinity" + }, + "vm201-vm202-must-be-kept-separate" : { + "affinity" : "negative", + "disable" : 0, + "resources" : { + "vm:201" : 1, + "vm:202" : 1 + }, + "type" : "resource-affinity" + }, + "vm202-must-be-on-node2" : { + "disable" : 0, + "nodes" : { + "node2" : { + "priority" : 0 + } + }, + "resources" : { + "vm:202" : 1 + }, + "strict" : 1, + "type" : "node-affinity" + } + }, + "order" : { + "vm101-vm102-must-be-kept-together" : 2, + "vm101-vm102-must-be-on-node1" : 1, + "vm201-must-be-on-node1" : 3, + "vm201-vm202-must-be-kept-separate" : 5, + "vm202-must-be-on-node2" : 4 + } +} +--- Compiled Config --- +{ + "node-affinity" : { + "vm:101" : { + "nodes" : { + "node1" : { + "priority" : 0 + } + } + }, + "vm:102" : { + "nodes" : { + "node1" : { + "priority" : 0 + } + } + }, + "vm:201" : { + "nodes" : { + "node1" : { + "priority" : 0 + } + } + }, + "vm:202" : { + "nodes" : { + "node2" : { + "priority" : 0 + } + } + } + }, + "resource-affinity" : { + "negative" : { + "vm:201" : { + "vm:202" : 1 + }, + "vm:202" : { + "vm:201" : 1 + } + }, + "positive" : { + "vm:101" : { + "vm:102" : 1 + }, + "vm:102" : { + "vm:101" : 1 + } + } + } +} diff --git a/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg b/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg new file mode 100644 index 0000000..88feb0b --- /dev/null +++ b/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg @@ -0,0 +1,32 @@ +# Case 1: Remove positive and negative resource affinity rules, which share two or more ha resources. +resource-affinity: keep-apart1 + resources vm:102,vm:103 + affinity negative + disable 0 + +resource-affinity: keep-apart2 + resources vm:102,vm:104,vm:106 + affinity negative + disable 0 + +resource-affinity: stick-together1 + resources vm:101,vm:102,vm:103,vm:104,vm:106 + affinity positive + disable 0 + +# Case 2: Remove positive and negative resource affinity rules, which share two or more HA resources with the positive +# resource affinity being split in two. +resource-affinity: split-stick-together1 + resources vm:201,vm:202 + affinity positive + disable 0 + +resource-affinity: split-stick-together2 + resources vm:202,vm:203 + affinity positive + disable 0 + +resource-affinity: split-keep-apart1 + resources vm:201,vm:203 + affinity negative + disable 0 diff --git a/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg.expect b/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg.expect new file mode 100644 index 0000000..019159c --- /dev/null +++ b/src/test/rules_cfgs/explicitly-not-disabled-resource-affinity-rules.cfg.expect @@ -0,0 +1,22 @@ +--- Log --- +Drop rule 'keep-apart1', because rule shares two or more resources with a positive resource affinity rule. +Drop rule 'keep-apart2', because rule shares two or more resources with a positive resource affinity rule. +Drop rule 'split-keep-apart1', because rule shares two or more resources with a positive resource affinity rule. +Drop rule 'split-stick-together1', because rule shares two or more resources with a negative resource affinity rule. +Drop rule 'split-stick-together2', because rule shares two or more resources with a negative resource affinity rule. +Drop rule 'stick-together1', because rule shares two or more resources with a negative resource affinity rule. +Drop rule 'stick-together1', because rule shares two or more resources with a negative resource affinity rule. +--- Config --- +{ + "digest" : "d4de6b15d65b32e975e51766e23a4a25a950ff2e", + "ids" : {}, + "order" : {} +} +--- Compiled Config --- +{ + "node-affinity" : {}, + "resource-affinity" : { + "negative" : {}, + "positive" : {} + } +} -- 2.47.3