/[smeserver]/rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-updateDarCatalogSleep.patch
ViewVC logotype

Contents of /rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-updateDarCatalogSleep.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Mar 21 14:56:12 2014 UTC (10 years, 2 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-backup-2_4_0-31_el6_sme, e-smith-backup-2_4_0-32_el6_sme, e-smith-backup-2_4_0-42_el6_sme, e-smith-backup-2_4_0-38_el6_sme, e-smith-backup-2_4_0-46_el6_sme, e-smith-backup-2_4_0-34_el6_sme, e-smith-backup-2_4_0-30_el6_sme, e-smith-backup-2_4_0-35_el6_sme, e-smith-backup-2_4_0-36_el6_sme, e-smith-backup-2_4_0-44_el6_sme, e-smith-backup-2_4_0-37_el6_sme, e-smith-backup-2_4_0-33_el6_sme, e-smith-backup-2_4_0-41_el6_sme, e-smith-backup-2_4_0-39_el6_sme, e-smith-backup-2_4_0-45_el6_sme, e-smith-backup-2_4_0-40_el6_sme, e-smith-backup-2_4_0-43_el6_sme, HEAD
* Fri Mar 11 2014 Ian Wells <esmith@wellsi.com> 2.4.0-30.sme
- Delete items from dar catalog in descending order [SME: 8129]
- Minor non-functional updates based on PerlCritic and review comments

1 diff -ruN e-smith-backup-2.4.0.p29/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.4.0.p30/root/etc/e-smith/events/actions/workstation-backup-dar
2 --- e-smith-backup-2.4.0.p29/root/etc/e-smith/events/actions/workstation-backup-dar 2014-03-20 22:04:42.000000000 -0700
3 +++ e-smith-backup-2.4.0.p30/root/etc/e-smith/events/actions/workstation-backup-dar 2014-03-21 07:25:38.000000000 -0700
4 @@ -441,14 +441,13 @@
5 {
6 system("/usr/bin/dar_manager", "-Q", "-C", "$catalog") == 0
7 or ldie("Unable to create dar_manager catalog.\n");
8 + sleep 1; # sleep added to ensure the creation of a valid catalog
9 }
10
11 - # sleep added to ensure the creation of a valid catalog
12 - sleep 1;
13 -
14 # find available backups for the server
15 my $setbackuplist = sub {if($_ =~ /([\w|-]+)-(\d+)\..*\.dar/){$backupfiles{$2} = $File::Find::dir."/$1-$2";}};
16 - find { wanted => \&$setbackuplist, untaint => 1 }, $mntbkdir ;
17 + find { wanted => \&$setbackuplist, untaint => 1 }, $mntbkdir ;
18 + my @deletions;
19
20 my $pid = open (DAR_LIST, "-|", "/usr/bin/dar_manager", "-Q", "-B", "$catalog", "-l") or ldie ("Cannot start : $!");
21 my $catalogIndex; # Dar refers to each backup by an index
22 @@ -456,9 +455,7 @@
23
24 while (<DAR_LIST>)
25 {
26 - next unless ($_ =~ /set/);
27 - chomp;
28 - $_ =~ /(\d+).*\s[\w|-]+-(\d+)/;
29 + next unless ($_ =~ /(\d+).*\s[\w|-]+-(\d+)/);
30 ($catalogIndex, $oldkey) = ($1,$2);
31
32 if (defined($backupfiles{$oldkey})) # found on disk and in catalog
33 @@ -467,21 +464,29 @@
34 }
35 else
36 {
37 - system("/usr/bin/dar_manager", "-Q", "-B", "$catalog", "-D", "$catalogIndex") == 0
38 - or ldie("Failed to delete set $catalogIndex from catalog.\n");
39 + push @deletions, $catalogIndex; # Will be deleted from the catalog
40 }
41 }
42 waitpid ($pid, 0);
43 my $err = WEXITSTATUS($?);
44 close (DAR_LIST);
45 - ldie ("Catalog error : $err") if $err;
46 + ldie ("Catalog error : $err") if $err;
47 +
48 + # Delete backups from the catalog that were missing on disk in descending order
49 + while (my $catIndex = pop @deletions)
50 + {
51 + system("/usr/bin/dar_manager", "-Q", "-B", "$catalog", "-D", "$catIndex") == 0
52 + or ldie("Failed to delete set $catIndex from catalog. $!\n");
53 + sleep 1; # sleep added to ensure the creation of a valid catalog
54 + }
55
56 - # Now add backups that were missing from the catalog in chronological order
57 + # Add backups that were missing from the catalog in chronological order
58 foreach my $key (sort keys %backupfiles)
59 {
60 next unless ($key > $oldkey); # prevent adding old backups to the catalog
61 system("/usr/bin/dar_manager", "-Q", "-B", "$catalog", "-A", "$backupfiles{$key}") == 0
62 - or ldie("Failed to add set $backupfiles{$key} to catalog.\n");
63 + or ldie("Failed to add set $backupfiles{$key} to catalog. $!\n");
64 + sleep 1; # sleep added to ensure the creation of a valid catalog
65 }
66 }
67

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed