From: Kern Sibbald Date: Mon, 20 Nov 2006 08:02:15 +0000 (+0000) Subject: kes Make WritePartAfterJob the default so that the last DVD part X-Git-Tag: Release-2.0.0~256 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=495cff1fc569ee8028564e7a34f5b624c7d8fa95;p=bacula%2Fbacula kes Make WritePartAfterJob the default so that the last DVD part always gets written to the DVD by default. kes Add additional error messages in migration. kes Suppress redundant error messages in migration (possibly more to do). kes Apply Martin's fix (updated to 1.39) that takes into account run storage overrides in the Director status display. kes Implement, but turn off the submitted code that sets the EOT model on FreeBSD machines. Turning on this code is too risky at this point in the development. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3661 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/AUTHORS b/bacula/AUTHORS index 30e592b8f8..182b6ec899 100644 --- a/bacula/AUTHORS +++ b/bacula/AUTHORS @@ -10,6 +10,7 @@ name on this list, please send a note to me: kern@sibbald.com Contributors: +Adam Thorton Adrew J. Millar Adrian Close Aleksandar Milivojevic diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 9021d8b6fd..843211ef75 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -285,7 +285,7 @@ RES_ITEM job_items[] = { {"rescheduleinterval", store_time, ITEM(res_job.RescheduleInterval), 0, ITEM_DEFAULT, 60 * 30}, {"rescheduletimes", store_pint, ITEM(res_job.RescheduleTimes), 0, 0, 0}, {"priority", store_pint, ITEM(res_job.Priority), 0, ITEM_DEFAULT, 10}, - {"writepartafterjob", store_bool, ITEM(res_job.write_part_after_job), 0, ITEM_DEFAULT, false}, + {"writepartafterjob", store_bool, ITEM(res_job.write_part_after_job), 0, ITEM_DEFAULT, true}, {"selectionpattern", store_str, ITEM(res_job.selection_pattern), 0, 0, 0}, {"selectiontype", store_migtype, ITEM(res_job.selection_type), 0, 0, 0}, {"runscript", store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0}, diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 2ddba5ccc0..e810bcdd40 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -65,11 +65,13 @@ bool do_migration_init(JCR *jcr) if (jcr->previous_jr.JobId == 0) { Dmsg1(dbglevel, "JobId=%d no previous JobId\n", (int)jcr->JobId); + Jmsg(jcr, M_INFO, 0, _("No previous Job found to migrate.\n")); return true; /* no work */ } if (!get_or_create_fileset_record(jcr)) { Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId); + Jmsg(jcr, M_FATAL, 0, _("Could not get or create the FileSet record.\n")); return false; } @@ -78,6 +80,7 @@ bool do_migration_init(JCR *jcr) jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->hdr.name); if (jcr->jr.PoolId == 0) { Dmsg1(dbglevel, "JobId=%d no PoolId\n", (int)jcr->JobId); + Jmsg(jcr, M_FATAL, 0, _("Could not get or create a Pool record.\n")); return false; } @@ -127,6 +130,11 @@ bool do_migration(JCR *jcr) if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) { set_jcr_job_status(jcr, JS_Terminated); Dmsg1(dbglevel, "JobId=%d expected files == 0\n", (int)jcr->JobId); + if (jcr->previous_jr.JobId == 0) { + Jmsg(jcr, M_INFO, 0, _("No previous Job found to migrate.\n")); + } else { + Jmsg(jcr, M_INFO, 0, _("Previous Job has no data to migrate.\n")); + } migration_cleanup(jcr, jcr->JobStatus); return true; /* no work */ } @@ -277,6 +285,7 @@ bool do_migration(JCR *jcr) if (((STORE *)jcr->rstorage->first())->name() == ((STORE *)jcr->wstorage->first())->name()) { Jmsg(jcr, M_FATAL, 0, _("Read storage \"%s\" same as write storage.\n"), ((STORE *)jcr->rstorage->first())->name()); + return false; } if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { return false; @@ -701,6 +710,10 @@ static bool get_job_to_migrate(JCR *jcr) * for each of them. For the last JobId, we handle it below. */ p = ids.list; + if (ids.count == 0) { + Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); + goto ok_out; + } Jmsg(jcr, M_INFO, 0, _("The following %u JobId%s will be migrated: %s\n"), ids.count, ids.count==0?"":"s", ids.list); Dmsg2(dbglevel, "Before loop count=%d ids=%s\n", ids.count, ids.list); @@ -716,7 +729,7 @@ static bool get_job_to_migrate(JCR *jcr) goto bail_out; } else if (stat == 0) { Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); - goto ok_out; + goto bail_out; } } @@ -729,7 +742,7 @@ static bool get_job_to_migrate(JCR *jcr) goto bail_out; } else if (stat == 0) { Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); - goto ok_out; + goto bail_out; } jcr->previous_jr.JobId = JobId; diff --git a/bacula/src/dird/next_vol.c b/bacula/src/dird/next_vol.c index 82675a2246..ac4bb9ce96 100644 --- a/bacula/src/dird/next_vol.c +++ b/bacula/src/dird/next_vol.c @@ -32,7 +32,7 @@ static bool get_scratch_volume(JCR *jcr, MEDIA_DBR *mr, bool InChanger); /* * Items needed: * mr.PoolId must be set - * jcr->store + * jcr->wstore * jcr->db * jcr->pool * MEDIA_DBR mr (zeroed out) diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index b0e261ba49..c0e3779b03 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -588,6 +588,7 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays) /* Nothing found */ return NULL; } + /* * Fill in the remaining fields of the jcr as if it * is going to run the job. diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 16b82cba5b..13c3ff38f7 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -377,6 +377,7 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp) if (ok) { mr.PoolId = jcr->jr.PoolId; mr.StorageId = sp->store->StorageId; + jcr->wstore = sp->store; ok = find_next_volume_for_append(jcr, &mr, 1, false/*no create*/); } if (!ok) { @@ -400,7 +401,6 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp) db_close_database(jcr, jcr->db); } jcr->db = ua->db; /* restore ua db to jcr */ - } /* diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index c0cc13822d..231f3c1566 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -80,7 +80,7 @@ #endif /* Forward referenced functions */ -void set_os_device_parameters(DEVICE *dev); +void set_os_device_parameters(DCR *dcr); static bool dev_get_os_pos(DEVICE *dev, struct mtget *mt_stat); static char *mode_to_str(int mode); @@ -392,7 +392,7 @@ void DEVICE::open_tape_device(DCR *dcr, int omode) } dev_errno = 0; lock_door(); - set_os_device_parameters(this); /* do system dependent stuff */ + set_os_device_parameters(dcr); /* do system dependent stuff */ break; /* Successfully opened and rewound */ } } @@ -2282,8 +2282,10 @@ bool double_dev_wait_time(DEVICE *dev) } -void set_os_device_parameters(DEVICE *dev) +void set_os_device_parameters(DCR *dcr) { + DEVICE *dev = dcr->dev; + #if defined(HAVE_LINUX_OS) || defined(HAVE_WIN32) struct mtop mt_com; @@ -2347,6 +2349,22 @@ void set_os_device_parameters(DEVICE *dev) dev->clrerror(MTSETBSIZ); } } +/* Turn this on later when fully tested */ +#if defined(xxxMTIOCSETEOTMODEL) + uint32_t neof; + if (dev_cap(dev, CAP_TWOEOF)) { + neof = 2; + } else { + neof = 1; + } + if (ioctl(dev->fd, MTIOCSETEOTMODEL, (caddr_t)&neof) < 0) { + berrno be; + dev->dev_errno = errno; /* save errno */ + Mmsg2(dev->errmsg, _("Unable to set eotmodel on device %s: ERR=%s\n"), + dev->print_name(), be.strerror(dev->dev_errno)); + Jmsg(dcr->jcr, M_FATAL, 0, dev->errmsg); + } +#endif return; #endif diff --git a/bacula/src/version.h b/bacula/src/version.h index 2f280e8ca6..841198c32f 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.29" -#define BDATE "19 November 2006" -#define LSMDATE "19Nov06" +#define BDATE "20 November 2006" +#define LSMDATE "20Nov06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 08758fe02a..71b8a06119 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,16 @@ Technical notes on version 1.39 General: +20Nov06 +kes Make WritePartAfterJob the default so that the last DVD part + always gets written to the DVD by default. +kes Add additional error messages in migration. +kes Suppress redundant error messages in migration (possibly more to do). +kes Apply Martin's fix (updated to 1.39) that takes into account + run storage overrides in the Director status display. +kes Implement, but turn off the submitted code that sets the EOT + model on FreeBSD machines. Turning on this code is too risky at + this point in the development. 19Nov06 kes Implement unique dbid routine for migration to prevent the same JobId from being migrated twice. This should fix bug #709.