From: "Daniel Kral" <d.kral@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
"Michael Köppl" <m.koeppl@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 1/1] api: create/store: allow adding VM as HA resource after creation
Date: Mon, 10 Nov 2025 13:30:19 +0100 [thread overview]
Message-ID: <DE50L2KKHISA.1FRMRC2E5FHP1@proxmox.com> (raw)
In-Reply-To: <20251006155233.267374-2-m.koeppl@proxmox.com>
On Mon Oct 6, 2025 at 5:52 PM CEST, Michael Köppl wrote:
> @@ -1204,6 +1210,7 @@ __PACKAGE__->register_method({
> my $force = extract_param($param, 'force');
> my $pool = extract_param($param, 'pool');
> my $start_after_create = extract_param($param, 'start');
> + my $ha_managed = extract_param($param, 'ha-managed');
> my $storage = extract_param($param, 'storage');
> my $unique = extract_param($param, 'unique');
> my $live_restore = extract_param($param, 'live-restore');
> @@ -1380,6 +1387,15 @@ __PACKAGE__->register_method({
> eval { PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }) };
> warn $@ if $@;
> }
> +
> + if ($ha_managed) {
> + print "Add as HA resource\n";
> + my $state = $start_after_create ? 'started' : 'stopped';
> + eval {
> + PVE::API2::HA::Resources->create({ sid => "vm:$vmid", state => $state });
> + };
> + warn $@ if $@;
> + }
Was there a reason that in the restore function the VM is added to the
HA stack after the vm_start(...) / live restore while in the create
function it is added before vm_start(...) / live import?
I just wonder if it might cause any trouble with these :)
> };
>
> my $createfn = sub {
> @@ -1463,6 +1479,15 @@ __PACKAGE__->register_method({
>
> PVE::QemuConfig->lock_config_full($vmid, 1, $realcmd);
>
> + if ($ha_managed) {
> + print "Add as HA resource\n";
> + my $state = $start_after_create ? 'started' : 'stopped';
> + eval {
> + PVE::API2::HA::Resources->create({ sid => "vm:$vmid", state => $state });
> + };
> + warn $@ if $@;
> + }
> +
> if ($start_after_create && !$live_restore) {
> print "Execute autostart\n";
> eval { PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }) };
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-11-10 12:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 15:52 [pve-devel] [PATCH container/manager/qemu-server 0/5] add option to create HA resource upon guest create or restore Michael Köppl
2025-10-06 15:52 ` [pve-devel] [PATCH qemu-server 1/1] api: create/store: allow adding VM as HA resource after creation Michael Köppl
2025-10-06 17:23 ` Thomas Lamprecht
2025-10-06 17:24 ` Thomas Lamprecht
2025-11-10 12:30 ` Daniel Kral [this message]
2025-10-06 15:52 ` [pve-devel] [PATCH container 1/1] api: create/store: allow adding CT " Michael Köppl
2025-10-06 17:22 ` [pve-devel] applied: " Thomas Lamprecht
2025-10-06 15:52 ` [pve-devel] [PATCH manager 1/3] qemu: create: add checkbox for creating HA resource upon VM creation Michael Köppl
2025-10-06 17:29 ` Thomas Lamprecht
2025-10-07 9:52 ` Michael Köppl
2025-10-07 10:26 ` Thomas Lamprecht
2025-10-07 11:46 ` Michael Köppl
2025-10-07 12:42 ` Michael Köppl
2025-10-06 15:52 ` [pve-devel] [PATCH manager 2/3] lxc: create: add checkbox for creating HA resource upon CT creation Michael Köppl
2025-10-06 15:52 ` [pve-devel] [PATCH manager 3/3] ui: restore: add checkbox for adding HA resource upon restore of guest Michael Köppl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DE50L2KKHISA.1FRMRC2E5FHP1@proxmox.com \
--to=d.kral@proxmox.com \
--cc=m.koeppl@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox