]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add '*' when volume is online when displaying volume list in restore.
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 23 Jun 2009 11:56:35 +0000 (11:56 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 23 Jun 2009 11:56:35 +0000 (11:56 +0000)
     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
bacula/src/cats/sql_get.c
bacula/src/dird/bsr.c
bacula/technotes

index 9431685fe1f34f4fa0faca570ff994c0e3d011e7..2ff803fbd24466408b31fcff1a05b2c746e4cd60 100644 (file)
@@ -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 */
 };
index 1d76c7806b7647cf3dc0d16925865e6c84f4f83c..6dddb210729791f64bbb90378a537f286c9b4cd1 100644 (file)
@@ -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;
             }
index 81e384314dda741e32720430cad63b09fa2055f4..24cabc3449998b1e2f823db3ad50f6ff92ad19ed 100644 (file)
@@ -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");
index b82c8eb30ad1a2fd289d9da69a8706753970bff4..b73624263abaf0a5309db46ca78824c524230606 100644 (file)
@@ -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