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 CD1531FF15E for ; Mon, 10 Nov 2025 15:36:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7350D18B31; Mon, 10 Nov 2025 15:36:35 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Mon, 10 Nov 2025 15:36:20 +0100 Message-ID: <20251110143627.365434-6-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251110143627.365434-1-d.kral@proxmox.com> References: <20251110143627.365434-1-d.kral@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762785368521 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 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 Subject: [pve-devel] [PATCH container 1/1] api: create_vm: use ha-manager command to add container as an HA resource X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" PVE::API2::HA::Resources is not imported through a use statement here, so `pct create ... --ha-managed 1` will not add the container as an HA resource. Replace the direct API call with a 'ha-manager' invocation as we don't seem to import API modules from other packages except in pve-manager and use the 'ha-manager' command at other call sites already. Signed-off-by: Daniel Kral --- src/PVE/API2/LXC.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index e53b388..b792930 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -627,9 +627,7 @@ __PACKAGE__->register_method({ if ($ha_managed) { print "Add as HA resource\n"; my $state = $start_after_create ? 'started' : 'stopped'; - eval { - PVE::API2::HA::Resources->create({ sid => "ct:$vmid", state => $state }); - }; + eval { run_command(['ha-manager', 'add', "ct:$vmid", '--state', $state]); }; warn $@ if $@; } }; -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel