From: Kern Sibbald Date: Thu, 19 Jul 2007 08:33:25 +0000 (+0000) Subject: Ensure that we keep Recycle Pool when moving Scratch volumes. X-Git-Tag: Release-7.0.0~5984 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ea58847359c91428206acad425dde02543ce1499;p=bacula%2Fbacula Ensure that we keep Recycle Pool when moving Scratch volumes. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5198 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c index 7d572dab4a..25647c8d80 100644 --- a/bacula/src/cats/sql_list.c +++ b/bacula/src/cats/sql_list.c @@ -1,14 +1,7 @@ -/* - * Bacula Catalog Database List records interface routines - * - * Kern Sibbald, March 2000 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 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. @@ -32,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Bacula Catalog Database List records interface routines + * + * Kern Sibbald, March 2000 + * + * Version $Id$ + */ + /* The following is necessary so that we do not include * the dummy external definition of DB. diff --git a/bacula/src/dird/next_vol.c b/bacula/src/dird/next_vol.c index 11a253b8d5..1a4f8b4a7e 100644 --- a/bacula/src/dird/next_vol.c +++ b/bacula/src/dird/next_vol.c @@ -327,7 +327,7 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; bool get_scratch_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr) { - MEDIA_DBR smr; + MEDIA_DBR smr; /* for searching scratch pool */ POOL_DBR spr, pr; bool ok = false; bool found = false; @@ -371,7 +371,7 @@ bool get_scratch_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr) * that we can add a Volume. */ memset(&pr, 0, sizeof(pr)); - bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name)); + bstrncpy(pr.Name, jcr->pool->name(), sizeof(pr.Name)); if (!db_get_pool_record(jcr, jcr->db, &pr)) { Jmsg(jcr, M_WARNING, 0, _("Unable to get Pool record: ERR=%s"), @@ -379,9 +379,10 @@ bool get_scratch_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr) goto bail_out; } + /* Make sure there is room for another volume */ if (pr.MaxVols > 0 && pr.NumVols >= pr.MaxVols) { Jmsg(jcr, M_WARNING, 0, _("Unable add Scratch Volume, Pool \"%s\" full MaxVols=%d\n"), - jcr->pool->hdr.name, pr.MaxVols); + jcr->pool->name(), pr.MaxVols); goto bail_out; } @@ -397,11 +398,15 @@ bool get_scratch_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr) } /* Set default parameters from current pool */ set_pool_dbr_defaults_in_media_dbr(mr, &pr); + /* * set_pool_dbr_defaults_in_media_dbr set VolStatus to Append, - * we could have Recycled media, + * we could have Recycled media, also, we retain the old + * RecyclePoolId. */ bstrncpy(mr->VolStatus, smr.VolStatus, sizeof(smr.VolStatus)); + mr.RecyclePoolId = smr.RecyclePoolId; + if (!db_update_media_record(jcr, jcr->db, mr)) { Jmsg(jcr, M_WARNING, 0, _("Failed to move Scratch Volume. ERR=%s\n"), db_strerror(jcr->db)); diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 839294ca76..1d7fd50050 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,7 +2,9 @@ General: Release 2.1.28 beta -18Jul08 +19Jul07 +kes Ensure that we keep Recycle Pool when moving Scratch volumes. +18Jul07 kes Update Release notes 17Jul07 ebl fix a bug in get_scratch_volume() report by Andreas Helmcke