From: Michal Rakowski Date: Wed, 9 Jun 2021 06:21:27 +0000 (+0200) Subject: Fix #7568 About wrong handling of copy and migration jobs error handlig X-Git-Tag: Release-11.3.2~492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61f4b4c58594af935767ec0549086200558b6557;p=thirdparty%2Fbacula.git Fix #7568 About wrong handling of copy and migration jobs error handlig --- diff --git a/bacula/src/dird/mac.c b/bacula/src/dird/mac.c index aca3959cb..ae8524536 100644 --- a/bacula/src/dird/mac.c +++ b/bacula/src/dird/mac.c @@ -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; } diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 3da8d516e..17307613f 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -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 */