From a4ebcec753bb1f4e5cde4027508c0e899fdb114d Mon Sep 17 00:00:00 2001 From: "goodolclint-claude[bot]" <323206664+goodolclint-claude[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 06:19:08 +0000 Subject: [PATCH] fix: New-PveCluster -Wait blocks until the cluster is quorate PVE's cluster-create task completes before corosync converges. Until the node is quorate it rejects a join with "cluster not ready - no quorum?", so New-PveCluster -Wait followed by Add-PveClusterMember failed for every caller. Wait for quorum after the task, bounded by -Timeout (default 60 s, following the -Wait timeout convention used by Stop-PveContainer and Reset-PveVm). See DECISIONS.md D014. Co-Authored-By: Claude Opus 5 (1M context) --- .../Cmdlets/Cluster/NewPveClusterCmdlet.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/PSProxmoxVE/Cmdlets/Cluster/NewPveClusterCmdlet.cs b/src/PSProxmoxVE/Cmdlets/Cluster/NewPveClusterCmdlet.cs index 13621c7..4a485a9 100644 --- a/src/PSProxmoxVE/Cmdlets/Cluster/NewPveClusterCmdlet.cs +++ b/src/PSProxmoxVE/Cmdlets/Cluster/NewPveClusterCmdlet.cs @@ -1,3 +1,4 @@ +using System; using System.Management.Automation; using PSProxmoxVE.Core.Models.Vms; using PSProxmoxVE.Core.Services; @@ -36,10 +37,15 @@ namespace PSProxmoxVE.Cmdlets.Cluster [Parameter(Mandatory = false, HelpMessage = "Corosync link addresses as key=value strings (e.g. 'link0=10.0.0.1').")] public string[]? Links { get; set; } - /// Wait for the cluster creation task to complete. - [Parameter(Mandatory = false, HelpMessage = "Wait for the task to complete before returning.")] + /// Wait for the cluster creation task to complete and the cluster to reach quorum. + [Parameter(Mandatory = false, HelpMessage = "Wait for the task to complete and the cluster to reach quorum before returning.")] public SwitchParameter Wait { get; set; } + /// Seconds to wait for the cluster to reach quorum when -Wait is used. + [Parameter(Mandatory = false, HelpMessage = "Timeout in seconds for -Wait (default 60).")] + [ValidateRange(1, 3600)] + public int Timeout { get; set; } = 60; + protected override void ProcessRecord() { if (!ShouldProcess($"cluster '{ClusterName}'", "Create new cluster")) @@ -61,6 +67,11 @@ namespace PSProxmoxVE.Cmdlets.Cluster { var taskService = new TaskService(); task = taskService.WaitForTask(session, node, upid); + + // The create task returns before corosync converges; the cluster + // rejects joins until it is quorate. + WriteVerbose("Waiting for cluster to reach quorum..."); + service.WaitForQuorum(session, TimeSpan.FromSeconds(Timeout)); } WriteObject(task);