]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7568 About wrong handling of copy and migration jobs error handlig
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Wed, 9 Jun 2021 06:21:27 +0000 (08:21 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:02 +0000 (09:03 +0100)
bacula/src/dird/mac.c
bacula/src/dird/msgchan.c

index aca3959cbd37e835fd88ba7b3504b578973da235..ae85245363cd13b62295ca67a18465ad9f4fce1c 100644 (file)
@@ -441,6 +441,7 @@ bool do_mac(JCR *jcr)
     */
    Dmsg0(200, "Connect to write (wjcr) storage daemon.\n");
    if (!connect_to_storage_daemon(wjcr, 10, SDConnectTimeout, 1)) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not connect to write Storage Daemon: %s\n"), wjcr->store_mngr->get_wstore()->name());
       goto bail_out;
    }
    wsd = wjcr->store_bsock;
@@ -450,6 +451,7 @@ bool do_mac(JCR *jcr)
     */
    Dmsg1(200, "Connect to read (jcr) storage daemon. Jid=%d\n", jcr->JobId);
    if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not connect to read Storage Daemon: %s\n"), jcr->store_mngr->get_rstore()->name());
       goto bail_out;
    }
    sd = jcr->store_bsock;
@@ -469,6 +471,7 @@ bool do_mac(JCR *jcr)
     */
    Dmsg1(200, "Start job with read (jcr) storage daemon. Jid=%d\n", jcr->JobId);
    if (!start_storage_daemon_job(jcr, jcr->store_mngr->get_rstore_list(), NULL, true /* wait */, /*send_bsr*/true)) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not start job on read Storage Daemon: %s\n"), jcr->store_mngr->get_rstore()->name());
       goto bail_out;
    }
    Dmsg0(150, "Read storage daemon connection OK\n");
@@ -486,6 +489,7 @@ bool do_mac(JCR *jcr)
     */
    Dmsg1(200, "Start Job with write (wjcr) storage daemon. Jid=%d\n", jcr->JobId);
    if (!start_storage_daemon_job(wjcr, NULL, wjcr->store_mngr->get_wstore_list(), true /* wait */, /*no_send_bsr*/false)) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not start job on write Storage Daemon: %s\n"), wjcr->store_mngr->get_wstore()->name());
       goto bail_out;
    }
    Dmsg0(150, "Write storage daemon connection OK\n");
@@ -626,9 +630,7 @@ bail_out:
    wjcr->store_mngr->reset_wstorage();
    wjcr->file_bsock = NULL;
 
-   if (ok) {
-      mac_cleanup(jcr, jcr->JobStatus, wjcr->JobStatus);
-   }
+   mac_cleanup(jcr, jcr->JobStatus, wjcr->JobStatus);
    return ok;
 }
 
index 3da8d516ec066823aba113cc1d1ab43a19c27e74..17307613f4e4b9668b9a35a14c0abd53cfd9d7c1 100644 (file)
@@ -96,6 +96,7 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
    STORE *store;
    utime_t heart_beat;
    STORE *wstore = jcr->store_mngr->get_wstore();
+   POOL_MEM buf;
 
    if (is_bsock_open(sd)) {
       return true;                    /* already connected */
@@ -112,7 +113,7 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
    }
 
    if (!store) {
-      Dmsg0(100, "No storage resource found in jcr!\n");
+      Dmsg1(100, "No storage resource found in jcr for JobId: %d!\n", jcr->JobId);
       return false;
    }
 
@@ -128,7 +129,9 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
    Dmsg2(100, "Connect to Storage daemon %s:%d\n", store->address,
       store->SDport);
    sd->set_source_address(director->DIRsrc_addr);
-   if (!sd->connect(jcr, retry_interval, max_retry_time, heart_beat, _("Storage daemon"),
+   //TODO is translating needed/useful here?
+   Mmsg(buf, _("Storage Daemon: %s"), store->name());
+   if (!sd->connect(jcr, retry_interval, max_retry_time, heart_beat, buf.c_str(),
          store->address, NULL, store->SDport, verbose)) {
 
       if (!jcr->store_bsock) {  /* The bsock was locally created, so we free it here */