[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] Accept "spooldata" flag on bconsole "run" cmd


Hi,

On Tuesday 04 November 2008, Kern Sibbald wrote:
> On Tuesday 04 November 2008 15:44:27 Bastian Friedrich wrote:
> > Hi Eric et al.,
> >
> > On Tuesday 04 November 2008, Eric Bollengier wrote:
> > >
> > > Le Tuesday 04 November 2008 15:14:40 Bastian Friedrich, vous avez 
écrit :
> > > >
> > > > currently, Bacula accepts a "Spool data" flag for storages within job
> > > > ressources, and in Run statements in a schedule. Modifying the
> > > > Spooling statement while calling "run" inside bconsole is not
> > > > available.
> > > >
> > > > Doing so is sensible in a number of cases; often, Full backups may be
> > > > non-spooled, while incrementals should be spooled. Defining a Job as
> > > > "to disk" per default, but enabling spooling when running the same
> > > > job to tape, is quite sensible.
> > > >
> > > > The attached patch
> > > > a) adds a "spooldata={yes|1|no|0}" to the run statement on the
> > > > bconsole CLI
> > >
[...]
>
> A patch that just adds a command line spooling option (no prompts, ...)
> would be something I would be in favor of adding.

The attached version is stripped down to the non-interactive parts only.

Thx & Best regards
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-28
f: +49 (0) 761-45684-10        www.collax.com

Geschäftsführer: William K. Hite / Boris Nalbach
AG München HRB 158898 . Ust.-IdNr: DE 814464942
\ Runtime Error 6D at 417A:32CF: Incompetent User.
--- bacula-2.5-20081014svn/src/dird/ua_run.c.ori	2008-07-17 22:53:01.000000000 +0200
+++ bacula-2.5-20081014svn/src/dird/ua_run.c	2008-11-04 14:30:04.000000000 +0100
@@ -60,6 +60,8 @@
    int files;
    bool cloned;
    bool mod;
+   bool spool_data;
+   bool spool_data_set;
 
    /* Methods */
    run_ctx() { memset(this, 0, sizeof(run_ctx)); 
@@ -174,6 +176,7 @@
 start_job:
       Dmsg3(100, "JobId=%u using pool %s priority=%d\n", (int)jcr->JobId, 
             jcr->pool->name(), jcr->JobPriority);
+      Dmsg1(900, "Running a job; its spool_data = %d\n", jcr->spool_data);
       JobId = run_job(jcr);
       Dmsg4(100, "JobId=%u NewJobId=%d using pool %s priority=%d\n", (int)jcr->JobId, 
             JobId, jcr->pool->name(), jcr->JobPriority);
@@ -1008,6 +1025,7 @@
       "backupclient",                 /* 23 */
       "restoreclient",                /* 24 */
       "pluginoptions",                /* 25 */
+      "spooldata",                    /* 26 */
       NULL};
 
 #define YES_POS 14
@@ -1021,6 +1039,7 @@
    rc.fileset_name = NULL;
    rc.verify_job_name = NULL;
    rc.previous_job_name = NULL;
+   rc.spool_data_set = 0;
 
 
    for (i=1; i<ua->argc; i++) {
@@ -1225,6 +1244,27 @@
                }
                kw_ok = true;
                break;
+            case 26: /* spooldata */
+	       if (rc.spool_data_set) {
+                  ua->send_msg(_("Spool flag specified twice.\n"));
+                  return false;
+	       }
+	       if ((strncasecmp(ua->argv[i], "yes", strlen(ua->argv[i])) == 0) ||
+	           (strncasecmp(ua->argv[i], _("yes"), strlen(ua->argv[i])) == 0) ||
+	           (strncmp(ua->argv[i], "1", strlen(ua->argv[i])) == 0)) {
+	          rc.spool_data = 1;
+	          rc.spool_data_set = 1;
+		  kw_ok = true;
+	       } else if ((strncasecmp(ua->argv[i], "no", strlen(ua->argv[i])) == 0) ||
+	           (strncasecmp(ua->argv[i], _("no"), strlen(ua->argv[i])) == 0) ||
+	           (strncmp(ua->argv[i], "0", strlen(ua->argv[i])) == 0)) {
+	          rc.spool_data = 0;
+	          rc.spool_data_set = 1;
+		  kw_ok = true;
+               } else {
+                  ua->send_msg(_("Invalid spooldata flag.\n"));
+               }
+               break;
             default:
                break;
             }
@@ -1305,6 +1343,11 @@
    }
    Dmsg1(100, "Using pool %s\n", rc.pool->name());
 
+   if (rc.spool_data_set) {
+      rc.job->spool_data = rc.spool_data;
+   }
+   Dmsg1(900, "Spooling data: %s\n", (rc.job->spool_data ? "Yes" : "No"));
+
    if (rc.store_name) {
       rc.store->store = GetStoreResWithName(rc.store_name);
       pm_strcpy(rc.store->store_source, _("command line"));
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilot Consulting.