]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/restore.c
Minor tweaks to Migration
[bacula/bacula] / bacula / src / dird / restore.c
index 4c442816c87652e6880b212bd6d5262333ce1a08..49b412c5aa08a9fa431b13373982b49603865924 100644 (file)
@@ -18,7 +18,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -43,6 +43,7 @@ static char storaddr[]     = "storage address=%s port=%d ssl=0\n";
 /* 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";
 
 /*
  * Do a restore of the specified files
@@ -55,6 +56,8 @@ bool do_restore(JCR *jcr)
    BSOCK   *fd;
    JOB_DBR rjr;                       /* restore job record */
 
+   free_wstorage(jcr);                /* we don't write */
+
    memset(&rjr, 0, sizeof(rjr));
    jcr->jr.JobLevel = L_FULL;         /* Full restore */
    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
@@ -94,10 +97,13 @@ bool do_restore(JCR *jcr)
    /*
     * Now start a job with the Storage daemon
     */
-   if (!start_storage_daemon_job(jcr, jcr->storage, NULL)) {
+   if (!start_storage_daemon_job(jcr, jcr->rstorage, NULL)) {
       restore_cleanup(jcr, JS_ErrorTerminated);
       return false;
    }
+   if (!bnet_fsend(jcr->store_bsock, "run")) {
+      return false;
+   }
    /*
     * Now start a Storage daemon message thread
     */
@@ -107,6 +113,7 @@ bool do_restore(JCR *jcr)
    }
    Dmsg0(50, "Storage daemon connection OK\n");
 
+
    /*
     * Start conversation with File daemon
     */
@@ -119,27 +126,15 @@ bool do_restore(JCR *jcr)
    fd = jcr->file_bsock;
    set_jcr_job_status(jcr, JS_Running);
 
-#ifdef xxx
-   if (!send_include_list(jcr)) {
-      restore_cleanup(jcr, JS_ErrorTerminated);
-      return false;
-   }
-
-   if (!send_exclude_list(jcr)) {
-      restore_cleanup(jcr, JS_ErrorTerminated);
-      return false;
-   }
-#endif
-
    /*
     * send Storage daemon address to the File daemon,
     *   then wait for File daemon to make connection
     *   with Storage daemon.
     */
-   if (jcr->store->SDDport == 0) {
-      jcr->store->SDDport = jcr->store->SDport;
+   if (jcr->rstore->SDDport == 0) {
+      jcr->rstore->SDDport = jcr->rstore->SDport;
    }
-   bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport);
+   bnet_fsend(fd, storaddr, jcr->rstore->address, jcr->rstore->SDDport);
    Dmsg1(6, "dird>filed: %s\n", fd->msg);
    if (!response(jcr, fd, OKstore, "Storage", DISPLAY_ERROR)) {
       restore_cleanup(jcr, JS_ErrorTerminated);
@@ -149,13 +144,14 @@ bool do_restore(JCR *jcr)
    /*
     * Send the bootstrap file -- what Volumes/files to restore
     */
-   if (!send_bootstrap_file(jcr)) {
+   if (!send_bootstrap_file(jcr, fd) ||
+       !response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
       restore_cleanup(jcr, JS_ErrorTerminated);
       return false;
    }
 
 
-   if (!send_run_before_and_after_commands(jcr)) {
+   if (!send_runscripts_commands(jcr)) {
       restore_cleanup(jcr, JS_ErrorTerminated);
       return false;
    }
@@ -197,6 +193,7 @@ bool do_restore(JCR *jcr)
 
 bool do_restore_init(JCR *jcr) 
 {
+   free_wstorage(jcr);
    return true;
 }