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 86C111FF2CA for ; Tue, 23 Jul 2024 11:57:15 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 404683FB50; Tue, 23 Jul 2024 11:57:24 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 23 Jul 2024 11:56:21 +0200 Message-Id: <20240723095624.53621-21-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240723095624.53621-1-f.ebner@proxmox.com> References: <20240723095624.53621-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.061 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 container 20/23] backup: implement backup 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" The filesystem structure is made available as a directory in a consistent manner (with details depending on the vzdump backup mode) just like for regular backup via tar. The backup provider needs to back up the guest and firewall configuration and then the filesystem structure, honoring the ID maps (for unprivileged containers) as well as file exclusions and the bandwidth limit. Signed-off-by: Fiona Ebner --- src/PVE/VZDump/LXC.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm index 67d13db..f2ccd11 100644 --- a/src/PVE/VZDump/LXC.pm +++ b/src/PVE/VZDump/LXC.pm @@ -373,7 +373,25 @@ sub archive { my $userns_cmd = $task->{userns_cmd}; my $findexcl = $self->{vzdump}->{findexcl}; - if ($self->{vzdump}->{opts}->{pbs}) { + if (my $backup_provider = $self->{vzdump}->{'backup-provider'}) { + $self->loginfo("starting external backup via " . $backup_provider->provider_name()); + + my ($mechanism) = $backup_provider->backup_get_mechanism($vmid, 'lxc'); + die "mechanism '$mechanism' requested by backup provider is not supported for containers\n" + if $mechanism ne 'directory'; + + my $config_file = "$tmpdir/etc/vzdump/pct.conf"; + my $firewall_file = "$tmpdir/etc/vzdump/pct.fw"; + + $backup_provider->backup_guest_config($vmid, $config_file); + $backup_provider->backup_firewall_config($vmid, $firewall_file) if -e $firewall_file; + + my $conf = PVE::LXC::Config->load_config($vmid); + my ($id_map, undef, undef) = PVE::LXC::parse_id_maps($conf); + my $bandwidth_limit = $opts->{bwlimit} ? $opts->{bwlimit} * 1024 : undef; + $backup_provider->backup_directory( + $vmid, $snapdir, $id_map, $findexcl, [@sources], $bandwidth_limit); + } elsif ($self->{vzdump}->{opts}->{pbs}) { my $param = []; push @$param, "pct.conf:$tmpdir/etc/vzdump/pct.conf"; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel