]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Add job report indication of whether or not VSS and Encryption were
authorKern Sibbald <kern@sibbald.com>
Mon, 4 Dec 2006 13:00:01 +0000 (13:00 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 4 Dec 2006 13:00:01 +0000 (13:00 +0000)
     used by the FD.
kes  Modify sparseBlock variable name to make the code clearer.
kes  Add more sparse tests to regress using gigaslam sparse file
     generator.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3745 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/backup.c
bacula/src/filed/backup.c
bacula/src/filed/job.c
bacula/src/filed/pythonfd.c
bacula/src/jcr.h
bacula/technotes-1.39

index 641d8fc9c59ef1b820b2dca1f7e934631010ad08..1975e5b078789b50b0aec3c66202939166183b5d 100644 (file)
@@ -53,8 +53,11 @@ static char storaddr[]  = "storage address=%s port=%d ssl=%d\n";
 static char OKbackup[]   = "2000 OK backup\n";
 static char OKstore[]    = "2000 OK storage\n";
 static char EndJob[]     = "2800 End Job TermCode=%d JobFiles=%u "
+                           "ReadBytes=%lld JobBytes=%lld Errors=%u "  
+                           "VSS=%d Encrypt=%d\n";
+/* Pre 1.39.29 (04Dec06) EndJob */
+static char OldEndJob[]  = "2800 End Job TermCode=%d JobFiles=%u "
                            "ReadBytes=%lld JobBytes=%lld Errors=%u\n";
-
 /* 
  * Called here before the job is run to do the job
  *   specific setup.
@@ -259,12 +262,17 @@ int wait_for_job_termination(JCR *jcr)
    bool fd_ok = false;
    uint32_t JobFiles, Errors;
    uint64_t ReadBytes, JobBytes;
+   int VSS = 0;
+   int Encrypt = 0;
 
    set_jcr_job_status(jcr, JS_Running);
    /* Wait for Client to terminate */
    while ((n = bget_dirmsg(fd)) >= 0) {
-      if (!fd_ok && sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
-          &ReadBytes, &JobBytes, &Errors) == 5) {
+      if (!fd_ok && 
+          (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
+              &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 ||
+           sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
+                 &ReadBytes, &JobBytes, &Errors) == 5)) {
          fd_ok = true;
          set_jcr_job_status(jcr, jcr->FDJobStatus);
          Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus);
@@ -292,6 +300,8 @@ int wait_for_job_termination(JCR *jcr)
       jcr->Errors = Errors;
       jcr->ReadBytes = ReadBytes;
       jcr->JobBytes = JobBytes;
+      jcr->VSS = VSS;
+      jcr->Encrypt = Encrypt;
    } else {
       Jmsg(jcr, M_FATAL, 0, _("No Job status returned from FD.\n"));
    }
@@ -446,6 +456,8 @@ void backup_cleanup(JCR *jcr, int TermCode)
 "  SD Bytes Written:       %s (%sB)\n"
 "  Rate:                   %.1f KB/s\n"
 "  Software Compression:   %s\n"
+"  VSS:                    %s\n"
+"  Encryption:             %s\n"
 "  Volume name(s):         %s\n"
 "  Volume Session Id:      %d\n"
 "  Volume Session Time:    %d\n"
@@ -478,6 +490,8 @@ void backup_cleanup(JCR *jcr, int TermCode)
         edit_uint64_with_suffix(jcr->SDJobBytes, ec6),
         (float)kbps,
         compress,
+        jcr->VSS?"yes":"no",
+        jcr->Encrypt?"yes":"no",
         jcr->VolumeName,
         jcr->VolSessionId,
         jcr->VolSessionTime,
index 62ebcf6fcf73737205f994f64861568828c2bbb3..343552ed6c1bb2dd75988c931f8598a43006a304 100644 (file)
@@ -595,7 +595,8 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level)
  * We return 1 on sucess and 0 on errors.
  *
  * ***FIXME***
- * We use ff_pkt->statp.st_size when FO_SPARSE.
+ * We use ff_pkt->statp.st_size when FO_SPARSE to know when to stop
+ *  reading.
  * Currently this is not a problem as the only other stream, resource forks,
  * are not handled as sparse files.
  */
