"AND Job.ClientId=%s "
"AND Job.Type='g')";
+/*
+ * Select Jobs from the DelCandidates table.
+ * This is the list of Jobs to delete for an Copy Job.
+ */
+const char *select_copy_del =
+ "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
+ "FROM Job,DelCandidates "
+ "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR "
+ "(Job.JobTDate>%s "
+ "AND Job.ClientId=%s "
+ "AND Job.Type='C')";
+
+
#else
/* Faster way */
const char *select_backup_del =
"AND Job.ClientId=%s "
"AND Job.Type='g')";
+const char *select_copy_del =
+ "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
+ "FROM Job,DelCandidates "
+ "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus!='T') OR "
+ "(Job.JobTDate>%s "
+ "AND Job.ClientId=%s "
+ "AND Job.Type='C')";
+
+
#endif
/* ======= ua_restore.c */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
extern const char CATS_IMP_EXP *select_restore_del;
extern const char CATS_IMP_EXP *select_admin_del;
extern const char CATS_IMP_EXP *select_migrate_del;
+extern const char CATS_IMP_EXP *select_copy_del;
extern const char CATS_IMP_EXP *select_job;
extern const char CATS_IMP_EXP *count_select_job;
extern const char CATS_IMP_EXP *del_File;
{"verify", JT_VERIFY},
{"restore", JT_RESTORE},
{"migrate", JT_MIGRATE},
+ {"copy", JT_COPY},
{NULL, 0}
};
if (res->res_job.JobType == JT_BACKUP) {
sendit(sock, _(" Accurate=%d\n"), res->res_job.accurate);
}
- if (res->res_job.JobType == JT_MIGRATE) {
+ if (res->res_job.JobType == JT_MIGRATE || res->res_job.JobType == JT_COPY) {
sendit(sock, _(" SelectionType=%d\n"), res->res_job.selection_type);
}
if (res->res_job.client) {
pm_strcpy(jcr->pool_source, _("unknown source"));
}
Dmsg2(500, "pool=%s (From %s)\n", jcr->pool->name(), jcr->pool_source);
- if (jcr->JobType == JT_MIGRATE) {
+ if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) {
if (!jcr->rpool_source) {
jcr->rpool_source = get_pool_memory(PM_MESSAGE);
pm_strcpy(jcr->rpool_source, _("unknown source"));
admin_cleanup(jcr, JS_ErrorTerminated);
}
break;
+ case JT_COPY:
case JT_MIGRATE:
if (!do_migration_init(jcr)) {
migration_cleanup(jcr, JS_ErrorTerminated);
admin_cleanup(jcr, JS_ErrorTerminated);
}
break;
- case JT_MIGRATE:
case JT_COPY:
- case JT_ARCHIVE:
+ case JT_MIGRATE:
if (do_migration(jcr)) {
do_autoprune(jcr);
} else {
case JT_RESTORE:
jcr->JobLevel = L_NONE;
break;
+ case JT_COPY:
case JT_MIGRATE:
if (!jcr->rpool_source) {
jcr->rpool_source = get_pool_memory(PM_MESSAGE);
switch(jcr->JobType) {
case JT_RESTORE:
case JT_VERIFY:
+ case JT_COPY:
case JT_MIGRATE:
copy_rstorage(jcr, storage, where);
break;
switch(jcr->JobType) {
case JT_RESTORE:
case JT_VERIFY:
+ case JT_COPY:
case JT_MIGRATE:
set_rstorage(jcr, store);
break;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
/* Now mark the previous job as migrated if it terminated normally */
- if (jcr->JobStatus == JS_Terminated) {
+ if (jcr->JobType == JT_MIGRATE && jcr->JobStatus == JS_Terminated) {
Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
(char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1));
db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
set_jcr_job_status(jcr, JS_ErrorTerminated);
}
-
update_bootstrap_file(mig_jcr);
if (!db_get_job_volume_names(mig_jcr, mig_jcr->db, mig_jcr->jr.JobId, &mig_jcr->VolumeName)) {
break;
}
} else {
- if (jcr->previous_jr.JobId != 0) {
+ if (jcr->JobType == JT_MIGRATE && jcr->previous_jr.JobId != 0) {
/* Mark previous job as migrated */
Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
(char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1));
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*/
/* Do read side of storage daemon */
if (ok && rstore) {
- /* For the moment, only migrate has rpool */
- if (jcr->JobType == JT_MIGRATE) {
+ /* For the moment, only migrate and copy have rpool */
+ if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) {
pm_strcpy(pool_type, jcr->rpool->pool_type);
pm_strcpy(pool_name, jcr->rpool->name());
} else {
case JT_ADMIN:
Mmsg(query, select_admin_del, ed1, ed2);
break;
+ case JT_COPY:
+ Mmsg(query, select_copy_del, ed1, ed2);
+ break;
case JT_MIGRATE:
Mmsg(query, select_migrate_del, ed1, ed2);
break;
/* If pool changed, update migration write storage */
- if (jcr->JobType == JT_MIGRATE) {
+ if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) {
if (!set_migration_wstorage(jcr, rc.pool)) {
goto bail_out;
}
add_prompt(ua, _("When")); /* 5 */
add_prompt(ua, _("Priority")); /* 6 */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_COPY ||
jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) {
add_prompt(ua, _("Pool")); /* 7 */
case 7:
/* Pool or Bootstrap depending on JobType */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_COPY ||
jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) { /* Pool */
rc.pool = select_pool_resource(ua);
jcr->JobPriority);
}
break;
+ case JT_COPY:
case JT_MIGRATE:
+ char *prt_type;
+ if (jcr->JobType == JT_COPY) {
+ prt_type = _("Run Copy job\n");
+ } else {
+ prt_type = _("Run Migration job\n");
+ }
jcr->JobLevel = L_FULL; /* default level */
if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg(_("Run Migration job\n"
+ ua->send_msg("%s"
"JobName: %s\n"
"Bootstrap: %s\n"
"Client: %s\n"
"JobId: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n",
+ prt_type,
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->client->name(),
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
Dmsg1(200, "Run_cmd: %s\n", jcr->dir_bsock->msg);
/* The following jobs don't need the FD */
switch (jcr->JobType) {
- case JT_MIGRATE:
case JT_COPY:
+ case JT_MIGRATE:
case JT_ARCHIVE:
jcr->authenticated = true;
do_mac(jcr);
General:
24Feb08
+kes Implement first cut of Copy Job.
kes Implement Catalog in Pool resource. It overrides catalog specified
in the Client resource.
22Feb08