From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH container] fix: cloning a locked container creates an empty config
Date: Tue, 14 Jun 2022 14:51:33 +0200 [thread overview]
Message-ID: <1655211024.erde2ks6ir.astroid@nora.none> (raw)
In-Reply-To: <20220614122242.320670-1-d.tschlatscher@proxmox.com>
On June 14, 2022 2:22 pm, Daniel Tschlatscher wrote:
> When an attempt was made to clone a locked container the API would
> correctly present the error 'CT is locked (disk)' but create the
> config files for the new container anyway and then abort.
>
> The fix is to simply check whether the CT config is locked before
> creating the configs for the new container.
is there a reason for not just moving it to the start of the eval block
to avoid the same problem being re-introduced in the future? any error
occuring inside the eval block will then trigger a cleanup..
>
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
> ---
> src/PVE/API2/LXC.pm | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 64724cb..e1b4cd3 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -1461,9 +1461,6 @@ __PACKAGE__->register_method({
> my $vollist = [];
> my $running;
>
> - PVE::LXC::Config->create_and_lock_config($newid, 0);
> - PVE::Firewall::clone_vmfw_conf($vmid, $newid);
> -
> my $lock_and_reload = sub {
> my ($vmid, $code) = @_;
> return PVE::LXC::Config->lock_config($vmid, sub {
> @@ -1477,6 +1474,9 @@ __PACKAGE__->register_method({
>
> my $src_conf = PVE::LXC::Config->set_lock($vmid, 'disk');
>
> + PVE::LXC::Config->create_and_lock_config($newid, 0);
> + PVE::Firewall::clone_vmfw_conf($vmid, $newid);
> +
> $running = PVE::LXC::check_running($vmid) || 0;
>
> my $full = extract_param($param, 'full');
> --
> 2.30.2
>
>
>
> _______________________________________________
> 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:[~2022-06-14 12:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 12:22 Daniel Tschlatscher
2022-06-14 12:51 ` Fabian Grünbichler [this message]
2022-06-14 13:43 ` Daniel Tschlatscher
2022-06-15 8:11 ` Fabian Grünbichler
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=1655211024.erde2ks6ir.astroid@nora.none \
--to=f.gruenbichler@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