From: Kern Sibbald Date: Sat, 7 Mar 2009 20:59:46 +0000 (+0000) Subject: kes Prepare to add JS_Warnings termination status. X-Git-Tag: Release-7.0.0~3336 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=74de3a7b8c973e2206ecfceed422fbae821965cf;p=bacula%2Fbacula kes Prepare to add JS_Warnings termination status. kes Attempt to resolve bwx-console Win32 crash. Not likely to work. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8508 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index a96b789a04..0fd6b3538d 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -60,7 +60,7 @@ const char *fill_jobhisto = "JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId, " "PurgedFiles, HasBase " "FROM Job " - "WHERE JobStatus IN ('T', 'f', 'A', 'E') " + "WHERE JobStatus IN ('T','W','f','A','E') " "AND JobId NOT IN (SELECT JobId FROM JobHisto) " "AND JobTDate < %s "; @@ -75,7 +75,7 @@ const char *client_backups = " WHERE Client.Name='%s'" " AND FileSet='%s'" " AND Client.ClientId=Job.ClientId" - " AND JobStatus='T' AND Type='B'" + " AND JobStatus IN ('T','W') AND Type='B'" " AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId" " AND Job.FileSetId=FileSet.FileSetId" " ORDER BY Job.StartTime"; @@ -139,10 +139,10 @@ const char *select_backup_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " "WHERE (Job.JobTDate<%s AND ((DelCandidates.JobFiles=0) OR " - "(DelCandidates.JobStatus!='T'))) OR " + "(DelCandidates.JobStatus NOT IN ('T','W')))) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " - "AND Job.Level='F' AND Job.JobStatus='T' AND Job.Type IN ('B','M') " + "AND Job.Level='F' AND Job.JobStatus IN ('T','W') AND Job.Type IN ('B','M') " "AND Job.FileSetId=DelCandidates.FileSetId)"; /* Select Jobs from the DelCandidates table that have a @@ -152,10 +152,10 @@ const char *select_backup_del = const char *select_verify_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " - "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus='T' " + "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus IN ('T','W') " "AND Job.FileSetId=DelCandidates.FileSetId)"; @@ -165,7 +165,7 @@ const char *select_verify_del = const char *select_restore_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='R')"; @@ -176,7 +176,7 @@ const char *select_restore_del = const char *select_admin_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='D')"; @@ -188,7 +188,7 @@ const char *select_admin_del = const char *select_migrate_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='g')"; @@ -200,7 +200,7 @@ const char *select_migrate_del = const char *select_copy_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='C')"; @@ -212,10 +212,10 @@ const char *select_backup_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " "WHERE (Job.JobId=DelCandidates.JobId AND ((DelCandidates.JobFiles=0) OR " - "(DelCandidates.JobStatus!='T'))) OR " + "(DelCandidates.JobStatus NOT IN ('T','W')))) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " - "AND Job.Level='F' AND Job.JobStatus='T' AND Job.Type IN ('B','M') " + "AND Job.Level='F' AND Job.JobStatus IN ('T','W') AND Job.Type IN ('B','M') " "AND Job.FileSetId=DelCandidates.FileSetId)"; /* Select Jobs from the DelCandidates table that have a @@ -225,10 +225,10 @@ const char *select_backup_del = const char *select_verify_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " - "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus='T' " + "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus IN ('T','W') " "AND Job.FileSetId=DelCandidates.FileSetId)"; @@ -238,7 +238,7 @@ const char *select_verify_del = const char *select_restore_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='R')"; @@ -249,7 +249,7 @@ const char *select_restore_del = const char *select_admin_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='D')"; @@ -261,7 +261,7 @@ const char *select_admin_del = const char *select_migrate_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='g')"; @@ -269,7 +269,7 @@ const char *select_migrate_del = const char *select_copy_del = "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles " "FROM Job,DelCandidates " - "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR " + "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR " "(Job.JobTDate>%s " "AND Job.ClientId=%s " "AND Job.Type='C')"; @@ -285,7 +285,7 @@ const char *uar_count_files = const char *uar_list_jobs = "SELECT JobId,Client.Name as Client,StartTime,Level as " "JobLevel,JobFiles,JobBytes " - "FROM Client,Job WHERE Client.ClientId=Job.ClientId AND JobStatus='T' " + "FROM Client,Job WHERE Client.ClientId=Job.ClientId AND JobStatus IN ('T','W') " "AND Type='B' ORDER BY StartTime DESC LIMIT 20"; /* @@ -306,7 +306,7 @@ const char *uar_last_full = "FROM Client,Job,JobMedia,Media,FileSet WHERE Client.ClientId=%s " "AND Job.ClientId=%s " "AND Job.StartTime<'%s' " - "AND Level='F' AND JobStatus='T' AND Type='B' " + "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' " "AND JobMedia.JobId=Job.JobId " "AND Media.Enabled=1 " "AND JobMedia.MediaId=Media.MediaId " @@ -320,7 +320,7 @@ const char *uar_full = "Job.ClientId,Job.Level,Job.JobFiles,Job.JobBytes," "StartTime,VolumeName,JobMedia.StartFile,VolSessionId,VolSessionTime " "FROM temp1,Job,JobMedia,Media WHERE temp1.JobId=Job.JobId " - "AND Level='F' AND JobStatus='T' AND Type='B' " + "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' " "AND Media.Enabled=1 " "AND JobMedia.JobId=Job.JobId " "AND JobMedia.MediaId=Media.MediaId"; @@ -336,7 +336,7 @@ const char *uar_dif = "AND JobMedia.JobId=Job.JobId " "AND Media.Enabled=1 " "AND JobMedia.MediaId=Media.MediaId " - "AND Job.Level='D' AND JobStatus='T' AND Type='B' " + "AND Job.Level='D' AND JobStatus IN ('T','W') AND Type='B' " "AND Job.FileSetId=FileSet.FileSetId " "AND FileSet.FileSet='%s' " "%s" @@ -353,7 +353,7 @@ const char *uar_inc = "AND Media.Enabled=1 " "AND JobMedia.JobId=Job.JobId " "AND JobMedia.MediaId=Media.MediaId " - "AND Job.Level='I' AND JobStatus='T' AND Type='B' " + "AND Job.Level='I' AND JobStatus IN ('T','W') AND Type='B' " "AND Job.FileSetId=FileSet.FileSetId " "AND FileSet.FileSet='%s' " "%s"; diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index 97866547d4..82e914e46b 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -77,7 +77,7 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime) if (jr->JobId == 0) { /* Differential is since last Full backup */ Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND " +"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " "ORDER BY StartTime DESC LIMIT 1", jr->JobType, L_FULL, jr->Name, @@ -107,7 +107,7 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime) sql_free_result(mdb); /* Now edit SQL command for Incremental Job */ Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND " +"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%s " "AND FileSetId=%s ORDER BY StartTime DESC LIMIT 1", jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name, @@ -168,7 +168,7 @@ db_find_last_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, i pm_strcpy(stime, "0000-00-00 00:00:00"); /* default */ Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND " +"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " "ORDER BY StartTime DESC LIMIT 1", jr->JobType, JobLevel, jr->Name, @@ -257,7 +257,7 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr) if (jr->JobLevel == L_VERIFY_CATALOG) { Mmsg(mdb->cmd, "SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND " -" JobStatus='T' AND Name='%s' AND " +" JobStatus IN ('T','W') AND Name='%s' AND " "ClientId=%s ORDER BY StartTime DESC LIMIT 1", L_VERIFY_INIT, jr->Name, edit_int64(jr->ClientId, ed1)); @@ -266,11 +266,11 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr) jr->JobType == JT_BACKUP) { if (Name) { Mmsg(mdb->cmd, -"SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND " +"SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " "Name='%s' ORDER BY StartTime DESC LIMIT 1", Name); } else { Mmsg(mdb->cmd, -"SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND " +"SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " "ClientId=%s ORDER BY StartTime DESC LIMIT 1", edit_int64(jr->ClientId, ed1)); } @@ -342,7 +342,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr /* Find next available volume */ if (InChanger) { Mmsg(changer, "AND InChanger=1 AND StorageId=%s", - edit_int64(mr->StorageId, ed1)); + edit_int64(mr->StorageId, ed1)); } if (strcmp(mr->VolStatus, "Recycle") == 0 || strcmp(mr->VolStatus, "Purged") == 0) { diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index f658e7432a..1d76c7806b 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -121,7 +121,7 @@ int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr) Mmsg(mdb->cmd, "SELECT FileId, LStat, MD5 FROM File,Job WHERE " "File.JobId=Job.JobId AND File.PathId=%s AND " -"File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus='T' AND " +"File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus IN ('T','W') AND " "ClientId=%s ORDER BY StartTime DESC LIMIT 1", edit_int64(fdbr->PathId, ed1), edit_int64(fdbr->FilenameId, ed2), @@ -1111,7 +1111,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " "FROM Job JOIN FileSet USING (FileSetId) " "WHERE ClientId = %s " - "AND Level='F' AND JobStatus='T' AND Type='B' " + "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' " "AND StartTime<'%s' " "AND FileSet.FileSet=(SELECT FileSet FROM FileSet WHERE FileSetId = %s) " "ORDER BY Job.JobTDate DESC LIMIT 1", @@ -1131,7 +1131,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " "FROM Job JOIN FileSet USING (FileSetId) " "WHERE ClientId = %s " - "AND Level='D' AND JobStatus='T' AND Type='B' " + "AND Level='D' AND JobStatus IN ('T','W') AND Type='B' " "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 1) " "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) " "ORDER BY Job.JobTDate DESC LIMIT 1 ", @@ -1150,7 +1150,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " "FROM Job JOIN FileSet USING (FileSetId) " "WHERE ClientId = %s " - "AND Level='I' AND JobStatus='T' AND Type='B' " + "AND Level='I' AND JobStatus IN ('T','W') AND Type='B' " "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 1) " "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) " "ORDER BY Job.JobTDate DESC ", diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c index df933acf7b..5b56f86b06 100644 --- a/bacula/src/cats/sql_list.c +++ b/bacula/src/cats/sql_list.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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/backup.c b/bacula/src/dird/backup.c index fddb4b6fa1..2c30e83aa1 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -349,6 +349,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) BSOCK *fd = jcr->file_bsock; bool fd_ok = false; uint32_t JobFiles, JobErrors; + uint32_t JobWarnings = 0; uint64_t ReadBytes = 0; uint64_t JobBytes = 0; int VSS = 0; @@ -404,6 +405,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) jcr->JobErrors += JobErrors; /* Keep total errors */ jcr->ReadBytes = ReadBytes; jcr->JobBytes = JobBytes; + jcr->JobWarnings = JobWarnings; jcr->VSS = VSS; jcr->Encrypt = Encrypt; } else { @@ -482,6 +484,9 @@ void backup_cleanup(JCR *jcr, int TermCode) term_msg = _("Backup OK"); } break; + case JS_Warnings: + term_msg = _("Backup OK -- with warnings"); + break; case JS_FatalError: case JS_ErrorTerminated: term_msg = _("*** Backup Error ***"); diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 15a91497f3..084d4beea2 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -1387,7 +1387,8 @@ bail_out: } /* TODO: redirect command ouput to job log */ -bool run_console_command(JCR *jcr, const char *cmd){ +bool run_console_command(JCR *jcr, const char *cmd) +{ UAContext *ua; bool ok; JCR *ljcr = new_control_jcr("-RunScript-", JT_CONSOLE); diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 60b9bee04c..36b40e3f58 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -517,7 +517,7 @@ const char *sql_jobids_from_client = "SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool,Client" " WHERE Client.Name='%s' AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId" " AND Job.ClientId=Client.ClientId AND Job.Type='B'" - " AND Job.JobStatus = 'T'" + " AND Job.JobStatus IN ('T','W')" " ORDER by Job.StartTime"; /* Get Volume names in Pool */ @@ -531,7 +531,7 @@ const char *sql_jobids_from_vol = "SELECT DISTINCT Job.JobId,Job.StartTime FROM Media,JobMedia,Job" " WHERE Media.VolumeName='%s' AND Media.MediaId=JobMedia.MediaId" " AND JobMedia.JobId=Job.JobId AND Job.Type='B'" - " AND Job.JobStatus = 'T' AND Media.Enabled=1" + " AND Job.JobStatus IN ('T','W') AND Media.Enabled=1" " ORDER by Job.StartTime"; const char *sql_smallest_vol = @@ -552,7 +552,7 @@ const char *sql_oldest_vol = const char *sql_jobids_from_mediaid = "SELECT DISTINCT Job.JobId,Job.StartTime FROM JobMedia,Job" " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId IN (%s)" - " AND Job.Type='B' AND Job.JobStatus = 'T'" + " AND Job.Type='B' AND Job.JobStatus IN ('T','W')" " ORDER by Job.StartTime"; /* Get the number of bytes in the pool */ @@ -561,7 +561,7 @@ const char *sql_pool_bytes = " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE" " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND" " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND" - " Job.Type='B' AND Job.JobStatus = 'T' AND" + " Job.Type='B' AND Job.JobStatus IN ('T','W') AND" " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)"; /* Get the number of bytes in the Jobs */ @@ -578,8 +578,8 @@ const char *sql_mediaids = const char *sql_pool_time = "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 Job.JobStatus = 'T' AND" + " VolStatus IN ('Full','Used','Error') AND Media.Enabled=1 AND" + " Job.Type='B' AND Job.JobStatus IN ('T','W') AND" " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId" " AND Job.RealEndTime<='%s'"; @@ -587,11 +587,11 @@ const char *sql_pool_time = 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.Type = 'B' AND Job.JobStatus IN ('T','W')" " AND Job.jobBytes > 0" " AND Job.JobId NOT IN" " (SELECT PriorJobId FROM Job WHERE" - " Type IN ('B','C') AND Job.JobStatus = 'T'" + " Type IN ('B','C') AND Job.JobStatus IN ('T','W')" " AND PriorJobId != 0)" " ORDER by Job.StartTime"; diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index d58556fc29..3e88b59941 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -258,6 +258,9 @@ void restore_cleanup(JCR *jcr, int TermCode) term_msg = _("Restore OK"); } break; + case JS_Warnings: + term_msg = _("Restore OK -- with warnings"); + break; case JS_FatalError: case JS_ErrorTerminated: term_msg = _("*** Restore Error ***"); diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 4371fe05a2..5577c3445b 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -1780,6 +1780,7 @@ int wait_cmd(UAContext *ua, const char *cmd) status = 2 ; /* Critical */ break; + case JS_Warnings: case JS_Terminated: status = 0 ; /* Ok */ break; diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index 5c48755ea3..3d5fc1dfba 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -320,7 +320,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) /* List JOBMEDIA */ } else if (strcasecmp(ua->argk[i], NT_("jobmedia")) == 0) { - int done = FALSE; + bool done = false; for (j=i+1; jargc; j++) { if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) { bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH); @@ -333,7 +333,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) continue; } db_list_jobmedia_records(ua->jcr, ua->db, jobid, prtit, ua, llist); - done = TRUE; + done = true; } if (!done) { /* List for all jobs (jobid=0) */ @@ -342,7 +342,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) /* List JOBLOG */ } else if (strcasecmp(ua->argk[i], NT_("joblog")) == 0) { - int done = FALSE; + bool done = false; for (j=i+1; jargc; j++) { if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) { bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH); @@ -355,7 +355,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) continue; } db_list_joblog_records(ua->jcr, ua->db, jobid, prtit, ua, llist); - done = TRUE; + done = true; } if (!done) { /* List for all jobs (jobid=0) */ diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 87c70f30ca..bbcbb6d003 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -651,6 +651,9 @@ static void list_running_jobs(UAContext *ua) case JS_Terminated: msg = _("has terminated"); break; + case JS_Warnings: + msg = _("has terminated with warnings"); + break; case JS_ErrorTerminated: msg = _("has erred"); break; @@ -860,6 +863,9 @@ static void list_terminated_jobs(UAContext *ua) case JS_Terminated: termstat = _("OK"); break; + case JS_Warnings: + termstat = _("OK -- with warnings"); + break; default: termstat = _("Other"); break; diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 790f9ee504..7694bd44d7 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -162,7 +162,8 @@ bool do_verify(JCR *jcr) db_strerror(jcr->db)); return false; } - if (jcr->previous_jr.JobStatus != 'T') { + if (!(jcr->previous_jr.JobStatus == JS_Terminated || + jcr->previous_jr.JobStatus == JS_Warnings)) { Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"), verify_jobid, jcr->previous_jr.JobStatus); return false; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 94005ffe87..a49951fbd7 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1530,8 +1530,8 @@ static int backup_cmd(JCR *jcr) Dmsg0(110, "Error in blast_data.\n"); } else { set_jcr_job_status(jcr, JS_Terminated); - - if (jcr->JobStatus != JS_Terminated) { + /* Note, the above set status will not override an error */ + if (!(jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) { bnet_suppress_error_messages(sd, 1); goto cleanup; /* bail out now */ } @@ -1567,7 +1567,7 @@ static int backup_cmd(JCR *jcr) Jmsg(jcr, M_FATAL, 0, _("Append Close with SD failed.\n")); goto cleanup; } - if (SDJobStatus != JS_Terminated) { + if (!(SDJobStatus == JS_Terminated || SDJobStatus == JS_Warnings)) { Jmsg(jcr, M_FATAL, 0, _("Bad status %d returned from Storage Daemon.\n"), SDJobStatus); } diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 4c9ef8a77b..dac2a7b4ee 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -74,6 +74,7 @@ #define JS_Running 'R' /* running */ #define JS_Blocked 'B' /* blocked */ #define JS_Terminated 'T' /* terminated normally */ +#define JS_Warnings 'W' /* Terminated normally with warnings */ #define JS_ErrorTerminated 'E' /* Job terminated in error */ #define JS_Error 'e' /* Non-fatal error */ #define JS_FatalError 'f' /* Fatal error */ @@ -210,6 +211,7 @@ public: uint32_t VolSessionTime; uint32_t JobFiles; /* Number of files written, this job */ uint32_t JobErrors; /* Number of non-fatal errors this job */ + uint32_t JobWarnings; /* Number of warning messages */ uint64_t JobBytes; /* Number of bytes processed this job */ uint64_t ReadBytes; /* Bytes read -- before compression */ FileId_t FileId; /* Last FileId used */ diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 1ad19cb3af..2b123ed588 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -450,11 +450,11 @@ void close_msg(JCR *jcr) } if ( (d->dest_code == MD_MAIL_ON_ERROR && jcr && - jcr->JobStatus == JS_Terminated) + (jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) || (d->dest_code == MD_MAIL_ON_SUCCESS && jcr && jcr->JobStatus == JS_ErrorTerminated) - ){ + ) { goto rem_temp_file; } @@ -1149,6 +1149,9 @@ Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) break; case M_WARNING: len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Warning: "), my_name, JobId); + if (jcr) { + jcr->JobWarnings++; + } break; case M_SECURITY: len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Security violation: "), diff --git a/bacula/src/lib/runscript.c b/bacula/src/lib/runscript.c index c2f61aa8c9..1122f30dc1 100644 --- a/bacula/src/lib/runscript.c +++ b/bacula/src/lib/runscript.c @@ -157,7 +157,8 @@ int run_scripts(JCR *jcr, alist *runscripts, const char *label) } if ((script->when & SCRIPT_After) && (when & SCRIPT_After)) { - if ((script->on_success && (jcr->JobStatus == JS_Terminated)) + if ((script->on_success && + (jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) || (script->on_failure && job_canceled(jcr)) ) { diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index a19ba34737..5d3bffa30a 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -195,6 +195,9 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen) case JS_Error: jobstat = _("Non-fatal error"); break; + case JS_Warnings: + jobstat = _("OK -- with warnings"); + break; case JS_Canceled: jobstat = _("Canceled"); break; @@ -266,6 +269,9 @@ void jobstatus_to_ascii_gui(int JobStatus, char *msg, int maxlen) case JS_Terminated: cnv = _("Completed successfully"); break; + case JS_Warnings: + cnv = _("Completed with warnings"); + break; case JS_ErrorTerminated: cnv = _("Terminated with errors"); break; @@ -298,7 +304,7 @@ void jobstatus_to_ascii_gui(int JobStatus, char *msg, int maxlen) if (cnv) { bstrncpy(msg, cnv, maxlen); } else { - jobstatus_to_ascii( JobStatus, msg, maxlen); + jobstatus_to_ascii(JobStatus, msg, maxlen); } } @@ -314,6 +320,9 @@ const char *job_status_to_str(int stat) case JS_Terminated: str = _("OK"); break; + case JS_Warnings: + str = _("OK -- with warnings"); + break; case JS_ErrorTerminated: case JS_Error: str = _("Error"); diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 0a65d0d6dd..39fb18d424 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -1167,6 +1167,9 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel, case JS_Terminated: term_msg = _("Backup OK"); break; + case JS_Warnings: + term_msg = _("Backup OK -- with warnings"); + break; case JS_FatalError: case JS_ErrorTerminated: term_msg = _("*** Backup Error ***"); diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 208a042c25..11939fb247 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2003-2008 Free Software Foundation Europe e.V. + Copyright (C) 2003-2009 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. @@ -549,6 +549,9 @@ static void list_terminated_jobs(STATUS_PKT *sp) case JS_Terminated: termstat = _("OK"); break; + case JS_Warnings: + termstat = _("OK -- with warnings"); + break; default: termstat = _("Other"); break; diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index eb3fe34f04..487c0ba4e5 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -25,6 +25,10 @@ filepattern (restore with regex in bsr) mixed priorities General: +07Mar09 +kes Prepare to add JS_Warnings termination status. +kes Attempt to resolve bwx-console Win32 crash. Not likely to + work. 06Mar09 kes Move src/win32/dll to src/win32/lib, which is much more logical. kes Fix the Win32 build.