]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #8448 About 'show job' command not showing StoragePolicy
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Wed, 8 Dec 2021 11:18:39 +0000 (12:18 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:56 +0000 (13:56 +0200)
bacula/src/dird/dird_conf.c

index b88915f2edd5ddbb4e966bca763ebc65c97e1ca7..3cc500855779a51cbabaa38d873b62bb0c8ff133 100644 (file)
@@ -911,6 +911,26 @@ char *level_to_str(char *buf, int len, int level)
    return buf;
 }
 
+/* Dump Storage Group (it's policy and group items) */
+void dump_storage_group(alist *list, const char *policy,
+      void sendit(void *sock, const char *fmt, ...), void *sock)
+{
+   if (list->size() == 0) {
+      return;
+   }
+
+   /* Policy can be specified explicitly, the default one is used otherwise */
+   const char *p = policy ? policy : StorageManager::get_default_policy();
+
+   sendit(sock, _("  --> StoragePolicy=%s StorageGroupSize=%d\n"), p, list->size());
+
+   STORE *store;
+   foreach_alist(store, list) {
+      sendit(sock, _("    --> "));
+      dump_resource(-R_STORAGE, (RES *)store, sendit, sock);
+   }
+}
+
 /* Dump contents of resource */
 void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
@@ -1167,11 +1187,7 @@ void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt,
          sendit(sock, _("  --> MaxRunSchedTime=%u\n"), res->res_job.MaxRunSchedTime);
       }
       if (res->res_job.storage) {
-         STORE *store;
-         foreach_alist(store, res->res_job.storage) {
-            sendit(sock, _("  --> "));
-            dump_resource(-R_STORAGE, (RES *)store, sendit, sock);
-         }
+         dump_storage_group(res->res_pool.storage, res->res_pool.storage_policy, sendit, sock);
       }
       if (res->res_job.base) {
          JOB *job;
@@ -1477,11 +1493,7 @@ next_run:
          sendit(sock, _("      Catalog=%s\n"), res->res_pool.catalog->name());
       }
       if (res->res_pool.storage) {
-         STORE *store;
-         foreach_alist(store, res->res_pool.storage) {
-            sendit(sock, _("  --> "));
-            dump_resource(-R_STORAGE, (RES *)store, sendit, sock);
-         }
+         dump_storage_group(res->res_pool.storage, res->res_pool.storage_policy, sendit, sock);
       }
       if (res->res_pool.CopyPool) {
          POOL *copy;