-/*
- * 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.
(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.
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;
* 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"),
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;
}
}
/* 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));