mirror of https://github.com/digint/btrbk
btrbk: first adaptions for vinfo holding config
parent
ceb346db66
commit
d3148851c5
63
btrbk
63
btrbk
|
@ -2912,22 +2912,19 @@ MAIN:
|
|||
#
|
||||
# fill vinfo hash, basic checks on configuration
|
||||
#
|
||||
foreach my $config_vol (@{$config->{VOLUME}})
|
||||
foreach my $sroot (valid_subsection_vinfo($config))
|
||||
{
|
||||
next if($config_vol->{ABORTED});
|
||||
my $sroot = vinfo($config_vol->{url}, $config_vol);
|
||||
unless(vinfo_root($sroot)) {
|
||||
ABORTED($config_vol, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
||||
WARN "Skipping volume \"$sroot->{PRINT}\": $config_vol->{ABORTED}";
|
||||
ABORTED($sroot, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
||||
WARN "Skipping volume \"$sroot->{PRINT}\": " . ABORTED($sroot);
|
||||
next;
|
||||
}
|
||||
$config_vol->{sroot} = $sroot;
|
||||
|
||||
foreach my $config_subvol (@{$config_vol->{SUBVOLUME}})
|
||||
foreach my $svol (valid_subsection_vinfo($sroot))
|
||||
{
|
||||
next if($config_subvol->{ABORTED});
|
||||
|
||||
my $svol = vinfo_subvol($sroot, $config_subvol->{rel_path});
|
||||
dump_vinfo $svol;
|
||||
my $config_subvol = $svol->{CONFIG} // die; #!!!
|
||||
$svol = vinfo_subvol($sroot, $config_subvol);
|
||||
unless($svol) {
|
||||
# configured subvolume is not present in btrfs subvolume list.
|
||||
# try to read subvolume detail, as configured subvolume could be a symlink.
|
||||
|
@ -2952,20 +2949,20 @@ MAIN:
|
|||
next;
|
||||
}
|
||||
}
|
||||
$config_subvol->{svol} = $svol;
|
||||
$svol->{CONFIG} = $config_subvol; #!!! (maybe better have vinfo_set_config() function!)
|
||||
$config_subvol->{VINFO} = $svol; #!!!
|
||||
$config_subvol->{svol} = $svol; #!!!
|
||||
|
||||
|
||||
foreach my $config_target (@{$config_subvol->{TARGET}})
|
||||
foreach my $droot (valid_subsection_vinfo($svol))
|
||||
{
|
||||
next if($config_target->{ABORTED});
|
||||
my $droot = vinfo($config_target->{url}, $config_target);
|
||||
|
||||
my $config_target = $droot->{CONFIG} // die; #!!!
|
||||
my $target_type = $config_target->{target_type} || die;
|
||||
if($target_type eq "send-receive")
|
||||
{
|
||||
unless(vinfo_root($droot)) {
|
||||
ABORTED($config_target, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
||||
WARN "Skipping target \"$droot->{PRINT}\": $config_target->{ABORTED}";
|
||||
ABORTED($droot, "Failed to fetch subvolume detail" . ($err ? ": $err" : ""));
|
||||
WARN "Skipping target \"$droot->{PRINT}\": " . ABORTED($droot);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
@ -2982,8 +2979,8 @@ MAIN:
|
|||
non_destructive => 1,
|
||||
);
|
||||
unless(defined($ret)) {
|
||||
ABORTED($config_target, "Failed to list files from: $droot->{PATH}");
|
||||
WARN "Skipping target \"$droot->{PRINT}\": $config_target->{ABORTED}";
|
||||
ABORTED($droot, "Failed to list files from: $droot->{PATH}");
|
||||
WARN "Skipping target \"$droot->{PRINT}\": " . ABORTED($droot);
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -2996,7 +2993,7 @@ MAIN:
|
|||
next;
|
||||
}
|
||||
unless($file =~ s/^\Q$droot->{PATH}\E\///) {
|
||||
ABORTED($config_target, "Unexpected result from 'find': file \"$file\" is not under \"$droot->{PATH}\"");
|
||||
ABORTED($droot, "Unexpected result from 'find': file \"$file\" is not under \"$droot->{PATH}\"");
|
||||
last;
|
||||
}
|
||||
my $snapshot_basename = config_key($config_subvol, "snapshot_name") // die;
|
||||
|
@ -3024,8 +3021,8 @@ MAIN:
|
|||
push @{$child_uuid_list{$filename_info->{REMOTE_PARENT_UUID}}}, $subvol;
|
||||
}
|
||||
}
|
||||
if($config_target->{ABORTED}) {
|
||||
WARN "Skipping target \"$droot->{PRINT}\": $config_target->{ABORTED}";
|
||||
if(ABORTED($droot)) {
|
||||
WARN "Skipping target \"$droot->{PRINT}\": " . ABORTED($droot);
|
||||
next;
|
||||
}
|
||||
DEBUG "Found " . scalar(keys %subvol_list) . " raw subvolume backups of: $svol->{PRINT}";
|
||||
|
@ -3059,7 +3056,6 @@ MAIN:
|
|||
|
||||
# TRACE(Data::Dumper->Dump([\%subvol_list], ["vinfo_raw_subvol_list{$droot}"]));
|
||||
}
|
||||
$config_target->{droot} = $droot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3067,18 +3063,11 @@ MAIN:
|
|||
# check for duplicate snapshot locations
|
||||
my %snapshot_check;
|
||||
my %backup_check;
|
||||
foreach my $config_vol (@{$config->{VOLUME}})
|
||||
{
|
||||
next if($config_vol->{ABORTED});
|
||||
my $sroot = $config_vol->{sroot} || die;
|
||||
foreach my $config_subvol (@{$config_vol->{SUBVOLUME}})
|
||||
{
|
||||
next if($config_subvol->{ABORTED});
|
||||
my $svol = $config_subvol->{svol} || die;
|
||||
|
||||
foreach my $sroot (valid_subsection_vinfo($config)) {
|
||||
foreach my $svol (valid_subsection_vinfo($sroot)) {
|
||||
# check for duplicate snapshot locations
|
||||
my $snapdir = config_key($config_subvol, "snapshot_dir", postfix => '/') // "";
|
||||
my $snapshot_basename = config_key($config_subvol, "snapshot_name") // die;
|
||||
my $snapdir = config_key($svol, "snapshot_dir", postfix => '/') // "";
|
||||
my $snapshot_basename = config_key($svol, "snapshot_name") // die;
|
||||
my $snapshot_target = "$sroot->{REAL_URL}/$snapdir$snapshot_basename";
|
||||
if(my $prev = $snapshot_check{$snapshot_target}) {
|
||||
ERROR "Subvolume \"$prev\" and \"$svol->{PRINT}\" will create same snapshot: $snapshot_target";
|
||||
|
@ -3087,11 +3076,7 @@ MAIN:
|
|||
}
|
||||
$snapshot_check{$snapshot_target} = $svol->{PRINT};
|
||||
|
||||
foreach my $config_target (@{$config_subvol->{TARGET}})
|
||||
{
|
||||
next if($config_target->{ABORTED});
|
||||
my $droot = $config_target->{droot} || die;
|
||||
|
||||
foreach my $droot (valid_subsection_vinfo($svol)) {
|
||||
# check for duplicate snapshot locations
|
||||
my $snapshot_backup_target = "$droot->{REAL_URL}/$snapshot_basename";
|
||||
if(my $prev = $backup_check{$snapshot_backup_target}) {
|
||||
|
|
Loading…
Reference in New Issue