From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: [pve-devel] applied: [PATCH container] apply pending mountpoint: also hotplug non-volume mount points
Date: Fri, 12 Aug 2022 09:14:07 +0200 [thread overview]
Message-ID: <20220812071407.na66gjdqokm6acsu@casey.proxmox.com> (raw)
In-Reply-To: <20220808123642.2412163-1-f.ebner@proxmox.com>
applied, thanks
On Mon, Aug 08, 2022 at 02:36:42PM +0200, Fiona Ebner wrote:
> Previously, bind and device mount points were applied to the
> configuration, but not actually hot-plugged/mounted, causing a
> mismatch for running containers.
>
> Reported in the community forum:
> https://forum.proxmox.com/threads/113364/
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>
> Better viewed with -w
>
> src/PVE/LXC/Config.pm | 60 +++++++++++++++++++++----------------------
> 1 file changed, 29 insertions(+), 31 deletions(-)
>
> diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
> index b4b0261..23c1ba7 100644
> --- a/src/PVE/LXC/Config.pm
> +++ b/src/PVE/LXC/Config.pm
> @@ -1471,40 +1471,38 @@ sub apply_pending_mountpoint {
>
> my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt});
> my $old = $conf->{$opt};
> - if ($mp->{type} eq 'volume') {
> - if ($mp->{volume} =~ $PVE::LXC::NEW_DISK_RE) {
> - my $original_value = $conf->{pending}->{$opt};
> - my $vollist = PVE::LXC::create_disks(
> - $storecfg,
> - $vmid,
> - { $opt => $original_value },
> - $conf,
> - 1,
> - );
> - if ($running) {
> - # Re-parse mount point:
> - my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt});
> - eval {
> - PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg);
> - };
> - my $err = $@;
> - if ($err) {
> - PVE::LXC::destroy_disks($storecfg, $vollist);
> - # The pending-changes code collects errors but keeps on looping through further
> - # pending changes, so unroll the change in $conf as well if destroy_disks()
> - # didn't die().
> - $conf->{pending}->{$opt} = $original_value;
> - die $err;
> - }
> - }
> - } else {
> - die "skip\n" if $running && defined($old); # TODO: "changing" mount points?
> - $rescan_volume->($storecfg, $mp);
> - if ($running) {
> + if ($mp->{type} eq 'volume' && $mp->{volume} =~ $PVE::LXC::NEW_DISK_RE) {
> + my $original_value = $conf->{pending}->{$opt};
> + my $vollist = PVE::LXC::create_disks(
> + $storecfg,
> + $vmid,
> + { $opt => $original_value },
> + $conf,
> + 1,
> + );
> + if ($running) {
> + # Re-parse mount point:
> + my $mp = $class->parse_volume($opt, $conf->{pending}->{$opt});
> + eval {
> PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg);
> + };
> + my $err = $@;
> + if ($err) {
> + PVE::LXC::destroy_disks($storecfg, $vollist);
> + # The pending-changes code collects errors but keeps on looping through further
> + # pending changes, so unroll the change in $conf as well if destroy_disks()
> + # didn't die().
> + $conf->{pending}->{$opt} = $original_value;
> + die $err;
> }
> - $conf->{pending}->{$opt} = $class->print_ct_mountpoint($mp);
> }
> + } else {
> + die "skip\n" if $running && defined($old); # TODO: "changing" mount points?
> + $rescan_volume->($storecfg, $mp) if $mp->{type} eq 'volume';
> + if ($running) {
> + PVE::LXC::mountpoint_hotplug($vmid, $conf, $opt, $mp, $storecfg);
> + }
> + $conf->{pending}->{$opt} = $class->print_ct_mountpoint($mp);
> }
>
> if (defined($old)) {
> --
> 2.30.2
prev parent reply other threads:[~2022-08-12 7:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 12:36 [pve-devel] " Fiona Ebner
2022-08-12 7:14 ` Wolfgang Bumiller [this message]
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=20220812071407.na66gjdqokm6acsu@casey.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=f.ebner@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