]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_run.c
- Fix the block listing bug pointed out by Arno.
[bacula/bacula] / bacula / src / dird / ua_run.c
index e544817cf032c7d7112bea36bfed361648ee9c38..470cd5bd9630b9871833967a01c00a63e6f4b05a 100644 (file)
@@ -34,7 +34,7 @@ extern struct s_kw ReplaceOptions[];
  *     run [job=]<job-name> level=<level-name>
  *
  * For Restore Jobs
- *     run <job-name> jobid=nn
+ *     run <job-name> 
  *
  *  Returns: 0 on error
  *           JobId if OK
@@ -47,6 +47,7 @@ int run_cmd(UAContext *ua, const char *cmd)
    char *where, *fileset_name, *client_name, *bootstrap;
    const char *replace;
    char *when, *verify_job_name, *catalog_name;
+   char *migration_job_name;
    char *since = NULL;
    char *verify_list;
    bool cloned = false;
@@ -55,6 +56,7 @@ int run_cmd(UAContext *ua, const char *cmd)
    bool kw_ok;
    JOB *job = NULL;
    JOB *verify_job = NULL;
+   JOB *migration_job = NULL;
    STORE *store = NULL;
    CLIENT *client = NULL;
    FILESET *fileset = NULL;
@@ -81,6 +83,7 @@ int run_cmd(UAContext *ua, const char *cmd)
       "since",                        /* 18 since */
       "cloned",                       /* 19 cloned */
       "verifylist",                   /* 20 verify output list */
+      "migrationjob",                 /* 21 migration job name */
       NULL};
 
 #define YES_POS 14
@@ -101,6 +104,7 @@ int run_cmd(UAContext *ua, const char *cmd)
    bootstrap = NULL;
    replace = NULL;
    verify_job_name = NULL;
+   migration_job_name = NULL;
    catalog_name = NULL;
    verify_list = NULL;
 
@@ -254,6 +258,15 @@ int run_cmd(UAContext *ua, const char *cmd)
                verify_list = ua->argv[i];
                kw_ok = true;
                break;
+            case 21: /* Migration Job */
+               if (migration_job_name) {
+                  bsendmsg(ua, _("Migration Job specified twice.\n"));
+                  return 0;
+               }
+               migration_job_name = ua->argv[i];
+               kw_ok = true;
+               break;
+
 
             default:
                break;
@@ -401,6 +414,17 @@ int run_cmd(UAContext *ua, const char *cmd)
       verify_job = job->verify_job;
    }
 
+   if (migration_job_name) {
+      migration_job = (JOB *)GetResWithName(R_JOB, migration_job_name);
+      if (!migration_job) {
+         bsendmsg(ua, _("Migration Job \"%s\" not found.\n"), migration_job_name);
+         migration_job = select_job_resource(ua);
+      }
+   } else {
+      migration_job = job->verify_job;
+   }
+
+
    /*
     * Create JCR to run job.  NOTE!!! after this point, free_jcr()
     *  before returning.
@@ -409,6 +433,7 @@ int run_cmd(UAContext *ua, const char *cmd)
    set_jcr_defaults(jcr, job);
 
    jcr->verify_job = verify_job;
+   jcr->migration_job = migration_job;
    set_storage(jcr, store);
    jcr->client = client;
    jcr->fileset = fileset;
@@ -638,6 +663,32 @@ try_again:
               jcr->JobPriority);
       }
       break;
+   case JT_MIGRATE:
+      jcr->JobLevel = L_FULL;      /* default level */
+      bsendmsg(ua, _("Run Restore job\n"
+                     "JobName:       %s\n"
+                     "Bootstrap:     %s\n"
+                     "Where:         %s\n"
+                     "Replace:       %s\n"
+                     "FileSet:       %s\n"
+                     "Client:        %s\n"
+                     "Storage:       %s\n"
+                     "Migration Job: %s\n"
+                     "When:          %s\n"
+                     "Catalog:       %s\n"
+                     "Priority:      %d\n"),
+           job->hdr.name,
+           NPRT(jcr->RestoreBootstrap),
+           jcr->where?jcr->where:NPRT(job->RestoreWhere),
+           replace,
+           jcr->fileset->hdr.name,
+           jcr->client->hdr.name,
+           jcr->store->hdr.name,
+           jcr->migration_job->hdr.name,
+           bstrutime(dt, sizeof(dt), jcr->sched_time),
+           jcr->catalog->hdr.name,
+           jcr->JobPriority);
+      break;
    default:
       bsendmsg(ua, _("Unknown Job Type=%d\n"), jcr->JobType);
       goto bail_out;