From: Kern Sibbald Date: Sun, 13 Dec 2015 13:49:07 +0000 (+0100) Subject: Tweak dir_update_volume_info X-Git-Tag: Release-7.4.0~135 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=675c2b9666c3d1a8ddde171e18eb2ce9d76105d9;p=bacula%2Fbacula Tweak dir_update_volume_info --- diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index b6faaf11c3..153843c960 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -451,8 +451,7 @@ DCR *acquire_device_for_append(DCR *dcr) Dmsg4(100, "=== nwriters=%d nres=%d vcatjob=%d dev=%s\n", dev->num_writers, dev->num_reserved(), dev->VolCatInfo.VolCatJobs, dev->print_name()); - dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ - ok = true; + ok = dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ get_out: /* Don't plugin close here, we might have multiple writers */ diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index a3cb80e613..b7e9ba4df4 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -428,6 +428,9 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten) } Dmsg1(100, "get_volume_info() %s", dir->msg); /* Update dev Volume info in case something changed (e.g. expired) */ + vol->Slot = dev->VolCatInfo.Slot; + bstrncpy(vol->VolCatStatus, dcr->VolCatInfo.VolCatStatus, sizeof(vol->VolCatStatus)); + dcr->VolCatInfo.VolCatAdataBytes = dev->VolCatInfo.VolCatAdataBytes; dcr->VolCatInfo.VolCatAmetaBytes = dev->VolCatInfo.VolCatAmetaBytes; dcr->VolCatInfo.VolCatHoleBytes = dev->VolCatInfo.VolCatHoleBytes; @@ -436,8 +439,13 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten) dcr->VolCatInfo.VolCatAmetaPadding = dev->VolCatInfo.VolCatAmetaPadding; dcr->VolCatInfo.VolCatAdataPadding = dev->VolCatInfo.VolCatAdataPadding; dcr->VolCatInfo.VolCatFiles = dev->VolCatInfo.VolCatFiles; - bstrncpy(vol->VolCatStatus, dcr->VolCatInfo.VolCatStatus, sizeof(vol->VolCatStatus)); - /* ***FIXME*** copy other fields that can change, if any */ + dcr->VolCatInfo.VolCatBytes = dev->VolCatInfo.VolCatBytes; + dcr->VolCatInfo.VolCatMounts = dev->VolCatInfo.VolCatMounts; + dcr->VolCatInfo.VolCatJobs = dev->VolCatInfo.VolCatJobs; + dcr->VolCatInfo.VolCatFiles = dev->VolCatInfo.VolCatFiles; + dcr->VolCatInfo.VolCatRecycles = dev->VolCatInfo.VolCatRecycles; + dcr->VolCatInfo.VolCatWrites = dev->VolCatInfo.VolCatWrites; + dcr->VolCatInfo.VolCatReads = dev->VolCatInfo.VolCatReads; ok = true; } diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 90a11cfb38..e2b31f51bf 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -138,7 +138,9 @@ bool fixup_device_block_write_error(DCR *dcr, int retries) dev->Lock(); /* lock again */ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs on vol */ - dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ + if (!dir_update_volume_info(dcr, false, false)) { /* send Volume info to Director */ + goto bail_out; + } Jmsg(jcr, M_INFO, 0, _("New volume \"%s\" mounted on device %s at %s.\n"), dcr->VolumeName, dev->print_name(), bstrftime(dt, sizeof(dt), time(NULL))); diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index aaa97d78a3..a764f95f8c 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -593,7 +593,7 @@ bool DCR::rewrite_volume_label(bool recycle) dev->setVolCatStatus("Append"); ASSERT(dcr->VolumeName[0]); dev->setVolCatName(dcr->VolumeName); - if (!dir_update_volume_info(dcr, true, true)) { /* indicate doing relabel */ + if (!dir_update_volume_info(dcr, true, true)) { /* indicate relabel */ Leave(100); return false; }