]> git.sur5r.net Git - bacula/bacula/commitdiff
Allow plugin to skip restore if problem
authorKern Sibbald <kern@sibbald.com>
Fri, 3 Sep 2010 15:43:39 +0000 (17:43 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 7 Sep 2010 19:06:39 +0000 (21:06 +0200)
bacula/src/filed/fd_plugins.c
bacula/src/win32/filed/plugins/root_node.c

index 683b51db0ca96aeaf4c77fc76cc6e91c1d827a24..d235d0c18580c68a168a6181d970658c3b89eb9b 100644 (file)
@@ -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);
index 8e9ed418142c1afcec958e02624108f2351554e2..ae84f09d4d6259cc2ed19166af6915600a001cfc 100644 (file)
@@ -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;