From 4c4c9209f3994fe9de15fe437b7ac71efea46b14 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 8 Dec 2006 14:27:10 +0000 Subject: [PATCH] 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. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3774 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/config.h.in | 3 + bacula/autoconf/config.h.in.save | 3 + bacula/autoconf/configure.in | 2 + bacula/configure | 2 + bacula/src/baconfig.h | 17 + bacula/src/dird/backup.c | 2 +- bacula/src/dird/job.c | 30 +- bacula/src/dird/migrate.c | 177 +++++--- bacula/src/dird/msgchan.c | 24 +- bacula/src/dird/protos.h | 1 + bacula/src/dird/ua_restore.c | 1 + bacula/src/dird/ua_run.c | 515 ++++++++++++---------- bacula/src/dird/ua_select.c | 2 +- bacula/src/gnome2-console/console.c | 2 + bacula/src/gnome2-console/support.h | 4 +- bacula/src/jcr.h | 6 +- bacula/src/stored/askdir.c | 2 +- bacula/src/stored/block.c | 2 +- bacula/src/version.h | 4 +- bacula/src/wx-console/console_thread.h | 7 + bacula/src/wx-console/main.cpp | 4 - bacula/src/wx-console/wxbrestorepanel.cpp | 1 + bacula/technotes-1.39 | 16 + 23 files changed, 486 insertions(+), 341 deletions(-) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 45f330ca04..00bb6056e5 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -673,3 +673,6 @@ /* Define if data encryption should be enabled */ #undef HAVE_CRYPTO + +/* Define the LOCALEDIR if a translation */ +#undef LOCALEDIR diff --git a/bacula/autoconf/config.h.in.save b/bacula/autoconf/config.h.in.save index 45f330ca04..00bb6056e5 100644 --- a/bacula/autoconf/config.h.in.save +++ b/bacula/autoconf/config.h.in.save @@ -673,3 +673,6 @@ /* Define if data encryption should be enabled */ #undef HAVE_CRYPTO + +/* Define the LOCALEDIR if a translation */ +#undef LOCALEDIR diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 57b35067f9..ef55bcccbe 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2071,6 +2071,8 @@ chmod 755 $c/make_catalog_backup $c/delete_catalog_backup 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 diff --git a/bacula/configure b/bacula/configure index 5c6124bf0d..35e0b321f7 100755 --- a/bacula/configure +++ b/bacula/configure @@ -31647,6 +31647,8 @@ chmod 755 $c/make_catalog_backup $c/delete_catalog_backup 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 diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 8b46f79e0b..88e7da97ec 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -110,6 +110,7 @@ void InitWinAPIWrapper(); #define tape_read read #define tape_write write #define tape_close ::close + #endif @@ -123,6 +124,12 @@ void InitWinAPIWrapper(); #define N_(s) (s) #endif /* N_ */ #else /* !ENABLE_NLS */ + #undef _ + #undef N_ + #undef textdomain + #undef bindtextdomain + #undef setlocale + #ifndef _ #define _(s) (s) #endif @@ -139,6 +146,8 @@ void InitWinAPIWrapper(); #define setlocale(p, d) #endif #endif /* ENABLE_NLS */ + + /* Use the following for strings not to be translated */ #define NT_(s) (s) @@ -532,6 +541,14 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #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 */ diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 979d35df15..4cde534a67 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -78,7 +78,7 @@ bool do_backup_init(JCR *jcr) 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; } diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 09fdc13b40..0301534d9e 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -115,7 +115,7 @@ bool setup_job(JCR *jcr) } 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(); @@ -144,6 +144,13 @@ bool setup_job(JCR *jcr) 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 @@ -599,6 +606,7 @@ DBId_t get_or_create_pool_record(JCR *jcr, char *pool_name) 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 */ @@ -616,7 +624,7 @@ DBId_t get_or_create_pool_record(JCR *jcr, char *pool_name) 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 @@ -626,9 +634,9 @@ void apply_pool_overrides(JCR *jcr) 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; @@ -636,9 +644,9 @@ void apply_pool_overrides(JCR *jcr) 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; @@ -646,9 +654,9 @@ void apply_pool_overrides(JCR *jcr) 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; @@ -735,7 +743,7 @@ void init_jcr_job_record(JCR *jcr) 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)); } @@ -834,6 +842,10 @@ void dird_free_jcr_pointers(JCR *jcr) 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; diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 6c5114c9f6..bb6e46d4df 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -87,7 +87,10 @@ static int get_next_dbid_from_list(char **p, DBId_t *DBId); * 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) { @@ -98,6 +101,27 @@ 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) { @@ -121,15 +145,6 @@ bool do_migration_init(JCR *jcr) 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) { @@ -220,32 +235,19 @@ bool do_migration_init(JCR *jcr) * 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; } @@ -637,7 +639,7 @@ static int get_job_to_migrate(JCR *jcr) 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; @@ -647,9 +649,9 @@ static int get_job_to_migrate(JCR *jcr) 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; } @@ -657,7 +659,7 @@ static int get_job_to_migrate(JCR *jcr) 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)); @@ -704,9 +706,9 @@ static int get_job_to_migrate(JCR *jcr) } 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; } @@ -717,12 +719,12 @@ static int get_job_to_migrate(JCR *jcr) 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)); @@ -837,7 +839,7 @@ static bool find_mediaid_then_jobids(JCR *jcr, idpkt *ids, const char *query1, 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; @@ -895,17 +897,9 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, 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)) { @@ -913,29 +907,51 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, _("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 @@ -944,7 +960,7 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, 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, @@ -956,10 +972,10 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, 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; } @@ -1101,8 +1117,9 @@ void migration_cleanup(JCR *jcr, int TermCode) " 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" @@ -1128,9 +1145,10 @@ void migration_cleanup(JCR *jcr, int TermCode) 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, @@ -1191,3 +1209,24 @@ static int get_next_dbid_from_list(char **p, DBId_t *DBId) *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; +} diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 3980b3af4d..84a25f4537 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -199,11 +199,6 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) 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 @@ -215,15 +210,24 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) */ /* 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) { @@ -246,8 +250,11 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) /* 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); @@ -255,6 +262,7 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) 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) { diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 717cc861c8..ac06432e7b 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -130,6 +130,7 @@ extern bool create_restore_bootstrap_file(JCR *jcr); 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 */ diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 104dca9db5..7f8cf1db6b 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -1037,6 +1037,7 @@ static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *dat } 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; } diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 7cd2f781a5..d28ef51fee 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -37,7 +37,11 @@ #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[]; @@ -344,6 +348,26 @@ int run_cmd(UAContext *ua, const char *cmd) 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")); @@ -358,6 +382,7 @@ int run_cmd(UAContext *ua, const char *cmd) 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"), @@ -366,26 +391,6 @@ int run_cmd(UAContext *ua, const char *cmd) } 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) { @@ -453,10 +458,10 @@ int run_cmd(UAContext *ua, const char *cmd) 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; @@ -519,6 +524,12 @@ int run_cmd(UAContext *ua, const char *cmd) } 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) { @@ -545,174 +556,14 @@ try_again: * 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. */ @@ -728,6 +579,7 @@ try_again: 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) { @@ -742,63 +594,7 @@ try_again: 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 */ @@ -863,10 +659,12 @@ try_again: 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; @@ -946,6 +744,7 @@ try_again: 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, "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; +} diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index f5234a4e1d..9ef57dd2d0 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -749,7 +749,7 @@ int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt, 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; } diff --git a/bacula/src/gnome2-console/console.c b/bacula/src/gnome2-console/console.c index 7e1839ff2f..063fce15a1 100644 --- a/bacula/src/gnome2-console/console.c +++ b/bacula/src/gnome2-console/console.c @@ -213,9 +213,11 @@ int main(int argc, char *argv[]) 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"); diff --git a/bacula/src/gnome2-console/support.h b/bacula/src/gnome2-console/support.h index 2bec209a5a..8e0506ad4f 100644 --- a/bacula/src/gnome2-console/support.h +++ b/bacula/src/gnome2-console/support.h @@ -3,11 +3,12 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include + #undef Q_ #ifdef ENABLE_NLS # define Q_(String) g_strip_context ((String), gettext (String)) @@ -46,4 +47,3 @@ GdkPixbuf* create_pixbuf (const gchar *filename); void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description); - diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 4380efc723..5874faaf42 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -203,10 +203,11 @@ public: 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; @@ -236,6 +237,7 @@ public: }; 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 */ diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index ca68fa10d4..a42863cabb 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -166,7 +166,6 @@ static bool do_get_volume_info(DCR *dcr) 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")); @@ -220,6 +219,7 @@ bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) 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; } diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index e7d37337e8..b788bfb28a 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -940,7 +940,7 @@ reread: 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); diff --git a/bacula/src/version.h b/bacula/src/version.h index 773168bfbb..dca4fb1ff7 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #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 */ diff --git a/bacula/src/wx-console/console_thread.h b/bacula/src/wx-console/console_thread.h index 10a9875190..689bfc8088 100644 --- a/bacula/src/wx-console/console_thread.h +++ b/bacula/src/wx-console/console_thread.h @@ -37,6 +37,13 @@ #ifndef CONSOLE_THREAD_H #define CONSOLE_THREAD_H +#ifndef ENABLE_NLS +#undef setlocale +#undef textdomain +#undef bindtextdomain +#endif + + #include #include diff --git a/bacula/src/wx-console/main.cpp b/bacula/src/wx-console/main.cpp index 7fd717a085..69f3cbd7d7 100644 --- a/bacula/src/wx-console/main.cpp +++ b/bacula/src/wx-console/main.cpp @@ -51,10 +51,6 @@ #include "bacula.h" -#undef setlocale -#undef textdomain -#undef bindtextdomain - #include #include #include diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index c4c5659400..6984bc4e2e 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -70,6 +70,7 @@ Select parameter to modify (1-11): #undef _DEBUG #include "bacula.h" + #include "wxbrestorepanel.h" #include "wxbmainframe.h" #include "csprint.h" diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index f75e441418..a79fce0f21 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,22 @@ 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. -- 2.39.5