]> git.sur5r.net Git - bacula/bacula/commitdiff
Commit Preben's tweak to verify.c
authorKern Sibbald <kern@sibbald.com>
Tue, 21 Dec 2004 22:28:19 +0000 (22:28 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 21 Dec 2004 22:28:19 +0000 (22:28 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1772 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/examples/local_partitions [new file with mode: 0644]
bacula/examples/local_partitions.txt [new file with mode: 0644]
bacula/examples/pool-query.txt [new file with mode: 0644]
bacula/examples/python/EndJob.py [new file with mode: 0644]
bacula/examples/python/NewVolume.py [new file with mode: 0644]
bacula/examples/python/StartJob.py [new file with mode: 0644]
bacula/kernstodo
bacula/src/filed/verify.c

diff --git a/bacula/examples/local_partitions b/bacula/examples/local_partitions
new file mode 100644 (file)
index 0000000..3946146
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# A script to extract the local, permanently mounted, real, filesystems.
+# Tested on Solaris, Linux, IRIX
+#
+# Written by: Peter Eriksson <pen@lysator.liu.se> 2004-12-13
+#
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+export PATH
+
+if [ -f /etc/fstab ]; then
+    awk '($1 ~ /^\/dev/ && $2 ~ /^\// && $4 !~ /noauto/) {print $2}' </etc/fstab | sort
+elif [ -f /etc/vfstab ]; then
+    awk '($1 ~ /^\/dev/ && $2 ~ /^\/dev/ && $3 ~ /^\//) { print $3 }' </etc/vfstab | sort
+else
+    echo 'ERROR: Can not find /etc/fstab or /etc/vfstab' >&2
+    exit 1
+fi
+
+exit 0
diff --git a/bacula/examples/local_partitions.txt b/bacula/examples/local_partitions.txt
new file mode 100644 (file)
index 0000000..cbcbfce
--- /dev/null
@@ -0,0 +1,8 @@
+Date: Mon, 13 Dec 2004 11:52:51 +0100 (MET)
+From: Peter Eriksson <peter@ifm.liu.se>
+To: kern@sibbald.com
+Subject: A script to extract local partitions to backup
+Please find enclosed a small script that perhaps could be included
+in Bacula as an example for how to use the \| feature in FileSets.
+
+See: local_partitions in this directory for the script.
diff --git a/bacula/examples/pool-query.txt b/bacula/examples/pool-query.txt
new file mode 100644 (file)
index 0000000..5e23354
--- /dev/null
@@ -0,0 +1,108 @@
+From: Arno Lehmann <al@its-lehmann.de>
+Organization: IT-Service Lehmann
+Subject: [Bacula-users] Pool information
+Date: Wed, 15 Dec 2004 23:00:50 +0100
+
+Hi all,
+
+I've been playing around a bit and created a small SQL program which 
+tries to give some useful information on pool usage in bacula.
+
+It gives you information like this:
++--------+----+------------+---------+----------+------------+------+
+| Pool   | Nr | GB_Total   | Nr_Full | Nr_Avail | GB_Avail   | V    |
++--------+----+------------+---------+----------+------------+------+
+| D-Full | 10 |    130.002 |       5 |        4 |     90.364 |  87% |
+| Diff   |  5 |     16.217 |       2 |        3 |     12.773 |  52% |
+| Full   | 29 |     63.994 |      23 |        6 |     14.284 |  25% |
+| Incr   |  9 |     32.844 |       7 |        2 |      6.838 |  91% |
+| QIC    | 15 |      3.978 |       1 |       14 |      3.657 |   0% |
++--------+----+------------+---------+----------+------------+------+
+and doesn't break the catalog :-)
+It's in no way optimized, but the impact on the database should not be 
+too big.
+
+Might be helpful sometimes, for example before a holiday.
+
+Here, it runs with MySQL 3.23.33. I'm not sure, but the function STD is 
+probably not ANSI-SQL. According to the MySQL manual, STDDEV is Oracles 
+version, so probably PostgreSQL has something similar... Implementing 
+Standard Deviation is otherwise quite inefficient, I'm afraid...
+
+If someone can improve or enhance the script - go on!
+
+Simply add this to he end of the query.sql file, usually found in 
+/etc/bacula under linux.
+
+Oh, and to make this as clearly as possible:
+Anybody may use, modify, distribute or ignore this script without any 
+limitations.
+
+Arno
+
+
+# 20
+:Show Pool usage
+CREATE TABLE tempal_F(Pool TINYBLOB NOT NULL,
+         Nr_Full INTEGER NOT NULL,GB_Full DECIMAL(9,3) NOT NULL,
+         Cap_Avg DECIMAL(15,0),V DECIMAL(3,2));
+CREATE TABLE tempal_E(Pool TINYBLOB NOT NULL,
+         Nr_Empty INTEGER NOT NULL);
+CREATE TABLE tempal_P(Pool TINYBLOB NOT NULL,Nr_Partly INTEGER NOT NULL,
+         GB_Partly DECIMAL(9,3) NOT NULL);
+CREATE TABLE tempal_T(Pool TINYBLOB NOT NULL,Nr INTEGER NOT NULL,
+         GB_Total DECIMAL(9,3) NOT NULL);
+INSERT INTO tempal_F
+         SELECT Pool.Name,COUNT(*),ROUND(SUM(VolBytes)/1024/1024/1024,3),
+                 AVG(VolBytes),STD(VolBytes)/AVG(VolBytes) FROM Media,Pool
+         WHERE Media.VolStatus='Full' AND Media.PoolId=Pool.PoolId
+         GROUP BY Pool.PoolId;
+INSERT INTO tempal_P
+         SELECT Pool.Name,COUNT(*),ROUND(SUM(VolBytes)/1024/1024/1024,3)
+         FROM Media,Pool
+         WHERE (Media.VolStatus='Append' OR Media.VolStatus='Busy')
+         AND Media.PoolId=Pool.PoolId
+         GROUP BY Pool.PoolId;
+INSERT INTO tempal_E
+         SELECT Pool.Name,COUNT(*)
+         FROM Media,Pool
+         WHERE (Media.VolStatus='Recycle' OR Media.VolStatus='Purged')
+         AND Media.PoolId=Pool.PoolId
+         GROUP BY Pool.PoolId;
+INSERT INTO tempal_T
+         SELECT Pool.Name AS Pool,COUNT(*),
+                 ROUND(SUM(VolBytes)/1024/1024/1024,3)
+         FROM Media,Pool
+         WHERE (Media.VolStatus='Full' OR (Media.Volstatus='Archive')
+         OR (Media.Volstatus='Append') OR (Media.Volstatus='Read-Only')
+         OR (Media.Volstatus='Busy') OR (Media.Volstatus='Used')
+         OR (Media.VolStatus='Disabled') OR (Media.VolStatus='Error'))
+         AND Media.PoolId=Pool.PoolId
+         GROUP BY Pool.PoolId;
+CREATE TABLE tempal_N(Note TINYBLOB);
+INSERT INTO tempal_N
+         VALUES("Only Pools with full and appendable volumes are shown!");
+INSERT INTO tempal_N
+         VALUES("V is a measurement for the reliability of the *guess*");
+INSERT INTO tempal_N
+         VALUES("of average volume capacity.");
+SELECT * FROM tempal_N;
+DROP TABLE IF EXISTS tempal_N;
+SELECT tempal_F.Pool,Nr+Nr_Empty AS Nr,LPAD(GB_Total,10,' ') AS GB_Total,
+         Nr_Full,Nr_Partly+Nr_Empty AS Nr_Avail,
+         LPAD(ROUND(GREATEST(0.0007,(Nr_Partly+Nr_Empty)*
+                 (GB_Full/Nr_Full)-GB_Partly),3),10,' ') AS GB_Avail,
+         CONCAT(LPAD(ROUND(
+                 100-(100*(V+1/(Nr_Full*Nr_Full*Nr_Full))),0),3,' '),'%')
+                 AS V
+         FROM tempal_P,tempal_F,tempal_T,tempal_E
+         WHERE tempal_F.Pool=tempal_T.Pool
+         AND tempal_F.Pool=tempal_P.Pool
+         AND tempal_E.Pool=tempal_T.Pool
+         GROUP BY Pool
+         ORDER BY Pool;
+!DROP TABLE tempal_P,tempal_E,tempal_T,tempal_F;
+
+-- 
+IT-Service Lehmann                    al@its-lehmann.de
+Arno Lehmann                  http://www.its-lehmann.de
diff --git a/bacula/examples/python/EndJob.py b/bacula/examples/python/EndJob.py
new file mode 100644 (file)
index 0000000..00a9247
--- /dev/null
@@ -0,0 +1,11 @@
+import bacula
+
+def EndJob(j):
+    jobid = bacula.get(j, "JobId")
+    client = bacula.get(j, "Client") 
+    bacula.set(jcr=j, JobReport="Python JndJob output: JobId=%d Client=%s.\n" % (jobid, client))
+    if (jobid < 5) :
+       startid = bacula.run(j, "run kernsave")
+       print "Python started jobid=", startid
+
+    return 1
diff --git a/bacula/examples/python/NewVolume.py b/bacula/examples/python/NewVolume.py
new file mode 100644 (file)
index 0000000..b6df07e
--- /dev/null
@@ -0,0 +1,12 @@
+import bacula
+
+def NewVolume(j):
+    jobid = bacula.get(j, "JobId")
+    print "JobId=", jobid
+    client = bacula.get(j, "Client") 
+    print "Client=" + client
+    numvol = bacula.get(j, "NumVols");
+    print "NumVols=", numvol
+    bacula.set(jcr=j, JobReport="Python New Volume set for Job.\n") 
+    bacula.set(jcr=j, VolumeName="TestA-001")
+    return 1
diff --git a/bacula/examples/python/StartJob.py b/bacula/examples/python/StartJob.py
new file mode 100644 (file)
index 0000000..a5de57b
--- /dev/null
@@ -0,0 +1,8 @@
+import bacula
+
+def StartJob(j):
+    jobid = bacula.get(j, "JobId")
+    client = bacula.get(j, "Client")
+    numvols = bacula.get(j, "NumVols") 
+    bacula.set(jcr=j, JobReport="Python StartJob: JobId=%d Client=%s NumVols=%d\n" % (jobid,client,numvols))
+    return 1
index 73e927765b43f1232510ec646c3c8f2305c07065..f1c599691fc8fa57de99acd27713c95e2f8665e9 100644 (file)
@@ -21,6 +21,12 @@ Version 1.37                Kern (see below)
      bimagemgr.
 ##   Consider moving docs to their own project.
 
+Suggestions for Preben:
+- Look at adding Client run command that will use the
+  port opened by the client.
+- Implement WildFile and WildDir to solve problem of 
+  saving only *.doc files.
+
 For 1.37:
 - Create a new GUI chapter explaining all the GUI programs.
 - Tell the "restore" user when browsing is no longer possible.
@@ -31,8 +37,6 @@ For 1.37:
 - Add dump of VolSessionId/Time and FileIndex with bls.
 - Make bootstrap file handle multiple MediaTypes (SD)
 - Add offline command to Bacula console.
-- Implement WildFile and WildDir to solve problem of 
-  saving only *.doc files.
 - Add performance testing hooks
 - Add Python writable variable for changing the Priority.
 - Document that Bootstrap files can be written with cataloging
@@ -40,9 +44,6 @@ For 1.37:
 - Look at adding full Volume and Pool information to a Volume 
   label so that bscan can get *all* the info. 
 - Scratch Pool where the volumes can be re-assigned to any Pool.
-- Fix orphanned buffers:
-   Orphaned buffer:      24 bytes allocated at line 808 of rufus-dir job.c
-   Orphaned buffer:      40 bytes allocated at line 45 of rufus-dir alist.c
 - Upgrade to MySQL 4.1.1 See:  
   http://dev.mysql.com/doc/mysql/en/Server_SQL_mode.html
 - Bug: 
@@ -85,11 +86,6 @@ Regression tests (Jo):
 1.37 Possibilities:
 - Can one write tapes faster with 8192 byte block sizes?
 - Specify a single directory to restore.
-- FileSet implement "default = include" or "default = exclude"
-  as a solution to being able to include only certain files??????
-- Implement Preben's suggestion to add
-  File System Types = ext2, ext3 
-  to FileSets, thus simplifying backup of *all* local partitions.
 - Implement Maximum Job Spool Size
 - Document security problems with the same password for everyone in
   rpm and Win32 releases.
@@ -198,14 +194,9 @@ For 1.37 Testing/Documentation:
 - Minimal autochanger handling in Bacula and in btape.
 - Look into how tar does not save sockets and the possiblity of
   not saving them in Bacula (Martin Simmons reported this).
-- Add All Local Partitions = yes to new style saves.
-- localmounts=`awk '/ext/ { print $2 }' /proc/mounts`   # or whatever
-  find $localmounts -xdev -type s -ls
 - Fix restore jobs so that multiple jobs can run if they
   are not using the same tape(s).
 - Allow the user to select JobType for manual pruning/purging.
-- Look at adding Client run command that will use the
-  port opened by the client.
 - bscan does not put first of two volumes back with all info in
   bscan-test.
 - Implement the FreeBSD nodump flag in chflags.
@@ -1071,3 +1062,10 @@ Block Position: 0
 - Update StartTime if job held in Job Queue.
 - Look at www.nu2.nu/pebuilder as a helper for full windows
   bare metal restore. (done by Scott)
+- Fix orphanned buffers:
+   Orphaned buffer:      24 bytes allocated at line 808 of rufus-dir job.c
+   Orphaned buffer:      40 bytes allocated at line 45 of rufus-dir alist.c
+- Implement Preben's suggestion to add
+  File System Types = ext2, ext3 
+  to FileSets, thus simplifying backup of *all* local partitions.
+
index 883596817ddf7be15dc14b3a66c1917f979ad9cb..797d7f379caf5f9b5baa1d9b25cd8b78ed656df7 100644 (file)
@@ -30,7 +30,7 @@
 #include "filed.h"
 
 static int verify_file(FF_PKT *ff_pkt, void *my_pkt);
-static int read_chksum(BFILE *bfd, CHKSUM *chksum, JCR *jcr, char *fname);
+static int read_chksum(BFILE *bfd, CHKSUM *chksum, JCR *jcr);
 
 /*
  * Find all the requested files and send attributes
@@ -216,7 +216,7 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt)
            jcr->Errors++;
            return 1;
         }
-        read_chksum(&bfd, &chksum, jcr, ff_pkt->fname);
+        read_chksum(&bfd, &chksum, jcr);
         bclose(&bfd);
       }
 
@@ -234,7 +234,7 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt)
            }
            return 1;
         }
-        read_chksum(&bfd, &chksum, jcr, ff_pkt->fname);
+        read_chksum(&bfd, &chksum, jcr);
         bclose(&bfd);
       }
       if (ff_pkt->flags & FO_HFSPLUS) {
@@ -269,7 +269,7 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt)
  * Read checksum of bfd, updating chksum
  * In case of errors we need the job control record and file name.
  */
-int read_chksum(BFILE *bfd, CHKSUM *chksum, JCR *jcr, char *fname)
+int read_chksum(BFILE *bfd, CHKSUM *chksum, JCR *jcr)
 {
    int64_t n;
 
@@ -282,7 +282,7 @@ int read_chksum(BFILE *bfd, CHKSUM *chksum, JCR *jcr, char *fname)
       berrno be;
       be.set_errno(bfd->berrno);
       Jmsg(jcr, M_ERROR, 1, _("Error reading file %s: ERR=%s\n"),
-           fname, be.strerror());
+           jcr->last_fname, be.strerror());
       jcr->Errors++;
       return -1;
    }