public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fabian Ebner <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 1/2] pve6to7: add check for guest images on misconfigured storages
Date: Mon, 21 Jun 2021 11:25:11 +0200	[thread overview]
Message-ID: <7eda9604-8612-6ba5-433d-d325d7c15e0e@proxmox.com> (raw)
In-Reply-To: <20210618105938.57107-9-f.ebner@proxmox.com>

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 <f.ebner@proxmox.com>
> ---
> 
> 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 ({
> 





  reply	other threads:[~2021-06-21  9:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 10:59 [pve-devel] [PATCH-SERIES] stricter storage rules for migration Fabian Ebner
2021-06-18 10:59 ` [pve-devel] [PATCH container 1/3] prefer storage_check_enabled over storage_check_node Fabian Ebner
2021-06-21  8:42   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH container 2/3] migrate: also test unused volumes Fabian Ebner
2021-06-21  8:42   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH container 3/3] migrate: enforce that rootdir content type is available Fabian Ebner
2021-06-21  8:42   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH qemu-server 1/2] prefer storage_check_enabled over storage_check_node Fabian Ebner
2021-06-21  9:18   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH qemu-server 2/2] migrate: enforce that image content type is available Fabian Ebner
2021-06-21  9:18   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH storage 1/2] vdisk_list: only scan storages with the correct content type(s) Fabian Ebner
2021-06-21  9:22   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH storage 2/2] config: prevent empty content list when content type 'none' is not supported Fabian Ebner
2021-06-21  9:22   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-18 10:59 ` [pve-devel] [PATCH manager 1/2] pve6to7: add check for guest images on misconfigured storages Fabian Ebner
2021-06-21  9:25   ` Thomas Lamprecht [this message]
2021-06-18 10:59 ` [pve-devel] [PATCH manager 2/2] pve6to7: check for misconfigured content type 'none' 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=7eda9604-8612-6ba5-433d-d325d7c15e0e@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=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