Amanda-Users

Re: autoflush off, but still flushing to tape after amdump

2006-10-23 17:07:06
Subject: Re: autoflush off, but still flushing to tape after amdump
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: "Lee, Raymond" <Raymond.Lee AT qwest DOT com>
Date: Mon, 23 Oct 2006 17:04:46 -0400
Lee,

Could you start from http://www.iro.umontreal.ca/~martinea/amanda/amanda-2.5.1p1-20061020.tar.gz
and apply the attached patch.
The patch will send the -o options to taper/dumper and chunker process.
changer will not get the options.

run: amdump DailySet1 -o tapedev=/dev/null -o tpchanger=""

The -o tpchanger="" is to disable  the use of the changer.

Let me know if it work.

Jean-Louis

Lee, Raymond wrote:
H,

The -o flags are not sent to all subprocess. the taper process never get your tapedev overwrite.
I will try to make a patch available for that soon.

Are you using a changer? It might need fix too.



Hi Jean-Louis.  Yes, I am using a tape changer.  Here's an excerpt from
my amanda.conf.

tpchanger "/usr/local/libexec/chg-zd-mtx"
tapedev "/dev/rmt/0cbn"
changerfile "/usr/local/etc/amanda/DailySet1/chg-zd-mtx"
changerdev "/dev/scsi/changer/c2t0d0"


Thanks,
Ray


Jean-Louis

Lee, Raymond wrote:
Thanks, Sven. That's exactly what I'd like to do.
However, when I do
"amdump DailySet1 -o tapedev=/dev/null" option and don't change
"tapedev=/dev/rmt/0cbn" in amanda.conf, amdump is still flushing to
tape. If I change it in amanda.conf, then amdump won't
flush to tape.
But then I have to change it back to /dev/rmt/0cbn before I
run amflush.
I noticed that the configuration overwrite section of the
man page says
"Most commands allow any amanda.conf configuration parameter to be
overridden on the command line with -o option." Is the
tapedev option
not able to be overwritten or do I have the syntax wrong?

Also, after I run amflush, I still see empty directories on
my holding
disk.  I have "usetimestamps yes" in amanda.conf, so the empty
directories are named like "20061023123346".  The email I get after
amflush finishes says:

        *** THE DUMPS DID NOT FINISH PROPERLY!

        The dumps were flushed to tape DailySet1-GCB709S1.
        The next tape Amanda expects to use is: a new tape.
        .
        .
        .
        .
        NOTES:
          taper: tape DailySet1-GCB709S1 kb 237632 fm 2 [OK]
        
> Is amflush supposed to delete that directory after flushing?  Is
that
the reason why the email reported that the dump didn't
finish properly?
Thanks,
Ray


This communication is the property of Qwest and may contain
confidential or
privileged information. Unauthorized use of this
communication is strictly
prohibited and may be unlawful. If you have received this
communication
in error, please immediately notify the sender by reply
e-mail and destroy
all copies of the communication and any attachments.


diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1p1.new/server-src/conffile.c 
amanda-2.5.1p1.new.taper/server-src/conffile.c
--- amanda-2.5.1p1.new/server-src/conffile.c    2006-10-20 07:45:42.000000000 
-0400
+++ amanda-2.5.1p1.new.taper/server-src/conffile.c      2006-10-23 
16:46:42.000000000 -0400
@@ -2302,6 +2302,31 @@ parse_server_conf(
     }
 }
 
