From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 9952F1FF09F for ; Tue, 01 Dec 2026 15:58:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2FB5E21714; Tue, 01 Dec 2026 15:58:26 +0100 (CET) From: =?UTF-8?q?Michael=20K=C3=B6ppl?= To: pve-devel@lists.proxmox.com Subject: [PATCH test-tools 5/8] instance: cli: run a script once for a whole cluster Date: Tue, 1 Dec 2026 15:58:14 +0100 Message-ID: <20261201145817.894414-6-m.koeppl@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201145817.894414-1-m.koeppl@proxmox.com> References: <20261201145817.894414-1-m.koeppl@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796137099490 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.832 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_BADIPHTTP 2 Due to the Storm Bot Network, IPs in emails is bad KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) NUMERIC_HTTP_ADDR 0.001 Uses a numeric IP address in URL RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record WEIRD_PORT 0.001 Uses non-standard port number for HTTP Message-ID-Hash: RM2Y6L4L5M4KU7WTCL45RGPP7OLP7TAV X-Message-ID-Hash: RM2Y6L4L5M4KU7WTCL45RGPP7OLP7TAV X-MailFrom: m.koeppl@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: Clusters formed with `setup --no-cluster` and `create-cluster` do not run post_cluster hooks, so there was no way to run a script that needs the whole cluster against them. Add `run-script --cluster NAME`, which runs the script once with the same $CONFIG_PATH as post_cluster hooks, targeting all nodes of the cluster, ordered by IP. Unlike per-instance runs, which keep at most max_concurrent_setups instances up, all nodes are powered on together. Nodes that were not running before are shut down again afterwards. Signed-off-by: Michael Köppl --- README.md | 9 ++ proxmox-test-instance/src/cli.rs | 20 ++- .../src/instance_manager/mod.rs | 118 ++++++++++++++++-- 3 files changed, 135 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d54095aa..fe727133 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,15 @@ address. The first node is the one the cluster was created on. } ``` +Clusters formed manually (`setup --no-cluster` followed by `create-cluster`) do not run +`post_cluster` hooks. Once such a cluster is formed, `run-script --cluster` runs a script once for +it, with the same `$CONFIG_PATH`. As with other `run-script` calls, the script path is relative to +the current directory: + +```shell +proxmox-test-instance run-script --cluster pvecluster inventory.ron ./scripts/my-cluster-hook.sh +``` + # proxmox-test-runner ## TL;DR diff --git a/proxmox-test-instance/src/cli.rs b/proxmox-test-instance/src/cli.rs index 1aca340a..5745c9fd 100644 --- a/proxmox-test-instance/src/cli.rs +++ b/proxmox-test-instance/src/cli.rs @@ -157,6 +157,9 @@ OPTIONS: --config PATH Provide a custom config file --include INSTANCE Include this instance. Can be set multiple times. --exclude INSTANCE Exclude this instance. Can be set multiple times. + --cluster NAME Run the script once for this cluster instead, with all + of its nodes in $CONFIG_PATH. Cannot be combined with + --include or --exclude. If neither --include nor --exclude are provided, the script is executed against ALL instances from the inventory. @@ -164,7 +167,8 @@ If both are provided, excluded instances are subtracted from included ones. ARGS: Inventory of test instances -