} else {
ed2[0] = 0;
}
+ Dmsg1(050, "Scratch pool=%s\n", ed2);
/*
* ed2 ends up with scratch poolid and current poolid or
* just current poolid if there is no scratch pool
Mmsg(query, select, ed1, ed2, mr->MediaType, "");
}
+ Dmsg1(050, "query=%s\n", query.c_str());
if (!db_get_query_dbids(ua->jcr, ua->db, query, ids)) {
Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
goto bail_out;
}
+ Dmsg1(050, "num_ids=%d\n", ids.num_ids);
+
/* Visit each Volume and Prune it until we find one that is purged */
for (i=0; i<ids.num_ids; i++) {
MEDIA_DBR lmr;
memset(&lmr, 0, sizeof(lmr));
lmr.MediaId = ids.DBId[i];
- Dmsg1(150, "Get record MediaId=%d\n", (int)lmr.MediaId);
+ Dmsg1(050, "Get record MediaId=%d\n", (int)lmr.MediaId);
if (!db_get_media_record(jcr, jcr->db, &lmr)) {
Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
continue;
mr = &lmr; /* struct copy */
break;
}
+ } else {
+ Dmsg2(050, "Nothing pruned MediaId=%d Volume=%s\n", (int)lmr.MediaId, lmr.VolumeName);
}
}
/*
* 4. Try pruning Volumes
*/
- Dmsg0(150, "Call prune_volumes\n");
if (prune) {
+ Dmsg0(150, "Call prune_volumes\n");
prune_volumes(jcr, InChanger, mr);
}
ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
}
Jmsg(jcr, M_INFO, 0, _("Using Volume \"%s\" from 'Scratch' pool.\n"),
smr.VolumeName);
- /* Set new Pool Id in smr record, then copy it to mr */
- smr.PoolId = mr->PoolId;
- memcpy(mr, &smr, sizeof(MEDIA_DBR));
+ /*
+ * Get *full* media record to return as db_find_next_volume does
+ * not return everything .
+ */
+ if (!db_get_media_record(jcr, jcr->db, mr)) {
+ Jmsg(jcr, M_WARNING, 0, _("Unable to get Volume record: ERR=%s"),
+ db_strerror(jcr->db));
+ goto bail_out;
+ }
/* Set default parameters from current pool */
set_pool_dbr_defaults_in_media_dbr(mr, &pr);
/*
General:
07Jul07
+kes Correct a problem when selecting a scratch volume and moving
+ it to another pool that lost some columns.
kes Tweak some code in ua_update.c to use POOL_MEM instead of POOLMEM.
kes Enhance Autochanger error messages to include Volume and device name.
kes Rework prune_volumes() code to take account of InChanger flag,