]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Tweak restore path prompt
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index fcecd164318dbcd6f7f8dd1639c340b0982eac5f..9c37032325ca16861643014c9ea446ea31a40a32 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -31,7 +31,6 @@
  *
  *     Kern Sibbald, September MM
  *
- *   Version $Id$
  */
  
 #include "bacula.h"
@@ -134,9 +133,9 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("help"),       help_cmd,      _("Print help on specific command"),  
    NT_("add autodisplay automount cancel create delete disable\n\tenable estimate exit gui label list llist"
        "\n\tmessages memory mount prune purge python quit query\n\trestore relabel release reload run status"
-       "\n\tsetdebug setip show sqlquery time trace unmount umount\n\tupdate use var version wait"),         false},
+       "\n\tsetdebug setip show sqlquery time trace unmount\n\tumount update use var version wait"),         false},
 
- { NT_("label"),      label_cmd,     _("Label a tape"), NT_("storage=<storage> volume=<vol> pool=<pool>"), false},
+ { NT_("label"),      label_cmd,     _("Label a tape"), NT_("storage=<storage> volume=<vol> pool=<pool> slot=<slot> barcodes"), false},
  { NT_("list"),       list_cmd,      _("List objects from catalog"), 
    NT_("pools | jobs | jobtotals | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn>"), true},
 
@@ -157,7 +156,7 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("query"),      querycmd,      _("Query catalog"),              NT_(""),              false},
  { NT_("restore"),    restore_cmd,   _("Restore files"), 
    NT_("where=</path> client=<client> storage=<storage> bootstrap=<file> "
-       "restore_job=<job>"
+       "restorejob=<job>"
        "\n\tcomment=<text> jobid=<jobid> done select all"), false},
 
  { NT_("relabel"),    relabel_cmd,   _("Relabel a tape"), 
@@ -194,7 +193,7 @@ static struct cmdstruct commands[] = {                                      /* C
        "\n\t pool=<pool> recycle=<yes/no> slot=<number>\n\t inchanger=<yes/no>"
        "\n\t maxvolbytes=<size> maxvolfiles=<nb> maxvoljobs=<nb>"
        "\n\t enable=<yes/no> recyclepool=<pool> actiononpurge=<action>"),true},
- { NT_("use"),        use_cmd,       _("Use catalog xxx"), NT_(""),     false},
+ { NT_("use"),        use_cmd,       _("Use catalog xxx"), NT_("catalog=<catalog>"),     false},
  { NT_("var"),        var_cmd,       _("Does variable expansion"), NT_(""),  false},
  { NT_("version"),    version_cmd,   _("Print Director version"),  NT_(""),  true},
  { NT_("wait"),       wait_cmd,      _("Wait until no jobs are running"), 
@@ -281,7 +280,6 @@ static int add_cmd(UAContext *ua, const char *cmd)
    POOL_DBR pr;
    MEDIA_DBR mr;
    int num, i, max, startnum;
-   int first_id = 0;
    char name[MAX_NAME_LENGTH];
    STORE *store;
    int Slot = 0, InChanger = 0;
@@ -296,7 +294,6 @@ static int add_cmd(UAContext *ua, const char *cmd)
    }
 
    memset(&pr, 0, sizeof(pr));
-   memset(&mr, 0, sizeof(mr));
 
    if (!get_pool_dbr(ua, &pr)) {
       return 1;
@@ -400,16 +397,13 @@ static int add_cmd(UAContext *ua, const char *cmd)
       bsnprintf(mr.VolumeName, sizeof(mr.VolumeName), name, i);
       mr.Slot = Slot++;
       mr.InChanger = InChanger;
-      mr.StorageId = store->StorageId;
       mr.Enabled = 1;
+      set_storageid_in_mr(store, &mr);
       Dmsg1(200, "Create Volume %s\n", mr.VolumeName);
       if (!db_create_media_record(ua->jcr, ua->db, &mr)) {
          ua->error_msg("%s", db_strerror(ua->db));
          return 1;
       }
-      if (i == startnum) {
-         first_id = mr.PoolId;
-      }
    }
    pr.NumVols += num;
    Dmsg0(200, "Update pool record.\n");
@@ -795,7 +789,6 @@ static int python_cmd(UAContext *ua, const char *cmd)
    return 1;
 }
 
-
 /*
  * Set a new address in a Client resource. We do this only
  *  if the Console name is the same as the Client name
@@ -1190,7 +1183,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
    JCR *jcr = ua->jcr;
    int accurate=-1;
 
-   jcr->set_JobLevel(L_FULL);
+   jcr->setJobLevel(L_FULL);
    for (int i=1; i<ua->argc; i++) {
       if (strcasecmp(ua->argk[i], NT_("client")) == 0 ||
           strcasecmp(ua->argk[i], NT_("fd")) == 0) {
@@ -1303,7 +1296,8 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
    }
 
    jcr->job = job;
-   jcr->set_JobType(JT_BACKUP);
+   jcr->setJobType(JT_BACKUP);
+   jcr->start_time = time(NULL);
    init_jcr_job_record(jcr);
 
    if (!get_or_create_client_record(jcr)) {
@@ -1322,16 +1316,6 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       return 1;
    }
 
-   if (!send_include_list(jcr)) {
-      ua->error_msg(_("Error sending include list.\n"));
-      goto bail_out;
-   }
-
-   if (!send_exclude_list(jcr)) {
-      ua->error_msg(_("Error sending exclude list.\n"));
-      goto bail_out;
-   }
-
    /* The level string change if accurate mode is enabled */
    if (accurate >= 0) {
       jcr->accurate = accurate;
@@ -1343,6 +1327,16 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       goto bail_out;
    }
 
+   if (!send_include_list(jcr)) {
+      ua->error_msg(_("Error sending include list.\n"));
+      goto bail_out;
+   }
+
+   if (!send_exclude_list(jcr)) {
+      ua->error_msg(_("Error sending exclude list.\n"));
+      goto bail_out;
+   }
+
    /*
     * If the job is in accurate mode, we send the list of
     * all files to FD.