From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <f.ebner@proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C11A173B0A for <pve-devel@lists.proxmox.com>; Wed, 7 Jul 2021 12:23:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B7AB12DF35 for <pve-devel@lists.proxmox.com>; Wed, 7 Jul 2021 12:22:57 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 113282DF2B for <pve-devel@lists.proxmox.com>; Wed, 7 Jul 2021 12:22:57 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CDFCA40045 for <pve-devel@lists.proxmox.com>; Wed, 7 Jul 2021 12:22:56 +0200 (CEST) From: Fabian Ebner <f.ebner@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 7 Jul 2021 12:22:50 +0200 Message-Id: <20210707102250.5478-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210707102250.5478-1-f.ebner@proxmox.com> References: <20210707102250.5478-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.560 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 2/2] pve6to7: storage content: ignore misconfigured unreferenced volumes X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> X-List-Received-Date: Wed, 07 Jul 2021 10:23:27 -0000 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