]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Ensure the Director can work with the previous SD after VolRetention modification
authorEric Bollengier <eric@baculasystems.com>
Tue, 4 Apr 2023 12:50:19 +0000 (14:50 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/dird/authenticate.c
bacula/src/dird/catreq.c
bacula/src/version.h

index f20b6861bf260542fbb0bae612049e0b555f0b33..d4737502bf61832f31f073d227aa4a0f381ea417 100644 (file)
@@ -140,7 +140,8 @@ bool DIRAuthenticateSD::authenticate_storage_daemon(STORE *store)
       sd->clear_compress();
       Dmsg0(050, "*** No Dir compression to SD\n");
    }
-   if (jcr->SDVersion < SD_VERSION) {
+   // workaround with 30008 can be removed in 18.0.0
+   if (jcr->SDVersion < SD_VERSION && !(jcr->SDVersion == 30007 && SD_VERSION == 30008)) {
       status = M_FATAL;
       Mmsg(errmsg, _("[DE0031] Older Storage daemon at \"%s:%d\" incompatible with this Director.\n"),
            sd->host(), sd->port());
index a2a81f4928d5f57f92a8270624622bbf6ed3bf25..7f622d930206a9c18e133d5f04a8e7dce02f1dff 100644 (file)
@@ -59,16 +59,21 @@ static char Create_jobmedia[] = "CatReq JobId=%ld CreateJobMedia\n";
 static char Create_filemedia[] = "CatReq JobId=%ld CreateFileMedia\n";
 static char OK_create_filemedia[] = "1000 OK CreateFileMedia\n";
 
+/* To be removed in 18.0.0 */
 /* Responses  sent to Storage daemon */
-static char OK_media[] = "1000 OK VolName=%s VolJobs=%u VolFiles=%u"
-   " VolBlocks=%u VolBytes=%s VolABytes=%s VolHoleBytes=%s VolHoles=%u"
-   " VolMounts=%u VolErrors=%u VolWrites=%s"
-   " MaxVolBytes=%s VolCapacityBytes=%s VolStatus=%s Slot=%d"
-   " MaxVolJobs=%u MaxVolFiles=%u InChanger=%d VolReadTime=%s"
-   " VolWriteTime=%s EndFile=%u EndBlock=%u VolType=%u LabelType=%d"
-   " MediaId=%s ScratchPoolId=%s VolParts=%d VolCloudParts=%d"
-   " LastPartBytes=%lld Enabled=%d MaxPoolBytes=%s PoolBytes=%s Recycle=%d"
-   " Protected=%d UseProtect=%d VolEncrypted=%d VolRetention=%u\n";
+#define OK_media_base "1000 OK VolName=%s VolJobs=%u VolFiles=%u"           \
+   " VolBlocks=%u VolBytes=%s VolABytes=%s VolHoleBytes=%s VolHoles=%u"     \
+   " VolMounts=%u VolErrors=%u VolWrites=%s"                                \
+   " MaxVolBytes=%s VolCapacityBytes=%s VolStatus=%s Slot=%d"               \
+   " MaxVolJobs=%u MaxVolFiles=%u InChanger=%d VolReadTime=%s"              \
+   " VolWriteTime=%s EndFile=%u EndBlock=%u VolType=%u LabelType=%d"        \
+   " MediaId=%s ScratchPoolId=%s VolParts=%d VolCloudParts=%d"              \
+   " LastPartBytes=%lld Enabled=%d MaxPoolBytes=%s PoolBytes=%s Recycle=%d" \
+   " Protected=%d UseProtect=%d VolEncrypted=%d"
+
+static char OK_media[] = OK_media_base " VolRetention=%u\n";
+
+static char OK_media_old[] = OK_media_base "\n";
 
 static char OK_create[] = "1000 OK CreateJobMedia\n";
 
@@ -91,6 +96,14 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
    char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50],
       ed9[50], ed10[50], ed11[50], ed12[50];
 
+   /* 30008 is a change inside 16.0.x branch, we can simplify the code in 18.0 */
+   char *protocol;
+   if (jcr->SDVersion < 30008) {
+      protocol = OK_media_old;
+   } else {
+      protocol = OK_media;
+   }
+
    POOL_DBR pr;
    pr.PoolId = mr->PoolId;
    has_quota_reached(jcr, &pr); /* Fill MaxPoolBytes and PoolBytes if needed */
@@ -98,7 +111,9 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
    jcr->MediaId = mr->MediaId;
    pm_strcpy(jcr->VolumeName, mr->VolumeName);
    bash_spaces(mr->VolumeName);
-   stat = sd->fsend(OK_media, mr->VolumeName, mr->VolJobs,
+
+   stat = sd->fsend(protocol,
+      mr->VolumeName, mr->VolJobs,
       mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
       edit_uint64(mr->VolABytes, ed2),
       edit_uint64(mr->VolHoleBytes, ed3),
index 68129bd14c38bc083a8981ab3a5b7420cd8f290c..c1bd7bd2187c8dd943673d36fe04c8c0b59462f5 100644 (file)
  *  30005 04Jun15 - Added JobMedia queueing
  *  30006 11Apr17 - Added PoolBytes, MaxPoolBytes and Recycle
  *  30007 06Feb20 - Added can_create to the Find media request
+ *  30008 04Apr23 - Added VolumeRetention to Find_Media
  *
  * Community:
  *    305 04Jun15 - Added JobMedia queueing
  *    306 20Mar15 - Added comm line compression
  *    307 06Feb20 - Added can_create to the Find media request
  *  30007 02Dec20 - Sync with Enterprise
+ *  30008 04Apr23 - Added VolumeRetention to Find_Media
  */
 
 #ifdef COMMUNITY
-#define SD_VERSION 30007   /* Community SD version */
+#define SD_VERSION 30008   /* Community SD version */
 #else
-#define SD_VERSION 30007   /* Enterprise SD version */
+#define SD_VERSION 30008   /* Enterprise SD version */
 #endif
 
 /* FD_VERSION history Enterprise