public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] fix #3367: skip bind mounts when converting to template
Date: Fri,  2 Apr 2021 14:36:36 +0200	[thread overview]
Message-ID: <20210402123636.27037-1-f.ebner@proxmox.com> (raw)

Restoring a backup of a template with a bind mount point failed, because the
volume_has_feature check would fail.

Fix this by skipping bind mounts on template creation. There is no check against
adding a bind mount with 'pct set' *after* converting to a template, so it
shouldn't be an issue if we also allow conversion if bind mounts are present *at*
conversion time.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PVE/LXC.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 6395d12..5a9f76d 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1186,6 +1186,8 @@ sub template_create {
     PVE::LXC::Config->foreach_volume($conf, sub {
 	my ($ms, $mountpoint) = @_;
 
+	return if $mountpoint->{type} eq 'bind';
+
 	my $volid = $mountpoint->{volume};
 
 	die "Template feature is not available for '$volid'\n"
@@ -1195,6 +1197,8 @@ sub template_create {
     PVE::LXC::Config->foreach_volume($conf, sub {
 	my ($ms, $mountpoint) = @_;
 
+	return if $mountpoint->{type} eq 'bind';
+
 	my $volid = $mountpoint->{volume};
 
 	PVE::Storage::activate_volumes($storecfg, [$volid]);
-- 
2.20.1





             reply	other threads:[~2021-04-02 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 12:36 Fabian Ebner [this message]
2021-04-06  6:26 ` Fabian Ebner
2021-06-21  8:41   ` Wolfgang Bumiller
2021-06-22  7:20     ` 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=20210402123636.27037-1-f.ebner@proxmox.com \
    --to=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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal