--sd.conf password does not match dir.conf storage password
=======
+- After unmount, if restore job started, ask to mount.
- Fix db_update_fileset in cats/sql_get.c
- Fix start/end blocks for File
- Add new code to scheduler.c and run_conf.c
/*
* Request to find next appendable Volume for this Job
*/
- Dmsg1(20, "catreq %s", bs->msg);
+ Dmsg1(120, "catreq %s", bs->msg);
if (sscanf(bs->msg, Find_media, &Job, &index) == 2) {
mr.PoolId = jcr->PoolId;
strcpy(mr.MediaType, jcr->store->media_type);
unbash_spaces(mr.VolumeName);
if (db_get_media_record(jcr->db, &mr)) {
jcr->MediaId = mr.MediaId;
- Dmsg1(20, "VolumeInfo MediaId=%d\n", jcr->MediaId);
+ Dmsg1(120, "VolumeInfo MediaId=%d\n", jcr->MediaId);
strcpy(jcr->VolumeName, mr.VolumeName);
/*
* Make sure this volume is suitable for this job, i.e.
mr.VolStatus, mr.VolumeName);
if (db_update_media_record(jcr->db, &mr)) {
bnet_fsend(bs, OK_update);
- Dmsg0(90, "send OK\n");
+ Dmsg0(190, "send OK\n");
} else {
Jmsg(jcr, M_ERROR, 0, _("Catalog error updating Media record. %s"),
db_strerror(jcr->db));
bnet_fsend(bs, "1992 Update Media error\n");
- Dmsg0(90, "send error\n");
+ Dmsg0(190, "send error\n");
}
/*
bnet_fsend(bs, "1990 Invalid Catalog Request: %s", omsg);
free_memory(omsg);
}
- Dmsg1(20, ">CatReq response: %s", bs->msg);
+ Dmsg1(120, ">CatReq response: %s", bs->msg);
return;
}
len = strlen(fname); /* length before attributes */
attr = &fname[len+1];
- Dmsg2(99, "dird<stored: stream=%d %s\n", Stream, fname);
- Dmsg1(99, "dird<stored: attr=%s\n", attr);
+ Dmsg2(109, "dird<stored: stream=%d %s\n", Stream, fname);
+ Dmsg1(109, "dird<stored: attr=%s\n", attr);
ar.attr = attr;
ar.fname = fname;
ar.FileIndex = FileIndex;
ar.link = NULL;
ar.JobId = jcr->JobId;
- Dmsg2(11, "dird<filed: stream=%d %s\n", Stream, fname);
- Dmsg1(20, "dird<filed: attr=%s\n", attr);
+ Dmsg2(111, "dird<filed: stream=%d %s\n", Stream, fname);
+ Dmsg1(120, "dird<filed: attr=%s\n", attr);
/* ***FIXME*** fix link field */
if (!db_create_file_attributes_record(jcr->db, &ar)) {
/* Update MD5 signature in catalog */
char MD5buf[50]; /* 24 bytes should be enough */
bin_to_base64(MD5buf, fname, 16);
- Dmsg2(90, "MD5len=%d MD5=%s\n", strlen(MD5buf), MD5buf);
+ Dmsg2(190, "MD5len=%d MD5=%s\n", strlen(MD5buf), MD5buf);
if (!db_add_MD5_to_file_record(jcr->db, jcr->FileId, MD5buf)) {
Jmsg(jcr, M_ERROR, 0, _("Catalog error updating MD5. %s"),
db_strerror(jcr->db));
*/
bnet_fsend(fd, jobcmd, jcr->JobId, jcr->Job, jcr->VolSessionId,
jcr->VolSessionTime, jcr->sd_auth_key);
- Dmsg1(10, ">filed: %s", fd->msg);
+ Dmsg1(110, ">filed: %s", fd->msg);
if (bnet_recv(fd) > 0) {
- Dmsg1(10, "<filed: %s", fd->msg);
+ Dmsg1(110, "<filed: %s", fd->msg);
if (strcmp(fd->msg, OKjob) != 0) {
Jmsg(jcr, M_FATAL, 0, _("File daemon rejected Job command: %s\n"), fd->msg);
jcr->JobStatus = JS_ErrorTerminated;
bnet_send(fd);
for (i=0; i < fileset->num_includes; i++) {
fd->msglen = strlen(fileset->include_array[i]);
- Dmsg1(20, "dird>filed: include file: %s\n", fileset->include_array[i]);
+ Dmsg1(120, "dird>filed: include file: %s\n", fileset->include_array[i]);
fd->msg = fileset->include_array[i];
if (!bnet_send(fd)) {
fd->msg = msgsave;
bnet_send(fd);
for (i=0; i < fileset->num_excludes; i++) {
fd->msglen = strlen(fileset->exclude_array[i]);
- Dmsg1(20, "dird>filed: exclude file: %s\n", fileset->exclude_array[i]);
+ Dmsg1(120, "dird>filed: exclude file: %s\n", fileset->exclude_array[i]);
fd->msg = fileset->exclude_array[i];
if (!bnet_send(fd)) {
Emsg0(M_FATAL, 0, _(">filed: write error on socket\n"));
jcr->jr.FirstIndex = 1;
memset(&ar, 0, sizeof(ar));
- Dmsg0(20, "bdird: waiting to receive file attributes\n");
+ Dmsg0(120, "bdird: waiting to receive file attributes\n");
/* Pickup file attributes and signature */
while (!fd->errors && (n = bget_msg(fd, 0)) > 0) {
ar.PathId = 0;
ar.FilenameId = 0;
- Dmsg2(11, "dird<filed: stream=%d %s\n", stream, jcr->fname);
- Dmsg1(20, "dird<filed: attr=%s\n", attr);
+ Dmsg2(111, "dird<filed: stream=%d %s\n", stream, jcr->fname);
+ Dmsg1(120, "dird<filed: attr=%s\n", attr);
/* ***FIXME*** fix link field */
if (!db_create_file_attributes_record(jcr->db, &ar)) {
continue;
}
db_escape_string(MD5, Opts_MD5, strlen(Opts_MD5));
- Dmsg2(20, "MD5len=%d MD5=%s\n", strlen(MD5), MD5);
+ Dmsg2(120, "MD5len=%d MD5=%s\n", strlen(MD5), MD5);
if (!db_add_MD5_to_file_record(jcr->db, jcr->FileId, MD5)) {
Jmsg1(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
jcr->JobStatus = JS_Error;
return 0;
}
if ((n = bget_msg(fd, 0)) > 0) {
- Dmsg0(10, fd->msg);
+ Dmsg0(110, fd->msg);
if (strcmp(fd->msg, resp) == 0) {
return 1;
}
jcr->JobStatus = JS_Terminated;
break;
default:
- Dmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
+ Pmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
break;
}
}
return 0;
}
jcr->jr.ClientId = cr.ClientId;
- Dmsg2(9, "Created Client %s record %d\n", jcr->client->hdr.name,
+ Dmsg2(100, "Created Client %s record %d\n", jcr->client->hdr.name,
jcr->jr.ClientId);
return 1;
}
if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
memcpy(&jr, &(jcr->jr), sizeof(jr));
if (!db_find_last_jobid(jcr->db, &jr)) {
- Jmsg(jcr, M_FATAL, 0, _("Unable to find last full verify. %s"),
- db_strerror(jcr->db));
+ Jmsg(jcr, M_FATAL, 0, _(
+ "Unable to find JobId of previous InitCatalog Job.\n"
+ "Please run a Verify with Level=InitCatalog before\n"
+ "running the current Job.\n"));
goto bail_out;
}
JobId = jr.JobId;
case FT_LNKSAVED: /* Hard linked, file already saved */
break;
case FT_REGE:
- Dmsg1(30, "FT_REGE saving: %s\n", ff_pkt->fname);
+ Dmsg1(130, "FT_REGE saving: %s\n", ff_pkt->fname);
break;
case FT_REG:
- Dmsg1(30, "FT_REG saving: %s\n", ff_pkt->fname);
+ Dmsg1(130, "FT_REG saving: %s\n", ff_pkt->fname);
break;
case FT_LNK:
- Dmsg2(30, "FT_LNK saving: %s -> %s\n", ff_pkt->fname, ff_pkt->link);
+ Dmsg2(130, "FT_LNK saving: %s -> %s\n", ff_pkt->fname, ff_pkt->link);
break;
case FT_DIR:
- Dmsg1(30, "FT_DIR saving: %s\n", ff_pkt->link);
+ Dmsg1(130, "FT_DIR saving: %s\n", ff_pkt->link);
break;
case FT_SPEC:
- Dmsg1(30, "FT_SPEC saving: %s\n", ff_pkt->fname);
+ Dmsg1(130, "FT_SPEC saving: %s\n", ff_pkt->fname);
break;
case FT_NOACCESS:
Jmsg(jcr, M_NOTSAVED, -1, _(" Could not access %s: ERR=%s"), ff_pkt->fname,
fid = -1;
}
- Dmsg1(30, "bfiled: sending %s to stored\n", ff_pkt->fname);
+ Dmsg1(130, "bfiled: sending %s to stored\n", ff_pkt->fname);
encode_stat(attribs, &ff_pkt->statp);
jcr->JobFiles++; /* increment number of files sent */
}
return 0;
}
- Dmsg1(10, ">stored: attrhdr %s\n", sd->msg);
+ Dmsg1(100, ">stored: attrhdr %s\n", sd->msg);
/*
* Send file attributes to Storage daemon
ff_pkt->type, ff_pkt->fname, 0, attribs, 0, 0);
}
- Dmsg2(20, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg);
+ Dmsg2(100, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg);
if (!stat) {
if (fid >= 0) {
close(fid);
*/
if (fid >= 0) {
- Dmsg1(60, "Saving data, type=%d\n", ff_pkt->type);
+ Dmsg1(100, "Saving data, type=%d\n", ff_pkt->type);
/*
* Send Data header to Storage daemon
* <file-index> <stream> <info>
close(fid);
return 0;
}
- Dmsg1(10, ">stored: datahdr %s\n", sd->msg);
+ Dmsg1(100, ">stored: datahdr %s\n", sd->msg);
#endif
if (ff_pkt->flags & FO_MD5) {
close(fid);
return 0;
}
- Dmsg1(30, "Send data to FD len=%d\n", sd->msglen);
+ Dmsg1(130, "Send data to FD len=%d\n", sd->msglen);
#endif
jcr->JobBytes += sd->msglen;
sd->msg = msgsave; /* restore read buffer */
close(fid);
return 0;
}
- Dmsg1(30, "Send data to FD len=%d\n", sd->msglen);
+ Dmsg1(130, "Send data to FD len=%d\n", sd->msglen);
#endif
jcr->JobBytes += sd->msglen;
} /* end while */
#ifndef NO_FD_SEND_TEST
#ifndef NO_POLL_TEST
bnet_sig(sd, BNET_EOD_POLL);
- Dmsg0(30, "Send EndData_Poll\n");
+ Dmsg0(130, "Send EndData_Poll\n");
/* ***FIXME**** change to use bget_msg() */
if (bnet_recv(sd) <= 0) {
close(fid);
MD5Final(signature, &md5c);
#ifndef NO_FD_SEND_TEST
bnet_fsend(sd, "%ld %d 0", jcr->JobFiles, STREAM_MD5_SIGNATURE);
- Dmsg1(10, "bfiled>stored:header %s\n", sd->msg);
+ Dmsg1(100, "bfiled>stored:header %s\n", sd->msg);
memcpy(sd->msg, signature, 16);
sd->msglen = 16;
bnet_send(sd);
break; /* connection terminated */
}
dir->msg[dir->msglen] = 0;
- Dmsg1(9, "<dird: %s", dir->msg);
+ Dmsg1(100, "<dird: %s", dir->msg);
found = FALSE;
for (i=0; cmds[i].cmd; i++) {
if (strncmp(cmds[i].cmd, dir->msg, strlen(cmds[i].cmd)) == 0) {
}
if (!cmds[i].func(jcr)) { /* do command */
quit = TRUE; /* error, get out */
- Dmsg0(20, "Command error\n");
+ Pmsg0(20, "Command error\n");
}
found = TRUE; /* indicate command found */
break;
break;
}
}
- Dmsg0(20, "Calling term_find_files\n");
+ Dmsg0(100, "Calling term_find_files\n");
term_find_files(jcr->ff);
- Dmsg0(20, "Done with term_find_files\n");
+ Dmsg0(100, "Done with term_find_files\n");
free_jcr(jcr); /* destroy JCR record */
- Dmsg0(20, "Done with free_jcr\n");
+ Dmsg0(100, "Done with free_jcr\n");
return NULL;
}
while (bnet_recv(dir) > 0) {
dir->msg[dir->msglen] = 0;
strip_trailing_junk(dir->msg);
- Dmsg1(10, "filed<dird: include file %s\n", dir->msg);
+ Dmsg1(110, "filed<dird: include file %s\n", dir->msg);
add_fname_to_include_list(jcr->ff, 1, dir->msg);
}
for ( ; *p && *p == ' '; p++)
{ }
add_fname_to_exclude_list(jcr->ff, p);
- Dmsg1(10, "<dird: exclude file %s\n", dir->msg);
+ Dmsg1(110, "<dird: exclude file %s\n", dir->msg);
}
return bnet_fsend(dir, OKexc);
time_t mtime;
level = (char *) get_memory(dir->msglen);
- Dmsg1(10, "level_cmd: %s", dir->msg);
+ Dmsg1(110, "level_cmd: %s", dir->msg);
if (sscanf(dir->msg, "level = %s ", level) != 1) {
Jmsg1(jcr, M_FATAL, 0, _("Bad level command: %s\n"), dir->msg);
free_memory(level);
tm.tm_wday = tm.tm_yday = 0;
tm.tm_isdst = -1;
mtime = mktime(&tm);
- Dmsg1(90, "Got since time: %s", ctime(&mtime));
+ Dmsg1(100, "Got since time: %s", ctime(&mtime));
jcr->incremental = 1;
jcr->mtime = mtime;
} else {
{
BSOCK *dir = jcr->dir_bsock;
- Dmsg1(050, "SessionCmd: %s", dir->msg);
+ Dmsg1(100, "SessionCmd: %s", dir->msg);
if (sscanf(dir->msg, sessioncmd, jcr->VolumeName,
&jcr->VolSessionId, &jcr->VolSessionTime,
&jcr->StartFile, &jcr->EndFile,
BSOCK *dir = jcr->dir_bsock;
BSOCK *sd; /* storage daemon bsock */
- Dmsg1(050, "StorageCmd: %s", dir->msg);
+ Dmsg1(100, "StorageCmd: %s", dir->msg);
if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port) != 2) {
Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), dir->msg);
return 0;
}
- Dmsg2(30, "Got storage: %s:%d\n", jcr->stored_addr, stored_port);
+ Dmsg2(10, "Open storage: %s:%d\n", jcr->stored_addr, stored_port);
/* Open command communications with Storage daemon */
/* Try to connect for 1 hour at 10 second intervals */
sd = bnet_connect(jcr, 10, 3600, _("Storage daemon"),
Jmsg(jcr, M_FATAL, 0, _("Failed to authenticate Storage daemon.\n"));
return 0;
}
+ Dmsg0(10, "Authenticated with SD.\n");
/* Send OK to Director */
return bnet_fsend(dir, OKstore);
}
bnet_fsend(dir, OKbackup);
- Dmsg1(10, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "bfiled>dird: %s", dir->msg);
/*
* Send Append Open Session to Storage daemon
*/
bnet_fsend(sd, append_open);
- Dmsg1(10, ">stored: %s", sd->msg);
+ Dmsg1(110, ">stored: %s", sd->msg);
/*
* Expect to receive back the Ticket number
*/
if (bnet_recv(sd) > 0) {
- Dmsg1(10, "<stored: %s", sd->msg);
+ Dmsg1(110, "<stored: %s", sd->msg);
if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) {
Jmsg(jcr, M_FATAL, 0, _("Bad response to append open: %s\n"), sd->msg);
jcr->JobStatus = JS_ErrorTerminated;
* Send Append data command to Storage daemon
*/
bnet_fsend(sd, append_data, jcr->Ticket);
- Dmsg1(10, ">stored: %s", sd->msg);
+ Dmsg1(110, ">stored: %s", sd->msg);
/*
* Expect to get OK data
*/
- Dmsg1(10, "<stored: %s", sd->msg);
+ Dmsg1(110, "<stored: %s", sd->msg);
if (!response(sd, OK_data, "Append Data")) {
jcr->JobStatus = JS_ErrorTerminated;
goto cleanup;
/*
* Send Files to Storage daemon
*/
- Dmsg1(100, "begin blast ff=%p\n", jcr->ff);
+ Dmsg1(10, "begin blast ff=%p\n", jcr->ff);
if (!blast_data_to_storage_daemon(jcr, NULL)) {
jcr->JobStatus = JS_ErrorTerminated;
} else {
}
bnet_fsend(dir, OKverify);
- Dmsg1(10, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "bfiled>dird: %s", dir->msg);
switch (jcr->JobLevel) {
case L_VERIFY_INIT:
* Send Close session command to Storage daemon
*/
bnet_fsend(sd, read_close, jcr->Ticket);
- Dmsg1(30, "bfiled>stored: %s", sd->msg);
+ Dmsg1(130, "bfiled>stored: %s", sd->msg);
/* ****FIXME**** check response */
bnet_recv(sd); /* get OK */
/*
* Scan WHERE (base directory for restore) from command
*/
- Dmsg0(50, "restore command\n");
+ Dmsg0(150, "restore command\n");
/* Pickup where string */
where = get_memory(dir->msglen+1);
*where = 0;
sscanf(dir->msg, restorecmd, where);
- Dmsg1(50, "Got where=%s\n", where);
+ Dmsg1(150, "Got where=%s\n", where);
jcr->where = where;
bnet_fsend(dir, OKrestore);
- Dmsg1(10, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "bfiled>dird: %s", dir->msg);
jcr->JobType = JT_RESTORE;
jcr->JobStatus = JS_Blocked;
* Send Close session command to Storage daemon
*/
bnet_fsend(sd, read_close, jcr->Ticket);
- Dmsg1(30, "bfiled>stored: %s", sd->msg);
+ Dmsg1(130, "bfiled>stored: %s", sd->msg);
/* ****FIXME**** check response */
bnet_recv(sd); /* get OK */
/* Inform Director that we are done */
bnet_sig(dir, BNET_TERMINATE);
- Dmsg0(30, "Done in job.c\n");
+ Dmsg0(130, "Done in job.c\n");
return 1;
}
Jmsg(jcr, M_FATAL, 0, _("Improper calling sequence.\n"));
return 0;
}
- Dmsg4(20, "VolSessId=%ld VolsessT=%ld SF=%ld EF=%ld\n",
+ Dmsg4(120, "VolSessId=%ld VolsessT=%ld SF=%ld EF=%ld\n",
jcr->VolSessionId, jcr->VolSessionTime, jcr->StartFile, jcr->EndFile);
- Dmsg2(20, "JobId=%d vol=%s\n", jcr->JobId, "DummyVolume");
+ Dmsg2(120, "JobId=%d vol=%s\n", jcr->JobId, "DummyVolume");
/*
* Open Read Session with Storage daemon
*/
bnet_fsend(sd, read_open, jcr->VolumeName,
jcr->VolSessionId, jcr->VolSessionTime, jcr->StartFile, jcr->EndFile,
jcr->StartBlock, jcr->EndBlock);
- Dmsg1(10, ">stored: %s", sd->msg);
+ Dmsg1(110, ">stored: %s", sd->msg);
/*
* Get ticket number
*/
if (bnet_recv(sd) > 0) {
- Dmsg1(10, "bfiled<stored: %s", sd->msg);
+ Dmsg1(110, "bfiled<stored: %s", sd->msg);
if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) {
Jmsg(jcr, M_FATAL, 0, _("Bad response to SD read open: %s\n"), sd->msg);
return 0;
}
- Dmsg1(10, "bfiled: got Ticket=%d\n", jcr->Ticket);
+ Dmsg1(110, "bfiled: got Ticket=%d\n", jcr->Ticket);
} else {
Jmsg(jcr, M_FATAL, 0, _("Bad response from stored to read open command\n"));
return 0;
* Start read of data with Storage daemon
*/
bnet_fsend(sd, read_data, jcr->Ticket);
- Dmsg1(10, ">stored: %s", sd->msg);
+ Dmsg1(110, ">stored: %s", sd->msg);
/*
* Get OK data
return 0;
}
if ((n = bnet_recv(sd)) > 0) {
- Dmsg0(10, sd->msg);
+ Dmsg0(110, sd->msg);
if (strcmp(sd->msg, resp) == 0) {
return 1;
}
{
LEX *of;
- Dmsg1(20, "Close lex file: %s\n", lf->fname);
+ Dmsg1(40, "Close lex file: %s\n", lf->fname);
if (lf == NULL) {
Emsg0(M_ABORT, 0, "Close of NULL file\n");
}
of = lf->next;
fclose(lf->fd);
- Dmsg1(29, "Close cfg file %s\n", lf->fname);
+ Dmsg1(49, "Close cfg file %s\n", lf->fname);
free(lf->fname);
if (of) {
of->options = lf->options; /* preserve options */
memcpy(lf, of, sizeof(LEX));
- Dmsg1(29, "Restart scan of cfg file %s\n", of->fname);
+ Dmsg1(49, "Restart scan of cfg file %s\n", of->fname);
} else {
of = lf;
lf = NULL;
if ((fd = fopen(fname, "r")) == NULL) {
Emsg2(M_ABORT, 0, "Cannot open config file %s: %s\n", fname, strerror(errno));
}
- Dmsg1(29, "Open config file: %s\n", fname);
+ Dmsg1(49, "Open config file: %s\n", fname);
nf = (LEX *)malloc(sizeof(LEX));
if (lf) {
memcpy(nf, lf, sizeof(LEX));
} else {
lf->scan_error = s_err;
}
- Dmsg1(29, "Return lex=%x\n", lf);
+ Dmsg1(49, "Return lex=%x\n", lf);
return lf;
}
if (bnet_recv(fd) <= 0) {
break; /* connection terminated */
}
- Dmsg1(10, "<filed: %s", fd->msg);
+ Dmsg1(110, "<filed: %s", fd->msg);
found = 0;
for (i=0; fd_cmds[i].cmd; i++) {
if (strncmp(fd_cmds[i].cmd, fd->msg, strlen(fd_cmds[i].cmd)) == 0) {
}
}
if (!found) { /* command not found */
- Dmsg1(10, "<filed: Command not found: %s\n", fd->msg);
+ Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
bnet_fsend(fd, ferrmsg);
break;
}
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "Append data: %s", fd->msg);
+ Dmsg1(120, "Append data: %s", fd->msg);
if (jcr->session_opened) {
Dmsg1(10, "<bfiled: %s", fd->msg);
if (do_append_data(jcr)) {
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "store<file: %s", fd->msg);
+ Dmsg1(120, "store<file: %s", fd->msg);
if (!jcr->session_opened) {
bnet_fsend(fd, NOT_opened);
return 0;
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "Append open session: %s", fd->msg);
+ Dmsg1(120, "Append open session: %s", fd->msg);
if (jcr->session_opened) {
bnet_fsend(fd, NO_open);
return 0;
}
- Dmsg1(10, "Append open session: %s\n", dev_name(jcr->device->dev));
+ Dmsg1(110, "Append open session: %s\n", dev_name(jcr->device->dev));
jcr->session_opened = TRUE;
/* Send "Ticket" to File Daemon */
bnet_fsend(fd, OK_open, jcr->VolSessionId);
- Dmsg1(10, ">filed: %s", fd->msg);
+ Dmsg1(110, ">filed: %s", fd->msg);
return 1;
}
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "<filed: %s\n", fd->msg);
+ Dmsg1(120, "<filed: %s\n", fd->msg);
if (!jcr->session_opened) {
bnet_fsend(fd, NOT_opened);
return 0;
}
/* Send final statistics to File daemon */
bnet_fsend(fd, OK_close, jcr->NumVolumes);
- Dmsg1(60, ">filed: %s\n", fd->msg);
+ Dmsg1(160, ">filed: %s\n", fd->msg);
bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
- Dmsg1(10, "Append close session: %s\n", dev_name(jcr->device->dev));
+ Dmsg1(110, "Append close session: %s\n", dev_name(jcr->device->dev));
if (jcr->JobStatus != JS_ErrorTerminated) {
jcr->JobStatus = JS_Terminated;
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "Read data: %s\n", fd->msg);
+ Dmsg1(120, "Read data: %s\n", fd->msg);
if (jcr->session_opened) {
- Dmsg1(20, "<bfiled: %s", fd->msg);
+ Dmsg1(120, "<bfiled: %s", fd->msg);
return do_read_data(jcr);
} else {
bnet_fsend(fd, NOT_opened);
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "%s\n", fd->msg);
+ Dmsg1(120, "%s\n", fd->msg);
if (jcr->session_opened) {
bnet_fsend(fd, NO_open);
return 0;
/* Send "Ticket" to File Daemon */
bnet_fsend(fd, OK_open, jcr->VolSessionId);
- Dmsg1(10, ">filed: %s", fd->msg);
+ Dmsg1(110, ">filed: %s", fd->msg);
return 1;
}
{
BSOCK *fd = jcr->file_bsock;
- Dmsg1(20, "Read close session: %s\n", fd->msg);
+ Dmsg1(120, "Read close session: %s\n", fd->msg);
if (!jcr->session_opened) {
bnet_fsend(fd, NOT_opened);
return 0;
}
/* Send final statistics to File daemon */
bnet_fsend(fd, OK_close);
- Dmsg1(60, ">filed: %s\n", fd->msg);
+ Dmsg1(160, ">filed: %s\n", fd->msg);
bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
BSOCK *fd = (BSOCK *)arg;
char job_name[MAX_NAME_LENGTH];
- Dmsg0(200, "enter connection_from_filed\n");
+ Dmsg0(10, "enter connection_from_filed\n");
if (bnet_recv(fd) <= 0) {
Emsg0(M_FATAL, 0, _("Unable to authenticate Client.\n"));
return;
jcr->file_bsock = fd;
- Dmsg1(100, "Found Job %s\n", job_name);
+ Dmsg1(10, "Found Job %s\n", job_name);
if (jcr->authenticated) {
Pmsg2(000, "Hey!!!! JobId %d Job %s already authenticated.\n",
Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
} else {
jcr->authenticated = TRUE;
- Dmsg1(100, "OK Authentication Job %s\n", jcr->Job);
+ Dmsg1(10, "OK Authentication Job %s\n", jcr->Job);
}
P(jcr->mutex);
/* Global variables exported */
-struct s_shm *shm; /* memory shared with children */
-BSHM bshm; /* shared memory control packet */
+struct s_shm *shm; /* memory shared with children */
+BSHM bshm; /* shared memory control packet */
/* This is our own global resource */
static char *configfile;
static int foreground = 0;
-static workq_t dird_workq; /* queue for processing connections */
-static workq_t filed_workq; /* queue for processing connections */
+static workq_t dird_workq; /* queue for processing connections */
+static workq_t filed_workq; /* queue for processing connections */
static void usage()
/* Sanity checks */
if (TAPE_BSIZE % DEV_BSIZE != 0 || TAPE_BSIZE / DEV_BSIZE == 0) {
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
- TAPE_BSIZE, DEV_BSIZE);
+ TAPE_BSIZE, DEV_BSIZE);
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
while ((ch = getopt(argc, argv, "c:d:fst?")) != -1) {
switch (ch) {
case 'c': /* configuration file */
- if (configfile != NULL) {
- free(configfile);
- }
- configfile = bstrdup(optarg);
- break;
+ if (configfile != NULL) {
+ free(configfile);
+ }
+ configfile = bstrdup(optarg);
+ break;
case 'd': /* debug level */
- debug_level = atoi(optarg);
- if (debug_level <= 0) {
- debug_level = 1;
- }
- break;
+ debug_level = atoi(optarg);
+ if (debug_level <= 0) {
+ debug_level = 1;
+ }
+ break;
case 'f': /* run in foreground */
- foreground = TRUE;
- break;
+ foreground = TRUE;
+ break;
case 's': /* no signals */
- no_signals = TRUE;
- break;
+ no_signals = TRUE;
+ break;
case 't':
- test_config = TRUE;
- break;
+ test_config = TRUE;
+ break;
case '?':
- default:
- usage();
+ default:
+ usage();
}
}
if (argc) {
if (configfile != NULL) {
- free(configfile);
+ free(configfile);
}
configfile = bstrdup(*argv);
argc--;
}
if (!foreground) {
- daemon_start(); /* become daemon */
- init_stack_dump(); /* pick up new pid */
+ daemon_start(); /* become daemon */
+ init_stack_dump(); /* pick up new pid */
}
create_pid_file(me->pid_directory, "bacula-sd", me->SDport);
LockRes();
for (device=NULL,i=0; (device=(DEVRES *)GetNextRes(R_DEVICE, (RES *)device)); i++) {
if (i >= MAX_DEVICES) {
- UnlockRes();
+ UnlockRes();
Emsg1(M_ABORT, 0, _("Too many Device Resources. Max=%d\n"), MAX_DEVICES);
}
Dmsg1(90, "calling init_dev %s\n", device->device_name);
device->dev = init_dev(&shm->dev[i], device->device_name);
/* Copy some attributes from the Device Resource to the DEV structure */
if (device->dev) {
- device->dev->capabilities = device->cap_bits;
- device->dev->min_block_size = device->min_block_size;
- device->dev->max_block_size = device->max_block_size;
- device->dev->max_volume_jobs = device->max_volume_jobs;
- device->dev->max_volume_files = device->max_volume_files;
- device->dev->max_volume_size = device->max_volume_size;
- device->dev->max_file_size = device->max_file_size;
- device->dev->volume_capacity = device->volume_capacity;
- device->dev->max_rewind_wait = device->max_rewind_wait;
- device->dev->max_open_wait = device->max_open_wait;
- device->dev->device = device;
+ device->dev->capabilities = device->cap_bits;
+ device->dev->min_block_size = device->min_block_size;
+ device->dev->max_block_size = device->max_block_size;
+ device->dev->max_volume_jobs = device->max_volume_jobs;
+ device->dev->max_volume_files = device->max_volume_files;
+ device->dev->max_volume_size = device->max_volume_size;
+ device->dev->max_file_size = device->max_file_size;
+ device->dev->volume_capacity = device->volume_capacity;
+ device->dev->max_rewind_wait = device->max_rewind_wait;
+ device->dev->max_open_wait = device->max_open_wait;
+ device->dev->device = device;
}
- Dmsg1(10, "Init done %s\n", device->device_name);
+ Dmsg1(10, "SD init done %s\n", device->device_name);
if (!device->dev) {
Emsg1(M_ERROR, 0, _("Could not initialize %s\n"), device->device_name);
}
if (device->cap_bits & CAP_ALWAYSOPEN) {
Dmsg1(20, "calling open_device %s\n", device->device_name);
- if (!open_device(device->dev)) {
+ if (!open_device(device->dev)) {
Emsg1(M_ERROR, 0, _("Could not open device %s\n"), device->device_name);
- }
+ }
}
if (device->cap_bits & CAP_AUTOMOUNT && device->dev &&
- device->dev->state & ST_OPENED) {
- DEV_BLOCK *block;
- JCR *jcr;
- block = new_block(device->dev);
- jcr = new_jcr(sizeof(JCR), stored_free_jcr);
- switch (read_dev_volume_label(jcr, device->dev, block)) {
- case VOL_OK:
- break;
- default:
+ device->dev->state & ST_OPENED) {
+ DEV_BLOCK *block;
+ JCR *jcr;
+ block = new_block(device->dev);
+ jcr = new_jcr(sizeof(JCR), stored_free_jcr);
+ switch (read_dev_volume_label(jcr, device->dev, block)) {
+ case VOL_OK:
+ break;
+ default:
Emsg1(M_WARNING, 0, _("Could not mount device %s\n"), device->device_name);
- break;
- }
- free_jcr(jcr);
- free_block(block);
+ break;
+ }
+ free_jcr(jcr);
+ free_block(block);
}
}
UnlockRes();
set_thread_concurrency(me->max_concurrent_jobs * 2 +
4 /* watch dog + servers + misc */);
- start_watchdog(); /* start watchdog thread */
+ start_watchdog(); /* start watchdog thread */
/*
* Here we support either listening on one port or on two ports
if (me->SDDport == 0 || me->SDDport == me->SDport) {
/* Single server used for Director and File daemon */
bnet_thread_server(me->SDport, me->max_concurrent_jobs * 2,
- &dird_workq, connection_request);
+ &dird_workq, connection_request);
} else {
/* Start the Director server */
- if ((status=pthread_create(&dirid, NULL, director_thread,
- (void *)me->SDport)) != 0) {
+ if ((status=pthread_create(&dirid, NULL, director_thread,
+ (void *)me->SDport)) != 0) {
Emsg1(M_ABORT, 0, _("Cannot create Director thread: %s\n"), strerror(status));
}
/* Start File daemon server */
/* never returns */
}
- exit(1); /* to keep compiler quiet */
+ exit(1); /* to keep compiler quiet */
}
static void *director_thread(void *arg)
if (!me) {
UnlockRes();
Emsg1(M_ABORT, 0, _("No Storage resource defined in %s. Cannot continue.\n"),
- configfile);
+ configfile);
}
- my_name_is(0, (char **)NULL, me->hdr.name); /* Set our real name */
+ my_name_is(0, (char **)NULL, me->hdr.name); /* Set our real name */
if (GetNextRes(R_STORAGE, (RES *)me) != NULL) {
UnlockRes();
Emsg1(M_ABORT, 0, _("Only one Storage resource permitted in %s\n"),
- configfile);
+ configfile);
}
if (GetNextRes(R_DIRECTOR, NULL) == NULL) {
UnlockRes();
Emsg1(M_ABORT, 0, _("No Director resource defined in %s. Cannot continue.\n"),
- configfile);
+ configfile);
}
if (GetNextRes(R_DEVICE, NULL) == NULL){
UnlockRes();
Emsg1(M_ABORT, 0, _("No Device resource defined in %s. Cannot continue.\n"),
- configfile);
+ configfile);
}
if (!me->messages) {
me->messages = (MSGS *)GetNextRes(R_MSGS, NULL);
if (!me->messages) {
Emsg1(M_ABORT, 0, _("No Messages resource defined in %s. Cannot continue.\n"),
- configfile);
+ configfile);
}
}
- close_msg(NULL); /* close temp message handler */
+ close_msg(NULL); /* close temp message handler */
init_msg(NULL, me->messages); /* open daemon message handler */
UnlockRes();
if (!me->working_directory) {
Emsg1(M_ABORT, 0, _("No Working Directory defined in %s. Cannot continue.\n"),
- configfile);
+ configfile);
}
if (stat(me->working_directory, &stat_buf) != 0) {
Emsg1(M_ABORT, 0, _("Working Directory: %s not found. Cannot continue.\n"),
- me->working_directory);
+ me->working_directory);
}
if (!S_ISDIR(stat_buf.st_mode)) {
Emsg1(M_ABORT, 0, _("Working Directory: %s is not a directory. Cannot continue.\n"),
- me->working_directory);
+ me->working_directory);
}
working_directory = me->working_directory;
}
static int in_here = FALSE;
DEVRES *device;
- if (in_here) { /* prevent loops */
+ if (in_here) { /* prevent loops */
exit(1);
}
in_here = TRUE;
LockRes();
for (device=NULL; (device=(DEVRES *)GetNextRes(R_DEVICE, (RES *)device)); ) {
if (device->dev) {
- term_dev(device->dev);
+ term_dev(device->dev);
}
}
UnlockRes();
free(shm);
}
- sm_dump(False); /* dump orphaned buffers */
+ sm_dump(False); /* dump orphaned buffers */
exit(1);
}