@@ -720,23 +721,23 @@ int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
     * Read the file data
     */
    while ((sd->msglen=(uint32_t)bread(&ff_pkt->bfd, rbuf, rsize)) > 0) {
-      bool sparseBlock = false;
 
       /* Check for sparse blocks */
       if (ff_pkt->flags & FO_SPARSE) {
          ser_declare;
+         bool haveBlock = true;
          if (sd->msglen == rsize &&
              fileAddr+sd->msglen < (uint64_t)ff_pkt->statp.st_size ||
              ((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) &&
                (uint64_t)ff_pkt->statp.st_size == 0)) {
-            sparseBlock = is_buf_zero(rbuf, rsize);
+            haveBlock = !is_buf_zero(rbuf, rsize);
          }
-         if (!sparseBlock) {
+         if (haveBlock) {
             ser_begin(wbuf, SPARSE_FADDR_SIZE);
             ser_uint64(fileAddr);     /* store fileAddr in begin of buffer */
          }
          fileAddr += sd->msglen;      /* update file address */
-         if (sparseBlock) {
+         if (!haveBlock) {
             continue;                 /* skip block of zeros */
          }
       }
index f6cb4a91a39397dae3c6a3bf45a32d890db3cbd8..6ceacea8966976aaffe7f178ca7466efa296b1a9 100644 (file)
@@ -137,7 +137,8 @@ static char OKstore[]     = "2000 OK storage\n";
 static char OKjob[]       = "2000 OK Job %s (%s) %s,%s,%s";
 static char OKsetdebug[]  = "2000 OK setdebug=%d\n";
 static char BADjob[]      = "2901 Bad Job\n";
-static char EndJob[]      = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s JobBytes=%s Errors=%u\n";
+static char EndJob[]      = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s"
+                            " JobBytes=%s Errors=%u VSS=%d Encrypt=%d\n";
 static char OKRunBefore[] = "2000 OK RunBefore\n";
 static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n";
 static char OKRunAfter[]  = "2000 OK RunAfter\n";
@@ -1269,7 +1270,7 @@ static int storage_cmd(JCR *jcr)
 
 
 /*
- * Do a backup. For now, we handle only Full and Incremental.
+ * Do a backup.
  */
 static int backup_cmd(JCR *jcr)
 {
@@ -1278,17 +1279,17 @@ static int backup_cmd(JCR *jcr)
    int ok = 0;
    int SDJobStatus;
    char ed1[50], ed2[50];
+   bool bDoVSS = false;
 
 #if defined(WIN32_VSS)
    // capture state here, if client is backed up by multiple directors
    // and one enables vss and the other does not then enable_vss can change
    // between here and where its evaluated after the job completes.
-   bool bDoVSS = false;
-
    bDoVSS = g_pVSSClient && enable_vss;
-   if (bDoVSS)
+   if (bDoVSS) {
       /* Run only one at a time */
       P(vss_mutex);
+   }
 #endif
 
    set_jcr_job_status(jcr, JS_Blocked);
@@ -1460,7 +1461,8 @@ cleanup:
 
    bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
       edit_uint64(jcr->ReadBytes, ed1),
-      edit_uint64(jcr->JobBytes, ed2), jcr->Errors);
+      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, (int)bDoVSS, 
+      jcr->pki_encrypt);
    Dmsg1(110, "End FD msg: %s\n", dir->msg);
    
    return 0;                          /* return and stop command loop */
index 8e4469956d68ad8222c194ed2b6395d5913623aa..0ea3fc28920adfbddb93bacacfc56bdcffa3c7fc 100644 (file)
@@ -201,7 +201,7 @@ static PyObject *job_write(PyObject *self, PyObject *args)
    char *text = NULL;
 
    if (!PyArg_ParseTuple(args, "s:write", &text)) {
-      Dmsg0(000, "Parse tuple error in job_write\n");
+      Pmsg0(000, "Parse tuple error in job_write\n");
       return NULL;
    }
    if (text) {
@@ -219,7 +219,7 @@ static PyObject *set_job_events(PyObject *self, PyObject *arg)
 
    Dmsg0(100, "In set_job_events.\n");
    if (!PyArg_ParseTuple(arg, "O", &eObject)) {
-      Dmsg0(000, "Parse error looking for Object argument\n");
+      Pmsg0(000, "Parse error looking for Object argument\n");
       return NULL;
    }
    jcr = get_jcr_from_PyObject(self);
@@ -268,7 +268,7 @@ int generate_job_event(JCR *jcr, const char *event)
    if (result == NULL) {
       if (PyErr_Occurred()) {
          PyErr_Print();
-         Dmsg1(000, "Error in Python method %s\n", event);
+         Pmsg1(000, "Error in Python method %s\n", event);
       }
    } else {
       stat = 1;
index 916f6b94163d56fc38fc8c811658625819c7e06a..4380efc723397c2b59e64e67fa095d2ab7dea2da 100644 (file)
@@ -249,6 +249,8 @@ public:
    bool needs_sd;                     /* set if SD needed by Job */
    bool cloned;                       /* set if cloned */
    bool unlink_bsr;                   /* Unlink bsr file created */
+   bool VSS;                          /* VSS used by FD */
+   bool Encrypt;                      /* Encryption used by FD */
 #endif /* DIRECTOR_DAEMON */
 
 
index a609f9044cb90f714d10e3a7aebcc93e43cffebc..aa65c156e0a2df6a9b652f2c7e37ae6cffbc526e 100644 (file)
@@ -2,6 +2,11 @@
 
 General:
 04Dec06
+kes  Add job report indication of whether or not VSS and Encryption were
+     used by the FD.
+kes  Modify sparseBlock variable name to make the code clearer.
+kes  Add more sparse tests to regress using gigaslam sparse file
+     generator.
 kes  Enable data encryption code.
 kes  Add gigaslam.c to src/tools. It creates a 1GB file that contains
      only two blocks -- i.e. it is a real sparse file.