+char **
+get_config_options(
+    int first)
+{
+    char             **config_options;
+    char            **config_option;
+    command_option_t  *command_options;
+    int                nb_server_options = 0;
+
+    for(command_options = server_options; command_options->name != NULL;
+       command_options++) {
+       nb_server_options++;
+    }
+    config_options = alloc((first+nb_server_options+1)*SIZEOF(char *));
+    for(command_options = server_options,
+        config_option = config_options + first;
+       command_options->name != NULL; command_options++) {
+       *config_option = vstralloc("-o", command_options->name, "=",
+                                  command_options->value, NULL);
+       config_option++;
+    }
+    *config_option = NULL;
+    return(config_options);
+}
+
 void
 report_bad_conf_arg(void)
 {
diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1p1.new/server-src/conffile.h 
amanda-2.5.1p1.new.taper/server-src/conffile.h
--- amanda-2.5.1p1.new/server-src/conffile.h    2006-07-26 11:17:37.000000000 
-0400
+++ amanda-2.5.1p1.new.taper/server-src/conffile.h      2006-10-23 
16:15:09.000000000 -0400
@@ -313,6 +313,7 @@ extern int num_holdingdisks;
 
 void parse_server_conf(int parse_argc, char **parse_argv, int *new_argc,
                       char ***new_argv);
+char **get_config_options(int);
 void report_bad_conf_arg(void);
 void free_server_config(void);
 
diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1p1.new/server-src/driverio.c 
amanda-2.5.1p1.new.taper/server-src/driverio.c
--- amanda-2.5.1p1.new/server-src/driverio.c    2006-08-24 06:24:50.000000000 
-0400
+++ amanda-2.5.1p1.new.taper/server-src/driverio.c      2006-10-23 
16:15:09.000000000 -0400
@@ -84,7 +84,8 @@ void
 startup_tape_process(
     char *taper_program)
 {
-    int fd[2];
+    int    fd[2];
+    char **config_options;
 
     if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
        error("taper pipe: %s", strerror(errno));
@@ -110,7 +111,10 @@ startup_tape_process(
        aclose(fd[0]);
        if(dup2(fd[1], 0) == -1 || dup2(fd[1], 1) == -1)
            error("taper dup2: %s", strerror(errno));
-       execle(taper_program, "taper", config_name, (char *)0, safe_env());
+       config_options = get_config_options(2);
+       config_options[0] = "taper";
+       config_options[1] = config_name;
+       execve(taper_program, config_options, safe_env());
        error("exec %s: %s", taper_program, strerror(errno));
        /*NOTREACHED*/
 
@@ -126,7 +130,8 @@ startup_dump_process(
     dumper_t *dumper,
     char *dumper_program)
 {
-    int fd[2];
+    int    fd[2];
+    char **config_options;
 
     if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
        error("%s pipe: %s", dumper->name, strerror(errno));
@@ -142,11 +147,10 @@ startup_dump_process(
        aclose(fd[0]);
        if(dup2(fd[1], 0) == -1 || dup2(fd[1], 1) == -1)
            error("%s dup2: %s", dumper->name, strerror(errno));
-       execle(dumper_program,
-              dumper->name ? dumper->name : "dumper",
-              config_name,
-              (char *)0,
-              safe_env());
+       config_options = get_config_options(2);
+       config_options[0] = dumper->name ? dumper->name : "dumper",
+       config_options[1] = config_name;
+       execve(dumper_program, config_options, safe_env());
        error("exec %s (%s): %s", dumper_program,
              dumper->name, strerror(errno));
         /*NOTREACHED*/
@@ -191,7 +195,8 @@ startup_chunk_process(
     chunker_t *chunker,
     char *chunker_program)
 {
-    int fd[2];
+    int    fd[2];
+    char **config_options;
 
     if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
        error("%s pipe: %s", chunker->name, strerror(errno));
@@ -209,11 +214,10 @@ startup_chunk_process(
            error("%s dup2: %s", chunker->name, strerror(errno));
            /*NOTREACHED*/
        }
-       execle(chunker_program,
-              chunker->name ? chunker->name : "chunker",
-              config_name,
-              (char *)0,
-              safe_env());
+       config_options = get_config_options(2);
+       config_options[0] = chunker->name ? chunker->name : "chunker",
+       config_options[1] = config_name;
+       execve(chunker_program, config_options, safe_env());
        error("exec %s (%s): %s", chunker_program,
              chunker->name, strerror(errno));
         /*NOTREACHED*/
diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1p1.new/server-src/taper.c 
amanda-2.5.1p1.new.taper/server-src/taper.c
--- amanda-2.5.1p1.new/server-src/taper.c       2006-10-20 09:41:58.000000000 
-0400
+++ amanda-2.5.1p1.new.taper/server-src/taper.c 2006-10-23 16:56:06.000000000 
-0400
@@ -2119,6 +2118,10 @@ tape_writer_side(
     syncpipe_init(getp, putp);
     tape_started = 0;
     idlewait = times_zero;
+    if (tapedev != NULL) {
+       tapedev = stralloc(tapedev);
+    }
+
 
     while (1) {
        startclock();