Imported Upstream version 3.3.3
[debian/amanda] / server-src / planner.c
index aa816292f18a97051b9cc63b220e5fc82d2f0c95..f7a38be691eeedbdf900a7043fc8dc3e9fbde377 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
  * Copyright (c) 1991-1999 University of Maryland at College Park
+ * Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
  * All Rights Reserved.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
@@ -193,6 +194,7 @@ main(
     int exit_status = EXIT_SUCCESS;
     gboolean no_taper = FALSE;
     gboolean from_client = FALSE;
+    gboolean exact_match = FALSE;
 
     if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) {
        printf("planner-%s\n", VERSION);
@@ -276,6 +278,11 @@ main(
        from_client = TRUE;
        diskarg_offset += 1;
     }
+    if (argc - diskarg_offset > 0 && g_str_equal(argv[diskarg_offset],
+                                                 "--exact_match")) {
+       exact_match = TRUE;
+       diskarg_offset += 1;
+    }
 
 
     run_server_global_scripts(EXECUTE_ON_PRE_ESTIMATE, get_config_name());
@@ -348,7 +355,7 @@ main(
     g_fprintf(stderr, _("%s: timestamp %s\n"),
                    get_pname(), planner_timestamp);
 
-    errstr = match_disklist(&origq, argc-diskarg_offset,
+    errstr = match_disklist(&origq, exact_match, argc-diskarg_offset,
                                    argv+diskarg_offset);
     if (errstr) {
        g_fprintf(stderr,"%s",errstr);
@@ -463,7 +470,7 @@ main(
 
            /* see if this matches the command-line arguments */
            if (conf_autoflush == 1 &&
-               !match_dumpfile(&file, argc-diskarg_offset,
+               !match_dumpfile(&file, exact_match, argc-diskarg_offset,
                                       argv+diskarg_offset)) {
                continue;
            }
@@ -2159,6 +2166,19 @@ static void handle_result(
         * reported.
         */
        log_add(L_ERROR, "%s", errbuf);
+       for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
+           if (dp->todo) {
+               qname = quote_string(dp->name);
+               est(dp)->state = DISK_DONE;
+               remove_disk(&waitq, dp);
+               enqueue_disk(&failq, dp);
+
+               est(dp)->errstr = g_strdup(errbuf);
+               g_fprintf(stderr, _("error result for host %s disk %s: %s\n"),
+                         dp->host->hostname, qname, errbuf);
+               amfree(qname);
+           }
+       }
     }
     hostp->up = HOST_DONE;
     amfree(errbuf);