]> oss.titaniummirror.com Git - ovzbpc.git/commitdiff
bpcdump: allow removal of any VE backup
authorR. Steve McKown <rsmckown@gmail.com>
Fri, 12 Oct 2012 23:27:45 +0000 (17:27 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Fri, 12 Oct 2012 23:27:45 +0000 (17:27 -0600)
When looking to free space for the new backup, allow removal of older
backups for any VE, not just for the current VEID.  Since the typical
use case now is to back up just a single BackupPC container, a change in
VEID is going to be due to a replacement BackupPC container, such as in
a major upgrade scenario.

If these scripts are in fact used in the future to back up multiple
BackupPC containers, additional work will be required on the script.

bpcdump

diff --git a/bpcdump b/bpcdump
index 2db202c32e8ef1991a9e79b26af440223981850e..90ecd0291c7dd2de53f3544e5b37edadae3172da 100755 (executable)
--- a/bpcdump
+++ b/bpcdump
@@ -147,11 +147,12 @@ else
 fi
 
 # Before we begin writing, remove old backup dirs until we have room.
+# Assume backups for any VE are fair game for removal if space is needed.
 # Other disk contents shall not be removed.
 dstblks=$(df -P "$EXTFS" | grep "$EXTFS" | awk '{ print $4 }')
 while [ $dstblks -le $srcblks ]; do
     info "Only $dstblks free on $EXTFS"
-    oldest=$(cd $EXTFS && eval ls -td "ve${VEID}*" 2>/dev/null | tail -1)
+    oldest=$(cd $EXTFS && eval ls -td "ve[0-9]*" 2>/dev/null | tail -1)
     if [ -z "$oldest" ]; then
       cleanup 1 "out of space: need $srcblks KB, have $dstblks KB"
     elif [ -d "$EXTFS/$oldest" ]; then