Changes to 1.39.2:
05Dec05
+- Get next volume from Scratch pool before creating a volume.
+- Set new Pool defaults in Vol when moved from Scratch Pool.
- Remove argument from create_bacula_database for SQLite as it
caused an error.
- Add back index code so that two drive autochangers can get
time_t ttime;
struct tm tm;
int stat;
- char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50];
+ char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50];
+ char ed8[50], ed9[50];
Dmsg1(100, "update_media: FirstWritten=%d\n", mr->FirstWritten);
"VolFiles=%u,VolBlocks=%u,VolBytes=%s,VolMounts=%u,VolErrors=%u,"
"VolWrites=%u,MaxVolBytes=%s,VolStatus='%s',"
"Slot=%d,InChanger=%d,VolReadTime=%s,VolWriteTime=%s,VolParts=%d,"
- "LabelType=%d,StorageId=%s"
+ "LabelType=%d,StorageId=%s,PoolId=%s,VolRetention=%s,VolUseDuration=%s,"
+ "MaxVolJobs=%d,MaxVolFiles=%d,MaxVolBytes=%s"
" WHERE VolumeName='%s'",
mr->VolJobs, mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
mr->VolMounts, mr->VolErrors, mr->VolWrites,
mr->VolParts,
mr->LabelType,
edit_int64(mr->StorageId, ed5),
+ edit_int64(mr->PoolId, ed6),
+ edit_uint64(mr->VolRetention, ed7),
+ edit_uint64(mr->VolUseDuration, ed8),
+ mr->MaxVolJobs, mr->MaxVolFiles,
+ edit_uint64(mr->MaxVolBytes, ed9),
mr->VolumeName);
Dmsg1(400, "%s\n", mdb->cmd);
continue; /* retry again accepting any volume */
}
}
- Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
- if (!ok && create) {
- /*
- * 5. Try "creating" a new Volume
- */
- ok = newVolume(jcr, mr);
- }
}
}
POOLMEM *query;
char ed1[50], ed2[50];
/*
- * 6. Try pulling a volume from the Scratch pool
+ * 5. Try pulling a volume from the Scratch pool
*/
memset(&pr, 0, sizeof(pr));
bstrncpy(pr.Name, "Scratch", sizeof(pr.Name));
/* Set new Pool Id in smr record, then copy it to mr */
smr.PoolId = mr->PoolId;
memcpy(mr, &smr, sizeof(MEDIA_DBR));
+ memset(&pr, 0, sizeof(pr));
+ bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name));
+ /* Set default parameters from current pool */
+ if (db_get_pool_record(jcr, jcr->db, &pr)) {
+ set_pool_dbr_defaults_in_media_dbr(mr, &pr);
+ if (!db_update_media_record(jcr, jcr->db, mr)) {
+ Jmsg(jcr, M_WARNING, 0, _("Unable to update Volume record: ERR=%s"),
+ db_strerror(jcr->db));
+ }
+ } else {
+ Jmsg(jcr, M_WARNING, 0, _("Unable to get Pool record: ERR=%s"),
+ db_strerror(jcr->db));
+ }
}
}
}
+
+ if (!ok && create) {
+ /*
+ * 6. Try "creating" a new Volume
+ */
+ ok = newVolume(jcr, mr);
+ }
/*
* Look at more drastic ways to find an Appendable Volume
*/
UAContext *ua;
Dmsg0(400, "Try purge.\n");
/*
- * 5. Try to purging oldest volume only if not UA calling us.
+ * 7. Try to purging oldest volume only if not UA calling us.
*/
ua = new_ua_context(jcr);
if (jcr->pool->purge_oldest_volume && create) {
Jmsg(jcr, M_INFO, 0, _("Purging oldest volume \"%s\"\n"), mr->VolumeName);
ok = purge_jobs_from_volume(ua, mr);
/*
- * 5. or try recycling the oldest volume
+ * 8. or try recycling the oldest volume
*/
} else if (jcr->pool->recycle_oldest_volume) {
Jmsg(jcr, M_INFO, 0, _("Pruning oldest volume \"%s\"\n"), mr->VolumeName);
}
}
/* Look for an exact match all drives */
- rctx.PreferMountedVols = false;
+ rctx.PreferMountedVols = true;
rctx.exact_match = true;
rctx.available_autochanger = false;
if ((ok = find_suitable_device_for_job(jcr, rctx))) {