On Tue, Sep 21, 2010 at 10:12:26AM +0100, Graham Keeling wrote:
> On Tue, Sep 21, 2010 at 10:10:08AM +0100, Graham Keeling wrote:
> > OK, that sounds easy enough.
> > 
> > Attached is my patch to bacula-5.0.3 (completely untested at the moment).
> > 
> > I've made two new options:
> > truncondiff
> > trunconincr
> > I will report on whether it works in a while.
> 
> Sorry, here is the patch...

It turns out that it didn't work, because the decision on what to set
context->truncate_logs to was being made before the plugin options were parsed.

This also means that 'notrunconfull' has been broken up until now.

I have fixed it in the new patch attached to this email.
Index: src/win32/filed/plugins/exchange-fd.c
===================================================================
RCS file: /cvs/netpilot/GPL/bacula-5.0.3/WORK/src/win32/filed/plugins/exchange-fd.c,v
retrieving revision 1.1
diff -u -r1.1 exchange-fd.c
--- src/win32/filed/plugins/exchange-fd.c	27 Aug 2010 09:53:59 -0000	1.1
+++ src/win32/filed/plugins/exchange-fd.c	21 Sep 2010 12:53:52 -0000
@@ -166,7 +166,6 @@
    context = (exchange_fd_context_t *)ctx->pContext;
    context->bpContext = ctx;
    context->job_since = 0;
-   context->notrunconfull_option = false;
    bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&JobId);
    _DebugMessage(0, "newPlugin JobId=%d\n", JobId);
    bfuncs->registerBaculaEvents(ctx, 1, 2, 0);
@@ -224,27 +223,6 @@
       bfuncs->getBaculaValue(ctx, bVarAccurate, (void *)&accurate);
       context->accurate = accurate;
       context->job_type = JOB_TYPE_BACKUP;
-      // level should have been specified by now - check it
-      // if level is D or I, since should have been specified too
-      switch (context->job_level)
-      {
-      case 'F':
-         if (context->notrunconfull_option) {
-            context->truncate_logs = false;
-         } else {
-            context->truncate_logs = true;
-         }
-         break;
-      case 'D':
-         context->truncate_logs = false;
-         break;
-      case 'I':
-         context->truncate_logs = false;
-         break;
-      default:
-         _DebugMessage(0, "Invalid job level %c\n", context->job_level);
-         return bRC_Error;
-      }
       break;
    case bEventEndBackupJob:
       _DebugMessage(0, "BackupEnd\n");
@@ -280,12 +258,38 @@
       char *plugin_name = strtok((char *)command, ":");
       char *path = strtok(NULL, ":");
       char *option;
+
+      switch(context->job_level)
+      {
+         case 'F':
+            context->truncate_logs = true;
+            break;
+         case 'D':
+         case 'I':
+            context->truncate_logs = false;
+            break;
+         default:
+            _DebugMessage(0, "Invalid job level %c\n", context->job_level);
+            return bRC_Error;
+      }
+
       while ((option = strtok(NULL, ":")) != NULL)
       {
          _DebugMessage(100, "option %s\n", option);
-         if (stricmp(option, "notrunconfull") == 0)
-         {
-            context->notrunconfull_option = true;
+         if (stricmp(option, "notrunconfull") == 0) {
+            if(context->job_level == 'F') {
+                context->truncate_logs = false;
+            }
+         }
+         else if (stricmp(option, "truncondiff") == 0) {
+            if(context->job_level == 'D') {
+                context->truncate_logs = true;
+            }
+         }
+         else if (stricmp(option, "trunconincr") == 0) {
+            if(context->job_level == 'I') {
+                context->truncate_logs = true;
+            }
          }
          else
          {
Index: src/win32/filed/plugins/exchange-fd.h
===================================================================
RCS file: /cvs/netpilot/GPL/bacula-5.0.3/WORK/src/win32/filed/plugins/exchange-fd.h,v
retrieving revision 1.1
diff -u -r1.1 exchange-fd.h
--- src/win32/filed/plugins/exchange-fd.h	27 Aug 2010 09:53:59 -0000	1.1
+++ src/win32/filed/plugins/exchange-fd.h	21 Sep 2010 12:53:52 -0000
@@ -131,7 +131,6 @@
    int job_type;
    int job_level;
    time_t job_since;
-   bool notrunconfull_option;
    bool truncate_logs;
    bool accurate;
 };
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to