static char OKbackup[] = "2000 OK backup\n";
static char OKstore[] = "2000 OK storage\n";
static char EndJob[] = "2800 End Job TermCode=%d JobFiles=%u "
+ "ReadBytes=%lld JobBytes=%lld Errors=%u "
+ "VSS=%d Encrypt=%d\n";
+/* Pre 1.39.29 (04Dec06) EndJob */
+static char OldEndJob[] = "2800 End Job TermCode=%d JobFiles=%u "
"ReadBytes=%lld JobBytes=%lld Errors=%u\n";
-
/*
* Called here before the job is run to do the job
* specific setup.
bool fd_ok = false;
uint32_t JobFiles, Errors;
uint64_t ReadBytes, JobBytes;
+ int VSS = 0;
+ int Encrypt = 0;
set_jcr_job_status(jcr, JS_Running);
/* Wait for Client to terminate */
while ((n = bget_dirmsg(fd)) >= 0) {
- if (!fd_ok && sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
- &ReadBytes, &JobBytes, &Errors) == 5) {
+ if (!fd_ok &&
+ (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
+ &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 ||
+ sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
+ &ReadBytes, &JobBytes, &Errors) == 5)) {
fd_ok = true;
set_jcr_job_status(jcr, jcr->FDJobStatus);
Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus);
jcr->Errors = Errors;
jcr->ReadBytes = ReadBytes;
jcr->JobBytes = JobBytes;
+ jcr->VSS = VSS;
+ jcr->Encrypt = Encrypt;
} else {
Jmsg(jcr, M_FATAL, 0, _("No Job status returned from FD.\n"));
}
" SD Bytes Written: %s (%sB)\n"
" Rate: %.1f KB/s\n"
" Software Compression: %s\n"
+" VSS: %s\n"
+" Encryption: %s\n"
" Volume name(s): %s\n"
" Volume Session Id: %d\n"
" Volume Session Time: %d\n"
edit_uint64_with_suffix(jcr->SDJobBytes, ec6),
(float)kbps,
compress,
+ jcr->VSS?"yes":"no",
+ jcr->Encrypt?"yes":"no",
jcr->VolumeName,
jcr->VolSessionId,
jcr->VolSessionTime,
* We return 1 on sucess and 0 on errors.
*
* ***FIXME***
- * We use ff_pkt->statp.st_size when FO_SPARSE.
+ * We use ff_pkt->statp.st_size when FO_SPARSE to know when to stop
+ * reading.
* Currently this is not a problem as the only other stream, resource forks,
* are not handled as sparse files.
*/
* Read the file data
*/
while ((sd->msglen=(uint32_t)bread(&ff_pkt->bfd, rbuf, rsize)) > 0) {
- bool sparseBlock = false;
/* Check for sparse blocks */
if (ff_pkt->flags & FO_SPARSE) {
ser_declare;
+ bool haveBlock = true;
if (sd->msglen == rsize &&
fileAddr+sd->msglen < (uint64_t)ff_pkt->statp.st_size ||
((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) &&
(uint64_t)ff_pkt->statp.st_size == 0)) {
- sparseBlock = is_buf_zero(rbuf, rsize);
+ haveBlock = !is_buf_zero(rbuf, rsize);
}
- if (!sparseBlock) {
+ if (haveBlock) {
ser_begin(wbuf, SPARSE_FADDR_SIZE);
ser_uint64(fileAddr); /* store fileAddr in begin of buffer */
}
fileAddr += sd->msglen; /* update file address */
- if (sparseBlock) {
+ if (!haveBlock) {
continue; /* skip block of zeros */
}
}
static char OKjob[] = "2000 OK Job %s (%s) %s,%s,%s";
static char OKsetdebug[] = "2000 OK setdebug=%d\n";
static char BADjob[] = "2901 Bad Job\n";
-static char EndJob[] = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s JobBytes=%s Errors=%u\n";
+static char EndJob[] = "2800 End Job TermCode=%d JobFiles=%u ReadBytes=%s"
+ " JobBytes=%s Errors=%u VSS=%d Encrypt=%d\n";
static char OKRunBefore[] = "2000 OK RunBefore\n";
static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n";
static char OKRunAfter[] = "2000 OK RunAfter\n";
/*
- * Do a backup. For now, we handle only Full and Incremental.
+ * Do a backup.
*/
static int backup_cmd(JCR *jcr)
{
int ok = 0;
int SDJobStatus;
char ed1[50], ed2[50];
+ bool bDoVSS = false;
#if defined(WIN32_VSS)
// capture state here, if client is backed up by multiple directors
// and one enables vss and the other does not then enable_vss can change
// between here and where its evaluated after the job completes.
- bool bDoVSS = false;
-
bDoVSS = g_pVSSClient && enable_vss;
- if (bDoVSS)
+ if (bDoVSS) {
/* Run only one at a time */
P(vss_mutex);
+ }
#endif
set_jcr_job_status(jcr, JS_Blocked);
bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
edit_uint64(jcr->ReadBytes, ed1),
- edit_uint64(jcr->JobBytes, ed2), jcr->Errors);
+ edit_uint64(jcr->JobBytes, ed2), jcr->Errors, (int)bDoVSS,
+ jcr->pki_encrypt);
Dmsg1(110, "End FD msg: %s\n", dir->msg);
return 0; /* return and stop command loop */
char *text = NULL;
if (!PyArg_ParseTuple(args, "s:write", &text)) {
- Dmsg0(000, "Parse tuple error in job_write\n");
+ Pmsg0(000, "Parse tuple error in job_write\n");
return NULL;
}
if (text) {
Dmsg0(100, "In set_job_events.\n");
if (!PyArg_ParseTuple(arg, "O", &eObject)) {
- Dmsg0(000, "Parse error looking for Object argument\n");
+ Pmsg0(000, "Parse error looking for Object argument\n");
return NULL;
}
jcr = get_jcr_from_PyObject(self);
if (result == NULL) {
if (PyErr_Occurred()) {
PyErr_Print();
- Dmsg1(000, "Error in Python method %s\n", event);
+ Pmsg1(000, "Error in Python method %s\n", event);
}
} else {
stat = 1;
bool needs_sd; /* set if SD needed by Job */
bool cloned; /* set if cloned */
bool unlink_bsr; /* Unlink bsr file created */
+ bool VSS; /* VSS used by FD */
+ bool Encrypt; /* Encryption used by FD */
#endif /* DIRECTOR_DAEMON */
General:
04Dec06
+kes Add job report indication of whether or not VSS and Encryption were
+ used by the FD.
+kes Modify sparseBlock variable name to make the code clearer.
+kes Add more sparse tests to regress using gigaslam sparse file
+ generator.
kes Enable data encryption code.
kes Add gigaslam.c to src/tools. It creates a 1GB file that contains
only two blocks -- i.e. it is a real sparse file.