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 9CD1CA1CD6 for ; Fri, 16 Jun 2023 11:57:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BD0C330BBB for ; Fri, 16 Jun 2023 11:57:13 +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 for ; Fri, 16 Jun 2023 11:57:11 +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 8D97845BEF for ; Fri, 16 Jun 2023 11:57:10 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Fri, 16 Jun 2023 11:57:02 +0200 Message-Id: <20230616095708.1323621-7-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230616095708.1323621-1-a.lauterer@proxmox.com> References: <20230616095708.1323621-1-a.lauterer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.088 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH v4 qemu-server 6/12] migration: scan_local_volumes: adapt refs handling 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, 16 Jun 2023 09:57:14 -0000 Since we don't scan all storages for matching disk images anymore for a migration don't have any images found via storage alone. They will be referenced in the config somehwere. Therefore, there is no need for the 'storage' ref. A new ref, 'config_unused' is introduced to distinguish between a disk image that is attached or not (unusedX in the config). We can now also detect if a disk image is only referenced in the pending section. The refs are mostly used for informational use to print out in the logs why a disk image is part of the migration. Except for the 'config' case. The 'config' case is used to determine if the disk image needs to be live migrated if the VM is currently running. Therefore, only set the ref to 'config' if it is a used/attached disk image. Signed-off-by: Aaron Lauterer --- changes since v3: Parts of this were touched by patch 1, now its own dedicated patch. Different changes than in the previous version, overworking the whole refs handling a lot more. PVE/QemuMigrate.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 5f61bcd..9e80866 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -361,8 +361,11 @@ sub scan_local_volumes { $self->target_storage_check_available($storecfg, $targetsid, $volid); return if $scfg->{shared} && !$self->{opts}->{remote}; - $local_volumes->{$volid}->{ref} = $attr->{referenced_in_config} ? 'config' : 'snapshot'; - $local_volumes->{$volid}->{ref} = 'storage' if $attr->{is_unused}; + $local_volumes->{$volid}->{ref} = 'pending' if $attr->{referenced_in_pending}; + $local_volumes->{$volid}->{ref} = 'snapshot' if $attr->{referenced_in_snapshot}; + if ($attr->{referenced_in_config}) { + $local_volumes->{$volid}->{ref} = $attr->{is_unused} ? 'config_unused' : 'config'; + } $local_volumes->{$volid}->{ref} = 'generated' if $attr->{is_tpmstate}; $local_volumes->{$volid}->{bwlimit} = $self->get_bwlimit($sid, $targetsid); @@ -425,14 +428,16 @@ sub scan_local_volumes { foreach my $vol (sort keys %$local_volumes) { my $type = $replicatable_volumes->{$vol} ? 'local, replicated' : 'local'; my $ref = $local_volumes->{$vol}->{ref}; - if ($ref eq 'storage') { - $self->log('info', "found $type disk '$vol' (via storage)\n"); - } elsif ($ref eq 'config') { + if ($ref eq 'config') { &$log_error("can't live migrate attached local disks without with-local-disks option\n", $vol) if $self->{running} && !$self->{opts}->{"with-local-disks"}; $self->log('info', "found $type disk '$vol' (in current VM config)\n"); + } elsif ($ref eq 'config_unused') { + $self->log('info', "found $type, unused disk '$vol' (in current VM config)\n"); } elsif ($ref eq 'snapshot') { $self->log('info', "found $type disk '$vol' (referenced by snapshot(s))\n"); + } elsif ($ref eq 'pending') { + $self->log('info', "found $type disk '$vol' (pending change)\n"); } elsif ($ref eq 'generated') { $self->log('info', "found generated disk '$vol' (in current VM config)\n"); } else { -- 2.39.2