On August 13, 2024 3:28 pm, Fiona Ebner wrote:
> 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 <f.eb...@proxmox.com>
> ---
> 
> Changes in v2:
> * Adapt to API changes.
> 
>  src/PVE/VZDump/LXC.pm | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
> index 67d13db..0fc2a94 100644
> --- a/src/PVE/VZDump/LXC.pm
> +++ b/src/PVE/VZDump/LXC.pm
> @@ -373,7 +373,27 @@ 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";
> +
> +
> +     my $conf = PVE::LXC::Config->load_config($vmid);
> +     my ($id_map, undef, undef) = PVE::LXC::parse_id_maps($conf);
> +     my $info = {
> +         directory => $snapdir,
> +         sources => [@sources],
> +     };
> +     $info->{'firewall-config'} = $firewall_file if -e $firewall_file;
> +     $info->{'bandwidth-limit'} = $opts->{bwlimit} * 1024 if 
> $opts->{bwlimit};
> +     $backup_provider->backup_container($vmid, $config_file, $id_map, 
> $findexcl, $info);

it might be easier to hide the idmapping from the backup provider? e.g.,
hand it a idmapped bindmount or something like that?

> +    } 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
> 
> 
> 


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

Reply via email to