extern int r_first;
extern int r_last;
extern struct s_res resources[];
-extern char my_name[];
extern jobq_t job_queue; /* job queue */
return 1;
}
- while (ua->jcr->storage->size()) {
- ua->jcr->storage->remove(0);
+ while (ua->jcr->wstorage->size()) {
+ ua->jcr->wstorage->remove(0);
}
len = strlen(ua->argk[0]);
mr->MaxVolFiles = pr->MaxVolFiles;
mr->MaxVolBytes = pr->MaxVolBytes;
mr->LabelType = pr->LabelType;
+ mr->Enabled = 1;
}
mr.Slot = Slot++;
mr.InChanger = InChanger;
mr.StorageId = store->StorageId;
+ mr.Enabled = 1;
Dmsg1(200, "Create Volume %s\n", mr.VolumeName);
if (!db_create_media_record(ua->jcr, ua->db, &mr)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
pr->LabelType = pool->LabelType;
pr->UseOnce = pool->use_volume_once;
pr->UseCatalog = pool->use_catalog;
- pr->AcceptAnyVolume = pool->accept_any_volume;
pr->Recycle = pool->Recycle;
pr->VolRetention = pool->VolRetention;
pr->VolUseDuration = pool->VolUseDuration;
BSOCK *sd;
JCR *jcr = ua->jcr;
- set_storage(jcr, store);
+ set_wstorage(jcr, store);
/* Try connecting for up to 15 seconds */
bsendmsg(ua, _("Connecting to Storage daemon %s at %s:%d\n"),
- store->hdr.name, store->address, store->SDport);
+ store->name(), store->address, store->SDport);
if (!connect_to_storage_daemon(jcr, 1, 15, 0)) {
bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
return;
char sdt[50];
time_t ttime = time(NULL);
struct tm tm;
- localtime_r(&ttime, &tm);
+ (void)localtime_r(&ttime, &tm);
strftime(sdt, sizeof(sdt), "%d-%b-%Y %H:%M:%S", &tm);
bsendmsg(ua, "%s\n", sdt);
return 1;
/*
* do_job_delete now performs the actual delete operation atomically
- * we always return 1 because C++ is pissy about void functions
*/
static void do_job_delete(UAContext *ua, JobId_t JobId)
{
- POOLMEM *query = get_pool_memory(PM_MESSAGE);
+ POOL_MEM query(PM_MESSAGE);
char ed1[50];
- Mmsg(query, "DELETE FROM Job WHERE JobId=%s", edit_int64(JobId, ed1));
- db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(query, "DELETE FROM MAC WHERE JobId=%s", ed1);
- db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(query, "DELETE FROM File WHERE JobId=%s", ed1);
- db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%s", ed1);
- db_sql_query(ua->db, query, NULL, (void *)NULL);
- free_pool_memory(query);
+ purge_files_from_job(ua, JobId);
+ purge_job_from_catalog(ua, JobId);
bsendmsg(ua, _("Job %s and associated records deleted from the catalog.\n"), edit_int64(JobId, ed1));
}
if (!store) {
return;
}
- set_storage(jcr, store);
+ set_wstorage(jcr, store);
drive = get_storage_drive(ua, store);
Dmsg3(120, "Found storage, MediaType=%s DevName=%s drive=%d\n",