]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
command ".status dedupengines [dedupengine=XXXX]" mimic .device command
authorAlain Spineux <alain@baculasystems.com>
Tue, 25 Jan 2022 16:59:59 +0000 (17:59 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:57 +0000 (13:56 +0200)
bacula/src/dird/ua_status.c
bacula/src/stored/dedup_interface.h
bacula/src/stored/org_stored_dedup.c
bacula/src/stored/status.c

index 1209db07d3484f17aa8b81932d2a5e00d9613ff5..295dd7ca4d66741b5090bfc4ea51c268c1da05a6 100644 (file)
@@ -607,7 +607,7 @@ static void do_storage_status(UAContext *ua, STORE *store, char *cmd)
             sd->fsend(".status %s api=%d api_opts=%s",
                    cmd, ua->api, ua->api_opts);
          }
-      } else {
+      } else if (strcasecmp(cmd, "devices") == 0) {
          i = find_arg_with_value(ua, "device");
          if (i>0) {
             Mmsg(devname, "device=%s", ua->argv[i]);
@@ -615,6 +615,17 @@ static void do_storage_status(UAContext *ua, STORE *store, char *cmd)
          }
          sd->fsend(".status %s api=%d api_opts=%s %s",
                    cmd, ua->api, ua->api_opts, devname.c_str());
+      } else if (strcasecmp(cmd, "dedupengines") == 0) {
+         i = find_arg_with_value(ua, "dedupengine");
+         if (i>0) {
+            Mmsg(devname, "dedupengine=%s", ua->argv[i]);
+            bash_spaces(devname.c_str());
+         }
+         sd->fsend(".status %s api=%d api_opts=%s %s",
+                   cmd, ua->api, ua->api_opts, devname.c_str());
+      } else {
+         sd->fsend(".status %s api=%d api_opts=%s",
+                   cmd, ua->api, ua->api_opts);
       }
    } else {
       sd->fsend("status");
index 71831eacf12c50598bee9575b20c9d402b4c21ad..b48d9f41dc891143a8653962d45f173610334941 100644 (file)
@@ -22,7 +22,7 @@
 
 bool is_dedup_server_side(DEVICE *dev, int32_t stream, uint64_t stream_len);
 bool is_dedup_ref(DEV_RECORD *rec, bool lazy);
-void list_dedupengines(char *cmd, STATUS_PKT *sp);
+void list_dedupengines(char *cmd, STATUS_PKT *sp, const char *target);
 void dedup_get_limits(int64_t *nofile, int64_t *memlock);
 bool dedup_parse_filter(char *fltr);
 void dedup_filter_record(int verbose, DCR *dcr, DEV_RECORD *rec, char *dedup_msg, int len);
index ee4a0d2dcc46b4f2c842bf955a5bc21f8f58a4a4..9c9311e35dff3479a7b0f6c34100cc5c90ed7f8a 100644 (file)
@@ -36,7 +36,7 @@ void dedup_get_limits(int64_t *nofile, int64_t *memlock)
 }
 
 /* dump the status of all dedupengines */
-void list_dedupengines(char *cmd, STATUS_PKT *sp)
+void list_dedupengines(char *cmd, STATUS_PKT *sp, const char *target)
 {
 }
 
index 1925887ddb13ce73b7dd0ef0427884272af28141..0834c45b4a63164fdaf12232514529e0da667098 100644 (file)
@@ -1162,6 +1162,7 @@ bool qstatus_cmd(JCR *jcr)
    char *cmd;
    char *device=NULL;
    char *collname=NULL;
+   char *dedupengine=NULL;
    int api = true;
 
    sp.bs = dir;
@@ -1198,6 +1199,10 @@ bool qstatus_cmd(JCR *jcr)
       } else if (!strcmp(argk[i], "api_opts") && argv[i]) {
          bstrncpy(sp.api_opts, argv[i], sizeof(sp.api_opts));
       }
+      else if (!strcmp(argk[i], "dedupengine") && argv[i]) {
+         dedupengine = argv[i];
+         unbash_spaces(dedupengine);
+      }
    }
 
    Dmsg1(100, "cmd=%s\n", cmd);
@@ -1241,10 +1246,10 @@ bool qstatus_cmd(JCR *jcr)
        sp.api = api;
        show_config(&sp);
    /* ***BEEF*** */
-   } else if (strcasecmp(cmd, "dedupengine") == 0 ||
+   } else if (strcasecmp(cmd, "dedupengines") == 0 ||
               strcasecmp(cmd, "dedupengineandzerostats") == 0) {
       sp.api = api;
-      list_dedupengines(cmd, &sp);
+      list_dedupengines(cmd, &sp, dedupengine);
    } else if (strcasecmp(cmd, "shstore") == 0) {
       list_shared_storage(&sp, dir->msg);
    } else if (strcasecmp(cmd, "cloud") == 0) {