From 3dd53cfbab2cd1d95fd0911fc0bfb7169be61acf Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 6 Dec 2006 08:39:18 +0000 Subject: [PATCH] kes Modify migrate not to fail if nothing found to migrate. kes Add #undef HAVE_OPENSSL, HAVE_TLS, HAVE_CYRPTO to autoconf/config.h.in because they were not always set correctly. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3758 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/config.h.in | 11 ++++++++++- bacula/autoconf/config.h.in.save | 11 ++++++++++- bacula/src/dird/migrate.c | 32 +++++++++++++++++++------------- bacula/src/version.h | 6 +++--- bacula/technotes-1.39 | 4 ++++ 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 082f6410a6..45f330ca04 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -662,5 +662,14 @@ /* Define to `int' if doesn't define. */ #undef uid_t -/* Define to system config director */ +/* Define to system config directory */ #undef SYSCONFDIR + +/* Define if OPENSSL is available */ +#undef HAVE_OPENSSL + +/* Define if comm encryption should be enabled */ +#undef HAVE_TLS + +/* Define if data encryption should be enabled */ +#undef HAVE_CRYPTO diff --git a/bacula/autoconf/config.h.in.save b/bacula/autoconf/config.h.in.save index 082f6410a6..45f330ca04 100644 --- a/bacula/autoconf/config.h.in.save +++ b/bacula/autoconf/config.h.in.save @@ -662,5 +662,14 @@ /* Define to `int' if doesn't define. */ #undef uid_t -/* Define to system config director */ +/* Define to system config directory */ #undef SYSCONFDIR + +/* Define if OPENSSL is available */ +#undef HAVE_OPENSSL + +/* Define if comm encryption should be enabled */ +#undef HAVE_TLS + +/* Define if data encryption should be enabled */ +#undef HAVE_CRYPTO diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index ada5652471..6c5114c9f6 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -54,7 +54,7 @@ static const int dbglevel = 10; static char OKbootstrap[] = "3000 OK bootstrap\n"; -static bool get_job_to_migrate(JCR *jcr); +static int get_job_to_migrate(JCR *jcr); struct idpkt; static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, const char *query2, const char *type); @@ -96,11 +96,17 @@ bool do_migration_init(JCR *jcr) char ed1[100]; JOB *job, *prev_job; JCR *mig_jcr; /* newly migrated job */ + int count; /* If we find a job or jobs to migrate it is previous_jr.JobId */ - if (!get_job_to_migrate(jcr)) { + count = get_job_to_migrate(jcr); + if (count < 0) { return false; } + if (count == 0) { + return true; + } + Dmsg1(dbglevel, "Back from get_job_to_migrate JobId=%d\n", (int)jcr->JobId); if (jcr->previous_jr.JobId == 0) { @@ -547,10 +553,11 @@ const char *sql_pool_time = * one starting a new job with MigrationJobId set to that JobId, and * finally, it returns the last JobId to the caller. * - * Returns: false on error - * true if OK and jcr->previous_jr filled in + * Returns: -1 on error + * 0 if no jobs to migrate + * 1 if OK and jcr->previous_jr filled in */ -static bool get_job_to_migrate(JCR *jcr) +static int get_job_to_migrate(JCR *jcr) { char ed1[30]; POOL_MEM query(PM_MESSAGE); @@ -561,10 +568,10 @@ static bool get_job_to_migrate(JCR *jcr) idpkt ids, mid, jids; db_int64_ctx ctx; int64_t pool_bytes; - bool ok; time_t ttime; struct tm tm; char dt[MAX_TIME_LENGTH]; + int count = 0; ids.list = get_pool_memory(PM_MESSAGE); ids.list[0] = 0; @@ -678,8 +685,7 @@ static bool get_job_to_migrate(JCR *jcr) } mid.count = 1; Mmsg(mid.list, "%s", edit_int64(MediaId, ed1)); - ok = find_jobids_from_mediaid_list(jcr, &mid, "Volumes"); - if (!ok) { + if (!find_jobids_from_mediaid_list(jcr, &mid, "Volumes")) { continue; } if (i != 0) { @@ -760,7 +766,7 @@ static bool get_job_to_migrate(JCR *jcr) goto bail_out; } else if (stat == 0) { Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); - goto bail_out; + goto ok_out; } } @@ -773,7 +779,7 @@ static bool get_job_to_migrate(JCR *jcr) goto bail_out; } else if (stat == 0) { Jmsg(jcr, M_INFO, 0, _("No JobIds found to migrate.\n")); - goto bail_out; + goto ok_out; } jcr->previous_jr.JobId = JobId; @@ -790,19 +796,19 @@ static bool get_job_to_migrate(JCR *jcr) Dmsg3(dbglevel, "Migration JobId=%d using JobId=%s Job=%s\n", jcr->JobId, edit_int64(jcr->previous_jr.JobId, ed1), jcr->previous_jr.Job); + count = 1; ok_out: - ok = true; goto out; bail_out: - ok = false; + count = -1; out: free_pool_memory(ids.list); free_pool_memory(mid.list); free_pool_memory(jids.list); - return ok; + return count; } static void start_migration_job(JCR *jcr) diff --git a/bacula/src/version.h b/bacula/src/version.h index 12a34b7f0a..773168bfbb 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "1.39.29" -#define BDATE "05 December 2006" -#define LSMDATE "05Dec06" +#define VERSION "1.39.30" +#define BDATE "06 December 2006" +#define LSMDATE "06Dec06" #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/technotes-1.39 b/bacula/technotes-1.39 index 84d17edb78..96c755101c 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,10 @@ Technical notes on version 1.39 General: +06Dec06 +kes Modify migrate not to fail if nothing found to migrate. +kes Add #undef HAVE_OPENSSL, HAVE_TLS, HAVE_CYRPTO to autoconf/config.h.in + because they were not always set correctly. 05Dec06 kes Update configure.in to include python 2.5 search. kes Back out unwanted migration change reported by Richard Mortimer. -- 2.39.5