From: Kern Sibbald Date: Sat, 24 May 2008 14:07:17 +0000 (+0000) Subject: Apply Allan Black's status dir job count patch. X-Git-Tag: Release-3.0.0~1391 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9118ef8ba1a1a058b860c029661ec8426853696c;p=bacula%2Fbacula Apply Allan Black's status dir job count patch. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7025 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/bsr.h b/bacula/src/dird/bsr.h index 31cf306fd6..b71ae25171 100644 --- a/bacula/src/dird/bsr.h +++ b/bacula/src/dird/bsr.h @@ -1,19 +1,7 @@ -/* - * - * Bootstrap Record header file - * - * BSR (bootstrap record) handling routines split from - * ua_restore.c July MMIII - * - * Kern Sibbald, July MMII - * - * Version $Id$ - */ - /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2006 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -37,6 +25,18 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Bootstrap Record header file + * + * BSR (bootstrap record) handling routines split from + * ua_restore.c July MMIII + * + * Kern Sibbald, July MMII + * + * Version $Id$ + */ + /* FileIndex entry in restore bootstrap record */ @@ -63,3 +63,4 @@ struct RBSR { VOL_PARAMS *VolParams; /* Volume, start/end file/blocks */ RBSR_FINDEX *fi; /* File indexes this JobId */ }; + diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 1a5a762b96..a446b83a33 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -636,7 +636,7 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm sendit(sock, _(" SpoolSize=%s\n"), edit_uint64(res->res_job.spool_size, ed1)); } if (res->res_job.stats_enabled) { - sendit(sock, _(" StatsEnabled=%d\n"), res->res_job.stats_enabled); + sendit(sock, _(" StatsEnabled=%d\n"), res->res_job.stats_enabled); } if (res->res_job.JobType == JT_BACKUP) { sendit(sock, _(" Accurate=%d\n"), res->res_job.accurate); @@ -1616,7 +1616,7 @@ static void store_device(LEX *lc, RES_ITEM *item, int index, int pass) } /* - * Store JobType (backup, verify, restore) + * Store Migration/Copy type * */ void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass) diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index f314c110ed..500c0c1aa7 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 92b3eba853..612dff9bf5 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -432,7 +432,9 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp) bool close_db = false; JCR *jcr = ua->jcr; MEDIA_DBR mr; + int orig_jobtype; + orig_jobtype = jcr->JobType; memset(&mr, 0, sizeof(mr)); if (sp->job->JobType == JT_BACKUP) { jcr->db = NULL; @@ -475,6 +477,7 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp) db_close_database(jcr, jcr->db); } jcr->db = ua->db; /* restore ua db to jcr */ + jcr->JobType = orig_jobtype; } /* diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 989be6a532..0d31f7fa07 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -405,7 +405,7 @@ static void free_common_jcr(JCR *jcr) #ifdef DEBUG void b_free_jcr(const char *file, int line, JCR *jcr) { - struct s_last_job *je, last_job; + struct s_last_job *je; Dmsg3(dbglvl, "Enter free_jcr jid=%u from %s:%d\n", jcr->JobId, file, line); @@ -413,7 +413,7 @@ void b_free_jcr(const char *file, int line, JCR *jcr) void free_jcr(JCR *jcr) { - struct s_last_job *je, last_job; + struct s_last_job *je; Dmsg3(dbglvl, "Enter free_jcr jid=%u use_count=%d Job=%s\n", jcr->JobId, jcr->use_count(), jcr->Job); @@ -453,23 +453,24 @@ void free_jcr(JCR *jcr) case JT_MIGRATE: case JT_COPY: case JT_ADMIN: - num_jobs_run++; - last_job.Errors = jcr->Errors; - last_job.JobType = jcr->JobType; - last_job.JobId = jcr->JobId; - last_job.VolSessionId = jcr->VolSessionId; - last_job.VolSessionTime = jcr->VolSessionTime; - bstrncpy(last_job.Job, jcr->Job, sizeof(last_job.Job)); - last_job.JobFiles = jcr->JobFiles; - last_job.JobBytes = jcr->JobBytes; - last_job.JobStatus = jcr->JobStatus; - last_job.JobLevel = jcr->JobLevel; - last_job.start_time = jcr->start_time; - last_job.end_time = time(NULL); /* Keep list of last jobs, but not Console where JobId==0 */ - if (last_job.JobId > 0) { + if (jcr->JobId > 0) { + num_jobs_run++; je = (struct s_last_job *)malloc(sizeof(struct s_last_job)); - memcpy((char *)je, (char *)&last_job, sizeof(last_job)); + memset(je, 0, sizeof(struct s_last_job)); /* zero in case unset fields */ + je->Errors = jcr->Errors; + je->JobType = jcr->JobType; + je->JobId = jcr->JobId; + je->VolSessionId = jcr->VolSessionId; + je->VolSessionTime = jcr->VolSessionTime; + bstrncpy(je->Job, jcr->Job, sizeof(je->Job)); + je->JobFiles = jcr->JobFiles; + je->JobBytes = jcr->JobBytes; + je->JobStatus = jcr->JobStatus; + je->JobLevel = jcr->JobLevel; + je->start_time = jcr->start_time; + je->end_time = time(NULL); + if (!last_jobs) { init_last_jobs_list(); } diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index e7b17b4a94..553f880484 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -25,6 +25,7 @@ Add long term statistics job table General: 24May08 +kes Apply Allan Black's status dir job count patch. ebl Add information about IMPORT/EXPORT slots in mtx-script. kes Enhance a couple of SD debug messages. kes Tweak unload flag setting and ensure it is set during swap.