all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 container 1/1] fix #3421: allow custom storage plugins to support rootfs
Date: Thu, 27 May 2021 14:23:30 +0200	[thread overview]
Message-ID: <20210527122331.86302-2-l.stechauner@proxmox.com> (raw)
In-Reply-To: <20210527122331.86302-1-l.stechauner@proxmox.com>

it is now necessary for storages to support the 'rootdir' content in
order to start containers on them. all native storage plugins
already report the rootdir content correctly.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
 src/PVE/LXC.pm | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 7e6f378..556f7fa 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1682,15 +1682,16 @@ sub __mountpoint_mount {
 		}
 	    };
 	    my $use_loopdev = 0;
-	    if ($scfg->{path}) {
-		$mounted_dev = run_with_loopdev($domount, $path, $readonly);
-		$use_loopdev = 1;
-	    } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'lvm' ||
-		     $scfg->{type} eq 'rbd' || $scfg->{type} eq 'lvmthin') {
-		$mounted_dev = $path;
-		&$domount($path);
+	    if ($scfg->{content}->{rootdir}) {
+		if ($scfg->{path}) {
+		    $mounted_dev = run_with_loopdev($domount, $path, $readonly);
+		    $use_loopdev = 1;
+		} else {
+		    $mounted_dev = $path;
+		    &$domount($path);
+		}
 	    } else {
-		die "unsupported storage type '$scfg->{type}'\n";
+		die "storage '$storage' does not support containers\n";
 	    }
 	    return wantarray ? ($path, $use_loopdev, $mounted_dev) : $path;
 	} else {
@@ -1871,7 +1872,7 @@ sub alloc_disk {
 
     eval {
 	my $do_format = 0;
-	if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs' || $scfg->{type} eq 'cifs' ) {
+	if ($scfg->{content}->{rootdir} && $scfg->{path}) {
 	    if ($size_kb > 0) {
 		$volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw',
 						   undef, $size_kb);
@@ -1882,21 +1883,14 @@ sub alloc_disk {
 		$needs_chown = 1;
 	    }
 	} elsif ($scfg->{type} eq 'zfspool') {
-
 	    $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'subvol',
 					       undef, $size_kb);
 	    $needs_chown = 1;
-	} elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'lvm' || $scfg->{type} eq 'lvmthin') {
-
-	    $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', undef, $size_kb);
-	    $do_format = 1;
-
-	} elsif ($scfg->{type} eq 'rbd') {
-
+	} elsif ($scfg->{content}->{rootdir}) {
 	    $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', undef, $size_kb);
 	    $do_format = 1;
 	} else {
-	    die "unable to create containers on storage type '$scfg->{type}'\n";
+	    die "storage '$storage' does not support containers\n";
 	}
 	format_disk($storecfg, $volid, $rootuid, $rootgid) if $do_format;
     };
-- 
2.20.1





  reply	other threads:[~2021-05-27 12:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 12:23 [pve-devel] [PATCH-SERIES v3 container/qemu-server] " Lorenz Stechauner
2021-05-27 12:23 ` Lorenz Stechauner [this message]
2021-06-21  8:52   ` [pve-devel] applied: [PATCH v3 container 1/1] " Thomas Lamprecht
2021-05-27 12:23 ` [pve-devel] [PATCH v3 qemu-server 1/1] vm_start: check if storages of volumes support content images Lorenz Stechauner
2021-06-21  9:11   ` Thomas Lamprecht
2021-06-02  7:29 ` [pve-devel] [PATCH-SERIES v3 container/qemu-server] fix #3421: allow custom storage plugins to support rootfs Fabian Ebner
2021-06-02 11:51   ` Fabian Ebner

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=20210527122331.86302-2-l.stechauner@proxmox.com \
    --to=l.stechauner@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal