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 67C0074370 for ; Mon, 21 Jun 2021 11:25:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 47DD51A678 for ; Mon, 21 Jun 2021 11:25:21 +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 53BB91A66A for ; Mon, 21 Jun 2021 11:25:20 +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 C7BEF4046D for ; Mon, 21 Jun 2021 11:25:19 +0200 (CEST) Message-ID: <7eda9604-8612-6ba5-433d-d325d7c15e0e@proxmox.com> Date: Mon, 21 Jun 2021 11:25:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Thunderbird/90.0 Content-Language: en-US To: Proxmox VE development discussion , Fabian Ebner References: <20210618105938.57107-1-f.ebner@proxmox.com> <20210618105938.57107-9-f.ebner@proxmox.com> From: Thomas Lamprecht In-Reply-To: <20210618105938.57107-9-f.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.717 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 NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [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: Mon, 21 Jun 2021 09:25:51 -0000 On 18.06.21 12:59, Fabian Ebner wrote: > 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. > at least the container ones are applied now, and this needs a rebase anyway as the description length check was applied in-between. > 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 ({ >