mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-09-04 03:05:32 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
db93af27b2
commit
a4ebcec753
@@ -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; }
|
||||
|
||||
/// <summary>Wait for the cluster creation task to complete.</summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "Wait for the task to complete before returning.")]
|
||||
/// <summary>Wait for the cluster creation task to complete and the cluster to reach quorum.</summary>
|
||||
[Parameter(Mandatory = false, HelpMessage = "Wait for the task to complete and the cluster to reach quorum before returning.")]
|
||||
public SwitchParameter Wait { get; set; }
|
||||
|
||||
/// <summary>Seconds to wait for the cluster to reach quorum when -Wait is used.</summary>
|
||||
[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);
|
||||
|
||||
Reference in New Issue
Block a user