From: Kern Sibbald Date: Fri, 3 Sep 2010 15:43:39 +0000 (+0200) Subject: Allow plugin to skip restore if problem X-Git-Tag: Release-5.2.1~1127 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8694fe83738792584b6c7c1a42a6225159dbf998;p=bacula%2Fbacula Allow plugin to skip restore if problem --- diff --git a/bacula/src/filed/fd_plugins.c b/bacula/src/filed/fd_plugins.c index 683b51db0c..d235d0c185 100644 --- a/bacula/src/filed/fd_plugins.c +++ b/bacula/src/filed/fd_plugins.c @@ -570,6 +570,9 @@ int plugin_create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace) rc, attr->ofname); return CF_ERROR; } + if (rp.create_status == CF_SKIP) { + return CF_SKIP; + } if (rp.create_status == CF_ERROR) { Qmsg1(jcr, M_ERROR, 0, _("Plugin createFile call failed. Returned CF_ERROR file=%s\n"), attr->ofname); diff --git a/bacula/src/win32/filed/plugins/root_node.c b/bacula/src/win32/filed/plugins/root_node.c index 8e9ed41814..ae84f09d4d 100644 --- a/bacula/src/win32/filed/plugins/root_node.c +++ b/bacula/src/win32/filed/plugins/root_node.c @@ -77,7 +77,7 @@ root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp case 999: return bRC_Error; default: - _JobMessage(M_FATAL, "Invalid internal state %d", state); + _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state); state = 999; } return retval; @@ -102,7 +102,7 @@ root_node_t::endBackupFile(exchange_fd_context_t *context) case 999: retval = bRC_Error; default: - _JobMessage(M_FATAL, "Invalid internal state %d", state); + _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state); state = 999; return bRC_Error; } @@ -113,11 +113,9 @@ bRC root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) { _DebugMessage(0, "createFile_ROOT state = %d\n", state); - switch (state) - { + switch (state) { case 0: - if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) - { + if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) { _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n"); state = 999; return bRC_Error; @@ -128,10 +126,16 @@ root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp) case 1: rp->create_status = CF_CREATED; return bRC_OK; + + /* Skip this file */ + case 900: + rp->create_status = CF_SKIP; + return bRC_OK; + /* Error */ case 999: return bRC_Error; default: - _JobMessage(M_FATAL, "Invalid internal state %d", state); + _JobMessage(M_FATAL, "createFile: invalid internal state %d", state); state = 999; } return bRC_Error; @@ -150,7 +154,7 @@ root_node_t::endRestoreFile(exchange_fd_context_t *context) case 1: return bRC_OK; default: - _JobMessage(M_FATAL, "Invalid internal state %d", state); + _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state); state = 999; } return bRC_Error;