From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 7616973826 for ; Fri, 18 Jun 2021 13:00:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 646CB26B97 for ; Fri, 18 Jun 2021 12:59:46 +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 4D16B26B48 for ; Fri, 18 Jun 2021 12:59:43 +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 23D3E4420B for ; Fri, 18 Jun 2021 12:59:43 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Fri, 18 Jun 2021 12:59:37 +0200 Message-Id: <20210618105938.57107-9-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210618105938.57107-1-f.ebner@proxmox.com> References: <20210618105938.57107-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.721 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [pve6to7.pm] Subject: [pve-devel] [PATCH manager 1/2] pve6to7: add check for guest images on misconfigured storages X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 11:00:16 -0000 migration will no longer work when the storage's content type is not correct, and unreferenced volumes on such storages will not be scanned for anymore. Signed-off-by: Fabian Ebner --- If Lorenz's patches that enforce the correct content type on guest startup are applied, the warning message should be extended/generalised here of course. PVE/CLI/pve6to7.pm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm index fc779e4f..3e8af0a0 100644 --- a/PVE/CLI/pve6to7.pm +++ b/PVE/CLI/pve6to7.pm @@ -660,6 +660,47 @@ sub check_custom_pool_roles { } } +sub check_storage_content { + log_info("Scanning for guest images on storages without images/rootdir content type.."); + + my $found; + + my $storage_cfg = PVE::Storage::config(); + + for my $storeid (keys $storage_cfg->{ids}->%*) { + my $scfg = $storage_cfg->{ids}->{$storeid}; + + next if !PVE::Storage::storage_check_enabled($storage_cfg, $storeid, undef, 1); + + 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. + # It's enough to *not* skip 'dir', because it is the only other storage that supports 'none' + # and 'images' or 'rootdir', hence being potentially misconfigured. + next if $scfg->{type} ne 'dir' && $scfg->{content}->{none}; + + my $res = PVE::Storage::vdisk_list($storage_cfg, $storeid); + my $disk_list = $res->{$storeid}; + + my @volumes = map { $_->{volid} } $disk_list->@*; + + if (scalar(@volumes) > 0) { + $found = 1; + log_warn("storage '$storeid' - neither content type 'images' nor 'rootdir' " . + "configured, but found guest volume(s) " . join(',', @volumes)); + } + } + + if ($found) { + log_warn("PVE 7.0 enforces stricter content type checks on migration, so migrating " . + "guests referencing those volumes will not work anymore."); + } else { + log_pass("none found"); + } +} + sub check_misc { print_header("MISCELLANEOUS CHECKS"); my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') }; @@ -753,6 +794,7 @@ sub check_misc { check_backup_retention_settings(); check_cifs_credential_location(); check_custom_pool_roles(); + check_storage_content(); } __PACKAGE__->register_method ({ -- 2.20.1