/*
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.
#include "bacula.h"
#include "stored.h"
-const int dbglvl = 50;
+const int dbglvl = 150;
static brwlock_t reservation_lock;
*/
unbash_spaces(dir->msg);
pm_strcpy(jcr->errmsg, dir->msg);
- Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg);
- Jmsg(jcr, M_FATAL, 0, _("\n"
- " Device \"%s\" with MediaType \"%s\" requested by DIR not found in SD Device resources.\n"),
- dev_name.c_str(), media_type.c_str());
+ Jmsg(jcr, M_FATAL, 0, _("Device reservation failed for JobId=%d: %s\n"),
+ jcr->JobId, jcr->errmsg);
dir->fsend(NO_device, dev_name.c_str());
Dmsg1(dbglvl, ">dird: %s", dir->msg);
bool ok = false;
ASSERT(dcr);
+ if (job_canceled(jcr)) {
+ return false;
+ }
dev->dlock();
- if (is_device_unmounted(dev)) {
+ if (dev->is_device_unmounted()) {
Dmsg1(dbglvl, "Device %s is BLOCKED due to user unmount.\n", dev->print_name());
Mmsg(jcr->errmsg, _("3601 JobId=%u device %s is BLOCKED due to user unmount.\n"),
jcr->JobId, dev->print_name());
bool ok = false;
ASSERT(dcr);
+ if (job_canceled(jcr)) {
+ return false;
+ }
dev->dlock();
}
/* If device is unmounted, we are out of luck */
- if (is_device_unmounted(dev)) {
+ if (dev->is_device_unmounted()) {
Mmsg(jcr->errmsg, _("3604 JobId=%u device %s is BLOCKED due to user unmount.\n"),
jcr->JobId, dev->print_name());
Dmsg1(dbglvl, "%s", jcr->errmsg);
dcr->VolCatInfo.VolCatJobs, dev->num_reserved(),
dcr->VolCatInfo.VolCatStatus,
dcr->VolumeName);
+ /* Limit max concurrent jobs on this drive */
+ if (dev->max_concurrent_jobs > 0 && dev->max_concurrent_jobs <=
+ (uint32_t)(dev->num_writers + dev->num_reserved())) {
+ /* Max Concurrent Jobs depassed or already reserved */
+ Mmsg(jcr->errmsg, _("3609 JobId=%u Max concurrent jobs exceeded on drive %s.\n"),
+ (uint32_t)jcr->JobId, dev->print_name());
+ queue_reserve_message(jcr);
+ Dmsg1(dbglvl, "reserve dev failed: %s", jcr->errmsg);
+ return false;
+ }
if (strcmp(dcr->VolCatInfo.VolCatStatus, "Recycle") == 0) {
return true;
}