return true;
}
-
-/*
- * Send bootstrap file if any to the socket given (FD or SD).
- * This is used for restore, verify VolumeToCatalog, and
- * for migration.
- */
-bool send_bootstrap_file(JCR *jcr, BSOCK *sock)
-{
- FILE *bs;
- char buf[1000];
- const char *bootstrap = "bootstrap\n";
-
- Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
- if (!jcr->RestoreBootstrap) {
- return true;
- }
- 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());
- set_jcr_job_status(jcr, JS_ErrorTerminated);
- return false;
- }
- sock->fsend(bootstrap);
- while (fgets(buf, sizeof(buf), bs)) {
- sock->fsend("%s", buf);
- }
- sock->signal(BNET_EOD);
- fclose(bs);
- if (jcr->unlink_bsr) {
- unlink(jcr->RestoreBootstrap);
- jcr->unlink_bsr = false;
- }
- return true;
-}
-
/* TODO: drop this with runscript.old_proto in bacula 1.42 */
static char runbefore[] = "RunBeforeJob %s\n";
static char runafter[] = "RunAfterJob %s\n";
set_jcr_job_status(jcr, JS_Terminated);
}
+/*
+ * Send bootstrap file to Storage daemon.
+ * This is used for restore, verify VolumeToCatalog, migration,
+ * and copy Jobs.
+ */
+bool send_bootstrap_file(JCR *jcr, BSOCK *sd)
+{
+ FILE *bs;
+ char buf[1000];
+ const char *bootstrap = "bootstrap\n";
+
+ Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
+ if (!jcr->RestoreBootstrap) {
+ return true;
+ }
+ 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());
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return false;
+ }
+ sd->fsend(bootstrap);
+ while (fgets(buf, sizeof(buf), bs)) {
+ sd->fsend("%s", buf);
+ }
+ sd->signal(BNET_EOD);
+ fclose(bs);
+ if (jcr->unlink_bsr) {
+ unlink(jcr->RestoreBootstrap);
+ jcr->unlink_bsr = false;
+ }
+ return true;
+}
+
+
#ifdef needed
#define MAX_TRIES 30
#define WAIT_TIME 2
int max_retry_time, int verbose);
extern bool send_include_list(JCR *jcr);
extern bool send_exclude_list(JCR *jcr);
-extern bool send_bootstrap_file(JCR *jcr, BSOCK *sock);
extern bool send_level_command(JCR *jcr);
extern int get_attributes_and_put_in_catalog(JCR *jcr);
extern void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId);
extern bool start_storage_daemon_message_thread(JCR *jcr);
extern int bget_dirmsg(BSOCK *bs);
extern void wait_for_storage_daemon_termination(JCR *jcr);
+extern bool send_bootstrap_file(JCR *jcr, BSOCK *sd);
/* next_vol.c */
int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, int index,
/* Responses received from File daemon */
static char OKrestore[] = "2000 OK restore\n";
static char OKstore[] = "2000 OK storage\n";
-static char OKbootstrap[] = "2000 OK bootstrap\n";
+
+/* Responses received from the Storage daemon */
+static char OKbootstrap[] = "3000 OK bootstrap\n";
/*
* Do a restore of the specified files
*/
bool do_restore(JCR *jcr)
{
- BSOCK *fd;
+ BSOCK *fd, *sd;
JOB_DBR rjr; /* restore job record */
char replace, *where, *cmd;
char empty = '\0';
if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
goto bail_out;
}
+ sd = jcr->store_bsock;
/*
* Now start a job with the Storage daemon
*/
if (!start_storage_daemon_job(jcr, jcr->rstorage, NULL)) {
goto bail_out;
}
- if (!jcr->store_bsock->fsend("run")) {
+
+ /*
+ * Send the bootstrap file -- what Volumes/files to restore
+ */
+ if (!send_bootstrap_file(jcr, sd) ||
+ !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+
+ if (!sd->fsend("run")) {
goto bail_out;
}
/*
goto bail_out;
}
- /*
- * Send the bootstrap file -- what Volumes/files to restore
- */
- if (!send_bootstrap_file(jcr, fd) ||
- !response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
- goto bail_out;
- }
-
-
if (!send_runscripts_commands(jcr)) {
goto bail_out;
}
/* Responses received from File daemon */
static char OKverify[] = "2000 OK verify\n";
static char OKstore[] = "2000 OK storage\n";
-static char OKbootstrap[] = "2000 OK bootstrap\n";
+
+/* Responses received from the Storage daemon */
+static char OKbootstrap[] = "3000 OK bootstrap\n";
/* Forward referenced functions */
static void prt_fname(JCR *jcr);
edit_uint64(jcr->JobId, ed1), level_to_str(jcr->get_JobLevel()), jcr->Job);
if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG) {
+ BSOCK *sd;
/*
* Start conversation with Storage daemon
*/
if (!start_storage_daemon_job(jcr, jcr->rstorage, NULL)) {
return false;
}
- if (!jcr->store_bsock->fsend("run")) {
+ sd = jcr->store_bsock;
+ /*
+ * Send the bootstrap file -- what Volumes/files to restore
+ */
+ if (!send_bootstrap_file(jcr, sd) ||
+ !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+ if (!sd->fsend("run")) {
return false;
}
/*
goto bail_out;
}
- /*
- * Send the bootstrap file -- what Volumes/files to restore
- */
- if (!send_bootstrap_file(jcr, fd) ||
- !response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
- goto bail_out;
- }
-
if (!jcr->RestoreBootstrap) {
Jmsg0(jcr, M_FATAL, 0, _("Deprecated feature ... use bootstrap.\n"));
goto bail_out;
bool is_job_canceled() {return job_canceled(this); };
int32_t get_JobType() { return m_JobType; };
int32_t get_JobLevel() { return m_JobLevel; };
-
+ bool no_client_used() {
+ return (m_JobType == JT_MIGRATE || m_JobType == JT_COPY ||
+ m_JobLevel == L_VIRTUAL_FULL);
+ };
const char *get_OperationName(); /* in lib/jcr.c */
const char *get_ActionName(bool past); /* in lib/jcr.c */
void set_JobLevel(int32_t JobLevel); /* in lib/jcr.c */
alist *reserve_msgs; /* reserve fail messages */
bool write_part_after_job; /* Set to write part after job */
bool PreferMountedVols; /* Prefer mounted vols rather than new */
- bool need_fd; /* set if we need FD connection */
/* Parmaters for Open Read Session */
BSR *bsr; /* Bootstrap record -- has everything */
static bool bootstrap_cmd(JCR *jcr)
{
- /* If getting the bootstrap file succeeds, we do not need
- * the FD because we will be reading.
- */
- jcr->need_fd = false;
return get_bootstrap_file(jcr, jcr->dir_bsock);
}
jcr->PreferMountedVols = PreferMountedVols;
jcr->authenticated = false;
- jcr->need_fd = true;
/*
* Pass back an authorization key for the File daemon
/* If we do not need the FD, we are doing a migrate, copy, or virtual
* backup.
*/
- if (!jcr->need_fd) {
+ if (jcr->no_client_used()) {
do_mac(jcr);
return false;
}
General:
13Jul09
+kes Send bootstrap directly from DIR to SD
kes Create build scripts for Win64 somewhat equilavent to the Win32 ones.
10Jul09
ebl Print correct JobId in bls, should fix #1331
kes Add --with-hostname to ./configure
mvw Changed ACL_OTHER into ACL_OTHER_OBJ as IRIX doesn't seem to have
ACL_OTHER. Fixes bug #1333
-=======
04Jul09
mvw Change checking for acl and xattr support from first file to
job level.