Skip to content

Commit

Permalink
stored: warn for Maximum Block Size on non-tape
Browse files Browse the repository at this point in the history
As setting Maximum Block Size on a non-tape device can lead to
unexpected results we now emit a warning in that case.
  • Loading branch information
arogge committed Sep 1, 2020
1 parent a535e1e commit 24d3b60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/src/stored/device_resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
02110-1301, USA.
*/

#include "lib/parse_conf.h"
#include "stored/autoxflate.h"
#include "stored/device_resource.h"
#include "stored/stored_globals.h"
Expand Down Expand Up @@ -284,5 +285,13 @@ void DeviceResource::CreateAndAssignSerialNumber(uint16_t number)
resource_name_ = strdup(tmp_name.c_str());
}

bool DeviceResource::Validate()
{
if (max_block_size > 0 && dev_type != DeviceType::B_TAPE_DEV) {
my_config->AddWarning(
"Setting 'Maximum Block Size' on a non-tape device is unsupported");
}
return true;
}

} /* namespace storagedaemon */
1 change: 1 addition & 0 deletions core/src/stored/device_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class DeviceResource : public BareosResource {
void CreateAndAssignSerialNumber(uint16_t number);
void MultipliedDeviceRestoreBaseName();
void MultipliedDeviceRestoreNumberedName();
bool Validate() override;

private:
std::string multiplied_device_resource_base_name; /** < base name without
Expand Down

0 comments on commit 24d3b60

Please sign in to comment.