Jon,
Can you try the attached patch.
Jean-Louis
Jon LaBadie wrote:
I haven't used amfetchdump before and thought I'd try its
inventory mode, option -i. As I understand it, with this
option amfetchdump will examine the tapes (vtapes in my
case) and generate output showing the contents in a
syntax similar to logfile entries.
If I enter amfetchdump -i mylog tstvt
It gets to the virtual tape changer, slot 1 and seems to
try to start an inventory. But after a few seconds I
get the message:
Scanning vtape01 (slot 1)
amfetchdump: error reading file header: Input/output error
If I actually try to recover a dump from a specific host/date,
things seem to work properly.
When I looked at the tape in slot 1, due to wrap-around the
tape list, it was the second tape of an amdump run. It contained
only the last couple of chunks of a dump started on the last
tape in the changer.
So I wonder if this scenario, first tape in the changer starts
in the middle of a split file sequence, was considered in the
logic of amfetchdump's -i option. Have others gotten a successful
inventory under these conditions?
diff -u -r --show-c-function --new-file
--exclude-from=/home/martinea/src.orig/amanda.diff
--ignore-matching-lines='$Id:' amanda-2.5.2p1/restore-src/restore.c
amanda-2.5.2p1.inventory/restore-src/restore.c
--- amanda-2.5.2p1/restore-src/restore.c 2007-06-06 19:19:20.000000000
-0400
+++ amanda-2.5.2p1.inventory/restore-src/restore.c 2007-06-19
15:42:41.000000000 -0400
@@ -1451,6 +1451,16 @@ search_a_tape(
}
dbprintf(("current tapefile_idx = %d\n", tapefile_idx));
+ /* if given a log file, print an inventory of stuff found */
+ if(flags->inventory_log) {
+ if(!strcmp(flags->inventory_log, "-")) logstream = stdout;
+ else if((logstream = fopen(flags->inventory_log, "w+")) == NULL) {
+ error("Couldn't open log file %s for writing: %s",
+ flags->inventory_log, strerror(errno));
+ /*NOTREACHED*/
+ }
+ }
+
/* if we know where we're going, fastforward there */
if(flags->fsf && !isafile){
/* If we have a tapelist entry, filenums will be store there */
@@ -1501,7 +1511,7 @@ search_a_tape(
tempdump = alloc(SIZEOF(dumplist_t));
tempdump->file = alloc(SIZEOF(dumpfile_t));
tempdump->next = NULL;
- memcpy(tempdump->file, &file, SIZEOF(dumpfile_t));
+ memcpy(tempdump->file, file, SIZEOF(dumpfile_t));
if(tape_seen->files){
fileentry = tape_seen->files;
while (fileentry->next != NULL)
@@ -1660,6 +1670,9 @@ search_a_tape(
fflush(logstream);
}
}
+ if (logstream != stderr && logstream != stdout) {
+ fclose(logstream);
+ }
}
}
@@ -1684,7 +1697,6 @@ search_tapes(
int have_changer = 1;
int slot_num = -1;
int slots = -1;
- FILE *logstream = NULL;
tapelist_t *desired_tape = NULL;
struct sigaction act, oact;
ssize_t read_result;
@@ -1720,16 +1732,6 @@ search_tapes(
if(flags->delay_assemble || flags->inline_assemble) exitassemble = 1;
else exitassemble = 0;
- /* if given a log file, print an inventory of stuff found */
- if(flags->inventory_log) {
- if(!strcmp(flags->inventory_log, "-")) logstream = stdout;
- else if((logstream = fopen(flags->inventory_log, "w+")) == NULL) {
- error("Couldn't open log file %s for writing: %s",
- flags->inventory_log, strerror(errno));
- /*NOTREACHED*/
- }
- }
-
/* Suss what tape device we're using, whether there's a changer, etc. */
if(!use_changer || (have_changer = changer_init()) == 0) {
if (flags->alt_tapedev) {
@@ -1945,9 +1947,6 @@ search_tapes(
}
- if(logstream && logstream != stderr && logstream != stdout){
- fclose(logstream);
- }
if(flags->delay_assemble || flags->inline_assemble){
flush_open_outputs(1, NULL);
}
|