From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 2/3] migrate: call vm_stop_cleanup after stopping in phase3_cleanup
Date: Fri, 22 Mar 2024 16:17:43 +0100 [thread overview]
Message-ID: <67e8a20d-c9a7-4946-8f83-179303e097dd@proxmox.com> (raw)
In-Reply-To: <20240320125158.2094900-3-d.csapak@proxmox.com>
Am 20.03.24 um 13:51 schrieb Dominik Csapak:
> @@ -1591,12 +1593,10 @@ sub phase3_cleanup {
> $self->{errors} = 1;
> }
>
> - # always deactivate volumes - avoid lvm LVs to be active on several nodes
> - eval {
> - PVE::Storage::deactivate_volumes($self->{storecfg}, $sourcevollist);
> - };
> + # stop with nocheck does not do a cleanup, so do it here with the original config
> + eval { PVE::QemuServer::vm_stop_cleanup($self->{storecfg}, $vmid, $oldconf, 0) };
The function has more parameters, so this does not set noerr to 0.
> if (my $err = $@) {
> - $self->log('err', $err);
> + $self->log('err', "cleanup for vm failed - $err");
> $self->{errors} = 1;
> }
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index d53e9693..54f73093 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6160,7 +6160,9 @@ sub cleanup_pci_devices {
> }
>
> sub vm_stop_cleanup {
> - my ($storecfg, $vmid, $conf, $keepActive, $apply_pending_changes) = @_;
> + my ($storecfg, $vmid, $conf, $keepActive, $apply_pending_changes, $noerr) = @_;
> +
> + $noerr //= 1; # defaults to warning
Not too happy about this, because usually passing undef and 0 for a
"boolean" is the same, but not here. And Perl won't help you. There's
not many callers, maybe just adapt them instead? Should be its own patch
then.
>
> eval {
>
> @@ -6186,7 +6188,13 @@ sub vm_stop_cleanup {
>
> vmconfig_apply_pending($vmid, $conf, $storecfg) if $apply_pending_changes;
> };
> - warn $@ if $@; # avoid errors - just warn
> + if (my $err = $@) {
> + if ($noerr) {
> + warn $err;
> + } else {
> + die $err;
> + }
Style nit: we usually have something like
die $err if !$noerr;
warn $err;
which avoids the line bloat.
> + }
> }
>
> # call only in locked context
next prev parent reply other threads:[~2024-03-22 15:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 12:51 [pve-devel] [PATCH qemu-server/manager] pci live migration followups Dominik Csapak
2024-03-20 12:51 ` [pve-devel] [PATCH qemu-server 1/3] stop cleanup: remove unnecessary tpmstate cleanup Dominik Csapak
2024-03-22 14:54 ` Fiona Ebner
2024-03-20 12:51 ` [pve-devel] [PATCH qemu-server 2/3] migrate: call vm_stop_cleanup after stopping in phase3_cleanup Dominik Csapak
2024-03-22 15:17 ` Fiona Ebner [this message]
2024-03-20 12:51 ` [pve-devel] [PATCH qemu-server 3/3] api: include not mapped resources for running vms in migrate preconditions Dominik Csapak
2024-03-22 14:53 ` Stefan Sterz
2024-03-22 16:19 ` Fiona Ebner
2024-04-02 9:39 ` Dominik Csapak
2024-04-10 10:52 ` Fiona Ebner
2024-03-20 12:51 ` [pve-devel] [PATCH manager 1/3] bulk migrate: improve precondition checks Dominik Csapak
2024-03-20 12:51 ` [pve-devel] [PATCH manager 2/3] bulk migrate: include checks for live-migratable local resources Dominik Csapak
2024-03-20 12:51 ` [pve-devel] [PATCH manager 3/3] ui: adapt migration window to precondition api change Dominik Csapak
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=67e8a20d-c9a7-4946-8f83-179303e097dd@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=d.csapak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.