Skip to content

Commit

Permalink
Merge pull request #465 from bareos/dev/franku/master/sd-droplet-exit…
Browse files Browse the repository at this point in the history
…-if-max_concurrent_jobs-gt-1

droplet: only allow configuration maximum concurrent jobs of 0 or 1
  • Loading branch information
franku committed Mar 31, 2020
2 parents 6964366 + a2b30b6 commit 238dc53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
30 changes: 29 additions & 1 deletion core/src/stored/stored_conf.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2016 Bareos GmbH & Co. KG
Copyright (C) 2013-2020 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 Expand Up @@ -538,9 +538,37 @@ static void ConfigBeforeCallback(ConfigurationParser& my_config)
my_config.InitializeQualifiedResourceNameTypeConverter(map);
}

static void CheckDropletDevices(ConfigurationParser& my_config)
{
BareosResource* p = nullptr;

while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
DeviceResource* device = dynamic_cast<DeviceResource*>(p);
if (device && device->dev_type == B_DROPLET_DEV) {
if (device->max_concurrent_jobs == 0) {
/*
* 0 is the general default. However, for this dev_type, only 1 works.
* So we set it to this value.
*/
Jmsg1(nullptr, M_WARNING, 0,
_("device %s is set to the default 'Maximum Concurrent Jobs' = "
"1.\n"),
device->device_name);
device->max_concurrent_jobs = 1;
} else if (device->max_concurrent_jobs > 1) {
Jmsg2(nullptr, M_ERROR_TERM, 0,
_("device %s is configured with 'Maximum Concurrent Jobs' = %d, "
"however only 1 is supported.\n"),
device->device_name, device->max_concurrent_jobs);
}
}
}
}

static void ConfigReadyCallback(ConfigurationParser& my_config)
{
MultiplyConfiguredDevices(my_config);
CheckDropletDevices(my_config);
}

ConfigurationParser* InitSdConfig(const char* configfile, int exit_code)
Expand Down
@@ -1,2 +1,6 @@
This directive specifies the maximum number of Jobs that can run concurrently on a specified Device. Using this directive, it is possible to have different Jobs using multiple drives, because when the Maximum Concurrent Jobs limit is reached, the Storage Daemon will start new Jobs on any other available compatible drive. This facilitates writing to multiple drives with multiple Jobs that all use the same Pool.

.. warning::

If :config:option:`sd/device/DeviceType` is "Droplet" then Maximum Concurrent Jobs is limited to 1.

0 comments on commit 238dc53

Please sign in to comment.