*/
/* Requests from the Storage daemon */
-static char Find_media[] = "CatReq Job=%127s FindMedia=%d PoolId=%lld\n";
+static char Find_media[] = "CatReq Job=%127s FindMedia=%d pool_name=%127s media_type=%127s\n";
static char Get_Vol_Info[] = "CatReq Job=%127s GetVolInfo VolName=%127s write=%d\n";
static char Update_media[] = "CatReq Job=%127s UpdateMedia VolName=%s"
mr->VolParts,
mr->LabelType);
unbash_spaces(mr->VolumeName);
- Dmsg2(400, "Vol Info for %s: %s", jcr->Job, sd->msg);
+ Dmsg2(100, "Vol Info for %s: %s", jcr->Job, sd->msg);
return stat;
}
MEDIA_DBR mr, sdmr;
JOBMEDIA_DBR jm;
char Job[MAX_NAME_LENGTH];
+ char pool_name[MAX_NAME_LENGTH];
int index, ok, label, writing;
POOLMEM *omsg;
+ POOL_DBR pr;
memset(&mr, 0, sizeof(mr));
memset(&sdmr, 0, sizeof(sdmr));
/*
* Request to find next appendable Volume for this Job
*/
- Dmsg1(400, "catreq %s", bs->msg);
+ Dmsg1(100, "catreq %s", bs->msg);
if (!jcr->db) {
omsg = get_memory(bs->msglen+1);
pm_strcpy(omsg, bs->msg);
/*
* Find next appendable medium for SD
*/
- if (sscanf(bs->msg, Find_media, &Job, &index, &mr.PoolId) == 3) {
- ok = find_next_volume_for_append(jcr, &mr, true /*permit create new vol*/);
+ if (sscanf(bs->msg, Find_media, &Job, &index, &pool_name, &mr.MediaType) == 4) {
+ memset(&pr, 0, sizeof(pr));
+ bstrncpy(pr.Name, pool_name, sizeof(pr.Name));
+ ok = db_get_pool_record(jcr, jcr->db, &pr);
+ if (ok) {
+ mr.PoolId = pr.PoolId;
+ ok = find_next_volume_for_append(jcr, &mr, true /*permit create new vol*/);
+ }
/*
* Send Find Media response to Storage daemon
*/
send_volume_info_to_storage_daemon(jcr, bs, &mr);
} else {
bnet_fsend(bs, "1901 No Media.\n");
+ Dmsg0(500, "1901 No Media.\n");
}
/*
* Request to find specific Volume information
*/
} else if (sscanf(bs->msg, Get_Vol_Info, &Job, &mr.VolumeName, &writing) == 3) {
- Dmsg1(400, "CatReq GetVolInfo Vol=%s\n", mr.VolumeName);
+ Dmsg1(500, "CatReq GetVolInfo Vol=%s\n", mr.VolumeName);
/*
* Find the Volume
*/
} else {
bnet_fsend(bs, "1997 Volume \"%s\" not in catalog.\n", mr.VolumeName);
+ Dmsg1(400, "1997 Volume \"%s\" not in catalog.\n", mr.VolumeName);
}
/*
* Insanity check for VolFiles get set to a smaller value
*/
if (sdmr.VolFiles < mr.VolFiles) {
- Jmsg(jcr, M_ERROR, 0, _("ERROR!! Volume Files at %u being set to %u. This is probably wrong.\n"),
- mr.VolFiles, sdmr.VolFiles);
+ Jmsg(jcr, M_FATAL, 0, _("Volume Files at %u being set to %u"
+ " for Volume \"%s\". This is incorrect.\n"),
+ mr.VolFiles, sdmr.VolFiles, mr.VolumeName);
+ bnet_fsend(bs, "1992 Update Media error\n");
+ db_unlock(jcr->db);
+ return;
}
}
Dmsg2(400, "Update media: BefVolJobs=%u After=%u\n", mr.VolJobs, sdmr.VolJobs);