The code to handle restart incomplete restore/copy/migration jobs is not implemented.
int status;
const char *reason, *cmd;
- Dmsg3(10, "cancel_job jcr=%p jobid=%d use_count\n", jcr, jcr->JobId, jcr->use_count());
-
+ if (!cancel) { /* stop the job */
+ if (!jcr->can_be_stopped()) {
+ ua->error_msg(_("Cannot stop JobId %s, Job %s is not a regular Backup Job\n"),
+ edit_uint64(jcr->JobId, ed1), jcr->Job);
+ return true;
+ }
+ }
+
if (cancel) {
status = JS_Canceled;
reason = _("canceled");
bool no_client_used() const {
return (m_JobLevel == L_VIRTUAL_FULL);
};
+ bool can_be_stopped(); /* in lib/jcr.c */
const char *get_OperationName(); /* in lib/jcr.c */
const char *get_ActionName(bool past); /* in lib/jcr.c */
void setJobStatus(int JobStatus); /* in lib/jcr.c */
return false;
}
+/* We can stop only Backup jobs connected to a client. It doesn't make sens at
+ * this time to stop a copy, migraton, restore or a verify job. The specific
+ * code should be implemented first.
+ */
+bool JCR::can_be_stopped()
+{
+ bool ok=true;
+ if (getJobType() == JT_BACKUP) { /* Is a Backup */
+ if (getJobLevel() == L_VIRTUAL_FULL) { /* Is a VirtualFull */
+ ok = false;
+ }
+ } else { /* Is not a backup (so, copy, migration, admin, verify, ... */
+ ok = false;
+ }
+ return ok;
+}
+
/*
* Push a subroutine address into the job end callback stack
*/