]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_update.c
- Back port changes to 1.38.5
[bacula/bacula] / bacula / src / dird / ua_update.c
index ffc795eb2311805bfc19ec4c797f42772d8404a9..c02ab2bca41cbfc8e22e499c3f3104aeea7ed749 100644 (file)
@@ -8,7 +8,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -29,8 +29,8 @@
 extern char *list_pool;               /* in sql_cmds.c */
 
 /* Imported functions */
-void set_pooldbr_from_poolres(POOL_DBR *pr, POOL *pool, e_pool_op op);
-int update_slots(UAContext *ua);
+void update_slots(UAContext *ua);
+
 
 
 /* Forward referenced functions */
@@ -340,6 +340,7 @@ static int update_volume(UAContext *ua)
    POOLMEM *query;
    char ed1[130];
    bool done = false;
+   int i;
    const char *kw[] = {
       _("VolStatus"),                /* 0 */
       _("VolRetention"),             /* 1 */
@@ -353,7 +354,7 @@ static int update_volume(UAContext *ua)
       _("AllFromPool"),              /* 9 */
       NULL };
 
-   for (int i=0; kw[i]; i++) {
+   for (i=0; kw[i]; i++) {
       int j;
       POOL_DBR pr;
       if ((j=find_arg_with_value(ua, kw[i])) > 0) {
@@ -403,9 +404,6 @@ static int update_volume(UAContext *ua)
    }
 
    for ( ; !done; ) {
-      if (!select_media_dbr(ua, &mr)) {
-         return 0;
-      }
       bsendmsg(ua, _("Updating Volume \"%s\"\n"), mr.VolumeName);
       start_prompt(ua, _("Parameters to modify:\n"));
       add_prompt(ua, _("Volume Status"));
@@ -422,7 +420,14 @@ static int update_volume(UAContext *ua)
       add_prompt(ua, _("Volume from Pool"));
       add_prompt(ua, _("All Volumes from Pool"));
       add_prompt(ua, _("Done"));
-      switch (do_prompt(ua, "", _("Select parameter to modify"), NULL, 0)) {
+      i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0);  
+      /* For All Volumes from Pool we don't need a Volume record */
+      if (i != 12) {
+         if (!select_media_dbr(ua, &mr)) {  /* Get Volume record */
+            return 0;
+         }
+      }
+      switch (i) {
       case 0:                         /* Volume Status */
          /* Modify Volume Status */
          bsendmsg(ua, _("Current Volume status is: %s\n"), mr.VolStatus);
@@ -509,7 +514,7 @@ static int update_volume(UAContext *ua)
          }
          Slot = ua->pint32_val;
          if (pr.MaxVols > 0 && Slot > (int)pr.MaxVols) {
-            bsendmsg(ua, _("Invalid slot, it must be between 0 and %d\n"),
+            bsendmsg(ua, _("Invalid slot, it must be between 0 and MaxVols=%d\n"),
                pr.MaxVols);
             break;
          }