]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_status.c
ebl tweak tab/space
[bacula/bacula] / bacula / src / dird / ua_status.c
index 92b3eba8537ad546c51d2f3b44b07a409ce47b3e..bb49e4e2a2e4db8cb40a57b9275546c56270bcb4 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -47,6 +47,7 @@ static void do_storage_status(UAContext *ua, STORE *store, char *cmd);
 static void do_client_status(UAContext *ua, CLIENT *client, char *cmd);
 static void do_director_status(UAContext *ua);
 static void do_all_status(UAContext *ua);
+void status_slots(UAContext *ua, STORE *store);
 
 static char OKqstatus[]   = "1000 OK .status\n";
 static char DotStatusJob[] = "JobId=%s JobStatus=%c JobErrors=%d\n";
@@ -157,7 +158,11 @@ int status_cmd(UAContext *ua, const char *cmd)
       } else {
          store = get_storage_resource(ua, false/*no default*/);
          if (store) {
-            do_storage_status(ua, store, NULL);
+            if (find_arg(ua, NT_("slots")) > 0) {
+               status_slots(ua, store);
+            } else {
+               do_storage_status(ua, store, NULL);
+            }
          }
          return 1;
       }
@@ -432,7 +437,9 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp)
    bool close_db = false;
    JCR *jcr = ua->jcr;
    MEDIA_DBR mr;
+   int orig_jobtype;
 
+   orig_jobtype = jcr->get_JobType();
    memset(&mr, 0, sizeof(mr));
    if (sp->job->JobType == JT_BACKUP) {
       jcr->db = NULL;
@@ -475,6 +482,7 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp)
       db_close_database(jcr, jcr->db);
    }
    jcr->db = ua->db;                  /* restore ua db to jcr */
+   jcr->set_JobType(orig_jobtype);
 }
 
 /*
@@ -519,7 +527,7 @@ static void list_scheduled_jobs(UAContext *ua)
    i = find_arg_with_value(ua, NT_("days"));
    if (i >= 0) {
      days = atoi(ua->argv[i]);
-     if ((days < 0) || (days > 500) && !ua->api) {
+     if (((days < 0) || (days > 500)) && !ua->api) {
        ua->send_msg(_("Ignoring invalid value for days. Max is 500.\n"));
        days = 1;
      }
@@ -586,7 +594,7 @@ static void list_running_jobs(UAContext *ua)
          /* this is a console or other control job. We only show console
           * jobs in the status output.
           */
-         if (jcr->JobType == JT_CONSOLE && !ua->api) {
+         if (jcr->get_JobType() == JT_CONSOLE && !ua->api) {
             bstrftime_nc(dt, sizeof(dt), jcr->start_time);
             ua->send_msg(_("Console connected at %s\n"), dt);
          }
@@ -744,13 +752,13 @@ static void list_running_jobs(UAContext *ua)
          msg = _("Dir inserting Attributes");
          break;
       }
-      switch (jcr->JobType) {
+      switch (jcr->get_JobType()) {
       case JT_ADMIN:
       case JT_RESTORE:
          bstrncpy(level, "      ", sizeof(level));
          break;
       default:
-         bstrncpy(level, level_to_str(jcr->JobLevel), sizeof(level));
+         bstrncpy(level, level_to_str(jcr->get_JobLevel()), sizeof(level));
          level[7] = 0;
          break;
       }