]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Fix bconsole bug with new BNET signals
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index 846f910552d20a971a10610b5956a95ce59f58b2..8f99ee8b934b92342e3ef93fb087387f16e0aa6b 100644 (file)
@@ -127,7 +127,7 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("disable"),    disable_cmd,   _("Disable a job"), NT_("job=<name>"),        true},
  { NT_("enable"),     enable_cmd,    _("Enable a job"), NT_("job=<name>"),          true},
  { NT_("estimate"),   estimate_cmd,  _("Performs FileSet estimate, listing gives full listing"), 
-   NT_("fileset=<fs> client=<cli> accurate=<yes/no> job=<job> listing"), true},
+   NT_("fileset=<fs> client=<cli> level=<level> accurate=<yes/no> job=<job> listing"), true},
 
  { NT_("exit"),       quit_cmd,      _("Terminate Bconsole session"), NT_(""),         false},
  { NT_("gui"),        gui_cmd,       _("Non-interactive gui mode"),   NT_("on | off"), false},
@@ -1342,8 +1342,8 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
 
 bail_out:
    if (jcr->file_bsock) {
-      bnet_sig(jcr->file_bsock, BNET_TERMINATE);
-      bnet_close(jcr->file_bsock);
+      jcr->file_bsock->signal(BNET_TERMINATE);
+      jcr->file_bsock->close();
       jcr->file_bsock = NULL;
    }
    return 1;
@@ -1955,6 +1955,22 @@ static int version_cmd(UAContext *ua, const char *cmd)
 }
 #endif
 
+/* 
+ * This call uses open_client_db() and force a
+ * new dedicated connection to the catalog
+ */
+bool open_new_client_db(UAContext *ua)
+{   
+   bool ret;
+
+   /* Force a new dedicated connection */
+   close_db(ua);
+   ua->force_mult_db_connections = true;
+   ret = open_client_db(ua);
+   ua->force_mult_db_connections = false;
+   return ret;
+}
+
 /* 
  * This call explicitly checks for a catalog=xxx and
  *  if given, opens that catalog.  It also checks for
@@ -2040,6 +2056,8 @@ bool open_client_db(UAContext *ua)
  */
 bool open_db(UAContext *ua)
 {
+   bool mult_db_conn;
+
    if (ua->db) {
       return true;
    }
@@ -2051,6 +2069,12 @@ bool open_db(UAContext *ua)
       }
    }
 
+   /* Some modules like bvfs need their own catalog connection */
+   mult_db_conn = ua->catalog->mult_db_connections;
+   if (ua->force_mult_db_connections) {
+      mult_db_conn = true;
+   }
+
    ua->jcr->catalog = ua->catalog;
 
    Dmsg0(100, "UA Open database\n");
@@ -2058,7 +2082,7 @@ bool open_db(UAContext *ua)
                              ua->catalog->db_user,
                              ua->catalog->db_password, ua->catalog->db_address,
                              ua->catalog->db_port, ua->catalog->db_socket,
-                             ua->catalog->mult_db_connections);
+                             mult_db_conn);
    if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
       ua->error_msg(_("Could not open catalog database \"%s\".\n"),
                  ua->catalog->db_name);