Skip to content

Commit

Permalink
mac: fix events not being dispatched correctly
Browse files Browse the repository at this point in the history
A bSdEventSetupRecordTranslation event should get dispatched
when reading and writing records during copy/migration.
  • Loading branch information
sebsura authored and BareosBot committed Nov 10, 2023
1 parent f4f28f1 commit d5d08f4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
30 changes: 30 additions & 0 deletions core/src/stored/mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,16 @@ bool DoMacRun(JobControlRecord* jcr)
jcr->sd_impl->read_dcr->dev->file,
jcr->sd_impl->read_dcr->dev->block_num);

// Let SD plugins setup the record translation on read dcr
if (GeneratePluginEvent(jcr, bSdEventSetupRecordTranslation,
jcr->sd_impl->read_dcr)
!= bRC_OK) {
Jmsg(jcr, M_FATAL, 0,
_("bSdEventSetupRecordTranslation call failed for read dcr!\n"));
ok = false;
goto bail_out;
}

jcr->sendJobStatus(JS_Running);

// Set network buffering.
Expand Down Expand Up @@ -588,6 +598,26 @@ bool DoMacRun(JobControlRecord* jcr)
Dmsg2(200, "===== After acquire pos %u:%u\n", jcr->sd_impl->dcr->dev->file,
jcr->sd_impl->dcr->dev->block_num);

// Let SD plugins setup the record translation on read dcr
if (GeneratePluginEvent(jcr, bSdEventSetupRecordTranslation,
jcr->sd_impl->read_dcr)
!= bRC_OK) {
Jmsg(jcr, M_FATAL, 0,
_("bSdEventSetupRecordTranslation call failed for read dcr!\n"));
ok = false;
goto bail_out;
}

// Let SD plugins setup the record translation on write dcr
if (GeneratePluginEvent(jcr, bSdEventSetupRecordTranslation,
jcr->sd_impl->dcr)
!= bRC_OK) {
Jmsg(jcr, M_FATAL, 0,
_("bSdEventSetupRecordTranslation call failed for write dcr!\n"));
ok = false;
goto bail_out;
}

jcr->sendJobStatus(JS_Running);

// Update the initial Job Statistics.
Expand Down
2 changes: 1 addition & 1 deletion systemtests/tests/autoxflate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2021-2022 Bareos GmbH & Co. KG
# Copyright (C) 2021-2023 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
6 changes: 6 additions & 0 deletions systemtests/tests/autoxflate/testrunner
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ setup_data

start_test

debug_level=500

# 1) Create a full backup with LZ4 compression (as per SelfTest fileset config)
# 2) Copy full backup to other pool and decompress (as per FileStorage2 device config)
# 3) Restore copied job
Expand All @@ -30,8 +32,12 @@ wait
update volume=TestVolume001 volstatus=Used
messages
label volume=TestCopyVolume001 storage=File2 pool=FullCopy
setdebug level=$debug_level storage=File
setdebug level=$debug_level storage=File2
run copy yes
wait
setdebug level=0 storage=File
setdebug level=0 storage=File2
messages
restore jobid=4 client=bareos-fd where=$tmp/bareos-restores all done yes
wait
Expand Down

0 comments on commit d5d08f4

Please sign in to comment.