Skip to content

Commit

Permalink
plugins: Allow plugins to override JobLevel.
Browse files Browse the repository at this point in the history
This patch implements the bVarLevel also for the setBareosValue
callback. This way the plugin can change the backup level of the Job if
it sees reason to change it.
  • Loading branch information
Marco van Wieringen committed Jun 15, 2016
1 parent 8b1c713 commit 1151baf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/filed/fd_plugins.c
Expand Up @@ -2142,6 +2142,9 @@ static bRC bareosSetValue(bpContext *ctx, bVariable var, void *value)
}

switch (var) {
case bVarLevel:
jcr->setJobLevel(*(int *)value);
break;
case bVarFileSeen:
if (!accurate_mark_file_as_seen(jcr, (char *)value)) {
return bRC_Error;
Expand Down
15 changes: 15 additions & 0 deletions src/plugins/filed/bareos_fd_consts.py
Expand Up @@ -152,3 +152,18 @@
IO_CLOSE=4,
IO_SEEK=5
)

bLevels = dict(
L_FULL='F',
L_INCREMENTAL='I',
L_DIFFERENTIAL='D',
L_SINCE='S',
L_VERIFY_CATALOG='C',
L_VERIFY_INIT='V',
L_VERIFY_VOLUME_TO_CATALOG='O',
L_VERIFY_DISK_TO_CATALOG='d',
L_VERIFY_DATA='A',
L_BASE='B',
L_NONE=' ',
L_VIRTUAL_FULL='f'
)
9 changes: 9 additions & 0 deletions src/plugins/filed/python-fd.c
Expand Up @@ -2683,6 +2683,15 @@ static PyObject *PyBareosSetValue(PyObject *self, PyObject *args)
}

switch (var) {
case bVarLevel: {
int value = 0;

value = PyInt_AsLong(pyValue);
if (value) {
retval = bfuncs->setBareosValue(ctx, (bVariable)var, &value);
}
break;
}
case bVarFileSeen: {
char *value;

Expand Down

0 comments on commit 1151baf

Please sign in to comment.