set_portable_backup(&ff_pkt->bfd); /* disable Win32 BackupRead() */
}
- if (ff_pkt->cmd_plugin && !ff_pkt->no_read) {
+ if (ff_pkt->cmd_plugin) {
do_plugin_set = true;
/* option and cmd plugin are not compatible together */
do_read = true;
}
- if (ff_pkt->cmd_plugin) {
+ if (ff_pkt->cmd_plugin && !ff_pkt->no_read) {
do_read = true;
}
#ifdef HAVE_LZO
/** Do compression if turned on */
if (ff_pkt->flags & FO_COMPRESS && ff_pkt->Compress_algo == COMPRESS_LZO1X && jcr->LZO_compress_workset) {
+ lzo_uint len; /* TODO: See with the latest patch how to handle lzo_uint with 64bit */
+
ser_declare;
ser_begin(cbuf, sizeof(comp_stream_header));
Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", cbuf, rbuf, sd->msglen);
- lzores = lzo1x_1_compress((const unsigned char*)rbuf, sd->msglen, cbuf2, &compress_len, jcr->LZO_compress_workset);
+ lzores = lzo1x_1_compress((const unsigned char*)rbuf, sd->msglen, cbuf2,
+ &len, jcr->LZO_compress_workset);
+ compress_len = len;
if (lzores == LZO_E_OK && compress_len <= max_compress_len)
{
/* complete header */
Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
}
}
+ /* Generate Job global writer metadata */
WCHAR *metadata = g_pVSSClient->GetMetadata();
if (metadata) {
FF_PKT *ff_pkt = jcr->ff;
- ff_pkt->fname = (char *)"job";
+ ff_pkt->fname = (char *)"*all*"; /* for all plugins */
ff_pkt->type = FT_RESTORE_FIRST;
ff_pkt->LinkFI = 0;
ff_pkt->object_name = (char *)"job_metadata.xml";
static int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd);
static void filed_free_jcr(JCR *jcr);
static int open_sd_read_session(JCR *jcr);
-static int send_bootstrap_file(JCR *jcr);
static int runscript_cmd(JCR *jcr);
static int runbefore_cmd(JCR *jcr);
static int runafter_cmd(JCR *jcr);
static char OK_open[] = "3000 OK open ticket = %d\n";
static char OK_data[] = "3000 OK data\n";
static char OK_append[] = "3000 OK append data\n";
-static char OKSDbootstrap[]= "3000 OK bootstrap\n";
/* Commands sent to Storage Daemon */
/* we still need to do this to detect a vss restore */
if (strcmp(rop.object_name, "job_metadata.xml") == 0) {
Dmsg0(100, "got job metadata\n");
- //free_and_null_pool_memory(jcr->job_metadata);
- jcr->job_metadata = rop.object; /* this is like a boolean in the restore case */
- // rop.object = NULL; /* but not this */
+ jcr->got_metadata = true;
}
generate_plugin_event(jcr, bEventRestoreObject, (void *)&rop);
* No need to enable VSS for restore if we do not have plugin
* data to restore
*/
- enable_vss = jcr->job_metadata != NULL;
- jcr->job_metadata = NULL;
+ enable_vss = jcr->got_metadata;
Dmsg2(50, "g_pVSSClient = %p, enable_vss = %d\n", g_pVSSClient, enable_vss);
// capture state here, if client is backed up by multiple directors
dir->fsend(OKstoreend);
ret = 1; /* we continue the loop, waiting for next part */
} else {
- end_restore_cmd(jcr);
ret = 0; /* we stop here */
}
ret = 0; /* we stop here */
}
+ if (ret == 0) {
+ end_restore_cmd(jcr); /* stopping so send bEventEndRestoreJob */
+ }
return ret;
}
return 0;
}
- if (!send_bootstrap_file(jcr)) {
- return 0;
- }
-
/*
* Start read of data with Storage daemon
*/
}
return 0;
}
-
-static int send_bootstrap_file(JCR *jcr)
-{
- FILE *bs;
- char buf[2000];
- BSOCK *sd = jcr->store_bsock;
- const char *bootstrap = "bootstrap\n";
- int stat = 0;
-
- Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
- if (!jcr->RestoreBootstrap) {
- return 1;
- }
- bs = fopen(jcr->RestoreBootstrap, "rb");
- if (!bs) {
- berrno be;
- Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
- jcr->RestoreBootstrap, be.bstrerror());
- jcr->setJobStatus(JS_ErrorTerminated);
- goto bail_out;
- }
- sd->msglen = pm_strcpy(sd->msg, bootstrap);
- sd->send();
- while (fgets(buf, sizeof(buf), bs)) {
- sd->msglen = Mmsg(sd->msg, "%s", buf);
- sd->send();
- }
- sd->signal(BNET_EOD);
- fclose(bs);
- if (!response(jcr, sd, OKSDbootstrap, "Bootstrap")) {
- jcr->setJobStatus(JS_ErrorTerminated);
- goto bail_out;
- }
- stat = 1;
-
-bail_out:
- free_bootstrap(jcr);
- return stat;
-}