]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/restore.c
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / bacula / src / dird / restore.c
index 22359e112c43f405a62d4248cf67c7e3437993c6..e3d7f8c2d681d9585d9b4972a8e1d397167f395f 100644 (file)
@@ -564,8 +564,40 @@ bail_out:
    return false;
 }
 
+/* Create a Plugin Config RestoreObject, will be sent
+ * at restore time to the Plugin
+ */
+static void plugin_create_restoreobject(JCR *jcr, plugin_config_item *elt)
+{
+   ROBJECT_DBR ro;
+   memset(&ro, 0, sizeof(ro));
+   ro.FileIndex = 1;
+   ro.JobId = jcr->JobId;
+   ro.FileType = FT_PLUGIN_CONFIG_FILLED;
+   ro.object_index = 1;
+   ro.object_full_len = ro.object_len = strlen(elt->content);
+   ro.object_compression = 0;
+   ro.plugin_name = elt->plugin_name;
+   ro.object_name = (char*)INI_RESTORE_OBJECT_NAME;
+   ro.object = elt->content;
+   db_create_restore_object_record(jcr, jcr->db, &ro);
+   Dmsg1(50, "Creating restore object for %s\n", elt->plugin_name);
+}
+
 bool do_restore_init(JCR *jcr)
 {
+   /* Will add RestoreObject used for the Plugin configuration */
+   if (jcr->plugin_config) {
+
+      plugin_config_item *elt;
+      foreach_alist(elt, jcr->plugin_config) {
+         plugin_create_restoreobject(jcr, elt);
+         free_plugin_config_item(elt);
+      }
+
+      delete jcr->plugin_config;
+      jcr->plugin_config = NULL;
+   }
    free_wstorage(jcr);
    return true;
 }
@@ -577,7 +609,7 @@ bool do_restore_init(JCR *jcr)
 void restore_cleanup(JCR *jcr, int TermCode)
 {
    char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH];
-   char ec1[30], ec2[30], ec3[30];
+   char ec1[30], ec2[30], ec3[30], ec4[30], elapsed[50];
    char term_code[100], fd_term_msg[100], sd_term_msg[100];
    const char *term_msg;
    int msg_type = M_INFO;
@@ -667,9 +699,10 @@ void restore_cleanup(JCR *jcr, int TermCode)
 "  Restore Client:         %s\n"
 "  Start time:             %s\n"
 "  End time:               %s\n"
+"  Elapsed time:           %s\n"
 "  Files Expected:         %s\n"
 "  Files Restored:         %s\n"
-"  Bytes Restored:         %s\n"
+"  Bytes Restored:         %s (%sB)\n"
 "  Rate:                   %.1f KB/s\n"
 "  FD Errors:              %d\n"
 "  FD termination status:  %s\n"
@@ -682,9 +715,10 @@ void restore_cleanup(JCR *jcr, int TermCode)
         jcr->client->name(),
         sdt,
         edt,
+        edit_utime(RunTime, elapsed, sizeof(elapsed)),
         edit_uint64_with_commas((uint64_t)jcr->ExpectedFiles, ec1),
         edit_uint64_with_commas((uint64_t)jcr->jr.JobFiles, ec2),
-        edit_uint64_with_commas(jcr->jr.JobBytes, ec3),
+        edit_uint64_with_commas(jcr->jr.JobBytes, ec3), edit_uint64_with_suffix(jcr->jr.JobBytes, ec4),
         (float)kbps,
         jcr->JobErrors,
         fd_term_msg,