Mmsg(mdb->cmd,
"SELECT VolumeName,MediaType,FirstIndex,LastIndex,StartFile,"
"JobMedia.EndFile,StartBlock,JobMedia.EndBlock,Copy,"
-"Slot,StorageId"
+"Slot,StorageId,InChanger"
" FROM JobMedia,Media WHERE JobMedia.JobId=%s"
" AND JobMedia.MediaId=Media.MediaId ORDER BY VolIndex,JobMediaId",
edit_int64(JobId, ed1));
// Vols[i].Copy = str_to_uint64(row[8]);
Vols[i].Slot = str_to_uint64(row[9]);
StorageId = str_to_uint64(row[10]);
+ Vols[i].InChanger = str_to_uint64(row[11]);
Vols[i].Storage[0] = 0;
SId[i] = StorageId;
}
return count;
}
-void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
+static void display_vol_info(UAContext *ua, RESTORE_CTX &rx, JobId_t JobId)
{
- char *p;
POOL_MEM volmsg(PM_MESSAGE);
- JobId_t JobId;
char Device[MAX_NAME_LENGTH];
+ char online;
RBSR *bsr;
+ for (bsr=rx.bsr; bsr; bsr=bsr->next) {
+ if (JobId && JobId != bsr->JobId) {
+ continue;
+ }
+
+ for (int i=0; i < bsr->VolCount; i++) {
+ if (bsr->VolParams[i].VolumeName[0]) {
+ if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
+ Device[0] = 0;
+ }
+ if (bsr->VolParams[i].InChanger && bsr->VolParams[i].Slot) {
+ online = '*';
+ } else {
+ online = ' ';
+ }
+ Mmsg(volmsg, "%c%-25.25s %-25.25s %-25.25s",
+ online, bsr->VolParams[i].VolumeName,
+ bsr->VolParams[i].Storage,
+ Device);
+ add_prompt(ua, volmsg.c_str());
+ }
+ }
+ }
+}
+
+void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
+{
+ char *p;
+ JobId_t JobId;
+
/* Tell the user what he will need to mount */
ua->send_msg("\n");
ua->send_msg(_("The job will require the following\n"
start_prompt(ua, "");
if (*rx.JobIds == 0) {
/* Print Volumes in any order */
- for (bsr=rx.bsr; bsr; bsr=bsr->next) {
- for (int i=0; i < bsr->VolCount; i++) {
- if (bsr->VolParams[i].VolumeName[0]) {
- if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
- Device[0] = 0;
- }
- Mmsg(volmsg, "%-25.25s %-25.25s %-25.25s",
- bsr->VolParams[i].VolumeName,
- bsr->VolParams[i].Storage, Device);
- add_prompt(ua, volmsg.c_str());
- }
- }
- }
+ display_vol_info(ua, rx, 0);
} else {
/* Ensure that the volumes are printed in JobId order */
for (p=rx.JobIds; get_next_jobid_from_list(&p, &JobId) > 0; ) {
- for (bsr=rx.bsr; bsr; bsr=bsr->next) {
- if (JobId != bsr->JobId) {
- continue;
- }
- for (int i=0; i < bsr->VolCount; i++) {
- if (bsr->VolParams[i].VolumeName[0]) {
- if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
- Device[0] = 0;
- }
- Mmsg(volmsg, "%-25.25s %-25.25s %-25.25s",
- bsr->VolParams[i].VolumeName,
- bsr->VolParams[i].Storage, Device);
- add_prompt(ua, volmsg.c_str());
- }
- }
- }
+ display_vol_info(ua, rx, JobId);
}
}
for (int i=0; i < ua->num_prompts; i++) {
}
if (ua->num_prompts == 0) {
ua->send_msg(_("No Volumes found to restore.\n"));
+ } else {
+ ua->send_msg(_("\nVolumes marked with \"*\" are online.\n"));
}
ua->num_prompts = 0;
ua->send_msg("\n");