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 manager 2/2] pve6to7: storage content: ignore misconfigured unreferenced volumes
Date: Wed,  7 Jul 2021 12:22:50 +0200	[thread overview]
Message-ID: <20210707102250.5478-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210707102250.5478-1-f.ebner@proxmox.com>

If the same local storage is configured twice with content type
separation, migration in PVE 6 would lead to the volumes being
duplicated. As that would happen for every migration, such an issue
would likely be noticed already, and in PVE 7 such configuration is
not problematic for migration anymore. Also, misconfigured
unreferenced volumes are not an issue with respect to the upgrade
itself, just drop the check.

It's not necessary to scan storages with either 'images' or 'rootdir'
anymore, as only the log_info() remains.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/CLI/pve6to7.pm | 43 ++++++-------------------------------------
 1 file changed, 6 insertions(+), 37 deletions(-)

diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm
index 17da70e8..7d7b09d2 100644
--- a/PVE/CLI/pve6to7.pm
+++ b/PVE/CLI/pve6to7.pm
@@ -695,15 +695,11 @@ sub check_description_lengths {
 sub check_storage_content {
     log_info("Checking storage content type configuration..");
 
-    my $found_referenced;
-    my $found_unreferenced;
+    my $found;
     my $pass = 1;
 
     my $storage_cfg = PVE::Storage::config();
 
-    my $potentially_affected = {};
-    my $referenced_volids = {};
-
     for my $storeid (sort keys $storage_cfg->{ids}->%*) {
 	my $scfg = $storage_cfg->{ids}->{$storeid};
 
@@ -718,7 +714,8 @@ sub check_storage_content {
 	    delete $scfg->{content}->{none}; # scan for guest images below
 	}
 
-	next if $scfg->{content}->{images} && $scfg->{content}->{rootdir};
+	next if $scfg->{content}->{images};
+	next if $scfg->{content}->{rootdir};
 
 	# Skip 'iscsi(direct)' (and foreign plugins with potentially similiar behavior) with 'none',
 	# because that means "use LUNs directly" and vdisk_list() in PVE 6.x still lists those.
@@ -739,12 +736,8 @@ sub check_storage_content {
 	}
 	my @volids = map { $_->{volid} } $res->{$storeid}->@*;
 
-	for my $volid (@volids) {
-	    $potentially_affected->{$volid} = 1;
-	}
-
 	my $number = scalar(@volids);
-	if ($number > 0 && !$scfg->{content}->{images} && !$scfg->{content}->{rootdir}) {
+	if ($number > 0) {
 	    log_info("storage '$storeid' - neither content type 'images' nor 'rootdir' configured"
 		.", but found $number guest volume(s)");
 	}
@@ -753,8 +746,6 @@ sub check_storage_content {
     my $check_volid = sub {
 	my ($volid, $vmid, $vmtype, $reference) = @_;
 
-	$referenced_volids->{$volid} = 1 if $reference ne 'unreferenced';
-
 	my $guesttext = $vmtype eq 'qemu' ? 'VM' : 'CT';
 	my $prefix = "$guesttext $vmid - volume '$volid' ($reference)";
 
@@ -777,19 +768,14 @@ sub check_storage_content {
 	}
 
 	if (!$scfg->{content}->{$vtype}) {
-	    $found_referenced = 1 if $reference ne 'unreferenced';
-	    $found_unreferenced = 1 if $reference eq 'unreferenced';
+	    $found = 1;
 	    $pass = 0;
 	    log_warn("$prefix - storage does not have content type '$vtype' configured.");
 	}
     };
 
-    my $guests = {};
-
     my $cts = PVE::LXC::config_list();
     for my $vmid (sort { $a <=> $b } keys %$cts) {
-	$guests->{$vmid} = 'lxc';
-
 	my $conf = PVE::LXC::Config->load_config($vmid);
 
 	my $volhash = {};
@@ -817,8 +803,6 @@ sub check_storage_content {
 
     my $vms = PVE::QemuServer::config_list();
     for my $vmid (sort { $a <=> $b } keys %$vms) {
-	$guests->{$vmid} = 'qemu';
-
 	my $conf = PVE::QemuConfig->load_config($vmid);
 
 	my $volhash = {};
@@ -849,26 +833,11 @@ sub check_storage_content {
 	}
     }
 
-    if ($found_referenced) {
+    if ($found) {
 	log_warn("Proxmox VE 7.0 enforces stricter content type checks. The guests above " .
 	    "might not work until the storage configuration is fixed.");
     }
 
-    for my $volid (sort keys $potentially_affected->%*) {
-	next if $referenced_volids->{$volid}; # already checked
-
-	my (undef, undef, $vmid) = PVE::Storage::parse_volname($storage_cfg, $volid);
-	my $vmtype = $guests->{$vmid};
-	next if !$vmtype;
-
-	$check_volid->($volid, $vmid, $vmtype, 'unreferenced');
-    }
-
-    if ($found_unreferenced) {
-	log_warn("When migrating, Proxmox VE 7.0 only scans storages with the appropriate " .
-	    "content types for unreferenced guest volumes.");
-    }
-
     if ($pass) {
 	log_pass("no problems found");
     }
-- 
2.20.1





  reply	other threads:[~2021-07-07 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 10:22 [pve-devel] [PATCH manager 1/2] pve6to7: storage content: skip scanning storage if shared Fabian Ebner
2021-07-07 10:22 ` Fabian Ebner [this message]
2021-07-08  7:29   ` [pve-devel] [PATCH manager 2/2] pve6to7: storage content: ignore misconfigured unreferenced volumes Fabian Grünbichler
2021-07-08  7:37     ` Thomas Lamprecht
2021-07-08  7:23 ` [pve-devel] [PATCH manager 1/2] pve6to7: storage content: skip scanning storage if shared Fabian Grünbichler
2021-07-08  7:26 ` [pve-devel] applied: " Thomas Lamprecht

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=20210707102250.5478-2-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