From: Eric Bollengier Date: Tue, 4 Apr 2023 12:50:19 +0000 (+0200) Subject: Ensure the Director can work with the previous SD after VolRetention modification X-Git-Tag: Beta-15.0.0~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acffd656f6e67f1f47a1482166229be2e9c6cc19;p=thirdparty%2Fbacula.git Ensure the Director can work with the previous SD after VolRetention modification --- diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index f20b6861b..d4737502b 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -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()); diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index a2a81f492..7f622d930 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -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), diff --git a/bacula/src/version.h b/bacula/src/version.h index 68129bd14..c1bd7bd21 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -171,18 +171,20 @@ * 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