const int dbglvl = 3400;
-/*
- * Setting a NULL in tsd doesn't clear the tsd but instead tells
- * pthreads not to call the tsd destructor. Consequently, we
- * define this *invalid* jcr address and stuff it in the tsd
- * when the jcr is no longer valid.
- */
-#define INVALID_JCR ((JCR *)(-1))
-
/* External variables we reference */
extern time_t watchdog_time;
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)
{
void set_jcr_job_status(JCR *jcr, int JobStatus)
{
- bool set_waittime=false;
+ bool set_waittime = false;
+ int oldJobStatus = jcr->JobStatus;
+
Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus);
/* if wait state is new, we keep current time for watchdog MaxWaitTime */
switch (JobStatus) {
jcr->wait_time = time(NULL);
}
}
- Dmsg3(200, "jid=%u leave set_jcr_job_status=%c set=%c\n", (uint32_t)jcr->JobId,
- jcr->JobStatus, JobStatus);
+ if (oldJobStatus != jcr->JobStatus) {
+ Dmsg3(200, "jid=%u leave set_old_job_status=%c new_set=%c\n", (uint32_t)jcr->JobId,
+ oldJobStatus, JobStatus);
+// generate_plugin_event(jcr, bEventStatusChange, NULL);
+ }
}
#ifdef TRACE_JCR_CHAIN