Am 21.11.25 um 11:04 AM schrieb Thomas Lamprecht:
> Am 21.11.25 um 10:45 schrieb Fiona Ebner:
>> Am 20.11.25 um 5:34 PM schrieb Michael Köppl:
>>> To avoid shutting down the VM when performing a live-restore, consider
>>> live-restore=1 to translate to a HA state of 'started', similar to
>>> start=1.
>>>
>>> Reported-by: Fiona Ebner <[email protected]>
>>> Signed-off-by: Michael Köppl <[email protected]>
>>> ---
>>> Used defined-or since in pve-manager, we only ever set one of the two
>>> values and in any other case I'd give precedence to the 'start'
>>> parameter if it is explicitly set.
>>
>> This could be part of the commit message. But from looking at the code,
>> it seems like the actual behavior if start=0 and live-restore=1 is still
>> doing a live restore, so the HA state should still be started in that case.
>>
>>>
>>> src/PVE/API2/Qemu.pm | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
>>> index c580bf63..33427ca7 100644
>>> --- a/src/PVE/API2/Qemu.pm
>>> +++ b/src/PVE/API2/Qemu.pm
>>> @@ -1237,7 +1237,8 @@ __PACKAGE__->register_method({
>>> my $bwlimit = extract_param($param, 'bwlimit');
>>> my $force = extract_param($param, 'force');
>>> my $pool = extract_param($param, 'pool');
>>> - my $start_after_create = extract_param($param, 'start');
>>> + my $start_after_create = extract_param($param, 'start')
>>> + // extract_param($param, 'live-restore');
>>
>> It's already started during create, so using the $start_after_create
>> variable seems like a slight misfit. Why not just also check for
>> $live_restore when setting the HA state when the resource is added?
>>
>
> We lock the config on restore, or?
> If so, couldn't we handle this in the HA stack and do not shutdown if a
> restore lock is present in the config?
But that'd be more coupling? Further below in the endpoint we have (two
instances of):
> if ($ha_managed) {
> print "Add as HA resource\n";
> my $state = $start_after_create ? 'started' : 'stopped';
> my $cmd = ['ha-manager', 'add', "vm:$vmid", '--state',
> $state];
> eval { PVE::Tools::run_command($cmd); };
> warn $@ if $@;
> }
So we could just put $start_after_create || $live_restore there
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel