From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A1ED31FF163 for ; Thu, 7 Nov 2024 17:52:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8F4AE34D15; Thu, 7 Nov 2024 17:52:25 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 7 Nov 2024 17:51:32 +0100 Message-Id: <20241107165146.125935-21-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241107165146.125935-1-f.ebner@proxmox.com> References: <20241107165146.125935-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.056 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 Subject: [pve-devel] [RFC qemu-server v3 20/34] backup: allow adding fleecing images also for EFI and TPM 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" For the external backup API, it will be necessary to add a fleecing image even for small disks like EFI and TPM, because there is no other place the old data could be copied to when a new guest write comes in. Signed-off-by: Fiona Ebner --- Changes in v3: * adapt to context changes from previous patch PVE/VZDump/QemuServer.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index 1ebafe6d..b6dcd6cc 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -534,7 +534,7 @@ my sub cleanup_fleecing_images { } my sub allocate_fleecing_images { - my ($self, $disks, $vmid, $fleecing_storeid, $format) = @_; + my ($self, $disks, $vmid, $fleecing_storeid, $format, $all_images) = @_; die "internal error - no fleecing storage specified\n" if !$fleecing_storeid; @@ -545,7 +545,8 @@ my sub allocate_fleecing_images { my $n = 0; # counter for fleecing image names for my $di ($disks->@*) { - next if $di->{virtdev} =~ m/^(?:tpmstate|efidisk)\d$/; # too small to be worth it + # EFI/TPM are usually too small to be worth it, but it's required for external providers + next if !$all_images && $di->{virtdev} =~ m/^(?:tpmstate|efidisk)\d$/; if ($di->{type} eq 'block' || $di->{type} eq 'file') { my $scfg = PVE::Storage::storage_config($self->{storecfg}, $fleecing_storeid); my $name = "vm-$vmid-fleece-$n"; @@ -609,7 +610,7 @@ my sub attach_fleecing_images { } my sub check_and_prepare_fleecing { - my ($self, $task, $vmid, $fleecing_opts, $disks, $is_template, $qemu_support) = @_; + my ($self, $task, $vmid, $fleecing_opts, $disks, $is_template, $qemu_support, $all_images) = @_; # Even if the VM was started specifically for fleecing, it's possible that the VM is resumed and # then starts doing IO. For VMs that are not resumed the fleecing images will just stay empty, @@ -632,7 +633,8 @@ my sub check_and_prepare_fleecing { $self->{storecfg}, $fleecing_opts->{storage}); my $format = scalar(grep { $_ eq 'qcow2' } $valid_formats->@*) ? 'qcow2' : 'raw'; - allocate_fleecing_images($self, $disks, $vmid, $fleecing_opts->{storage}, $format); + allocate_fleecing_images( + $self, $disks, $vmid, $fleecing_opts->{storage}, $format, $all_images); attach_fleecing_images($self, $disks, $vmid, $format); } @@ -723,7 +725,7 @@ sub archive_pbs { my $is_template = PVE::QemuConfig->is_template($self->{vmlist}->{$vmid}); $task->{'use-fleecing'} = check_and_prepare_fleecing( - $self, $task, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support); + $self, $task, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support, 0); my $fs_frozen = $self->qga_fs_freeze($task, $vmid); @@ -907,7 +909,7 @@ sub archive_vma { $attach_tpmstate_drive->($self, $task, $vmid); $task->{'use-fleecing'} = check_and_prepare_fleecing( - $self, $task, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support); + $self, $task, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support, 0); my $outfh; if ($opts->{stdout}) { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel