From 45e6ff57c7d23c542f38d8c51883e69c72b8e55d Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 23 Jun 2009 11:56:35 +0000 Subject: [PATCH] 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 --- bacula/src/cats/cats.h | 1 + bacula/src/cats/sql_get.c | 3 +- bacula/src/dird/bsr.c | 68 +++++++++++++++++++++------------------ bacula/technotes | 3 ++ 4 files changed, 42 insertions(+), 33 deletions(-) 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 -- 2.39.5