From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 00F501FF168
	for <inbox@lore.proxmox.com>; Tue, 12 Nov 2024 10:27:12 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id ED34C1BE8E;
	Tue, 12 Nov 2024 10:27:05 +0100 (CET)
Date: Tue, 12 Nov 2024 10:26:28 +0100
From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20241107165146.125935-1-f.ebner@proxmox.com>
 <20241107165146.125935-18-f.ebner@proxmox.com>
In-Reply-To: <20241107165146.125935-18-f.ebner@proxmox.com>
MIME-Version: 1.0
User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid)
Message-Id: <1731403462.9qscmc3o3o.astroid@yuna.none>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.048 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] applied: [PATCH qemu-server v3 17/34] backup: move
 cleanup of fleecing images to cleanup method
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On November 7, 2024 5:51 pm, Fiona Ebner wrote:
> TPM drives are already detached there and it's better to group
> these things together.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> No changes in v3.
> 
>  PVE/VZDump/QemuServer.pm | 25 +++++++++----------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
> index 012c9210..b2ced154 100644
> --- a/PVE/VZDump/QemuServer.pm
> +++ b/PVE/VZDump/QemuServer.pm
> @@ -690,7 +690,6 @@ sub archive_pbs {
>  
>      # get list early so we die on unkown drive types before doing anything
>      my $devlist = _get_task_devlist($task);
> -    my $use_fleecing;
>  
>      $self->enforce_vm_running_for_backup($vmid);
>      $self->{qmeventd_fh} = PVE::QemuServer::register_qmeventd_handle($vmid);
> @@ -721,7 +720,7 @@ sub archive_pbs {
>  
>  	my $is_template = PVE::QemuConfig->is_template($self->{vmlist}->{$vmid});
>  
> -	$use_fleecing = check_and_prepare_fleecing(
> +	$task->{'use-fleecing'} = check_and_prepare_fleecing(
>  	    $self, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support);
>  
>  	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
> @@ -735,7 +734,7 @@ sub archive_pbs {
>  	    devlist => $devlist,
>  	    'config-file' => $conffile,
>  	};
> -	$params->{fleecing} = JSON::true if $use_fleecing;
> +	$params->{fleecing} = JSON::true if $task->{'use-fleecing'};
>  
>  	if (defined(my $ns = $scfg->{namespace})) {
>  	    $params->{'backup-ns'} = $ns;
> @@ -784,11 +783,6 @@ sub archive_pbs {
>      }
>      $self->restore_vm_power_state($vmid);
>  
> -    if ($use_fleecing) {
> -	detach_fleecing_images($task->{disks}, $vmid);
> -	cleanup_fleecing_images($self, $task->{disks});
> -    }
> -
>      die $err if $err;
>  }
>  
> @@ -891,7 +885,6 @@ sub archive_vma {
>      }
>  
>      my $devlist = _get_task_devlist($task);
> -    my $use_fleecing;
>  
>      $self->enforce_vm_running_for_backup($vmid);
>      $self->{qmeventd_fh} = PVE::QemuServer::register_qmeventd_handle($vmid);
> @@ -911,7 +904,7 @@ sub archive_vma {
>  
>  	$attach_tpmstate_drive->($self, $task, $vmid);
>  
> -	$use_fleecing = check_and_prepare_fleecing(
> +	$task->{'use-fleecing'} = check_and_prepare_fleecing(
>  	    $self, $vmid, $opts->{fleecing}, $task->{disks}, $is_template, $qemu_support);
>  
>  	my $outfh;
> @@ -942,7 +935,7 @@ sub archive_vma {
>  		devlist => $devlist
>  	    };
>  	    $params->{'firewall-file'} = $firewall if -e $firewall;
> -	    $params->{fleecing} = JSON::true if $use_fleecing;
> +	    $params->{fleecing} = JSON::true if $task->{'use-fleecing'};
>  	    add_backup_performance_options($params, $opts->{performance}, $qemu_support);
>  
>  	    $qmpclient->queue_cmd($vmid, $backup_cb, 'backup', %$params);
> @@ -984,11 +977,6 @@ sub archive_vma {
>  
>      $self->restore_vm_power_state($vmid);
>  
> -    if ($use_fleecing) {
> -	detach_fleecing_images($task->{disks}, $vmid);
> -	cleanup_fleecing_images($self, $task->{disks});
> -    }
> -
>      if ($err) {
>  	if ($cpid) {
>  	    kill(9, $cpid);
> @@ -1132,6 +1120,11 @@ sub cleanup {
>  
>      $detach_tpmstate_drive->($task, $vmid);
>  
> +    if ($task->{'use-fleecing'}) {
> +	detach_fleecing_images($task->{disks}, $vmid);
> +	cleanup_fleecing_images($self, $task->{disks});
> +    }
> +
>      if ($self->{qmeventd_fh}) {
>  	close($self->{qmeventd_fh});
>      }
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel