From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 12C521FF163 for ; Thu, 12 Sep 2024 14:44:11 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7CA030ECD; Thu, 12 Sep 2024 14:44:08 +0200 (CEST) Date: Thu, 12 Sep 2024 14:44:03 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20240813132829.117460-1-f.ebner@proxmox.com> <20240813132829.117460-22-f.ebner@proxmox.com> In-Reply-To: <20240813132829.117460-22-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1726144470.re3492tra8.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 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: Re: [pve-devel] [RFC qemu-server v2 21/25] backup: implement restore for external providers 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" On August 13, 2024 3:28 pm, Fiona Ebner wrote: > First, the provider is asked about what restore mechanism to use. > Currently, only 'qemu-img' is possible. Then the configuration files > are restored, the provider gives information about volumes contained > in the backup and finally the volumes are restored via > 'qemu-img convert'. > > The code for the restore_external_archive() function was copied and > adapted from the restore_proxmox_backup_archive() function. Together > with restore_vma_archive() it seems sensible to extract the common > parts and use a dedicated module for restore code. > > The parse_restore_archive() helper was renamed, because it's not just > parsing. > > Signed-off-by: Fiona Ebner > --- > > Changes in v2: > * Adapt to API changes. > > PVE/API2/Qemu.pm | 29 +++++++++- > PVE/QemuServer.pm | 139 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 165 insertions(+), 3 deletions(-) > [snip..] > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 37f56f69..6cd21b7d 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm [snip..] > + > + # allocate volumes > + my $map = $restore_allocate_devices->($storecfg, $virtdev_hash, $vmid); > + > + for my $virtdev (sort keys $virtdev_hash->%*) { > + my $d = $virtdev_hash->{$virtdev}; > + next if $d->{is_cloudinit}; # no need to restore cloudinit > + > + my $info = > + $backup_provider->restore_vm_volume_init($volname, $storeid, $d->{devname}, {}); > + my $source_path = $info->{'qemu-img-path'} > + or die "did not get source image path from backup provider\n"; > + eval { > + qemu_img_convert( > + $source_path, $d->{volid}, $d->{size}, undef, 0, $options->{bwlimit}); > + }; this definitely needs to get a call to file_size_info with import hardening patches applied ;) > + my $err = $@; > + eval { > + $backup_provider->restore_vm_volume_cleanup($volname, $storeid, $d->{devname}, {}); > + }; > + if (my $cleanup_err = $@) { > + die $cleanup_err if !$err; > + warn $cleanup_err; > + } > + die $err if $err > + } > + _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel