From e5d9ef66d80849a79b2e279bbb831f0ecf296369 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 7 Oct 2007 14:01:34 +0000 Subject: [PATCH] kes Make maxvol-test and new more strict maxvol2-test work. kes Print JobId in all Jmsg() job output. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5738 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/message.c | 19 ++++++++----------- bacula/src/stored/acquire.c | 16 +--------------- bacula/src/stored/label.c | 2 +- bacula/src/stored/reserve.c | 16 +++++++--------- bacula/technotes-2.3 | 3 +++ 5 files changed, 20 insertions(+), 36 deletions(-) diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 2e1e9ff8cd..8f0bf18a03 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -1073,7 +1073,7 @@ Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) va_list arg_ptr; int len; MSGS *msgs; - const char *job; + uint32_t JobId = 0; Dmsg1(850, "Enter Jmsg type=%d\n", type); @@ -1093,20 +1093,16 @@ Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) } msgs = NULL; - job = NULL; if (!jcr) { jcr = get_jcr_from_tsd(); } if (jcr) { msgs = jcr->jcr_msgs; - job = jcr->Job; + JobId = jcr->JobId; } if (!msgs) { msgs = daemon_msgs; /* if no jcr, we use daemon handler */ } - if (!job) { - job = ""; /* Set null job name if none */ - } /* * Check if we have a message destination defined. @@ -1124,25 +1120,26 @@ Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...) len = bsnprintf(rbuf, sizeof(rbuf), _("%s ERROR TERMINATION\n"), my_name); break; case M_FATAL: - len = bsnprintf(rbuf, sizeof(rbuf), _("%s: %s Fatal error: "), my_name, job); + len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Fatal error: "), my_name, JobId); if (jcr) { set_jcr_job_status(jcr, JS_FatalError); } break; case M_ERROR: - len = bsnprintf(rbuf, sizeof(rbuf), _("%s: %s Error: "), my_name, job); + len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Error: "), my_name, JobId); if (jcr) { jcr->Errors++; } break; case M_WARNING: - len = bsnprintf(rbuf, sizeof(rbuf), _("%s: %s Warning: "), my_name, job); + len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Warning: "), my_name, JobId); break; case M_SECURITY: - len = bsnprintf(rbuf, sizeof(rbuf), _("%s: %s Security violation: "), my_name, job); + len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Security violation: "), + my_name, JobId); break; default: - len = bsnprintf(rbuf, sizeof(rbuf), "%s: ", my_name); + len = bsnprintf(rbuf, sizeof(rbuf), "%s JobId %u: ", my_name, JobId); break; } diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index e5cad381bb..3de501061b 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -360,22 +360,8 @@ DCR *acquire_device_for_append(DCR *dcr) if (!have_vol && !(dir_find_next_appendable_volume(dcr) && strcmp(dev->VolHdr.VolumeName, dcr->VolumeName) == 0)) { /* wrong tape mounted */ - Dmsg2(190, "Wrong tape mounted: %s. wants:%s\n", dev->VolHdr.VolumeName, - dcr->VolumeName); - if (dev->num_writers != 0) { - Jmsg3(jcr, M_FATAL, 0, _("Wanted to append to Volume \"%s\", but device %s is busy writing on \"%s\" .\n"), - dcr->VolumeName, dev->print_name(), dev->VolHdr.VolumeName); - Dmsg3(200, "Wanted to append to Volume \"%s\", but device %s is busy writing on \"%s\" .\n", - dcr->VolumeName, dev->print_name(), dev->VolHdr.VolumeName); - /* Release volume reserved by dir_find_next_appendable_volume() */ - if (dcr->VolumeName[0]) { - volume_unused(dcr); - } - goto get_out; - } /* Wrong tape mounted, release it, then fall through to get correct one */ - Dmsg1(190, "jid=%u Wrong tape mounted, release and try mount.\n", - (uint32_t)jcr->JobId); + Dmsg0(50, "Wrong tape mounted, release and try mount.\n"); release = true; do_mount = true; } else { diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index e56e32c39b..77afb82da1 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -716,7 +716,7 @@ bool write_session_label(DCR *dcr, int label) } break; default: - Jmsg1(jcr, M_ABORT, 0, _("Bad session label = %d\n"), label); + Jmsg1(jcr, M_ABORT, 0, _("Bad Volume session label = %d\n"), label); break; } create_session_label(dcr, rec, label); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 42b3434180..b98a656d99 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -330,8 +330,7 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) Dmsg1(dbglvl, "OK, vol=%s on device.\n", VolumeName); goto get_out; /* Volume already on this device */ } else { - Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", - vol->vol_name, vol->vol_name); + Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name); debug_list_volumes("reserve_vol free"); vol_list->remove(vol); free_vol_item(vol); @@ -1282,7 +1281,7 @@ static int is_pool_ok(DCR *dcr) /* Drive Pool not suitable for us */ Mmsg(jcr->errmsg, _( "3608 JobId=%u wants Pool=\"%s\" but have Pool=\"%s\" nreserve=%d on drive %s.\n"), - jcr->JobId, dcr->pool_name, dev->pool_name, + (uint32_t)jcr->JobId, dcr->pool_name, dev->pool_name, dev->reserved_device, dev->print_name()); queue_reserve_message(jcr); Dmsg2(dbglvl, "failed: busy num_writers=0, reserved, pool=%s wanted=%s\n", @@ -1326,6 +1325,11 @@ static int can_reserve_drive(DCR *dcr, RCTX &rctx) rctx.PreferMountedVols, rctx.exact_match, rctx.suitable_device, rctx.autochanger_only, rctx.any_drive); + /* Check for max jobs on this Volume */ + if (!is_max_jobs_ok(dcr)) { + return 0; + } + /* setting any_drive overrides PreferMountedVols flag */ if (!rctx.any_drive) { /* @@ -1411,9 +1415,6 @@ static int can_reserve_drive(DCR *dcr, RCTX &rctx) if (dev->num_writers == 0) { /* Now check if there are any reservations on the drive */ if (dev->reserved_device) { - if (!is_max_jobs_ok(dcr)) { - return 0; - } return is_pool_ok(dcr); } else if (dev->can_append()) { if (is_pool_ok(dcr)) { @@ -1436,9 +1437,6 @@ static int can_reserve_drive(DCR *dcr, RCTX &rctx) * available if pool is the same). */ if (dev->can_append() || dev->num_writers > 0) { - if (!is_max_jobs_ok(dcr)) { - return 0; - } return is_pool_ok(dcr); } else { Pmsg1(000, _("Logic error!!!! JobId=%u Should not get here.\n"), (int)jcr->JobId); diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index f2a04b287e..184da7bed4 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,9 @@ Technical notes on version 2.3 General: +07Oct07 +kes Make maxvol-test and new more strict maxvol2-test work. +kes Print JobId in all Jmsg() job output. 06Oct07 kes Add new SD despooling attributes and Dir inserting attributes job status codes. This fixes bug 961. -- 2.39.5