static int status_cmd(JCR *sjcr);
static void label_volume_if_ok(JCR *jcr, DEVICE *dev, char *vname, char *poolname,
int Slot);
+static void send_blocked_status(JCR *jcr, DEVICE *dev);
struct s_cmds {
char *cmd;
} else {
P(jcr->mutex);
oldStatus = jcr->JobStatus;
- jcr->JobStatus = JS_Cancelled;
- if (!jcr->authenticated && jcr->JobStatus == JS_WaitFD) {
+ set_jcr_job_status(jcr, JS_Cancelled);
+ if (!jcr->authenticated && oldStatus == JS_WaitFD) {
pthread_cond_signal(&jcr->job_start_wait); /* wake waiting thread */
}
V(jcr->mutex);
if (jcr->file_bsock) {
bnet_sig(jcr->file_bsock, BNET_TERMINATE);
}
- bnet_fsend(dir, _("3000 Job %s Status=%c marked to be cancelled.\n"),
- jcr->Job, oldStatus);
+ bnet_fsend(dir, _("3000 Job %s marked to be cancelled.\n"), jcr->Job);
free_jcr(jcr);
}
} else {
} else {
bnet_fsend(user, _("Device %s open but no Bacula volume is mounted.\n"), dev_name(dev));
}
- switch (dev->dev_blocked) {
- case BST_UNMOUNTED:
- bnet_fsend(user, _(" Deviced is blocked. User unmounted.\n"));
- break;
- case BST_UNMOUNTED_WAITING_FOR_SYSOP:
- bnet_fsend(user, _(" Deviced is blocked. User unmounted during wait for media/mount.\n"));
- break;
- case BST_WAITING_FOR_SYSOP:
- if (jcr->JobStatus == JS_WaitMount) {
- bnet_fsend(user, _(" Device is blocked waiting for mount.\n"));
- } else {
- bnet_fsend(user, _(" Device is blocked waiting for appendable media.\n"));
- }
- break;
- case BST_DOING_ACQUIRE:
- bnet_fsend(user, _(" Device is being initialized.\n"));
- break;
- case BST_WRITING_LABEL:
- bnet_fsend(user, _(" Device is blocked labeling a Volume.\n"));
- break;
- default:
- break;
- }
+ send_blocked_status(jcr, dev);
bpb = dev->VolCatInfo.VolCatBlocks;
if (bpb <= 0) {
bpb = 1;
} else {
bnet_fsend(user, _("Device %s is not open.\n"), dev_name(dev));
+ send_blocked_status(jcr, dev);
}
}
}
bnet_sig(user, BNET_EOD);
return 1;
}
+
+static void send_blocked_status(JCR *jcr, DEVICE *dev)
+{
+ BSOCK *user = jcr->dir_bsock;
+
+ switch (dev->dev_blocked) {
+ case BST_UNMOUNTED:
+ bnet_fsend(user, _(" Device is BLOCKED. User unmounted.\n"));
+ break;
+ case BST_UNMOUNTED_WAITING_FOR_SYSOP:
+ bnet_fsend(user, _(" Device is BLOCKED. User unmounted during wait for media/mount.\n"));
+ break;
+ case BST_WAITING_FOR_SYSOP:
+ if (jcr->JobStatus == JS_WaitMount) {
+ bnet_fsend(user, _(" Device is BLOCKED waiting for mount.\n"));
+ } else {
+ bnet_fsend(user, _(" Device is BLOCKED waiting for appendable media.\n"));
+ }
+ break;
+ case BST_DOING_ACQUIRE:
+ bnet_fsend(user, _(" Device is being initialized.\n"));
+ break;
+ case BST_WRITING_LABEL:
+ bnet_fsend(user, _(" Device is blocked labeling a Volume.\n"));
+ break;
+ default:
+ break;
+ }
+}