/* Define if data encryption should be enabled */
#undef HAVE_CRYPTO
+
+/* Define the LOCALEDIR if a translation */
+#undef LOCALEDIR
/* Define if data encryption should be enabled */
#undef HAVE_CRYPTO
+
+/* Define the LOCALEDIR if a translation */
+#undef LOCALEDIR
chmod 755 $c/sqlite
chmod 755 $c/mysql
+chmod 755 src/win32/build-depkgs-mingw32
+
if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
largefile_support="yes"
fi
chmod 755 $c/sqlite
chmod 755 $c/mysql
+chmod 755 src/win32/build-depkgs-mingw32
+
if test "x$ac_cv_sys_largefile_CFLAGS" != "xno" ; then
largefile_support="yes"
fi
#define tape_read read
#define tape_write write
#define tape_close ::close
+
#endif
#define N_(s) (s)
#endif /* N_ */
#else /* !ENABLE_NLS */
+ #undef _
+ #undef N_
+ #undef textdomain
+ #undef bindtextdomain
+ #undef setlocale
+
#ifndef _
#define _(s) (s)
#endif
#define setlocale(p, d)
#endif
#endif /* ENABLE_NLS */
+
+
/* Use the following for strings not to be translated */
#define NT_(s) (s)
#ifndef HAVE_WXCONSOLE
#undef strdup
#define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
+#else
+/* Groan, WxWidgets has its own way of doing NLS so cleanup */
+#ifndef ENABLE_NLS
+#undef _
+#undef setlocale
+#undef textdomain
+#undef bindtextdomain
+#endif
#endif
/* Use our fgets which handles interrupts */
apply_pool_overrides(jcr);
- jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->hdr.name);
+ jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->name());
if (jcr->jr.PoolId == 0) {
return false;
}
}
jcr->term_wait_inited = true;
- create_unique_job_name(jcr, jcr->job->hdr.name);
+ create_unique_job_name(jcr, jcr->job->name());
set_jcr_job_status(jcr, JS_Created);
jcr->unlock();
jcr->pool_source = get_pool_memory(PM_MESSAGE);
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->rpool_source) {
+ jcr->rpool_source = get_pool_memory(PM_MESSAGE);
+ pm_strcpy(jcr->rpool_source, _("unknown source"));
+ }
+ }
/*
* Create Job record
memset(&pr, 0, sizeof(pr));
bstrncpy(pr.Name, pool_name, sizeof(pr.Name));
+ Dmsg1(010, "get_or_create_pool=%s\n", pool_name);
while (!db_get_pool_record(jcr, jcr->db, &pr)) { /* get by Name */
/* Try to create the pool */
void apply_pool_overrides(JCR *jcr)
{
if (jcr->run_pool_override) {
- pm_strcpy(jcr->pool_source, _("run pool override"));
+ pm_strcpy(jcr->pool_source, _("Run pool override"));
}
/*
* Apply any level related Pool selections
if (jcr->full_pool) {
jcr->pool = jcr->full_pool;
if (jcr->run_full_pool_override) {
- pm_strcpy(jcr->pool_source, _("run FullPool override"));
+ pm_strcpy(jcr->pool_source, _("Run FullPool override"));
} else {
- pm_strcpy(jcr->pool_source, _("job FullPool override"));
+ pm_strcpy(jcr->pool_source, _("Job FullPool override"));
}
}
break;
if (jcr->inc_pool) {
jcr->pool = jcr->inc_pool;
if (jcr->run_inc_pool_override) {
- pm_strcpy(jcr->pool_source, _("run IncPool override"));
+ pm_strcpy(jcr->pool_source, _("Run IncPool override"));
} else {
- pm_strcpy(jcr->pool_source, _("job IncPool override"));
+ pm_strcpy(jcr->pool_source, _("Job IncPool override"));
}
}
break;
if (jcr->diff_pool) {
jcr->pool = jcr->diff_pool;
if (jcr->run_diff_pool_override) {
- pm_strcpy(jcr->pool_source, _("run DiffPool override"));
+ pm_strcpy(jcr->pool_source, _("Run DiffPool override"));
} else {
- pm_strcpy(jcr->pool_source, _("job DiffPool override"));
+ pm_strcpy(jcr->pool_source, _("Job DiffPool override"));
}
}
break;
jcr->jr.JobLevel = jcr->JobLevel;
jcr->jr.JobStatus = jcr->JobStatus;
jcr->jr.JobId = jcr->JobId;
- bstrncpy(jcr->jr.Name, jcr->job->hdr.name, sizeof(jcr->jr.Name));
+ bstrncpy(jcr->jr.Name, jcr->job->name(), sizeof(jcr->jr.Name));
bstrncpy(jcr->jr.Job, jcr->Job, sizeof(jcr->jr.Job));
}
free_pool_memory(jcr->pool_source);
jcr->pool_source = NULL;
}
+ if (jcr->rpool_source) {
+ free_pool_memory(jcr->rpool_source);
+ jcr->rpool_source = NULL;
+ }
if (jcr->wstore_source) {
free_pool_memory(jcr->wstore_source);
jcr->wstore_source = NULL;
* the current jcr. It is a backup job that moves (migrates) the
* data written for the previous_jr into the new pool. This
* job (mig_jcr) becomes the new backup job that replaces
- * the original backup job.
+ * the original backup job. Note, this jcr is not really run. It
+ * is simply attached to the current jcr. It will show up in
+ * the Director's status output, but not in the SD or FD, both of
+ * which deal only with the current migration job (i.e. jcr).
*/
bool do_migration_init(JCR *jcr)
{
JCR *mig_jcr; /* newly migrated job */
int count;
+
+ apply_pool_overrides(jcr);
+
+ jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->name());
+ if (jcr->jr.PoolId == 0) {
+ Dmsg1(dbglevel, "JobId=%d no PoolId\n", (int)jcr->JobId);
+ Jmsg(jcr, M_FATAL, 0, _("Could not get or create a Pool record.\n"));
+ return false;
+ }
+ /*
+ * Note, at this point, pool is the pool for this job. We
+ * transfer it to rpool (read pool), and a bit later,
+ * pool will be changed to point to the write pool,
+ * which comes from pool->NextPool.
+ */
+ jcr->rpool = jcr->pool; /* save read pool */
+ pm_strcpy(jcr->rpool_source, jcr->pool_source);
+
+
+ Dmsg2(dbglevel, "Read pool=%s (From %s)\n", jcr->rpool->name(), jcr->rpool_source);
+
/* If we find a job or jobs to migrate it is previous_jr.JobId */
count = get_job_to_migrate(jcr);
if (count < 0) {
return false;
}
- apply_pool_overrides(jcr);
-
- jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->hdr.name);
- if (jcr->jr.PoolId == 0) {
- Dmsg1(dbglevel, "JobId=%d no PoolId\n", (int)jcr->JobId);
- Jmsg(jcr, M_FATAL, 0, _("Could not get or create a Pool record.\n"));
- return false;
- }
-
create_restore_bootstrap_file(jcr);
if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) {
* will be migrating from pool to pool->NextPool.
*/
if (pool->NextPool) {
- jcr->jr.PoolId = get_or_create_pool_record(jcr, pool->NextPool->hdr.name);
+ jcr->jr.PoolId = get_or_create_pool_record(jcr, pool->NextPool->name());
if (jcr->jr.PoolId == 0) {
return false;
}
- /*
- * put the "NextPool" resource pointer in our jcr so that we
- * can pull the Storage reference from it.
- */
- mig_jcr->pool = jcr->pool = pool->NextPool;
- mig_jcr->jr.PoolId = jcr->jr.PoolId;
- pm_strcpy(jcr->pool_source, _("NextPool in Pool resource"));
- } else {
- Jmsg(jcr, M_FATAL, 0, _("No Next Pool specification found in Pool \"%s\".\n"),
- pool->hdr.name);
- return false;
}
-
- if (!jcr->pool->storage || jcr->pool->storage->size() == 0) {
- Jmsg(jcr, M_FATAL, 0, _("No Storage specification found in Next Pool \"%s\".\n"),
- jcr->pool->hdr.name);
+ if (!set_migration_wstorage(jcr, pool)) {
return false;
}
+ mig_jcr->pool = jcr->pool = pool->NextPool;
+ pm_strcpy(jcr->pool_source, _("Job Pool's NextPool resource"));
+ mig_jcr->jr.PoolId = jcr->jr.PoolId;
- /* If pool storage specified, use it instead of job storage for backup */
- copy_wstorage(jcr, jcr->pool->storage, _("NextPool in Pool resource"));
-
+ Dmsg2(dbglevel, "Write pool=%s read rpool=%s\n", jcr->pool->name(), jcr->rpool->name());
return true;
}
case MT_POOL_OCCUPANCY:
ctx.count = 0;
/* Find count of bytes in pool */
- Mmsg(query, sql_pool_bytes, jcr->pool->hdr.name);
+ Mmsg(query, sql_pool_bytes, jcr->rpool->name());
if (!db_sql_query(jcr->db, query.c_str(), db_int64_handler, (void *)&ctx)) {
Jmsg(jcr, M_FATAL, 0, _("SQL failed. ERR=%s\n"), db_strerror(jcr->db));
goto bail_out;
goto ok_out;
}
pool_bytes = ctx.value;
- Dmsg2(dbglevel, "highbytes=%d pool=%d\n", (int)jcr->pool->MigrationHighBytes,
+ Dmsg2(dbglevel, "highbytes=%d pool=%d\n", (int)jcr->rpool->MigrationHighBytes,
(int)pool_bytes);
- if (pool_bytes < (int64_t)jcr->pool->MigrationHighBytes) {
+ if (pool_bytes < (int64_t)jcr->rpool->MigrationHighBytes) {
Jmsg(jcr, M_INFO, 0, _("No Volumes found to migrate.\n"));
goto ok_out;
}
ids.count = 0;
/* Find a list of MediaIds that could be migrated */
- Mmsg(query, sql_mediaids, jcr->pool->hdr.name);
+ Mmsg(query, sql_mediaids, jcr->rpool->name());
Dmsg1(dbglevel, "query=%s\n", query.c_str());
if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void *)&ids)) {
Jmsg(jcr, M_FATAL, 0, _("SQL failed. ERR=%s\n"), db_strerror(jcr->db));
}
pool_bytes -= ctx.value;
Dmsg1(dbglevel, "Job bytes=%d\n", (int)ctx.value);
- Dmsg2(dbglevel, "lowbytes=%d pool=%d\n", (int)jcr->pool->MigrationLowBytes,
+ Dmsg2(dbglevel, "lowbytes=%d pool=%d\n", (int)jcr->rpool->MigrationLowBytes,
(int)pool_bytes);
- if (pool_bytes <= (int64_t)jcr->pool->MigrationLowBytes) {
+ if (pool_bytes <= (int64_t)jcr->rpool->MigrationLowBytes) {
Dmsg0(dbglevel, "We should be done.\n");
break;
}
break;
case MT_POOL_TIME:
- ttime = time(NULL) - (time_t)jcr->pool->MigrationTime;
+ ttime = time(NULL) - (time_t)jcr->rpool->MigrationTime;
(void)localtime_r(&ttime, &tm);
strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
ids.count = 0;
- Mmsg(query, sql_pool_time, jcr->pool->hdr.name, dt);
+ Mmsg(query, sql_pool_time, jcr->rpool->name(), dt);
Dmsg1(dbglevel, "query=%s\n", query.c_str());
if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void *)&ids)) {
Jmsg(jcr, M_FATAL, 0, _("SQL failed. ERR=%s\n"), db_strerror(jcr->db));
ids->count = 0;
/* Basic query for MediaId */
- Mmsg(query, query1, jcr->pool->hdr.name);
+ Mmsg(query, query1, jcr->rpool->name());
if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void *)ids)) {
Jmsg(jcr, M_FATAL, 0, _("SQL failed. ERR=%s\n"), db_strerror(jcr->db));
goto bail_out;
type);
goto bail_out;
}
- Dmsg1(dbglevel, "regex=%s\n", jcr->job->selection_pattern);
- /* Compile regex expression */
- rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED);
- if (rc != 0) {
- regerror(rc, &preg, prbuf, sizeof(prbuf));
- Jmsg(jcr, M_FATAL, 0, _("Could not compile regex pattern \"%s\" ERR=%s\n"),
- jcr->job->selection_pattern, prbuf);
- goto bail_out;
- }
+ Dmsg1(dbglevel, "regex-sel-pattern=%s\n", jcr->job->selection_pattern);
/* Basic query for names */
- Mmsg(query, query1, jcr->pool->hdr.name);
+ Mmsg(query, query1, jcr->rpool->name());
Dmsg1(dbglevel, "get name query1=%s\n", query.c_str());
if (!db_sql_query(jcr->db, query.c_str(), unique_name_handler,
(void *)item_chain)) {
_("SQL to get %s failed. ERR=%s\n"), type, db_strerror(jcr->db));
goto bail_out;
}
- /* Now apply the regex to the names and remove any item not matched */
- foreach_dlist(item, item_chain) {
- const int nmatch = 30;
- regmatch_t pmatch[nmatch];
+ Dmsg1(dbglevel, "query1 returned %d names\n", item_chain->size());
+ if (item_chain->size() == 0) {
+ Jmsg(jcr, M_INFO, 0, _("Query of Pool \"%s\" returned no Jobs to migrate.\n"),
+ jcr->rpool->name());
+ ok = true;
+ goto bail_out; /* skip regex match */
+ } else {
+ /* Compile regex expression */
+ rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED);
+ if (rc != 0) {
+ regerror(rc, &preg, prbuf, sizeof(prbuf));
+ Jmsg(jcr, M_FATAL, 0, _("Could not compile regex pattern \"%s\" ERR=%s\n"),
+ jcr->job->selection_pattern, prbuf);
+ goto bail_out;
+ }
+ /* Now apply the regex to the names and remove any item not matched */
+ foreach_dlist(item, item_chain) {
+ const int nmatch = 30;
+ regmatch_t pmatch[nmatch];
+ if (last_item) {
+ Dmsg1(dbglevel, "Remove item %s\n", last_item->item);
+ free(last_item->item);
+ item_chain->remove(last_item);
+ }
+ Dmsg1(dbglevel, "get name Item=%s\n", item->item);
+ rc = regexec(&preg, item->item, nmatch, pmatch, 0);
+ if (rc == 0) {
+ last_item = NULL; /* keep this one */
+ } else {
+ last_item = item;
+ }
+ }
if (last_item) {
- Dmsg1(dbglevel, "Remove item %s\n", last_item->item);
free(last_item->item);
+ Dmsg1(dbglevel, "Remove item %s\n", last_item->item);
item_chain->remove(last_item);
}
- Dmsg1(dbglevel, "get name Item=%s\n", item->item);
- rc = regexec(&preg, item->item, nmatch, pmatch, 0);
- if (rc == 0) {
- last_item = NULL; /* keep this one */
- } else {
- last_item = item;
- }
+ regfree(&preg);
}
- if (last_item) {
- free(last_item->item);
- Dmsg1(dbglevel, "Remove item %s\n", last_item->item);
- item_chain->remove(last_item);
+ if (item_chain->size() == 0) {
+ Jmsg(jcr, M_INFO, 0, _("Regex pattern matched no Jobs to migrate.\n"));
+ ok = true;
+ goto bail_out; /* skip regex match */
}
- regfree(&preg);
+
/*
* At this point, we have a list of items in item_chain
* that have been matched by the regex, so now we need
ids->count = 0;
foreach_dlist(item, item_chain) {
Dmsg2(dbglevel, "Got %s: %s\n", type, item->item);
- Mmsg(query, query2, item->item, jcr->pool->hdr.name);
+ Mmsg(query, query2, item->item, jcr->rpool->name());
Dmsg1(dbglevel, "get id from name query2=%s\n", query.c_str());
if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void *)ids)) {
Jmsg(jcr, M_FATAL, 0,
Jmsg(jcr, M_INFO, 0, _("No %ss found to migrate.\n"), type);
}
ok = true;
+
bail_out:
Dmsg2(dbglevel, "Count=%d Jobids=%s\n", ids->count, ids->list);
delete item_chain;
- Dmsg0(dbglevel, "After delete item_chain\n");
return ok;
}
" Backup Level: %s%s\n"
" Client: %s\n"
" FileSet: \"%s\" %s\n"
-" Pool: \"%s\" (From %s)\n"
+" Read Pool: \"%s\" (From %s)\n"
" Read Storage: \"%s\" (From %s)\n"
+" Write Pool: \"%s\" (From %s)\n"
" Write Storage: \"%s\" (From %s)\n"
" Start time: %s\n"
" End time: %s\n"
level_to_str(jcr->JobLevel), jcr->since,
jcr->client->name(),
jcr->fileset->name(), jcr->FSCreateTime,
- jcr->pool->name(), jcr->pool_source,
+ jcr->rpool->name(), jcr->rpool_source,
jcr->rstore?jcr->rstore->name():"*None*",
NPRT(jcr->rstore_source),
+ jcr->pool->name(), jcr->pool_source,
jcr->wstore?jcr->wstore->name():"*None*",
NPRT(jcr->wstore_source),
sdt,
*DBId = str_to_int64(id);
return 1;
}
+
+bool set_migration_wstorage(JCR *jcr, POOL *pool)
+{
+ POOL *wpool = pool->NextPool;
+
+ if (!wpool) {
+ Jmsg(jcr, M_FATAL, 0, _("No Next Pool specification found in Pool \"%s\".\n"),
+ pool->hdr.name);
+ return false;
+ }
+
+ if (!wpool->storage || wpool->storage->size() == 0) {
+ Jmsg(jcr, M_FATAL, 0, _("No Storage specification found in Next Pool \"%s\".\n"),
+ wpool->name());
+ return false;
+ }
+
+ /* If pool storage specified, use it instead of job storage for backup */
+ copy_wstorage(jcr, wpool->storage, _("Storage from Pool's NextPool resource"));
+ return true;
+}
return 0;
}
- pm_strcpy(pool_type, jcr->pool->pool_type);
- pm_strcpy(pool_name, jcr->pool->hdr.name);
- bash_spaces(pool_type);
- bash_spaces(pool_name);
-
/*
* We have two loops here. The first comes from the
* Storage = associated with the Job, and we need
*/
/* Do read side of storage daemon */
if (ok && rstore) {
+ /* For the moment, only migrate has rpool */
+ if (jcr->JobType == JT_MIGRATE) {
+ pm_strcpy(pool_type, jcr->rpool->pool_type);
+ pm_strcpy(pool_name, jcr->rpool->name());
+ } else {
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->name());
+ }
+ bash_spaces(pool_type);
+ bash_spaces(pool_name);
foreach_alist(storage, rstore) {
Dmsg1(100, "Rstore=%s\n", storage->name());
- pm_strcpy(store_name, storage->name());
bash_spaces(store_name);
pm_strcpy(media_type, storage->media_type);
bash_spaces(media_type);
bnet_fsend(sd, use_storage, store_name.c_str(), media_type.c_str(),
pool_name.c_str(), pool_type.c_str(), 0, copy, stripe);
-
+ Dmsg1(100, "rstore >stored: %s", sd->msg);
DEVICE *dev;
/* Loop over alternative storage Devices until one is OK */
foreach_alist(dev, storage->device) {
/* Do write side of storage daemon */
if (ok && wstore) {
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->name());
+ bash_spaces(pool_type);
+ bash_spaces(pool_name);
foreach_alist(storage, wstore) {
- Dmsg1(100, "Wstore=%s\n", storage->name());
pm_strcpy(store_name, storage->name());
bash_spaces(store_name);
pm_strcpy(media_type, storage->media_type);
bnet_fsend(sd, use_storage, store_name.c_str(), media_type.c_str(),
pool_name.c_str(), pool_type.c_str(), 1, copy, stripe);
+ Dmsg1(100, "wstore >stored: %s", sd->msg);
DEVICE *dev;
/* Loop over alternative storage Devices until one is OK */
foreach_alist(dev, storage->device) {
extern bool do_migration(JCR *jcr);
extern bool do_migration_init(JCR *jcr);
extern void migration_cleanup(JCR *jcr, int TermCode);
+extern bool set_migration_wstorage(JCR *jcr, POOL *pool);
/* mountreq.c */
}
if (do_prompt(ua, _("FileSet"), _("Select FileSet resource"),
fileset_name, sizeof(fileset_name)) < 0) {
+ bsendmsg(ua, _("No FileSet found for client \"%s\".\n"), cr.Name);
goto bail_out;
}
#include "bacula.h"
#include "dird.h"
-/* Imported subroutines */
+/* Forward referenced subroutines */
+static void select_job_level(UAContext *ua, JCR *jcr);
+static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *verify_list,
+ char *jid, const char *replace);
+
/* Imported variables */
extern struct s_kw ReplaceOptions[];
return 0;
}
+ if (pool_name) {
+ pool = (POOL *)GetResWithName(R_POOL, pool_name);
+ if (!pool) {
+ if (*pool_name != 0) {
+ bsendmsg(ua, _("Pool \"%s\" not found.\n"), pool_name);
+ }
+ pool = select_pool_resource(ua);
+ }
+ } else {
+ pool = job->pool; /* use default */
+ }
+ if (!pool) {
+ return 0;
+ } else if (!acl_access_ok(ua, Pool_ACL, pool->name())) {
+ bsendmsg(ua, _("No authorization. Pool \"%s\".\n"),
+ pool->name());
+ return 0;
+ }
+ Dmsg1(100, "Using pool %s\n", pool->name());
+
if (store_name) {
store.store = (STORE *)GetResWithName(R_STORAGE, store_name);
pm_strcpy(store.store_source, _("command line"));
get_job_storage(&store, job, NULL); /* use default */
}
if (!store.store) {
+ bsendmsg(ua, _("No storage specified.\n"));
return 1;
} else if (!acl_access_ok(ua, Storage_ACL, store.store->name())) {
bsendmsg(ua, _("No authorization. Storage \"%s\".\n"),
}
Dmsg1(800, "Using storage=%s\n", store.store->name());
- if (pool_name) {
- pool = (POOL *)GetResWithName(R_POOL, pool_name);
- if (!pool) {
- if (*pool_name != 0) {
- bsendmsg(ua, _("Pool \"%s\" not found.\n"), pool_name);
- }
- pool = select_pool_resource(ua);
- }
- } else {
- pool = job->pool; /* use default */
- }
- if (!pool) {
- return 0;
- } else if (!acl_access_ok(ua, Pool_ACL, pool->name())) {
- bsendmsg(ua, _("No authorization. Pool \"%s\".\n"),
- pool->name());
- return 0;
- }
- Dmsg1(800, "Using pool\n", pool->name());
-
if (client_name) {
client = (CLIENT *)GetResWithName(R_CLIENT, client_name);
if (!client) {
jcr->verify_job = verify_job;
jcr->previous_job = previous_job;
+ jcr->pool = pool;
set_rwstorage(jcr, &store);
jcr->client = client;
jcr->fileset = fileset;
- jcr->pool = pool;
jcr->ExpectedFiles = files;
if (catalog != NULL) {
jcr->catalog = catalog;
}
try_again:
+ /* If pool changed, update migration write storage */
+ if (jcr->JobType == JT_MIGRATE) {
+ if (!set_migration_wstorage(jcr, pool)) {
+ goto bail_out;
+ }
+ }
replace = ReplaceOptions[0].name;
for (i=0; ReplaceOptions[i].name; i++) {
if (ReplaceOptions[i].token == jcr->replace) {
* Prompt User to see if all run job parameters are correct, and
* allow him to modify them.
*/
- Dmsg1(800, "JobType=%c\n", jcr->JobType);
- switch (jcr->JobType) {
- char ec1[30];
- char dt[MAX_TIME_LENGTH];
- case JT_ADMIN:
- bsendmsg(ua, _("Run %s job\n"
-"JobName: %s\n"
-"FileSet: %s\n"
-"Client: %s\n"
-"Storage: %s\n"
-"When: %s\n"
-"Priority: %d\n"),
- _("Admin"),
- job->name(),
- jcr->fileset->name(),
- NPRT(jcr->client->name()),
- jcr->wstore?jcr->wstore->name():"*None*",
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->JobPriority);
- jcr->JobLevel = L_FULL;
- break;
- case JT_BACKUP:
- case JT_VERIFY:
- if (jcr->JobType == JT_BACKUP) {
- bsendmsg(ua, _("Run %s job\n"
-"JobName: %s\n"
-"FileSet: %s\n"
-"Level: %s\n"
-"Client: %s\n"
-"Storage: %s\n"
-"Pool: %s\n"
-"When: %s\n"
-"Priority: %d\n"),
- _("Backup"),
- job->name(),
- jcr->fileset->name(),
- level_to_str(jcr->JobLevel),
- jcr->client->name(),
- jcr->wstore?jcr->wstore->name():"*None*",
- NPRT(jcr->pool->name()),
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->JobPriority);
- } else { /* JT_VERIFY */
- const char *Name;
- if (jcr->verify_job) {
- Name = jcr->verify_job->name();
- } else {
- Name = "";
- }
- if (!verify_list) {
- verify_list = job->WriteVerifyList;
- }
- if (!verify_list) {
- verify_list = "";
- }
- bsendmsg(ua, _("Run %s job\n"
-"JobName: %s\n"
-"FileSet: %s\n"
-"Level: %s\n"
-"Client: %s\n"
-"Storage: %s\n"
-"Pool: %s\n"
-"Verify Job: %s\n"
-"Verify List: %s\n"
-"When: %s\n"
-"Priority: %d\n"),
- _("Verify"),
- job->name(),
- jcr->fileset->name(),
- level_to_str(jcr->JobLevel),
- jcr->client->name(),
- jcr->rstore->name(),
- NPRT(jcr->pool->name()),
- Name,
- verify_list,
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->JobPriority);
- }
- break;
- case JT_RESTORE:
- if (jcr->RestoreJobId == 0 && !jcr->RestoreBootstrap) {
- if (jid) {
- jcr->RestoreJobId = str_to_int64(jid);
- } else {
- if (!get_pint(ua, _("Please enter a JobId for restore: "))) {
- goto bail_out;
- }
- jcr->RestoreJobId = ua->int64_val;
- }
- }
- jcr->JobLevel = L_FULL; /* default level */
- Dmsg1(800, "JobId to restore=%d\n", jcr->RestoreJobId);
- if (jcr->RestoreJobId == 0) {
- 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"
- "When: %s\n"
- "Catalog: %s\n"
- "Priority: %d\n"),
- job->name(),
- NPRT(jcr->RestoreBootstrap),
- jcr->where?jcr->where:NPRT(job->RestoreWhere),
- replace,
- jcr->fileset->name(),
- jcr->client->name(),
- jcr->rstore->name(),
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->catalog->name(),
- jcr->JobPriority);
- } else {
- bsendmsg(ua, _("Run Restore job\n"
- "JobName: %s\n"
- "Bootstrap: %s\n"
- "Where: %s\n"
- "Replace: %s\n"
- "Client: %s\n"
- "Storage: %s\n"
- "JobId: %s\n"
- "When: %s\n"
- "Catalog: %s\n"
- "Priority: %d\n"),
- job->name(),
- NPRT(jcr->RestoreBootstrap),
- jcr->where?jcr->where:NPRT(job->RestoreWhere),
- replace,
- jcr->client->name(),
- jcr->rstore->name(),
- jcr->RestoreJobId==0?"*None*":edit_uint64(jcr->RestoreJobId, ec1),
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->catalog->name(),
- jcr->JobPriority);
- }
- break;
- case JT_MIGRATE:
- jcr->JobLevel = L_FULL; /* default level */
- bsendmsg(ua, _("Run Migration job\n"
- "JobName: %s\n"
- "Bootstrap: %s\n"
- "FileSet: %s\n"
- "Client: %s\n"
- "Storage: %s\n"
- "JobId: %s\n"
- "When: %s\n"
- "Catalog: %s\n"
- "Priority: %d\n"),
- job->name(),
- NPRT(jcr->RestoreBootstrap),
- jcr->fileset->name(),
- jcr->client->name(),
- jcr->wstore?jcr->wstore->name():"*None*",
- jcr->MigrateJobId==0?"*None*":edit_uint64(jcr->MigrateJobId, ec1),
- bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->catalog->name(),
- jcr->JobPriority);
- break;
- default:
- bsendmsg(ua, _("Unknown Job Type=%d\n"), jcr->JobType);
+ if (!display_job_parameters(ua, jcr, job, verify_list, jid, replace)) {
goto bail_out;
}
if (!get_cmd(ua, _("OK to run? (yes/mod/no): "))) {
goto bail_out;
}
+
/*
* At user request modify parameters of job to be run.
*/
add_prompt(ua, _("When")); /* 5 */
add_prompt(ua, _("Priority")); /* 6 */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) {
add_prompt(ua, _("Pool")); /* 7 */
if (jcr->JobType == JT_VERIFY) {
switch (do_prompt(ua, "", _("Select parameter to modify"), NULL, 0)) {
case 0:
/* Level */
- if (jcr->JobType == JT_BACKUP) {
- start_prompt(ua, _("Levels:\n"));
- add_prompt(ua, _("Base"));
- add_prompt(ua, _("Full"));
- add_prompt(ua, _("Incremental"));
- add_prompt(ua, _("Differential"));
- add_prompt(ua, _("Since"));
- switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
- case 0:
- jcr->JobLevel = L_BASE;
- break;
- case 1:
- jcr->JobLevel = L_FULL;
- break;
- case 2:
- jcr->JobLevel = L_INCREMENTAL;
- break;
- case 3:
- jcr->JobLevel = L_DIFFERENTIAL;
- break;
- case 4:
- jcr->JobLevel = L_SINCE;
- break;
- default:
- break;
- }
- goto try_again;
- } else if (jcr->JobType == JT_VERIFY) {
- start_prompt(ua, _("Levels:\n"));
- add_prompt(ua, _("Initialize Catalog"));
- add_prompt(ua, _("Verify Catalog"));
- add_prompt(ua, _("Verify Volume to Catalog"));
- add_prompt(ua, _("Verify Disk to Catalog"));
- add_prompt(ua, _("Verify Volume Data (not yet implemented)"));
- switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
- case 0:
- jcr->JobLevel = L_VERIFY_INIT;
- break;
- case 1:
- jcr->JobLevel = L_VERIFY_CATALOG;
- break;
- case 2:
- jcr->JobLevel = L_VERIFY_VOLUME_TO_CATALOG;
- break;
- case 3:
- jcr->JobLevel = L_VERIFY_DISK_TO_CATALOG;
- break;
- case 4:
- jcr->JobLevel = L_VERIFY_DATA;
- break;
- default:
- break;
- }
- goto try_again;
- } else {
- bsendmsg(ua, _("Level not appropriate for this Job. Cannot be changed.\n"));
- }
+ select_job_level(ua, jcr);
goto try_again;
case 1:
/* Storage */
case 7:
/* Pool or Bootstrap depending on JobType */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) { /* Pool */
pool = select_pool_resource(ua);
if (pool) {
jcr->pool = pool;
+ Dmsg1(100, "Set new pool=%s\n", jcr->pool->name());
goto try_again;
}
break;
JobId_t JobId;
Dmsg1(800, "Calling run_job job=%x\n", jcr->job);
start_job:
+ Dmsg1(100, "Using pool %s\n", jcr->pool->name());
JobId = run_job(jcr);
#if 0
bsendmsg(ua, "<job director=\"console\" time=\"%u\" status=\"%c\" type=\"%c\" "
free_jcr(jcr);
return 0; /* do not run */
}
+
+static void select_job_level(UAContext *ua, JCR *jcr)
+{
+ if (jcr->JobType == JT_BACKUP) {
+ start_prompt(ua, _("Levels:\n"));
+ add_prompt(ua, _("Base"));
+ add_prompt(ua, _("Full"));
+ add_prompt(ua, _("Incremental"));
+ add_prompt(ua, _("Differential"));
+ add_prompt(ua, _("Since"));
+ switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
+ case 0:
+ jcr->JobLevel = L_BASE;
+ break;
+ case 1:
+ jcr->JobLevel = L_FULL;
+ break;
+ case 2:
+ jcr->JobLevel = L_INCREMENTAL;
+ break;
+ case 3:
+ jcr->JobLevel = L_DIFFERENTIAL;
+ break;
+ case 4:
+ jcr->JobLevel = L_SINCE;
+ break;
+ default:
+ break;
+ }
+ } else if (jcr->JobType == JT_VERIFY) {
+ start_prompt(ua, _("Levels:\n"));
+ add_prompt(ua, _("Initialize Catalog"));
+ add_prompt(ua, _("Verify Catalog"));
+ add_prompt(ua, _("Verify Volume to Catalog"));
+ add_prompt(ua, _("Verify Disk to Catalog"));
+ add_prompt(ua, _("Verify Volume Data (not yet implemented)"));
+ switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
+ case 0:
+ jcr->JobLevel = L_VERIFY_INIT;
+ break;
+ case 1:
+ jcr->JobLevel = L_VERIFY_CATALOG;
+ break;
+ case 2:
+ jcr->JobLevel = L_VERIFY_VOLUME_TO_CATALOG;
+ break;
+ case 3:
+ jcr->JobLevel = L_VERIFY_DISK_TO_CATALOG;
+ break;
+ case 4:
+ jcr->JobLevel = L_VERIFY_DATA;
+ break;
+ default:
+ break;
+ }
+ } else {
+ bsendmsg(ua, _("Level not appropriate for this Job. Cannot be changed.\n"));
+ }
+ return;
+}
+
+static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *verify_list,
+ char *jid, const char *replace)
+{
+ Dmsg1(800, "JobType=%c\n", jcr->JobType);
+ switch (jcr->JobType) {
+ char ec1[30];
+ char dt[MAX_TIME_LENGTH];
+ case JT_ADMIN:
+ bsendmsg(ua, _("Run %s job\n"
+ "JobName: %s\n"
+ "FileSet: %s\n"
+ "Client: %s\n"
+ "Storage: %s\n"
+ "When: %s\n"
+ "Priority: %d\n"),
+ _("Admin"),
+ job->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->client->name()),
+ jcr->wstore?jcr->wstore->name():"*None*",
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ jcr->JobLevel = L_FULL;
+ break;
+ case JT_BACKUP:
+ case JT_VERIFY:
+ if (jcr->JobType == JT_BACKUP) {
+ bsendmsg(ua, _("Run %s job\n"
+ "JobName: %s\n"
+ "Level: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s (From %s)\n"
+ "Storage: %s (From %s)\n"
+ "When: %s\n"
+ "Priority: %d\n"),
+ _("Backup"),
+ job->name(),
+ level_to_str(jcr->JobLevel),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()), jcr->pool_source,
+ jcr->wstore?jcr->wstore->name():"*None*", jcr->wstore_source,
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ } else { /* JT_VERIFY */
+ const char *Name;
+ if (jcr->verify_job) {
+ Name = jcr->verify_job->name();
+ } else {
+ Name = "";
+ }
+ if (!verify_list) {
+ verify_list = job->WriteVerifyList;
+ }
+ if (!verify_list) {
+ verify_list = "";
+ }
+ bsendmsg(ua, _("Run %s job\n"
+ "JobName: %s\n"
+ "Level: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s (From %s)\n"
+ "Storage: %s (From %s)\n"
+ "Verify Job: %s\n"
+ "Verify List: %s\n"
+ "When: %s\n"
+ "Priority: %d\n"),
+ _("Verify"),
+ job->name(),
+ level_to_str(jcr->JobLevel),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()), jcr->pool_source,
+ jcr->rstore->name(), jcr->rstore_source,
+ Name,
+ verify_list,
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ }
+ break;
+ case JT_RESTORE:
+ if (jcr->RestoreJobId == 0 && !jcr->RestoreBootstrap) {
+ if (jid) {
+ jcr->RestoreJobId = str_to_int64(jid);
+ } else {
+ if (!get_pint(ua, _("Please enter a JobId for restore: "))) {
+ return false;
+ }
+ jcr->RestoreJobId = ua->int64_val;
+ }
+ }
+ jcr->JobLevel = L_FULL; /* default level */
+ Dmsg1(800, "JobId to restore=%d\n", jcr->RestoreJobId);
+ if (jcr->RestoreJobId == 0) {
+ 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"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n"),
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->where?jcr->where:NPRT(job->RestoreWhere),
+ replace,
+ jcr->fileset->name(),
+ jcr->client->name(),
+ jcr->rstore->name(),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority);
+ } else {
+ bsendmsg(ua, _("Run Restore job\n"
+ "JobName: %s\n"
+ "Bootstrap: %s\n"
+ "Where: %s\n"
+ "Replace: %s\n"
+ "Client: %s\n"
+ "Storage: %s\n"
+ "JobId: %s\n"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n"),
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->where?jcr->where:NPRT(job->RestoreWhere),
+ replace,
+ jcr->client->name(),
+ jcr->rstore->name(),
+ jcr->RestoreJobId==0?"*None*":edit_uint64(jcr->RestoreJobId, ec1),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority);
+ }
+ break;
+ case JT_MIGRATE:
+ jcr->JobLevel = L_FULL; /* default level */
+ bsendmsg(ua, _("Run Migration job\n"
+ "JobName: %s\n"
+ "Bootstrap: %s\n"
+ "Client: %s\n"
+ "FileSet: %s\n"
+ "Pool: %s (From %s)\n"
+ "Read Storage: %s (From %s)\n"
+ "Write Storage: %s (From %s)\n"
+ "JobId: %s\n"
+ "When: %s\n"
+ "Catalog: %s\n"
+ "Priority: %d\n"),
+ job->name(),
+ NPRT(jcr->RestoreBootstrap),
+ jcr->client->name(),
+ jcr->fileset->name(),
+ NPRT(jcr->pool->name()), jcr->pool_source,
+ jcr->rstore->name(), jcr->rstore_source,
+ jcr->wstore?jcr->wstore->name():"*None*", jcr->wstore_source,
+ jcr->MigrateJobId==0?"*None*":edit_uint64(jcr->MigrateJobId, ec1),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->catalog->name(),
+ jcr->JobPriority);
+ break;
+ default:
+ bsendmsg(ua, _("Unknown Job Type=%d\n"), jcr->JobType);
+ return false;
+ }
+ return true;
+}
for ( ;; ) {
/* First item is the prompt string, not the items */
if (ua->num_prompts == 1) {
- bsendmsg(ua, _("Selection is empty!\n"));
+ bsendmsg(ua, _("Selection list for \"%s\" is empty!\n"), automsg);
item = -1; /* list is empty ! */
break;
}
const char *gargv[2] = {"gnome-console", NULL};
CONFONTRES *con_font;
+#ifdef ENABLE_NLS
setlocale(LC_ALL, "");
bindtextdomain("bacula", LOCALEDIR);
textdomain("bacula");
+#endif
init_stack_dump();
my_name_is(argc, argv, "gnome-console");
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
#endif
#include <gnome.h>
+
#undef Q_
#ifdef ENABLE_NLS
# define Q_(String) g_strip_context ((String), gettext (String))
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);
-
alist *wstorage; /* Write storage possibilities */
STORE *wstore; /* Selected write storage */
CLIENT *client; /* Client resource */
- POOL *pool; /* Pool resource */
+ POOL *pool; /* Pool resource = write for migration */
+ POOL *rpool; /* Read pool. Used only in migration */
POOL *full_pool; /* Full backup pool resource */
POOL *inc_pool; /* Incremental backup pool resource */
- POOL *diff_pool; /* Differential backup pool resource */
+ POOL *diff_pool; /* Differential backup pool resource */
bool run_pool_override;
bool run_full_pool_override;
bool run_inc_pool_override;
};
POOLMEM *client_uname; /* client uname */
POOLMEM *pool_source; /* Where pool came from */
+ POOLMEM *rpool_source; /* Where migrate read pool came from */
POOLMEM *rstore_source; /* Where read storage came from */
POOLMEM *wstore_source; /* Where write storage came from */
int replace; /* Replace option */
int n;
int32_t InChanger;
- dcr->VolumeName[0] = 0; /* No volume */
if (bnet_recv(dir) <= 0) {
Dmsg0(200, "getvolname error bnet_recv\n");
Mmsg(jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
bnet_fsend(dir, Get_Vol_Info, jcr->Job, dcr->VolCatInfo.VolCatName,
writing==GET_VOL_INFO_FOR_WRITE?1:0);
Dmsg1(100, ">dird: %s", dir->msg);
+ unbash_spaces(dcr->VolCatInfo.VolCatName);
bool ok = do_get_volume_info(dcr);
return ok;
}
return false;
}
-#define lots_of_debug
+// #define lots_of_debug
#ifdef lots_of_debug
if (dev->at_eof() && dev->is_dvd()) {
Dmsg1(100, "file_size=%u\n",(unsigned int)dev->file_size);
#undef VERSION
#define VERSION "1.39.30"
-#define BDATE "06 December 2006"
-#define LSMDATE "06Dec06"
+#define BDATE "08 December 2006"
+#define LSMDATE "08Dec06"
#define PROG_COPYRIGHT "Copyright (C) %d-2006 Free Software Foundation Europe e.V.\n"
#define BYEAR "2006" /* year for copyright messages in progs */
#ifndef CONSOLE_THREAD_H
#define CONSOLE_THREAD_H
+#ifndef ENABLE_NLS
+#undef setlocale
+#undef textdomain
+#undef bindtextdomain
+#endif
+
+
#include <wx/wxprec.h>
#include <wx/string.h>
#include "bacula.h"
-#undef setlocale
-#undef textdomain
-#undef bindtextdomain
-
#include <wx/wxprec.h>
#include <wx/config.h>
#include <wx/intl.h>
#undef _DEBUG
#include "bacula.h"
+
#include "wxbrestorepanel.h"
#include "wxbmainframe.h"
#include "csprint.h"
Technical notes on version 1.39
General:
+08Dec06
+kes Mark build-depkgs-mingw3 executable in configure process.
+kes Update autoconf/config.h.in to include LOCALEDIR
+kes Undefine NLS settings for wxWidgets as there is a conflict with
+ their way of doing things.
+kes Implement a rpool and rpool_source in jcr.h for Migration jobs.
+kes Change a bunch of ->hdr.name to ->name()
+kes Straighten out handling of read and write pools for Migration, including
+ getting the code in the proper order.
+kes Improve migration error messages and debug output.
+kes Shorten code path in migration if nothing found to do.
+kes Implement read/write pool in migration job report.
+kes Move ua_run.c select_job_level code into a subroutine (readability).
+kes Move ua_run.c display_job_parameters into a subroutine.
+kes Do not bash dcr->VolumeName in get_volume_info() because it makes
+ restore dependent on a valid catalog containing the Volume name.
06Dec06
kes Put make_catalog_backup SQL_BINDIR in an environment variable to
make it easier for the user to change.