From: Kern Sibbald Date: Tue, 30 Sep 2008 11:44:16 +0000 (+0000) Subject: kes Apply Marco van Wieringen's set of patches, cleans up Migration/Copy X-Git-Tag: Release-7.0.0~4061 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e2facdbe25a7b762261290a96ea01b8e07da9c2f;p=bacula%2Fbacula kes Apply Marco van Wieringen's set of patches, cleans up Migration/Copy Implement 'Pool Uncopied Jobs', allow Solaris Compiler to build Bat; allow add and delete in place of mark and unmark. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7671 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/AUTHORS b/bacula/AUTHORS index a358522a2f..1f017fbd30 100644 --- a/bacula/AUTHORS +++ b/bacula/AUTHORS @@ -64,6 +64,7 @@ Lucas Di Pentima Ludovic Strappazon Marc Cousin Marc Schiffbauer +Marco van Wieringen Martin Schmid Martin Simmons Meno Abels diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index e4ed00a022..d574464cdc 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -489,6 +489,7 @@ struct s_jt migtypes[] = { {"oldestvolume", MT_OLDEST_VOL}, {"pooloccupancy", MT_POOL_OCCUPANCY}, {"pooltime", MT_POOL_TIME}, + {"pooluncopiedjobs", MT_POOL_UNCOPIED_JOBS}, {"client", MT_CLIENT}, {"volume", MT_VOLUME}, {"job", MT_JOB}, diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index f692e713fa..68763e7087 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -63,6 +63,7 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, static bool find_mediaid_then_jobids(JCR *jcr, idpkt *ids, const char *query1, const char *type); static bool find_jobids_from_mediaid_list(JCR *jcr, idpkt *ids, const char *type); +static bool find_jobids_of_pool_uncopied_jobs(JCR *jcr, idpkt *ids); static void start_migration_job(JCR *jcr); static int get_next_dbid_from_list(char **p, DBId_t *DBId); @@ -141,7 +142,7 @@ 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")); + Jmsg(jcr, M_INFO, 0, _("No previous Job found to %s.\n"), jcr->get_ActionName(0)); return true; /* no work */ } @@ -157,9 +158,9 @@ bool do_migration_init(JCR *jcr) 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")); + Jmsg(jcr, M_INFO, 0, _("No previous Job found to %s.\n"), jcr->get_ActionName(0)); } else { - Jmsg(jcr, M_INFO, 0, _("Previous Job has no data to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("Previous Job has no data to %s.\n"), jcr->get_ActionName(0)); } return true; /* no work */ } @@ -277,8 +278,9 @@ bool do_migration(JCR *jcr) } if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) { - Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to migrate. ERR=%s"), + Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to %s. ERR=%s"), edit_int64(jcr->previous_jr.JobId, ed1), + jcr->get_ActionName(0), db_strerror(jcr->db)); set_jcr_job_status(jcr, JS_Terminated); migration_cleanup(jcr, jcr->JobStatus); @@ -286,8 +288,10 @@ bool do_migration(JCR *jcr) } /* Make sure this job was not already migrated */ if (jcr->previous_jr.JobType != JT_BACKUP) { - Jmsg(jcr, M_INFO, 0, _("JobId %s already migrated probably by another Job. Migration stopped.\n"), - edit_int64(jcr->previous_jr.JobId, ed1)); + Jmsg(jcr, M_INFO, 0, _("JobId %s already %s probably by another Job. %s stopped.\n"), + edit_int64(jcr->previous_jr.JobId, ed1), + jcr->get_ActionName(1), + jcr->get_OperationName()); set_jcr_job_status(jcr, JS_Terminated); migration_cleanup(jcr, jcr->JobStatus); return true; @@ -295,8 +299,7 @@ bool do_migration(JCR *jcr) /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start %s JobId %s, Job=%s\n"), - jcr->get_JobType() == JT_MIGRATE ? "Migration" : "Copy", - edit_uint64(jcr->JobId, ed1), jcr->Job); + jcr->get_OperationName(), edit_uint64(jcr->JobId, ed1), jcr->Job); /* * Open a message channel connection with the Storage @@ -536,7 +539,6 @@ const char *sql_jobids_from_vol = " AND JobMedia.JobId=Job.JobId AND Job.Type='B'" " ORDER by Job.StartTime"; - const char *sql_smallest_vol = "SELECT Media.MediaId FROM Media,Pool,JobMedia WHERE" " Media.MediaId in (SELECT DISTINCT MediaId from JobMedia) AND" @@ -578,7 +580,6 @@ const char *sql_pool_bytes = const char *sql_job_bytes = "SELECT SUM(JobBytes) FROM Job WHERE JobId IN (%s)"; - /* Get Media Ids in Pool */ const char *sql_mediaids = "SELECT MediaId FROM Media,Pool WHERE" @@ -587,13 +588,24 @@ const char *sql_mediaids = /* Get JobIds in Pool longer than specified time */ const char *sql_pool_time = - "SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE" + "SELECT DISTINCT Job.JobId FROM Pool,Job,Media,JobMedia WHERE" " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND" " VolStatus in ('Full','Used','Error') AND Media.Enabled=1 AND" " Job.Type='B' AND" " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId" " AND Job.RealEndTime<='%s'"; +/* Get JobIds from successfully completed backup jobs which have not been copied before */ +const char *sql_jobids_of_pool_uncopied_jobs = + "SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool" + " WHERE Pool.Name = '%s' AND Pool.PoolId = Job.PoolId" + " AND Job.Type = 'B' AND Job.JobStatus = 'T'" + " AND Job.JobId NOT IN" + " (SELECT PriorJobId FROM Job WHERE" + " Type = 'B' AND Job.JobStatus = 'T'" + " AND PriorJobId != 0)" + " ORDER by Job.StartTime"; + /* * const char *sql_ujobid = * "SELECT DISTINCT Job.Job from Client,Pool,Media,Job,JobMedia " @@ -601,8 +613,6 @@ const char *sql_pool_time = * " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId"; */ - - /* * * This is the central piece of code that finds a job or jobs @@ -675,7 +685,7 @@ static int get_job_to_migrate(JCR *jcr) break; case MT_SQLQUERY: if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No Migration SQL selection pattern specified.\n")); + Jmsg(jcr, M_FATAL, 0, _("No %s SQL selection pattern specified.\n"), jcr->get_OperationName()); goto bail_out; } Dmsg1(dbglevel, "SQL=%s\n", jcr->job->selection_pattern); @@ -696,7 +706,6 @@ static int get_job_to_migrate(JCR *jcr) goto bail_out; } break; - case MT_POOL_OCCUPANCY: ctx.count = 0; /* Find count of bytes in pool */ @@ -706,14 +715,14 @@ static int get_job_to_migrate(JCR *jcr) goto bail_out; } if (ctx.count == 0) { - Jmsg(jcr, M_INFO, 0, _("No Volumes found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No Volumes found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } pool_bytes = ctx.value; Dmsg2(dbglevel, "highbytes=%lld pool=%lld\n", jcr->rpool->MigrationHighBytes, pool_bytes); if (pool_bytes < (int64_t)jcr->rpool->MigrationHighBytes) { - Jmsg(jcr, M_INFO, 0, _("No Volumes found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No Volumes found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } Dmsg0(dbglevel, "We should do Occupation migration.\n"); @@ -727,12 +736,12 @@ static int get_job_to_migrate(JCR *jcr) goto bail_out; } if (ids.count == 0) { - Jmsg(jcr, M_INFO, 0, _("No Volumes found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No Volumes found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } Dmsg2(dbglevel, "Pool Occupancy ids=%d MediaIds=%s\n", ids.count, ids.list); - if (!find_jobids_from_mediaid_list(jcr, &ids, "Volumes")) { + if (!find_jobids_from_mediaid_list(jcr, &ids, "Volume")) { goto bail_out; } /* ids == list of jobs */ @@ -763,7 +772,7 @@ static int get_job_to_migrate(JCR *jcr) goto bail_out; } pool_bytes -= ctx.value; - Dmsg1(dbglevel, "Total migrate Job bytes=%s\n", edit_int64_with_commas(ctx.value, ed1)); + Dmsg2(dbglevel, "Total %s Job bytes=%s\n", jcr->get_ActionName(0), edit_int64_with_commas(ctx.value, ed1)); Dmsg2(dbglevel, "lowbytes=%s poolafter=%s\n", edit_int64_with_commas(jcr->rpool->MigrationLowBytes, ed1), edit_int64_with_commas(pool_bytes, ed2)); @@ -777,7 +786,6 @@ static int get_job_to_migrate(JCR *jcr) pm_strcpy(ids.list, jids.list); Dmsg2(dbglevel, "Pool Occupancy ids=%d JobIds=%s\n", ids.count, ids.list); break; - case MT_POOL_TIME: ttime = time(NULL) - (time_t)jcr->rpool->MigrationTime; (void)localtime_r(&ttime, &tm); @@ -791,14 +799,18 @@ static int get_job_to_migrate(JCR *jcr) goto bail_out; } if (ids.count == 0) { - Jmsg(jcr, M_INFO, 0, _("No Volumes found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No Volumes found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } Dmsg2(dbglevel, "PoolTime ids=%d JobIds=%s\n", ids.count, ids.list); break; - + case MT_POOL_UNCOPIED_JOBS: + if (!find_jobids_of_pool_uncopied_jobs(jcr, &ids)) { + goto bail_out; + } + break; default: - Jmsg(jcr, M_FATAL, 0, _("Unknown Migration Selection Type.\n")); + Jmsg(jcr, M_FATAL, 0, _("Unknown %s Selection Type.\n"), jcr->get_OperationName()); goto bail_out; } } @@ -810,12 +822,13 @@ static int get_job_to_migrate(JCR *jcr) */ p = ids.list; if (ids.count == 0) { - Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No JobIds found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } - Jmsg(jcr, M_INFO, 0, _("The following %u JobId%s were chosen to be migrated: %s\n"), - ids.count, ids.count==0?"":"s", ids.list); + Jmsg(jcr, M_INFO, 0, _("The following %u JobId%s chosen to be %s: %s\n"), + ids.count, (ids.count < 2) ? _(" was") : _("s were"), + jcr->get_ActionName(1), ids.list); Dmsg2(dbglevel, "Before loop count=%d ids=%s\n", ids.count, ids.list); for (int i=1; i < (int)ids.count; i++) { @@ -829,7 +842,7 @@ static int get_job_to_migrate(JCR *jcr) Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n")); goto bail_out; } else if (stat == 0) { - Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No JobIds found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } } @@ -842,7 +855,7 @@ static int get_job_to_migrate(JCR *jcr) Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n")); goto bail_out; } else if (stat == 0) { - Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("No JobIds found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } @@ -850,14 +863,17 @@ static int get_job_to_migrate(JCR *jcr) Dmsg1(dbglevel, "Previous jobid=%d\n", (int)jcr->previous_jr.JobId); if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) { - Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to migrate. ERR=%s"), + Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to %s. ERR=%s"), edit_int64(jcr->previous_jr.JobId, ed1), + jcr->get_ActionName(0), db_strerror(jcr->db)); goto bail_out; } - Jmsg(jcr, M_INFO, 0, _("Migration using JobId=%s Job=%s\n"), + Jmsg(jcr, M_INFO, 0, _("%s using JobId=%s Job=%s\n"), + jcr->get_OperationName(), edit_int64(jcr->previous_jr.JobId, ed1), jcr->previous_jr.Job); - Dmsg3(dbglevel, "Migration JobId=%d using JobId=%s Job=%s\n", + Dmsg4(dbglevel, "%s JobId=%d using JobId=%s Job=%s\n", + jcr->get_OperationName(), jcr->JobId, edit_int64(jcr->previous_jr.JobId, ed1), jcr->previous_jr.Job); count = 1; @@ -882,13 +898,13 @@ static void start_migration_job(JCR *jcr) ua->batch = true; Mmsg(ua->cmd, "run %s jobid=%s", jcr->job->hdr.name, edit_uint64(jcr->MigrateJobId, ed1)); - Dmsg1(dbglevel, "=============== Migration cmd=%s\n", ua->cmd); + Dmsg2(dbglevel, "=============== %s cmd=%s\n", jcr->get_OperationName(), ua->cmd); parse_ua_args(ua); /* parse command */ JobId_t jobid = run_cmd(ua, ua->cmd); if (jobid == 0) { Jmsg(jcr, M_ERROR, 0, _("Could not start migration job.\n")); } else { - Jmsg(jcr, M_INFO, 0, _("Migration JobId %d started.\n"), (int)jobid); + Jmsg(jcr, M_INFO, 0, _("%s JobId %d started.\n"), jcr->get_OperationName(), (int)jobid); } free_ua_context(ua); } @@ -907,7 +923,7 @@ static bool find_mediaid_then_jobids(JCR *jcr, idpkt *ids, const char *query1, goto bail_out; } if (ids->count == 0) { - Jmsg(jcr, M_INFO, 0, _("No %s found to migrate.\n"), type); + Jmsg(jcr, M_INFO, 0, _("No %s found to %s.\n"), type, jcr->get_ActionName(0)); ok = true; /* Not an error */ goto bail_out; } else if (ids->count != 1) { @@ -940,7 +956,39 @@ static bool find_jobids_from_mediaid_list(JCR *jcr, idpkt *ids, const char *type goto bail_out; } if (ids->count == 0) { - Jmsg(jcr, M_INFO, 0, _("No %ss found to migrate.\n"), type); + Jmsg(jcr, M_INFO, 0, _("No %ss found to %s.\n"), type, jcr->get_ActionName(0)); + } + ok = true; + +bail_out: + return ok; +} + +/* + * This routine returns: + * false if an error occurred + * true otherwise + * ids.count number of jobids found (may be zero) + */ +static bool find_jobids_of_pool_uncopied_jobs(JCR *jcr, idpkt *ids) +{ + bool ok = false; + POOL_MEM query(PM_MESSAGE); + + /* Only a copy job is allowed */ + if (jcr->get_JobType() != JT_COPY) { + Jmsg(jcr, M_FATAL, 0, + _("Selection Type 'pooluncopiedjobs' only applies to Copy Jobs")); + goto bail_out; + } + + Dmsg1(dbglevel, "copy selection pattern=%s\n", jcr->rpool->name()); + Mmsg(query, sql_jobids_of_pool_uncopied_jobs, jcr->rpool->name()); + Dmsg1(dbglevel, "get uncopied jobs query=%s\n", query.c_str()); + if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void *)ids)) { + Jmsg(jcr, M_FATAL, 0, + _("SQL to get uncopied jobs failed. ERR=%s\n"), db_strerror(jcr->db)); + goto bail_out; } ok = true; @@ -962,8 +1010,8 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, item_chain = New(dlist(item, &item->link)); if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No Migration %s selection pattern specified.\n"), - type); + Jmsg(jcr, M_FATAL, 0, _("No %s %s selection pattern specified.\n"), + jcr->get_OperationName(), type); goto bail_out; } Dmsg1(dbglevel, "regex-sel-pattern=%s\n", jcr->job->selection_pattern); @@ -978,8 +1026,8 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, } Dmsg1(dbglevel, "query1 returned %d names\n", item_chain->size()); if (item_chain->size() == 0) { - Jmsg(jcr, M_INFO, 0, _("Query of Pool \"%s\" returned no Jobs to migrate.\n"), - jcr->rpool->name()); + Jmsg(jcr, M_INFO, 0, _("Query of Pool \"%s\" returned no Jobs to %s.\n"), + jcr->rpool->name(), jcr->get_ActionName(0)); ok = true; goto bail_out; /* skip regex match */ } else { @@ -1016,7 +1064,7 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, regfree(&preg); } if (item_chain->size() == 0) { - Jmsg(jcr, M_INFO, 0, _("Regex pattern matched no Jobs to migrate.\n")); + Jmsg(jcr, M_INFO, 0, _("Regex pattern matched no Jobs to %s.\n"), jcr->get_ActionName(0)); ok = true; goto bail_out; /* skip regex match */ } @@ -1038,7 +1086,7 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, } } if (ids->count == 0) { - Jmsg(jcr, M_INFO, 0, _("No %ss found to migrate.\n"), type); + Jmsg(jcr, M_INFO, 0, _("No %ss found to %s.\n"), type, jcr->get_ActionName(0)); } ok = true; @@ -1051,7 +1099,6 @@ bail_out: return ok; } - /* * Release resources allocated during backup. */ @@ -1170,17 +1217,17 @@ void migration_cleanup(JCR *jcr, int TermCode) term_msg = _("Inappropriate %s term code"); break; } - } else { - if (jcr->get_JobType() == JT_MIGRATE && jcr->previous_jr.JobId != 0) { - /* Mark previous job as migrated */ - Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", - (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1)); - db_sql_query(jcr->db, query.c_str(), NULL, NULL); - } - term_msg = _("%s -- no files to migrate"); - } - - bsnprintf(term_code, sizeof(term_code), term_msg, "Migration"); + } else { + if (jcr->get_JobType() == JT_MIGRATE && jcr->previous_jr.JobId != 0) { + /* Mark previous job as migrated */ + Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", + (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1)); + db_sql_query(jcr->db, query.c_str(), NULL, NULL); + } + term_msg = _("%s -- no files to %s"); + } + + bsnprintf(term_code, sizeof(term_code), term_msg, jcr->get_OperationName(), jcr->get_ActionName(0)); bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes(edt, sizeof(edt), jcr->jr.EndTime); RunTime = jcr->jr.EndTime - jcr->jr.StartTime; @@ -1190,7 +1237,6 @@ void migration_cleanup(JCR *jcr, int TermCode) kbps = (double)jcr->SDJobBytes / (1000 * RunTime); } - jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 2a5b75e735..18f8605c40 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -69,8 +69,10 @@ static int donecmd(UAContext *ua, TREE_CTX *tree); struct cmdstruct { const char *key; int (*func)(UAContext *ua, TREE_CTX *tree); const char *help; }; static struct cmdstruct commands[] = { + { NT_("add"), markcmd, _("add dir/file to be restored recursively, wildcards allowed")}, { NT_("cd"), cdcmd, _("change current directory")}, { NT_("count"), countcmd, _("count marked files in and below the cd")}, + { NT_("delete"), unmarkcmd, _("delete dir/file to be restored recursively in dir")}, { NT_("dir"), dircmd, _("long list current directory, wildcards allowed")}, { NT_(".dir"), dot_dircmd, _("long list current directory, wildcards allowed")}, { NT_("done"), donecmd, _("leave file selection mode")}, diff --git a/bacula/src/findlib/protos.h b/bacula/src/findlib/protos.h index dea3d576d1..83064d070d 100644 --- a/bacula/src/findlib/protos.h +++ b/bacula/src/findlib/protos.h @@ -75,7 +75,7 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors); /* from makepath.c */ -int makepath(ATTR *attr, const char *path, mode_t mode, +bool makepath(ATTR *attr, const char *path, mode_t mode, mode_t parent_mode, uid_t owner, gid_t group, int keep_dir_modes); diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 4150332e4a..9e04c570a3 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -99,6 +99,7 @@ enum { MT_OLDEST_VOL, MT_POOL_OCCUPANCY, MT_POOL_TIME, + MT_POOL_UNCOPIED_JOBS, MT_CLIENT, MT_VOLUME, MT_JOB, @@ -180,6 +181,8 @@ public: int32_t get_JobType() { return m_JobType; }; int32_t get_JobLevel() { return m_JobLevel; }; + const char *get_OperationName(); /* in lib/jcr.c */ + const char *get_ActionName(bool past); /* in lib/jcr.c */ void set_JobLevel(int32_t JobLevel); /* in lib/jcr.c */ void set_JobType(int32_t JobType); /* in lib/jcr.c */ bool JobReads(); /* in lib/jcr.c */ diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 4c9c0a3054..e7acb12a15 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -225,6 +225,52 @@ void unlock_last_jobs_list() V(last_jobs_mutex); } +/* Get an ASCII representation of the Operation being performed as an english Noun */ +const char *JCR::get_OperationName() +{ + switch(m_JobType) { + case JT_BACKUP: + return _("Backup"); + case JT_VERIFY: + return _("Verifying"); + case JT_RESTORE: + return _("Restoring"); + case JT_ARCHIVE: + return _("Archiving"); + case JT_COPY: + return _("Copying"); + case JT_MIGRATE: + return _("Migration"); + case JT_SCAN: + return _("Scanning"); + default: + return _("Unknown operation"); + } +} + +/* Get an ASCII representation of the Action being performed either an english Verb or Adjective */ +const char *JCR::get_ActionName(bool past) +{ + switch(m_JobType) { + case JT_BACKUP: + return _("backup"); + case JT_VERIFY: + return (past == true) ? _("verified") : _("verify"); + case JT_RESTORE: + return (past == true) ? _("restored") : _("restore"); + case JT_ARCHIVE: + return (past == true) ? _("archived") : _("archive"); + case JT_COPY: + return (past == true) ? _("copied") : _("copy"); + case JT_MIGRATE: + return (past == true) ? _("migrated") : _("migrate"); + case JT_SCAN: + return (past == true) ? _("scanned") : _("scan"); + default: + return _("unknown action"); + } +} + /* Set Job type in JCR and also set appropriate read flag */ void JCR::set_JobType(int32_t JobType) { diff --git a/bacula/src/qt-console/jobgraphs/jobplot.cpp b/bacula/src/qt-console/jobgraphs/jobplot.cpp index d3a02e9d9f..866975de7e 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.cpp +++ b/bacula/src/qt-console/jobgraphs/jobplot.cpp @@ -361,10 +361,21 @@ void JobPlot::addCurve() // attach data int size = m_pjd.count(); + int j = 0; +#if defined(__GNU_C) double tval[size]; double fval[size]; double bval[size]; - int j = 0; +#else + double *tval; + double *fval; + double *bval; + + tval = (double *)malloc(size * sizeof(double)); + fval = (double *)malloc(size * sizeof(double)); + bval = (double *)malloc(size * sizeof(double)); +#endif + foreach (PlotJobData* plotJobData, m_pjd) { // printf("%.0f %.0f %s\n", plotJobData->bytes, plotJobData->files, // plotJobData->dt.toString(mainWin->m_dtformat).toUtf8().data()); @@ -400,6 +411,12 @@ void JobPlot::addCurve() mX->attach(m_jobPlot); } } + +#if !defined(__GNU_C) + free(tval); + free(fval); + free(bval); +#endif } /* diff --git a/bacula/src/version.h b/bacula/src/version.h index 9bc38c7037..65ee06f9c0 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.5.8" -#define BDATE "29 September 2008" -#define LSMDATE "29Sep08" +#define VERSION "2.5.9" +#define BDATE "30 September 2008" +#define LSMDATE "309Sep08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 0ca060d9c0..0ed23d29e9 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -18,6 +18,9 @@ remove reader/writer in FOPTS???? General: 30Sep08 +kes Apply Marco van Wieringen's set of patches, cleans up Migration/Copy + Implement 'Pool Uncopied Jobs', allow Solaris Compiler to build + Bat; allow add and delete in place of mark and unmark. kes Another attempt to fix the endRestoreFile plugin bug noted below. 29Sep08 kes Apply dbi driver patch from Joao.