]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/msgchan.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / dird / msgchan.c
index 9733f0f6ebc411b20c4c5f4c6c5726cde8f7872a..0df166b27d395b97acd3f2ee367f233537d1292c 100644 (file)
@@ -16,7 +16,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2004 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -64,10 +64,9 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
                              int max_retry_time, int verbose)
 {
    BSOCK *sd;
-   STORE *store = jcr->store;
-   if (!store) {
-      jcr->store = store = (STORE *)jcr->storage[0]->first();
-   }
+   STORE *store;
+
+   store = (STORE *)jcr->storage[0]->first();
 
    /*
     *  Open message channel with the Storage daemon   
@@ -94,13 +93,13 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
  */
 int start_storage_daemon_job(JCR *jcr)
 {
-   int status;
+   int status = 0;
    STORE *storage;
    BSOCK *sd;
    char auth_key[100];
    POOL_MEM device_name, pool_name, pool_type, media_type;
+   int i;
 
-   storage = jcr->store;
    sd = jcr->store_bsock;
    /*
     * Now send JobId and permissions, and get back the authorization key.
@@ -139,23 +138,29 @@ int start_storage_daemon_job(JCR *jcr)
    /*
     * Send use device = xxx media = yyy pool = zzz
     */
-   pm_strcpy(device_name, storage->dev_name);
-   pm_strcpy(media_type, storage->media_type);
-   pm_strcpy(pool_type, jcr->pool->pool_type);
-   pm_strcpy(pool_name, jcr->pool->hdr.name);
-   bash_spaces(device_name);
-   bash_spaces(media_type);
-   bash_spaces(pool_type);
-   bash_spaces(pool_name);
-   bnet_fsend(sd, use_device, device_name.c_str(), 
-             media_type.c_str(), pool_name.c_str(), pool_type.c_str());
-   Dmsg1(110, ">stored: %s", sd->msg);
-   status = response(jcr, sd, OK_device, "Use Device", NO_DISPLAY);
-   if (!status) {
-      pm_strcpy(pool_type, sd->msg); /* save message */
-      Jmsg(jcr, M_FATAL, 0, _("\n"
-         "     Storage daemon didn't accept Device \"%s\" because:\n     %s"),
-        device_name.c_str(), pool_type.c_str()/* sd->msg */);
+
+   for (i=0; i < MAX_STORE; i++) {
+      if (jcr->storage[i]) {
+        storage = (STORE *)jcr->storage[i]->first();
+        pm_strcpy(device_name, storage->dev_name);
+        pm_strcpy(media_type, storage->media_type);
+        pm_strcpy(pool_type, jcr->pool->pool_type);
+        pm_strcpy(pool_name, jcr->pool->hdr.name);
+        bash_spaces(device_name);
+        bash_spaces(media_type);
+        bash_spaces(pool_type);
+        bash_spaces(pool_name);
+        bnet_fsend(sd, use_device, device_name.c_str(), 
+                   media_type.c_str(), pool_name.c_str(), pool_type.c_str());
+         Dmsg1(110, ">stored: %s", sd->msg);
+         status = response(jcr, sd, OK_device, "Use Device", NO_DISPLAY);
+        if (!status) {
+           pm_strcpy(pool_type, sd->msg); /* save message */
+            Jmsg(jcr, M_FATAL, 0, _("\n"
+               "     Storage daemon didn't accept Device \"%s\" because:\n     %s"),
+              device_name.c_str(), pool_type.c_str()/* sd->msg */);
+        }
+      }
    }
    return status;
 }