* Version $Id$
*/
/*
- Copyright (C) 2000-2006 Kern Sibbald
+ Bacula® - The Network Backup Solution
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as amended with additional clauses defined in the
- file LICENSE in the main source directory.
+ Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- the file LICENSE for additional details.
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
- */
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
#include "bacula.h"
#include "dird.h"
}
/* If there is a write storage use it */
- if (jcr->wstorage) {
- store = (STORE *)jcr->wstorage->first();
+ if (jcr->wstore) {
+ store = jcr->wstore;
} else {
- store = (STORE *)jcr->rstorage->first();
+ store = jcr->rstore;
}
/*
return 0;
}
- pm_strcpy(pool_type, jcr->pool->pool_type);
- pm_strcpy(pool_name, jcr->pool->hdr.name);
- bash_spaces(pool_type);
- bash_spaces(pool_name);
-
/*
* We have two loops here. The first comes from the
* Storage = associated with the Job, and we need
*/
/* Do read side of storage daemon */
if (ok && rstore) {
+ /* For the moment, only migrate has rpool */
+ if (jcr->JobType == JT_MIGRATE) {
+ pm_strcpy(pool_type, jcr->rpool->pool_type);
+ pm_strcpy(pool_name, jcr->rpool->name());
+ } else {
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->name());
+ }
+ bash_spaces(pool_type);
+ bash_spaces(pool_name);
foreach_alist(storage, rstore) {
- pm_strcpy(store_name, storage->hdr.name);
+ Dmsg1(100, "Rstore=%s\n", storage->name());
bash_spaces(store_name);
pm_strcpy(media_type, storage->media_type);
bash_spaces(media_type);
bnet_fsend(sd, use_storage, store_name.c_str(), media_type.c_str(),
pool_name.c_str(), pool_type.c_str(), 0, copy, stripe);
-
+ Dmsg1(100, "rstore >stored: %s", sd->msg);
DEVICE *dev;
/* Loop over alternative storage Devices until one is OK */
foreach_alist(dev, storage->device) {
/* Do write side of storage daemon */
if (ok && wstore) {
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->name());
+ bash_spaces(pool_type);
+ bash_spaces(pool_name);
foreach_alist(storage, wstore) {
- pm_strcpy(store_name, storage->hdr.name);
+ pm_strcpy(store_name, storage->name());
bash_spaces(store_name);
pm_strcpy(media_type, storage->media_type);
bash_spaces(media_type);
bnet_fsend(sd, use_storage, store_name.c_str(), media_type.c_str(),
pool_name.c_str(), pool_type.c_str(), 1, copy, stripe);
+ Dmsg1(100, "wstore >stored: %s", sd->msg);
DEVICE *dev;
/* Loop over alternative storage Devices until one is OK */
foreach_alist(dev, storage->device) {
* Start a thread to handle Storage daemon messages and
* Catalog requests.
*/
-int start_storage_daemon_message_thread(JCR *jcr)
+bool start_storage_daemon_message_thread(JCR *jcr)
{
int status;
pthread_t thid;
/* Wait for thread to start */
while (jcr->SD_msg_chan == 0) {
bmicrosleep(0, 50);
+ if (job_canceled(jcr) || jcr->sd_msg_thread_done) {
+ return false;
+ }
}
Dmsg1(100, "SD msg_thread started. use=%d\n", jcr->use_count());
- return 1;
+ return true;
}
extern "C" void msg_thread_cleanup(void *arg)