]> git.sur5r.net Git - bacula/bacula/commitdiff
Tweak dir_update_volume_info
authorKern Sibbald <kern@sibbald.com>
Sun, 13 Dec 2015 13:49:07 +0000 (14:49 +0100)
committerKern Sibbald <kern@sibbald.com>
Sun, 13 Dec 2015 13:49:52 +0000 (14:49 +0100)
bacula/src/stored/acquire.c
bacula/src/stored/askdir.c
bacula/src/stored/device.c
bacula/src/stored/label.c

index b6faaf11c3e770863bc221c6d2a333a6c05ff152..153843c960b80d784cd1739908270d8b3134f4cc 100644 (file)
@@ -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 */
index a3cb80e613db7f068b8a299f59fca743b47da7e5..b7e9ba4df4411af1cd1efb78e0fa244b3bf4a3d0 100644 (file)
@@ -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;
    }
 
index 90a11cfb38d68d76657302b43301c3dfdbb61083..e2b31f51bf25bfe4f713cb10af8a0c022abcfa46 100644 (file)
@@ -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)));
index aaa97d78a38d6cd3dc8e1b218ead601dc31d209c..a764f95f8c2b72d4dbc7b57e5ed0836eff19e4bd 100644 (file)
@@ -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;
    }