From: Kern Sibbald Date: Fri, 1 Sep 2006 11:56:23 +0000 (+0000) Subject: es Apply new dvd-handler patch from Richard Mortimer. X-Git-Tag: Release-2.0.0~522 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=eaa5e0915e2cc73aec3d8383fe73a9689490d661;p=bacula%2Fbacula es Apply new dvd-handler patch from Richard Mortimer. kes Tweak so that debug level 20 shows only DVD commands. kes Correct spooled_part flag in dev.c close() so that it is cleared when the spool file is deleted or does not exist. kes Print part number in read_records when eof hit (restore). git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3394 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/scripts/dvd-handler.in b/bacula/scripts/dvd-handler.in index 14bce276ab..487598abed 100644 --- a/bacula/scripts/dvd-handler.in +++ b/bacula/scripts/dvd-handler.in @@ -266,10 +266,10 @@ class disk: cmd = self.growcmd + self.growparams if newvol: - cmd += " -Z " # Ignore any existing iso9660 filesystem - used for truncate if newvol == 2: - cmd += "-use-the-force-luke=tty " + cmd += " -use-the-force-luke=tty" + cmd += " -Z " else: cmd += " -M " cmd += self.device + " " + str(partfile) diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index d972e76d5c..9910ce1c0e 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -80,7 +80,7 @@ bool do_append_data(JCR *jcr) if (dev->VolCatInfo.VolCatName[0] == 0) { Pmsg0(000, _("NULL Volume name. This shouldn't happen!!!\n")); } - Dmsg1(20, "Begin append device=%s\n", dev->print_name()); + Dmsg1(50, "Begin append device=%s\n", dev->print_name()); begin_data_spool(dcr); begin_attribute_spool(jcr); diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index c053980bb3..920a4ea01e 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -1782,16 +1782,21 @@ void DEVICE::close() struct stat statp; int part_save = part; POOL_MEM archive_name(PM_FNAME); + int status; part = num_dvd_parts; Dmsg3(100, "Remove empty part in close call make_dvd_filename. part=%d num=%d vol=%s\n", part, num_dvd_parts, VolCatInfo.VolCatName); make_spooled_dvd_filename(this, archive_name); /* Check that the part file is empty */ - if ((stat(archive_name.c_str(), &statp) == 0) && (statp.st_size == 0)) { + status = stat(archive_name.c_str(), &statp); + if (status == 0 && statp.st_size == 0) { Dmsg1(100, "unlink(%s)\n", archive_name.c_str()); unlink(archive_name.c_str()); - } + set_part_spooled(false); /* no spooled part left */ + } else if (status < 0) { + set_part_spooled(false); /* spool doesn't exit */ + } part = part_save; /* restore part number */ } @@ -1900,7 +1905,9 @@ bool DEVICE::do_mount(int mount, int dotimeout) } results = get_memory(2000); results[0] = 0; + /* If busy retry each second */ + Dmsg1(20, "do_mount run_prog=%s\n", ocmd.c_str()); while ((status = run_program_full_output(ocmd.c_str(), max_open_wait/2, results)) != 0) { /* Doesn't work with internationalisation (This is not a problem) */ diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index 3a7bb90c1f..298668240d 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -135,11 +135,11 @@ static bool do_mount_dvd(DEVICE* dev, int mount, int dotimeout) results = get_memory(2000); results[0] = 0; /* If busy retry each second */ - Dmsg1(100, "Run prog=%s\n", ocmd.c_str()); + Dmsg1(20, "Run mount prog=%s\n", ocmd.c_str()); while ((status = run_program_full_output(ocmd.c_str(), dev->max_open_wait/2, results)) != 0) { Dmsg2(99, "Mount status=%d result=%s\n", status, results); - /* Doesn't work with internationalisation (This is not a problem) */ + /* Doesn't work with internationalization (This is not a problem) */ if (mount && fnmatch("*is already mounted on*", results, 0) == 0) { break; } @@ -290,7 +290,7 @@ bool update_free_space_dev(DEVICE* dev) while (1) { berrno be; - Dmsg1(100, "Run prog=%s\n", ocmd.c_str()); + Dmsg1(20, "Run freespace prog=%s\n", ocmd.c_str()); status = run_program_full_output(ocmd.c_str(), dev->max_open_wait/2, results); if (status == 0) { free = str_to_int64(results); @@ -414,8 +414,7 @@ bool dvd_write_part(DCR *dcr) else timeout = dev->max_open_wait + (dev->part_size/(1350*1024/4)); - Dmsg2(29, "dvd_write_part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout); - + Dmsg2(20, "dvd_write_part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout); status = run_program_full_output(ocmd.c_str(), timeout, results.c_str()); if (status != 0) { @@ -431,6 +430,9 @@ bool dvd_write_part(DCR *dcr) return false; } Jmsg(dcr->jcr, M_INFO, 0, _("Part %d written to DVD.\n"), dev->part); + Dmsg2(400, "dvd_write_part: Part %d written to DVD\nResults: %s\n", + dev->part, results.c_str()); + if (dev->truncated_dvd) { dev->truncated_dvd = false; /* turn off flag */ } else { /* DVD part written */ diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 5734f43690..b51ec45661 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -704,14 +704,14 @@ bool write_session_label(DCR *dcr, int label) return false; } - Dmsg6(20, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d " + Dmsg6(50, "Write sesson_label record JobId=%d FI=%s SessId=%d Strm=%s len=%d " "remainder=%d\n", jcr->JobId, FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId, stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len, rec->remainder); free_record(rec); - Dmsg2(20, "Leave write_session_label Block=%d File=%d\n", + Dmsg2(50, "Leave write_session_label Block=%d File=%d\n", dev->block_num, dev->file); return true; } diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 3fb788987e..9ca1a1f4ea 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -109,8 +109,14 @@ bool read_records(DCR *dcr, } else if (dev->at_eof()) { if (verbose) { - Jmsg(jcr, M_INFO, 0, _("End of file %u on device %s, Volume \"%s\"\n"), - dev->file, dev->print_name(), dcr->VolumeName); + char dvdpart[100]; + if (dev->is_dvd()) { + bsnprintf(dvdpart, sizeof(dvdpart), _("part %d "), dev->part); + } else { + dvdpart[0] = 0; + } + Jmsg(jcr, M_INFO, 0, _("End of file %u %son device %s, Volume \"%s\"\n"), + dev->file, dvdpart, dev->print_name(), dcr->VolumeName); } Dmsg3(200, "End of file %u on device %s, Volume \"%s\"\n", dev->file, dev->print_name(), dcr->VolumeName); diff --git a/bacula/src/version.h b/bacula/src/version.h index b5a461f1b6..a4a6aa51df 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.21" -#define BDATE "31 August 2006" -#define LSMDATE "31Aug06" +#define BDATE "01 Septermber 2006" +#define LSMDATE "01Sep06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index d4e5056b1e..76063d427d 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,12 @@ Technical notes on version 1.39 General: +01Sep06 +kes Apply new dvd-handler patch from Richard Mortimer. +kes Tweak so that debug level 20 shows only DVD commands. +kes Correct spooled_part flag in dev.c close() so that it is cleared + when the spool file is deleted or does not exist. +kes Print part number in read_records when eof hit (restore). 31Aug06 kes Make find with no args in tree restore return error rather than stopping the selection. Fixes bug #665