From: Eric Bollengier Date: Tue, 23 Jun 2009 11:56:35 +0000 (+0000) Subject: ebl Add '*' when volume is online when displaying volume list in restore. X-Git-Tag: Release-3.0.2~148 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=45e6ff57c7d23c542f38d8c51883e69c72b8e55d;p=bacula%2Fbacula ebl Add '*' when volume is online when displaying volume list in restore. Should complete project 31. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8918 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 9431685fe1..2ff803fbd2 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -843,6 +843,7 @@ struct VOL_PARAMS { int32_t Slot; /* Slot */ uint64_t StartAddr; /* Start address */ uint64_t EndAddr; /* End address */ + int32_t InChanger; /* InChanger flag */ // uint32_t Copy; /* identical copy */ // uint32_t Stripe; /* RAIT strip number */ }; diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 1d76c7806b..6dddb21072 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -429,7 +429,7 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS 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)); @@ -470,6 +470,7 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS // 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; } diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 81e384314d..24cabc3449 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -254,14 +254,43 @@ bail_out: 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" @@ -271,38 +300,11 @@ void display_bsr_info(UAContext *ua, RESTORE_CTX &rx) 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++) { @@ -311,6 +313,8 @@ void display_bsr_info(UAContext *ua, RESTORE_CTX &rx) } 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"); diff --git a/bacula/technotes b/bacula/technotes index b82c8eb30a..b73624263a 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,9 @@ General: +23Jun09 +ebl Add '*' when volume is online when displaying volume list in restore. Should + complete project 31. 21Jun09 kes Re-fix bug #1311 if MaxDiffInterval exceeded ensure job upgraded 18Jun09