Nathan,

I was too fast to write the first patch, and you are completely right.

I committed the attached patch,now amflush use the --no-dump argument 
and driver merge both 'nodump' and '--no-dump'.

Jean-Louis

On 18/11/17 01:11 AM, Nathan Stratton Treadway wrote:
> On Thu, Nov 16, 2017 at 10:15:28 -0500, Jean-Louis Martineau wrote:
> > Nathan,
> >
> > Try this patch.
> >
> > run: amdump --no-dump --no-flush CONFIG
> > Will do all scheduled vault to the vault-storage
>
> [...]
>
> > diff --git a/server-src/driver.c b/server-src/driver.c
> > index 351494a..fd01296 100644
> > --- a/server-src/driver.c
> > +++ b/server-src/driver.c
> > @@ -107,6 +107,10 @@ static int taper_started = 0;
> > static int nb_storage;
> > static cmddatas_t *cmddatas = NULL;
> >
> > +static int no_dump = FALSE;
> > +//static int no_flush = FALSE;
> > +static int no_vault = FALSE;
> > +
> > static int wait_children(int count);
> > static void wait_for_children(void);
> > static void allocate_bandwidth(netif_t *ip, unsigned long kps);
> > @@ -305,6 +309,30 @@ main(
> > }
> >
> > if (argc > 2) {
> > + if (g_str_equal(argv[2], "--no-dump")) {
> > + no_dump = TRUE;
> > + argv++;
> > + argc--;
> > + }
> > + }
>
> I noticed when reviewing the log file from my "amdump --no-dump" run
> that there were still "INFO dumper" lines in there, from when the
> dumpers start up at the beginning of the run and when they terminate at
> the end (with no activity in between).
>
> I wondered if the dumpers should be getting started at all when no_dump
> is true, and took a look at driver.c to see how the dumpers were getting
> kicked off -- and discovered that driver.c already implements a "nodump"
> option, and that indeed if that option is enabled, the dumper processes
> are not spawned.
>
> (I see that this "nodump" option is used by Amflush.pm 
> <http://Amflush.pm>.)
>
> Anyway, I guess the question is whether it makes sense to merge the new
> --no-dump and original nodump options for driver.c, at least as far as
> having one internal boolean variable to handle both -- or, if not,
> if there are any places where the code currently checks for !nodump
> where !no_dump should be treated equivalently?
>
> Nathan
>
>
>
> ----------------------------------------------------------------------------
> Nathan Stratton Treadway - natha...@ontko.com - Mid-Atlantic region
> Ray Ontko & Co. - Software consulting services - http://www.ontko.com/ 
> <http://www.ontko.com/>
> GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt 
> <http://www.ontko.com/~nathanst/gpg_key.txt> 
> ID: 1023D/ECFB6239
> Key fingerprint = 6AD8 485E 20B9 5C71 231C 0C32 15F3 ADCD ECFB 6239
This message is the property of CARBONITE, INC. and may contain confidential or 
privileged information.
If this message has been delivered to you by mistake, then do not copy or 
deliver this message to anyone.  Instead, destroy it and notify me by reply 
e-mail
diff --git a/perl/Amanda/Amflush.pm b/perl/Amanda/Amflush.pm
index f2f8aa2..8323733 100644
--- a/perl/Amanda/Amflush.pm
+++ b/perl/Amanda/Amflush.pm
@@ -317,10 +317,9 @@ sub run {
 	POSIX::close($driver_pipe);
 	POSIX::dup2(fileno($self->{'amdump_log'}), 1);
 	POSIX::dup2(fileno($self->{'amdump_log'}), 2);
-	debug("exec: " . join(' ', $driver, $self->{'config'}, "nodump", "--no-vault",
-				   @log_filename, @config_overrides));
+	debug("exec: " . join(' ', $driver, $self->{'config'}, @log_filename, "--no-dump", "--no-vault", @config_overrides));
 	close($self->{'amdump_log'});
-	exec $driver, $self->{'config'}, "nodump", "--no-vault", @log_filename,
+	exec $driver, $self->{'config'}, @log_filename, "--no-dump", "--no-vault", 
 		      @config_overrides;
 	die "Could not exec $driver: $!";
     }
diff --git a/server-src/driver.c b/server-src/driver.c
index fd01296..1625d06 100644
--- a/server-src/driver.c
+++ b/server-src/driver.c
@@ -79,8 +79,6 @@ static off_t total_disksize;
 static char *dumper_program;
 static char *chunker_program;
 static int  inparallel;
-static int nodump = 0;
-static int novault = 0;
 static storage_t *storage;
 static int conf_max_dle_by_volume;
 static int conf_taperalgo;
@@ -274,22 +272,6 @@ main(
     set_config_overrides(cfg_ovr);
     argv0 = argv[0];
 
-    if(argc > 2) {
-        if(g_str_equal(argv[2], "nodump")) {
-            nodump = 1;
-	    argv++;
-	    argc--;
-        }
-    }
-
-    if(argc > 2) {
-        if(g_str_equal(argv[2], "--no-vault")) {
-            novault = 1;
-	    argv++;
-	    argc--;
-        }
-    }
-
     log_filename = NULL;
     if (argc > 3) {
 	if (g_str_equal(argv[2], "--log-filename")) {
@@ -393,7 +375,7 @@ main(
 
     /* check that we don't do many dump in a day and usetimestamps is off */
     if(strlen(driver_timestamp) == 8) {
-	if (!nodump) {
+	if (!no_dump) {
 	    char *conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
 	    char *logfile    = g_strjoin(NULL, conf_logdir, "/log.",
 					 driver_timestamp, ".0", NULL);
@@ -533,7 +515,7 @@ main(
     nb_storage = startup_dump_tape_process(taper_program, no_taper);
 
     /* fire up the dumpers now while we are waiting */
-    if(!nodump) startup_dump_processes(dumper_program, inparallel, driver_timestamp);
+    if(!no_dump) startup_dump_processes(dumper_program, inparallel, driver_timestamp);
 
     /*
      * Read schedule from stdin.  Usually, this is a pipe from planner,
@@ -587,7 +569,7 @@ main(
 	   getconf_str(CNF_DUMPORDER));
     fflush(stdout);
 
-    schedule_done = nodump;
+    schedule_done = no_dump;
     force_flush = 0;
 
     short_dump_state();
@@ -715,7 +697,7 @@ main(
     event_loop(0);
     short_dump_state();
 
-    if (!novault) {
+    if (!no_vault) {
 	/* close device for storage */
 	for (taper = tapetable; taper < tapetable+nb_storage ; taper++) {
 	    if (taper->fd >= 0 && !taper->vault_storage) {
@@ -751,7 +733,7 @@ main(
            walltime_str(curclock()));
     fflush(stdout);
 
-    if(!nodump) {
+    if(!no_dump) {
 	for(dumper = dmptable; dumper < dmptable + inparallel; dumper++) {
 	    if(dumper->fd >= 0)
 		dumper_cmd(dumper, QUIT, NULL, NULL);
@@ -871,7 +853,7 @@ kill_children(int signal)
     dumper_t *dumper;
     taper_t  *taper;
 
-    if(!nodump) {
+    if(!no_dump) {
         for(dumper = dmptable; dumper < dmptable + inparallel; dumper++) {
 	    if (!dumper->down && dumper->pid > 1) {
 		g_printf(_("driver: sending signal %d to %s pid %u\n"), signal,
@@ -909,7 +891,7 @@ wait_for_children(void)
     dumper_t *dumper;
     taper_t  *taper;
 
-    if(!nodump) {
+    if(!no_dump) {
 	for(dumper = dmptable; dumper < dmptable + inparallel; dumper++) {
 	    if (dumper->pid > 1 && dumper->fd >= 0) {
 		dumper_cmd(dumper, QUIT, NULL, NULL);
@@ -2766,7 +2748,7 @@ handle_taper_result(
              * cancel one.
              */
 	    taper_started = 1;
-            if(!nodump) {
+            if(!no_dump) {
                 log_add(L_WARNING,
                         _("going into degraded mode because of taper component error."));
 	    }
@@ -4248,7 +4230,7 @@ read_flush(
     unlock_cmdfile(cmddatas);
 
     start_a_flush();
-    if (!nodump) {
+    if (!no_dump) {
 	schedule_ev_read = event_create((event_id_t)0, EV_READFD,
 					  read_schedule, NULL);
 	event_activate(schedule_ev_read);

Reply via email to