|
From: <gi...@ba...> - 2012-12-27 12:23:42
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Bacula Community source".
The branch, Branch-5.2 has been updated
via 6decfe0792db538aa18cb07b2d06aba075e08bf5 (commit)
via 15dd146883982ef008afb932b4542b07aa7db618 (commit)
via a61a17b5d8a214fac8f6b5088e9a9fb7fb9e1410 (commit)
via b3d8733914c17446badbe376e8db9b964f24638d (commit)
via 25b659f37f9e83811b978fdb9e45b25bdfa1baa4 (commit)
via 0634ee7e2e87914cddc00a6b1cc3bde5b77df14d (commit)
via 5956e855931e223a0fac7bcd2503c9a599191615 (commit)
via b7adb6f581ff685f3b4b0479bb2831fadd50f846 (commit)
via b73b8e1c4a0f7ccbc3a4e4c008a0bf682830096d (commit)
via e9d4bc41410358c97e34df75bbefecaf4d46ae1c (commit)
via ae53ecd71437329e0013e3203964d5f35fcbb3a8 (commit)
via 23ac0e0b1a7f083fb0aa8a48a6c70191f21597d1 (commit)
via 0dbce460e3667a0466aa2f63fbafbc8420ce8d8b (commit)
via ab85e8592f4efaaa716b0bbcac78d27159246749 (commit)
via e892f9d7dd000a0014ba601bc85ba080ed073fd9 (commit)
via ec8593ea7712a8afd283572150b298f43160293a (commit)
via 777aa46cb6b6294b644d46f1e4eea8c1ab997c29 (commit)
via 9220a2db776e1bda2862e88064b5334c046dd2d1 (commit)
via 4825219cbdb16e2ea9b8fe92015ecd5b5e137606 (commit)
via 66198c5a5466fd80c66444e199ba278462e23842 (commit)
via f446b44dd58d03ed6afe310546f80997c2f730f3 (commit)
via ad6a38d279ecdf76fa17a195ced9aa5606e409ab (commit)
via fbe2e75bf7e9ae83cf3225408c90a350a2f9a8ca (commit)
via f2f0826cf4a6982011d3926022c70cc09ef61511 (commit)
via 82d1b54e914265c035ef183eaff3a8c554e515eb (commit)
via b170fa34cf6ef27a51e89aa2653f0d3052c84f92 (commit)
via c071d93656cd4274574b0574ea64d7392c9fa482 (commit)
via d222f68a580d9f0b7d68bc21b191c0d26f850e2f (commit)
via e1ef4d351ee09d2af3a997dac95d167884acf29c (commit)
via ce21363784390cd239f9d7c9d649e8382c80e814 (commit)
via 7d9a744e262da77ff4467ae178836d265cb7bc96 (commit)
from c608db5f8744172170b3af974551de9d4e54619e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6decfe0792db538aa18cb07b2d06aba075e08bf5
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 27 10:11:23 2012 +0100
Make compile of timelimit a bit more portable
commit 15dd146883982ef008afb932b4542b07aa7db618
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 27 08:38:21 2012 +0100
Tweak tests to work with timelimit
commit a61a17b5d8a214fac8f6b5088e9a9fb7fb9e1410
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 17:19:10 2012 +0100
Tweak remove non-existant test
commit b3d8733914c17446badbe376e8db9b964f24638d
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 17:15:32 2012 +0100
Fix typo in all-disk-tests
commit 25b659f37f9e83811b978fdb9e45b25bdfa1baa4
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 16:35:42 2012 +0100
Tweak regress run
commit 0634ee7e2e87914cddc00a6b1cc3bde5b77df14d
Author: Kern Sibbald <ke...@si...>
Date: Fri Nov 2 23:14:32 2012 +0100
Reduce wait time in regression RunScripts
commit 5956e855931e223a0fac7bcd2503c9a599191615
Author: Kern Sibbald <ke...@si...>
Date: Fri Nov 2 23:13:20 2012 +0100
Attempt to indicate timed out tests
commit b7adb6f581ff685f3b4b0479bb2831fadd50f846
Author: Kern Sibbald <ke...@si...>
Date: Fri Nov 2 10:43:25 2012 +0100
Implement a timeout on regression tests of 15 minutes
Conflicts:
bacula/src/tools/Makefile.in
regress/all-changer-tests
regress/all-dev-tests
regress/all-disk-tests
commit b73b8e1c4a0f7ccbc3a4e4c008a0bf682830096d
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 15:04:49 2012 +0100
Tweek turn off prune-test
commit e9d4bc41410358c97e34df75bbefecaf4d46ae1c
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 11:42:12 2012 +0100
Pull src/lib changes from master
commit ae53ecd71437329e0013e3203964d5f35fcbb3a8
Author: Kern Sibbald <ke...@si...>
Date: Wed Dec 26 10:10:26 2012 +0100
Pull SD files from master
commit 23ac0e0b1a7f083fb0aa8a48a6c70191f21597d1
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 23:48:03 2012 +0100
Turn off prune-test
commit 0dbce460e3667a0466aa2f63fbafbc8420ce8d8b
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 23:47:37 2012 +0100
Add logdir and bsrdir to regression config
commit ab85e8592f4efaaa716b0bbcac78d27159246749
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 17:40:51 2012 +0100
Add bsrdir and logdir to regress-config
commit e892f9d7dd000a0014ba601bc85ba080ed073fd9
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 17:37:44 2012 +0100
Rebuild configure
commit ec8593ea7712a8afd283572150b298f43160293a
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 17:37:16 2012 +0100
Changed default directories from /var/bacula to /opt/bacula
commit 777aa46cb6b6294b644d46f1e4eea8c1ab997c29
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 17:29:26 2012 +0100
Fix patches from master
commit 9220a2db776e1bda2862e88064b5334c046dd2d1
Author: Kern Sibbald <ke...@si...>
Date: Fri Dec 7 10:06:23 2012 +0100
Fix Virtual Full file close bug -- race condition
commit 4825219cbdb16e2ea9b8fe92015ecd5b5e137606
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 14:48:28 2012 +0100
Make spool size max message more explicit
commit 66198c5a5466fd80c66444e199ba278462e23842
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 25 14:08:04 2012 +0100
Display more info when maximum spool size is reached
commit f446b44dd58d03ed6afe310546f80997c2f730f3
Author: Kern Sibbald <ke...@si...>
Date: Sun Dec 23 16:18:49 2012 +0100
Fix TERM defs for Solaris 11 in conio.c
commit ad6a38d279ecdf76fa17a195ced9aa5606e409ab
Author: Kern Sibbald <ke...@si...>
Date: Fri Dec 14 20:44:46 2012 +0100
Allow group to cd to sysconfdir
commit fbe2e75bf7e9ae83cf3225408c90a350a2f9a8ca
Author: Kern Sibbald <ke...@si...>
Date: Sun Dec 9 16:59:13 2012 +0100
Make sysconfdir belong to Bacula user/group and exclude others
commit f2f0826cf4a6982011d3926022c70cc09ef61511
Author: Kern Sibbald <ke...@si...>
Date: Fri Dec 7 15:50:21 2012 +0100
Enhance mount message to include read/append
commit 82d1b54e914265c035ef183eaff3a8c554e515eb
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 6 12:37:16 2012 +0100
Improve vol_mgr swap messages
commit b170fa34cf6ef27a51e89aa2653f0d3052c84f92
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 6 12:36:20 2012 +0100
Add Jmsg7 and Jmsg8
commit c071d93656cd4274574b0574ea64d7392c9fa482
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 6 10:20:57 2012 +0100
Tweak update copyright date
commit d222f68a580d9f0b7d68bc21b191c0d26f850e2f
Author: Kern Sibbald <ke...@si...>
Date: Thu Dec 6 10:19:38 2012 +0100
Enhance output of Using Device to include for read/write
commit e1ef4d351ee09d2af3a997dac95d167884acf29c
Author: Kern Sibbald <ke...@si...>
Date: Tue Dec 4 12:11:04 2012 +0100
Add jobid to Pmsg output
commit ce21363784390cd239f9d7c9d649e8382c80e814
Author: Kern Sibbald <ke...@si...>
Date: Sat Nov 24 10:48:42 2012 +0100
Tweak fix comment typo
commit 7d9a744e262da77ff4467ae178836d265cb7bc96
Author: Eric Bollengier <er...@ba...>
Date: Fri Nov 23 17:30:15 2012 +0100
Add workaround for #5507 where autoprune and reload are in deadlock
-----------------------------------------------------------------------
Summary of changes:
diff --git a/bacula/Makefile.in b/bacula/Makefile.in
index 1abc14a..5483fe3 100755
--- a/bacula/Makefile.in
+++ b/bacula/Makefile.in
@@ -94,6 +94,13 @@ libtool: Makefile $(LIBTOOL_DEPS)
installdirs:
$(MKDIR) $(DESTDIR)$(sbindir)
$(MKDIR) $(DESTDIR)$(sysconfdir)
+ chmod 770 $(DESTDIR)$(sysconfdir)
+ -if test "x$(dir_user)" != "x" ; then \
+ chown $(dir_user) $(DESTDIR)$(sysconfdir); \
+ fi
+ -if test "x$(dir_group)" != "x" ; then \
+ chgrp $(dir_group) $(DESTDIR)$(sysconfdir); \
+ fi
$(MKDIR) $(DESTDIR)$(scriptdir)
$(MKDIR) $(DESTDIR)$(docdir)
$(MKDIR) $(DESTDIR)$(archivedir)
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index de09194..f802b43 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -1216,7 +1216,7 @@ AC_SEARCH_LIBS(dlopen, [dl])
dnl ------------------------------------------
dnl Where to place working dir
dnl ------------------------------------------
-working_dir=`eval echo ${prefix}/var/bacula/working`
+working_dir=`eval echo ${prefix}/opt/bacula/working`
AC_ARG_WITH(working-dir,
AC_HELP_STRING([--with-working-dir=PATH], [specify path of Bacula working directory]),
[
@@ -1301,7 +1301,7 @@ AC_SUBST(scriptdir)
dnl ------------------------------------------
dnl Where to place bsrdir (bsr files)
dnl ------------------------------------------
-bsrdir=`eval echo ${prefix}/var/bacula/working`
+bsrdir=`eval echo ${prefix}/opt/bacula/bsr`
AC_ARG_WITH(bsrdir,
AC_HELP_STRING([--with-bsrdir=PATH], [specify path of Bacula bsrs directory]),
[
@@ -1316,7 +1316,7 @@ AC_SUBST(bsrdir)
dnl ------------------------------------------
dnl Where to place logdir (bsr files)
dnl ------------------------------------------
-logdir=`eval echo ${prefix}/var/bacula/working`
+logdir=`eval echo ${prefix}/opt/bacula/log`
AC_ARG_WITH(logdir,
AC_HELP_STRING([--with-logdir=PATH], [specify path of Bacula logs directory]),
[
diff --git a/bacula/configure b/bacula/configure
index 9b14d32..610bf99 100755
--- a/bacula/configure
+++ b/bacula/configure
@@ -23486,7 +23486,7 @@ if test "$ac_res" != no; then :
fi
-working_dir=`eval echo ${prefix}/var/bacula/working`
+working_dir=`eval echo ${prefix}/opt/bacula/working`
# Check whether --with-working-dir was given.
if test "${with_working_dir+set}" = set; then :
@@ -23570,7 +23570,7 @@ fi
-bsrdir=`eval echo ${prefix}/var/bacula/working`
+bsrdir=`eval echo ${prefix}/opt/bacula/bsr`
# Check whether --with-bsrdir was given.
if test "${with_bsrdir+set}" = set; then :
@@ -23585,7 +23585,7 @@ fi
-logdir=`eval echo ${prefix}/var/bacula/working`
+logdir=`eval echo ${prefix}/opt/bacula/log`
# Check whether --with-logdir was given.
if test "${with_logdir+set}" = set; then :
diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h
index 38b6a11..6a7a69c 100644
--- a/bacula/src/baconfig.h
+++ b/bacula/src/baconfig.h
@@ -415,6 +415,8 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num);
#define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
#define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
#define Jmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
+#define Jmsg7(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
+#define Jmsg8(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
/** Queued Job Error Messages that are delivered according to the message resource */
#define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
diff --git a/bacula/src/console/conio.c b/bacula/src/console/conio.c
index 8a6ffd4..1b39d29 100755
--- a/bacula/src/console/conio.c
+++ b/bacula/src/console/conio.c
@@ -1,7 +1,7 @@
/*
Bacula® - The Network Backup Solution
- Copyright (C) 1981-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 1981-2012 Free Software Foundation Europe e.V.
Yes, that is 1981 no error.
The main author of Bacula is Kern Sibbald, with contributions from
@@ -54,6 +54,7 @@
#include <signal.h>
#include <string.h>
#include <ctype.h>
+#define HAVE_CONIO 1
#else
/* We are in Bacula */
@@ -61,6 +62,8 @@
#endif
+#ifdef HAVE_CONIO
+
#include <curses.h>
#include <term.h>
@@ -69,8 +72,10 @@
extern "C" int tgetent(void *, const char *);
extern "C" int tgetnum(const char *);
extern "C" char *tgetstr (const char*, char**);
-#endif
+# Note: the following on older (Solaris 10) systems
+# may need to be moved to after the #endif
extern "C" char *tgoto (const char *, int, int);
+#endif
#elif defined(__sgi)
extern "C" int tgetent(char *, char *);
extern "C" int tgetnum(char id[2]);
@@ -1189,3 +1194,5 @@ static void asdell()
{
t_send(t_dl);
}
+
+#endif
diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c
index 4596d98..147ab3f 100644
--- a/bacula/src/dird/dird.c
+++ b/bacula/src/dird/dird.c
@@ -564,7 +564,7 @@ void reload_config(int sig)
Jmsg(NULL, M_ERROR, 0, _("Resetting previous configuration.\n"));
}
reload_table[rtable].res_table = config->save_resources();
- /* Now restore old resoure values */
+ /* Now restore old resource values */
int num = r_last - r_first + 1;
RES **res_tab = reload_table[table].res_table;
for (int i=0; i<num; i++) {
diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c
index 1e7cfc7..686f0c7 100644
--- a/bacula/src/dird/msgchan.c
+++ b/bacula/src/dird/msgchan.c
@@ -269,6 +269,9 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_
} else {
ok = false;
}
+ if (ok) {
+ Jmsg(jcr, M_INFO, 0, _("Using Device \"%s\" to read.\n"), device_name.c_str());
+ }
}
/* Do write side of storage daemon */
@@ -304,6 +307,9 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_
} else {
ok = false;
}
+ if (ok) {
+ Jmsg(jcr, M_INFO, 0, _("Using Device \"%s\" to write.\n"), device_name.c_str());
+ }
}
if (!ok) {
POOL_MEM err_msg;
@@ -317,8 +323,6 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_
" Storage daemon didn't accept Device \"%s\" command.\n"),
device_name.c_str());
}
- } else {
- Jmsg(jcr, M_INFO, 0, _("Using Device \"%s\"\n"), device_name.c_str());
}
return ok;
}
diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c
index 68c747c..7380945 100644
--- a/bacula/src/dird/ua_prune.c
+++ b/bacula/src/dird/ua_prune.c
@@ -403,6 +403,9 @@ static int job_select_handler(void *ctx, int num_fields, char **row)
struct accurate_check_ctx *res;
ASSERT(num_fields == 6);
+ /* Quick fix for #5507, avoid locking res_head after db_lock() */
+
+#ifdef bug5507
/* If this job doesn't exist anymore in the configuration, delete it */
if (GetResWithName(R_JOB, row[0]) == NULL) {
return 0;
@@ -417,6 +420,7 @@ static int job_select_handler(void *ctx, int num_fields, char **row)
if (GetResWithName(R_CLIENT, row[2]) == NULL) {
return 0;
}
+#endif
/* Don't compute accurate things for Verify jobs */
if (*row[5] == 'V') {
@@ -526,7 +530,7 @@ int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType)
/* The job_select_handler will skip jobs or filesets that are no longer
* in the configuration file. Interesting ClientId/FileSetId will be
- * added to jobids_check
+ * added to jobids_check (currently disabled in 6.0.7b)
*/
if (!db_sql_query(ua->db, query.c_str(), job_select_handler, jobids_check)) {
ua->error_msg("%s", db_strerror(ua->db));
diff --git a/bacula/src/lib/crc32.c b/bacula/src/lib/crc32.c
index 847b140..ac2ff94 100644
--- a/bacula/src/lib/crc32.c
+++ b/bacula/src/lib/crc32.c
@@ -70,6 +70,12 @@ main()
#include "bacula.h"
+#ifdef HAVE_DARWIN_OS
+#if !defined(HAVE_LITTLE_ENDIAN) && !defined(HAVE_BIG_ENDIAN)
+#define HAVE_LITTLE_ENDIAN
+#endif
+#endif
+
#if !defined(HAVE_LITTLE_ENDIAN) && !defined(HAVE_BIG_ENDIAN)
#error Either HAVE_LITTLE_ENDIAN or HAVE_BIG_ENDIAN must be defined!
#endif
diff --git a/bacula/src/lib/devlock.c b/bacula/src/lib/devlock.c
index 99a1bc7..5b26545 100644
--- a/bacula/src/lib/devlock.c
+++ b/bacula/src/lib/devlock.c
@@ -57,14 +57,14 @@ devlock *new_devlock()
return lock;
}
-int devlock::init(int initial_priority)
+int devlock::init(int priority)
{
int stat;
devlock *rwl = this;
rwl->r_active = rwl->w_active = 0;
rwl->r_wait = rwl->w_wait = 0;
- rwl->priority = initial_priority;
+ rwl->priority = priority;
if ((stat = pthread_mutex_init(&rwl->mutex, NULL)) != 0) {
return stat;
}
diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c
index 82c5b4e..53f72c9 100644
--- a/bacula/src/lib/message.c
+++ b/bacula/src/lib/message.c
@@ -1139,13 +1139,15 @@ p_msg(const char *file, int line, int level, const char *fmt,...)
#ifdef FULL_LOCATION
if (level >= 0) {
- len = bsnprintf(buf, sizeof(buf), "%s: %s:%d ", my_name, get_basename(file), line);
+ len = bsnprintf(buf, sizeof(buf), "%s: %s:%d-%u ",
+ my_name, get_basename(file), line, get_jobid_from_tsd());
} else {
len = 0;
}
#else
- len = 0;
+ len = 0;
#endif
+
va_start(arg_ptr, fmt);
bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
va_end(arg_ptr);
diff --git a/bacula/src/lib/signal.c b/bacula/src/lib/signal.c
index 79f0333..548466c 100644
--- a/bacula/src/lib/signal.c
+++ b/bacula/src/lib/signal.c
@@ -1,7 +1,7 @@
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
@@ -133,6 +133,7 @@ static void dbg_print_bacula()
extern "C" void signal_handler(int sig)
{
static int already_dead = 0;
+ int chld_status=-1;
/* If we come back more than once, get out fast! */
if (already_dead) {
@@ -193,6 +194,13 @@ extern "C" void signal_handler(int sig)
strcpy((char *)working_directory, "/tmp/");
}
unlink("./core"); /* get rid of any old core file */
+
+#ifdef DEVELOPER /* When DEVELOPER not set, this is done below */
+ /* print information about the current state into working/<file>.bactrace */
+ dbg_print_bacula();
+#endif
+
+
sprintf(pid_buf, "%d", (int)main_pid);
Dmsg1(300, "Working=%s\n", working_directory);
Dmsg1(300, "btpath=%s\n", btpath);
@@ -226,13 +234,18 @@ extern "C" void signal_handler(int sig)
sigaction(sig, &sigdefault, NULL);
if (pid > 0) {
Dmsg0(500, "Doing waitpid\n");
- waitpid(pid, NULL, 0); /* wait for child to produce dump */
+ waitpid(pid, &chld_status, 0); /* wait for child to produce dump */
Dmsg0(500, "Done waitpid\n");
} else {
Dmsg0(500, "Doing sleep\n");
bmicrosleep(30, 0);
}
- fprintf(stderr, _("It looks like the traceback worked ...\n"));
+ if (WEXITSTATUS(chld_status) == 0) {
+ fprintf(stderr, _("It looks like the traceback worked...\n"));
+ } else {
+ fprintf(stderr, _("The btraceback call returned %d\n"),
+ WEXITSTATUS(chld_status));
+ }
/* If we want it printed, do so */
#ifdef direct_print
if (prt_kaboom) {
@@ -256,8 +269,12 @@ extern "C" void signal_handler(int sig)
fprintf(stderr, " ==== End traceback output ====\n\n");
}
#endif
+
+#ifndef DEVELOPER /* When DEVELOPER set, this is done above */
/* print information about the current state into working/<file>.bactrace */
dbg_print_bacula();
+#endif
+
}
#endif
exit_handler(sig);
diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c
index a5ac547..9a89927 100644
--- a/bacula/src/stored/askdir.c
+++ b/bacula/src/stored/askdir.c
@@ -36,6 +36,8 @@
#include "bacula.h" /* pull in global headers */
#include "stored.h" /* pull in Storage Deamon headers */
+static const int dbglvl = 200;
+
/* Requests sent to the Director */
static char Find_media[] = "CatReq Job=%s FindMedia=%d pool_name=%s media_type=%s\n";
static char Get_Vol_Info[] = "CatReq Job=%s GetVolInfo VolName=%s write=%d\n";
@@ -106,7 +108,7 @@ bool dir_update_device(JCR *jcr, DEVICE *dev)
dev->is_tape()?100000:1,
dev->autoselect, 0,
ChangerName.c_str(), MediaType.c_str(), VolumeName.c_str());
- Dmsg1(100, ">dird: %s\n", dir->msg);
+ Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
return ok;
}
@@ -135,7 +137,7 @@ bool dir_update_changer(JCR *jcr, AUTOCHANGER *changer)
"*", /* ChangerName */
MediaType.c_str(), /* MediaType */
"*"); /* VolName */
- Dmsg1(100, ">dird: %s\n", dir->msg);
+ Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
return ok;
}
#endif
@@ -173,12 +175,12 @@ static bool do_get_volume_info(DCR *dcr)
dcr->setVolCatInfo(false);
if (dir->recv() <= 0) {
- Dmsg0(200, "getvolname error bnet_recv\n");
+ Dmsg0(dbglvl, "getvolname error bnet_recv\n");
Mmsg(jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
return false;
}
memset(&vol, 0, sizeof(vol));
- Dmsg1(100, "<dird %s", dir->msg);
+ Dmsg1(dbglvl, "<dird %s", dir->msg);
n = sscanf(dir->msg, OK_media, vol.VolCatName,
&vol.VolCatJobs, &vol.VolCatFiles,
&vol.VolCatBlocks, &vol.VolCatBytes,
@@ -190,7 +192,7 @@ static bool do_get_volume_info(DCR *dcr)
&vol.EndFile, &vol.EndBlock, &vol.VolCatParts,
&vol.LabelType, &vol.VolMediaId);
if (n != 22) {
- Dmsg3(100, "Bad response from Dir fields=%d, len=%d: %s",
+ Dmsg3(dbglvl, "Bad response from Dir fields=%d, len=%d: %s",
n, dir->msglen, dir->msg);
Mmsg(jcr->errmsg, _("Error getting Volume info: %s"), dir->msg);
return false;
@@ -201,7 +203,7 @@ static bool do_get_volume_info(DCR *dcr)
bstrncpy(dcr->VolumeName, vol.VolCatName, sizeof(dcr->VolumeName));
dcr->VolCatInfo = vol; /* structure assignment */
- Dmsg2(100, "do_reqest_vol_info return true slot=%d Volume=%s\n",
+ Dmsg2(dbglvl, "do_reqest_vol_info return true slot=%d Volume=%s\n",
vol.Slot, vol.VolCatName);
return true;
}
@@ -219,19 +221,19 @@ static bool do_get_volume_info(DCR *dcr)
*/
bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing)
{
- JCR *jcr = dcr->jcr;
- BSOCK *dir = jcr->dir_bsock;
+ JCR *jcr = dcr->jcr;
+ BSOCK *dir = jcr->dir_bsock;
- P(vol_info_mutex);
- dcr->setVolCatName(dcr->VolumeName);
- bash_spaces(dcr->getVolCatName());
- dir->fsend(Get_Vol_Info, jcr->Job, dcr->getVolCatName(),
- writing==GET_VOL_INFO_FOR_WRITE?1:0);
- Dmsg1(100, ">dird %s", dir->msg);
- unbash_spaces(dcr->getVolCatName());
- bool ok = do_get_volume_info(dcr);
- V(vol_info_mutex);
- return ok;
+ P(vol_info_mutex);
+ dcr->setVolCatName(dcr->VolumeName);
+ bash_spaces(dcr->getVolCatName());
+ dir->fsend(Get_Vol_Info, jcr->Job, dcr->getVolCatName(),
+ writing==GET_VOL_INFO_FOR_WRITE?1:0);
+ Dmsg1(dbglvl, ">dird %s", dir->msg);
+ unbash_spaces(dcr->getVolCatName());
+ bool ok = do_get_volume_info(dcr);
+ V(vol_info_mutex);
+ return ok;
}
@@ -255,7 +257,7 @@ bool dir_find_next_appendable_volume(DCR *dcr)
bool rtn;
char lastVolume[MAX_NAME_LENGTH];
- Dmsg2(200, "dir_find_next_appendable_volume: reserved=%d Vol=%s\n",
+ Dmsg2(dbglvl, "dir_find_next_appendable_volume: reserved=%d Vol=%s\n",
dcr->is_reserved(), dcr->VolumeName);
/*
@@ -273,33 +275,33 @@ bool dir_find_next_appendable_volume(DCR *dcr)
dir->fsend(Find_media, jcr->Job, vol_index, dcr->pool_name, dcr->media_type);
unbash_spaces(dcr->media_type);
unbash_spaces(dcr->pool_name);
- Dmsg1(100, ">dird %s", dir->msg);
+ Dmsg1(dbglvl, ">dird %s", dir->msg);
if (do_get_volume_info(dcr)) {
/* Give up if we get the same volume name twice */
if (lastVolume[0] && strcmp(lastVolume, dcr->VolumeName) == 0) {
- Dmsg1(100, "Got same vol = %s\n", lastVolume);
+ Dmsg1(dbglvl, "Got same vol = %s\n", lastVolume);
break;
}
bstrncpy(lastVolume, dcr->VolumeName, sizeof(lastVolume));
if (dcr->can_i_write_volume()) {
- Dmsg1(100, "Call reserve_volume for write. Vol=%s\n", dcr->VolumeName);
+ Dmsg1(dbglvl, "Call reserve_volume for write. Vol=%s\n", dcr->VolumeName);
if (reserve_volume(dcr, dcr->VolumeName) == NULL) {
- Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
+ Dmsg2(dbglvl, "Could not reserve volume %s on %s\n", dcr->VolumeName,
dcr->dev->print_name());
continue;
}
- Dmsg1(100, "dir_find_next_appendable_volume return true. vol=%s\n",
+ Dmsg1(dbglvl, "dir_find_next_appendable_volume return true. vol=%s\n",
dcr->VolumeName);
rtn = true;
goto get_out;
} else {
- Dmsg1(100, "Volume %s is in use.\n", dcr->VolumeName);
+ Dmsg1(dbglvl, "Volume %s is in use.\n", dcr->VolumeName);
/* If volume is not usable, it is in use by someone else */
dcr->set_found_in_use();
continue;
}
}
- Dmsg2(100, "No vol. index %d return false. dev=%s\n", vol_index,
+ Dmsg2(dbglvl, "No vol. index %d return false. dev=%s\n", vol_index,
dcr->dev->print_name());
break;
}
@@ -342,7 +344,7 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
/* Lock during Volume update */
P(vol_info_mutex);
- Dmsg1(100, "Update cat VolBytes=%lld\n", vol->VolCatBytes);
+ Dmsg1(dbglvl, "Update cat VolBytes=%lld\n", vol->VolCatBytes);
/* Just labeled or relabeled the tape */
if (label) {
bstrncpy(vol->VolCatStatus, "Append", sizeof(vol->VolCatStatus));
@@ -365,13 +367,13 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
edit_int64(vol->VolWriteTime, ed4),
edit_uint64(vol->VolFirstWritten, ed5),
vol->VolCatParts);
- Dmsg1(100, ">dird %s", dir->msg);
+ Dmsg1(dbglvl, ">dird %s", dir->msg);
/* Do not lock device here because it may be locked from label */
if (!jcr->is_canceled()) {
if (!do_get_volume_info(dcr)) {
Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
- Dmsg2(100, _("Didn't get vol info vol=%s: ERR=%s"),
+ Dmsg2(dbglvl, _("Didn't get vol info vol=%s: ERR=%s"),
vol->VolCatName, jcr->errmsg);
goto bail_out;
}
@@ -403,7 +405,7 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero)
/* Throw out records where FI is zero -- i.e. nothing done */
if (!zero && dcr->VolFirstIndex == 0 &&
(dcr->StartBlock != 0 || dcr->EndBlock != 0)) {
- Dmsg0(100, "JobMedia FI=0 StartBlock!=0 record suppressed\n");
+ Dmsg0(dbglvl, "JobMedia FI=0 StartBlock!=0 record suppressed\n");
return true;
}
@@ -424,16 +426,16 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero)
dcr->Copy, dcr->Stripe,
edit_uint64(dcr->VolMediaId, ed1));
}
- Dmsg1(100, ">dird %s", dir->msg);
+ Dmsg1(dbglvl, ">dird %s", dir->msg);
if (dir->recv() <= 0) {
- Dmsg0(190, "create_jobmedia error bnet_recv\n");
+ Dmsg0(dbglvl, "create_jobmedia error bnet_recv\n");
Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia record: ERR=%s\n"),
dir->bstrerror());
return false;
}
- Dmsg1(100, "<dird %s", dir->msg);
+ Dmsg1(dbglvl, "<dird %s", dir->msg);
if (strcmp(dir->msg, OK_create) != 0) {
- Dmsg1(130, "Bad response from Dir: %s\n", dir->msg);
+ Dmsg1(dbglvl, "Bad response from Dir: %s\n", dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia record: %s\n"), dir->msg);
return false;
}
@@ -512,7 +514,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
if (job_canceled(jcr)) {
return false;
}
- Dmsg0(400, "enter dir_ask_sysop_to_create_appendable_volume\n");
+ Dmsg0(dbglvl, "enter dir_ask_sysop_to_create_appendable_volume\n");
ASSERT(dev->blocked());
for ( ;; ) {
if (job_canceled(jcr)) {
@@ -538,16 +540,16 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
dcr->pool_name,
dcr->media_type);
Jmsg(jcr, M_MOUNT, 0, "%s", dev->errmsg);
- Dmsg1(100, "%s", dev->errmsg);
+ Dmsg1(dbglvl, "%s", dev->errmsg);
}
}
jcr->sendJobStatus(JS_WaitMedia);
stat = wait_for_sysop(dcr);
- Dmsg1(100, "Back from wait_for_sysop stat=%d\n", stat);
+ Dmsg1(dbglvl, "Back from wait_for_sysop stat=%d\n", stat);
if (dev->poll) {
- Dmsg1(100, "Poll timeout in create append vol on device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Poll timeout in create append vol on device %s\n", dev->print_name());
continue;
}
@@ -556,7 +558,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
Mmsg(dev->errmsg, _("Max time exceeded waiting to mount Storage Device %s for Job %s\n"),
dev->print_name(), jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
- Dmsg1(100, "Gave up waiting on device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Gave up waiting on device %s\n", dev->print_name());
return false; /* exceeded maximum waits */
}
continue;
@@ -567,12 +569,12 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
return false;
}
- Dmsg1(100, "Someone woke me for device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Someone woke me for device %s\n", dev->print_name());
}
get_out:
jcr->sendJobStatus(JS_Running);
- Dmsg0(100, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
+ Dmsg0(dbglvl, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
return true;
}
@@ -594,7 +596,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, int mode)
DEVICE *dev = dcr->dev;
JCR *jcr = dcr->jcr;
- Dmsg0(400, "enter dir_ask_sysop_to_mount_volume\n");
+ Dmsg0(dbglvl, "enter dir_ask_sysop_to_mount_volume\n");
if (!dcr->VolumeName[0]) {
Mmsg0(dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
return false;
@@ -619,13 +621,13 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, int mode)
if (!dev->poll && (stat == W_TIMEOUT || stat == W_MOUNT)) {
char *msg;
if (mode == ST_APPEND) {
- msg = _("Please mount Volume \"%s\" or label a new one for:\n"
+ msg = _("Please mount append Volume \"%s\" or label a new one for:\n"
" Job: %s\n"
" Storage: %s\n"
" Pool: %s\n"
" Media type: %s\n");
} else {
- msg = _("Please mount Volume \"%s\" for:\n"
+ msg = _("Please mount read Volume \"%s\" for:\n"
" Job: %s\n"
" Storage: %s\n"
" Pool: %s\n"
@@ -637,17 +639,17 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, int mode)
dev->print_name(),
dcr->pool_name,
dcr->media_type);
- Dmsg3(400, "Mount \"%s\" on device \"%s\" for Job %s\n",
+ Dmsg3(dbglvl, "Mount \"%s\" on device \"%s\" for Job %s\n",
dcr->VolumeName, dev->print_name(), jcr->Job);
}
jcr->sendJobStatus(JS_WaitMount);
stat = wait_for_sysop(dcr); /* wait on device */
- Dmsg1(100, "Back from wait_for_sysop stat=%d\n", stat);
+ Dmsg1(dbglvl, "Back from wait_for_sysop stat=%d\n", stat);
if (dev->poll) {
- Dmsg1(400, "Poll timeout in mount vol on device %s\n", dev->print_name());
- Dmsg1(400, "Blocked=%s\n", dev->print_blocked());
+ Dmsg1(dbglvl, "Poll timeout in mount vol on device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Blocked=%s\n", dev->print_blocked());
goto get_out;
}
@@ -656,7 +658,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, int mode)
Mmsg(dev->errmsg, _("Max time exceeded waiting to mount Storage Device %s for Job %s\n"),
dev->print_name(), jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
- Dmsg1(400, "Gave up waiting on device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Gave up waiting on device %s\n", dev->print_name());
return false; /* exceeded maximum waits */
}
continue;
@@ -667,12 +669,12 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, int mode)
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
return false;
}
- Dmsg1(400, "Someone woke me for device %s\n", dev->print_name());
+ Dmsg1(dbglvl, "Someone woke me for device %s\n", dev->print_name());
break;
}
get_out:
jcr->sendJobStatus(JS_Running);
- Dmsg0(400, "leave dir_ask_sysop_to_mount_volume\n");
+ Dmsg0(dbglvl, "leave dir_ask_sysop_to_mount_volume\n");
return true;
}
diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c
index 578f296..9d8cd7c 100644
--- a/bacula/src/stored/job.c
+++ b/bacula/src/stored/job.c
@@ -97,7 +97,7 @@ bool job_cmd(JCR *jcr)
return false;
}
jcr->rerunning = (rerunning) ? true : false;
- Dmsg3(100, "==== rerunning=%d VolSesId=%d VolSesTime=%d\n", jcr->rerunning,
+ Dmsg3(100, "rerunning=%d VolSesId=%d VolSesTime=%d\n", jcr->rerunning,
jcr->VolSessionId, jcr->VolSessionTime);
/*
* Since this job could be rescheduled, we
diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c
index fac1007..68b5fed 100644
--- a/bacula/src/stored/mount.c
+++ b/bacula/src/stored/mount.c
@@ -863,7 +863,11 @@ bool mount_next_read_volume(DCR *dcr)
* End Of Tape -- mount next Volume (if another specified)
*/
if (jcr->NumReadVolumes > 1 && jcr->CurReadVolume < jcr->NumReadVolumes) {
+ dev->dlock();
dev->close();
+ dev->set_read();
+ dcr->set_reserved();
+ dev->dunlock();
if (!acquire_device_for_read(dcr)) {
Jmsg2(jcr, M_FATAL, 0, _("Cannot open Dev=%s, Vol=%s\n"), dev->print_name(),
dcr->VolumeName);
diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c
index d4eb27c..f9fb517 100644
--- a/bacula/src/stored/parse_bsr.c
+++ b/bacula/src/stored/parse_bsr.c
@@ -1,7 +1,7 @@
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
@@ -30,7 +30,6 @@
*
* Kern Sibbald, June MMII
*
- * Version $Id$
*/
diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c
index 47654ee..42868f9 100644
--- a/bacula/src/stored/spool.c
+++ b/bacula/src/stored/spool.c
@@ -475,16 +475,19 @@ bool write_block_to_spool_file(DCR *dcr)
}
V(mutex);
if (despool) {
-#ifdef xDEBUG
- char ec1[30], ec2[30], ec3[30], ec4[30];
- Dmsg4(100, "Despool in write_block_to_spool_file max_size=%s size=%s "
- "max_job_size=%s job_size=%s\n",
- edit_uint64_with_commas(dcr->max_job_spool_size, ec1),
- edit_uint64_with_commas(dcr->job_spool_size, ec2),
- edit_uint64_with_commas(dcr->dev->max_spool_size, ec3),
- edit_uint64_with_commas(dcr->dev->spool_size, ec4));
-#endif
- Jmsg(dcr->jcr, M_INFO, 0, _("User specified spool size reached.\n"));
+ char ec1[30], ec2[30];
+ if (dcr->max_job_spool_size > 0) {
+ Jmsg(dcr->jcr, M_INFO, 0, _("User specified Job spool size reached: "
+ "JobSpoolSize=%s MaxJobSpoolSize=%s\n"),
+ edit_uint64_with_commas(dcr->job_spool_size, ec1),
+ edit_uint64_with_commas(dcr->max_job_spool_size, ec2));
+ } else {
+ Jmsg(dcr->jcr, M_INFO, 0, _("User specified Device spool size reached: "
+ "DevSpoolSize=%s MaxDevSpoolSize=%s\n"),
+ edit_uint64_with_commas(dcr->dev->spool_size, ec1),
+ edit_uint64_with_commas(dcr->dev->max_spool_size, ec2));
+ }
+
if (!despool_data(dcr, false)) {
Pmsg0(000, _("Bad return from despool in write_block.\n"));
return false;
diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c
index 1b6843a..320d4ed 100644
--- a/bacula/src/stored/status.c
+++ b/bacula/src/stored/status.c
@@ -1,7 +1,7 @@
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2003-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2003-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
@@ -37,7 +37,7 @@
#include "stored.h"
#include "lib/status.h"
-/* Exported variables */
+/* Imported functions */
/* Imported variables */
extern BSOCK *filed_chan;
@@ -102,18 +102,43 @@ void output_status(STATUS_PKT *sp)
list_volumes(sendit, (void *)sp);
if (!sp->api) sendit("====\n\n", 6, sp);
-#ifdef xxx
- if (debug_level > 10) {
- bs->fsend(_("====\n\n"));
- dump_resource(R_DEVICE, resources[R_DEVICE-r_first].res_head, sendit, user);
- bs->fsend(_("====\n\n"));
- }
-#endif
list_spool_stats(sendit, (void *)sp);
if (!sp->api) sendit("====\n\n", 6, sp);
+
}
+static void list_resources(STATUS_PKT *sp)
+{
+#ifdef when_working
+ POOL_MEM msg(PM_MESSAGE);
+ int len;
+
+ len = Mmsg(msg, _("\nSD Resources:\n"));
+ if (!sp->api) sendit(msg, len, sp);
+ dump_resource(R_DEVICE, resources[R_DEVICE-r_first], sp);
+ if (!sp->api) sendit("====\n\n", 6, sp);
+#endif
+}
+
+#ifdef xxxx
+static find_device(char *devname)
+{
+ foreach_res(device, R_DEVICE) {
+ if (strcasecmp(device->hdr.name, devname) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ foreach_res(changer, R_AUTOCHANGER) {
+ if (strcasecmp(changer->hdr.name, devname) == 0) {
+ break;
+ }
+ }
+ }
+}
+#endif
static void list_devices(STATUS_PKT *sp)
{
@@ -143,21 +168,24 @@ static void list_devices(STATUS_PKT *sp)
}
}
}
+
+
foreach_res(device, R_DEVICE) {
dev = device->dev;
if (dev && dev->is_open()) {
if (dev->is_labeled()) {
- len = Mmsg(msg, _("Device %s is mounted with:\n"
+ len = Mmsg(msg, _("\nDevice %s is %s:\n"
" Volume: %s\n"
" Pool: %s\n"
" Media type: %s\n"),
dev->print_name(),
+ dev->blocked()?_("waiting for"):_("mounted with"),
dev->VolHdr.VolumeName,
- dev->pool_name[0]?dev->pool_name:"*unknown*",
+ dev->pool_name[0]?dev->pool_name:_("*unknown*"),
dev->device->media_type);
sendit(msg, len, sp);
} else {
- len = Mmsg(msg, _("Device %s open but no Bacula volume is currently mounted.\n"),
+ len = Mmsg(msg, _("\nDevice %s open but no Bacula volume is currently mounted.\n"),
dev->print_name());
sendit(msg, len, sp);
}
@@ -196,14 +224,16 @@ static void list_devices(STATUS_PKT *sp)
} else {
if (dev) {
- len = Mmsg(msg, _("Device %s is not open.\n"), dev->print_name());
+ len = Mmsg(msg, _("\nDevice %s is not open.\n"), dev->print_name());
sendit(msg, len, sp);
send_blocked_status(dev, sp);
} else {
- len = Mmsg(msg, _("Device \"%s\" is not open or does not exist.\n"), device->hdr.name);
+ len = Mmsg(msg, _("\nDevice \"%s\" is not open or does not exist.\n"), device->hdr.name);
sendit(msg, len, sp);
}
}
+
+ if (!sp->api) sendit("==\n", 4, sp);
}
if (!sp->api) sendit("====\n\n", 6, sp);
}
@@ -237,6 +267,21 @@ static void list_status_header(STATUS_PKT *sp)
(int)sizeof(boffset_t), (int)sizeof(size_t), (int)sizeof(int32_t),
(int)sizeof(int64_t), (int)DEVELOPER_MODE, (int)BEEF);
sendit(msg, len, sp);
+ if (bplugin_list->size() > 0) {
+ Plugin *plugin;
+ int len;
+ pm_strcpy(msg, " Plugin: ");
+ foreach_alist(plugin, bplugin_list) {
+ len = pm_strcat(msg, plugin->file);
+ if (len > 80) {
+ pm_strcat(msg, "\n ");
+ } else {
+ pm_strcat(msg, " ");
+ }
+ }
+ len = pm_strcat(msg, "\n");
+ sendit(msg.c_str(), len, sp);
+ }
}
static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
@@ -260,33 +305,30 @@ static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
break;
case BST_WAITING_FOR_SYSOP:
{
- dlist *dcrs = dev->attached_dcrs;
+ DCR *dcr;
bool found_jcr = false;
-
- if (dcrs != NULL) {
- DCR *dcr;
- for (dcr = (DCR *)dcrs->first(); dcr != NULL; dcr = (DCR *)dcrs->next(dcr)) {
- if (dcr->jcr->JobStatus == JS_WaitMount) {
- len = Mmsg(msg, _(" Device is BLOCKED waiting for mount of volume \"%s\",\n"
- " Pool: %s\n"
- " Media type: %s\n"),
- dcr->VolumeName,
- dcr->pool_name,
- dcr->media_type);
- sendit(msg, len, sp);
- found_jcr = true;
- } else if (dcr->jcr->JobStatus == JS_WaitMedia) {
- len = Mmsg(msg, _(" Device is BLOCKED waiting to create a volume for:\n"
- " Pool: %s\n"
- " Media type: %s\n"),
- dcr->pool_name,
- dcr->media_type);
- sendit(msg, len, sp);
- found_jcr = true;
- }
+ dev->dlock();
+ foreach_dlist(dcr, dev->attached_dcrs) {
+ if (dcr->jcr->JobStatus == JS_WaitMount) {
+ len = Mmsg(msg, _(" Device is BLOCKED waiting for mount of volume \"%s\",\n"
+ " Pool: %s\n"
+ " Media type: %s\n"),
+ dcr->VolumeName,
+ dcr->pool_name,
+ dcr->media_type);
+ sendit(msg, len, sp);
+ found_jcr = true;
+ } else if (dcr->jcr->JobStatus == JS_WaitMedia) {
+ len = Mmsg(msg, _(" Device is BLOCKED waiting to create a volume for:\n"
+ " Pool: %s\n"
+ " Media type: %s\n"),
+ dcr->pool_name,
+ dcr->media_type);
+ sendit(msg, len, sp);
+ found_jcr = true;
}
}
-
+ dev->dunlock();
if (!found_jcr) {
len = Mmsg(msg, _(" Device is BLOCKED waiting for media.\n"));
sendit(msg, len, sp);
@@ -307,15 +349,12 @@ static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
/* Send autochanger slot status */
if (dev->is_autochanger()) {
if (dev->get_slot() > 0) {
- len = Mmsg(msg, _(" Slot %d is loaded in drive %d.\n"),
- dev->get_slot(), dev->drive_index);
+ len = Mmsg(msg, _(" Slot %d %s loaded in drive %d.\n"),
+ dev->get_slot(), dev->is_open()?"is": "was last", dev->drive_index);
sendit(msg, len, sp);
- } else if (dev->get_slot() == 0) {
+ } else if (dev->get_slot() <= 0) {
len = Mmsg(msg, _(" Drive %d is not loaded.\n"), dev->drive_index);
sendit(msg, len, sp);
- } else {
- len = Mmsg(msg, _(" Drive %d status unknown.\n"), dev->drive_index);
- sendit(msg, len, sp);
}
}
if (debug_level > 1) {
@@ -328,28 +367,28 @@ static void send_device_status(DEVICE *dev, STATUS_PKT *sp)
POOL_MEM msg(PM_MESSAGE);
int len;
- len = Mmsg(msg, _("Configured device capabilities:\n"));
- sendit(msg, len, sp);
-
- len = Mmsg(msg, "%sEOF %sBSR %sBSF %sFSR %sFSF %sEOM %sREM %sRACCESS %sAUTOMOUNT %sLABEL %sANONVOLS %sALWAYSOPEN\n",
- dev->capabilities & CAP_EOF ? "" : "!",
- dev->capabilities & CAP_BSR ? "" : "!",
- dev->capabilities & CAP_BSF ? "" : "!",
- dev->capabilities & CAP_FSR ? "" : "!",
- dev->capabilities & CAP_FSF ? "" : "!",
- dev->capabilities & CAP_EOM ? "" : "!",
- dev->capabilities & CAP_REM ? "" : "!",
- dev->capabilities & CAP_RACCESS ? "" : "!",
- dev->capabilities & CAP_AUTOMOUNT ? "" : "!",
- dev->capabilities & CAP_LABEL ? "" : "!",
- dev->capabilities & CAP_ANONVOLS ? "" : "!",
- dev->capabilities & CAP_ALWAYSOPEN ? "" : "!");
- sendit(msg, len, sp);
+ if (debug_level > 5) {
+ len = Mmsg(msg, _("Configured device capabilities:\n"));
+ sendit(msg, len, sp);
+ len = Mmsg(msg, " %sEOF %sBSR %sBSF %sFSR %sFSF %sEOM %sREM %sRACCESS %sAUTOMOUNT %sLABEL %sANONVOLS %sALWAYSOPEN\n",
+ dev->capabilities & CAP_EOF ? "" : "!",
+ dev->capabilities & CAP_BSR ? "" : "!",
+ dev->capabilities & CAP_BSF ? "" : "!",
+ dev->capabilities & CAP_FSR ? "" : "!",
+ dev->capabilities & CAP_FSF ? "" : "!",
+ dev->capabilities & CAP_EOM ? "" : "!",
+ dev->capabilities & CAP_REM ? "" : "!",
+ dev->capabilities & CAP_RACCESS ? "" : "!",
+ dev->capabilities & CAP_AUTOMOUNT ? "" : "!",
+ dev->capabilities & CAP_LABEL ? "" : "!",
+ dev->capabilities & CAP_ANONVOLS ? "" : "!",
+ dev->capabilities & CAP_ALWAYSOPEN ? "" : "!");
+ sendit(msg, len, sp);
+ }
len = Mmsg(msg, _("Device state:\n"));
sendit(msg, len, sp);
-
- len = Mmsg(msg, "%sOPENED %sTAPE %sLABEL %sMALLOC %sAPPEND %sREAD %sEOT %sWEOT %sEOF %sNEXTVOL %sSHORT %sMOUNTED\n",
+ len = Mmsg(msg, " %sOPENED %sTAPE %sLABEL %sMALLOC %sAPPEND %sREAD %sEOT %sWEOT %sEOF %sNEXTVOL %sSHORT %sMOUNTED\n",
dev->is_open() ? "" : "!",
dev->is_tape() ? "" : "!",
dev->is_labeled() ? "" : "!",
@@ -363,35 +402,50 @@ static void send_device_status(DEVICE *dev, STATUS_PKT *sp)
dev->state & ST_SHORT ? "" : "!",
dev->state & ST_MOUNTED ? "" : "!");
sendit(msg, len, sp);
-
- len = Mmsg(msg, _("num_writers=%d reserved=%d block=%d\n\n"), dev->num_writers,
+ len = Mmsg(msg, _(" num_writers=%d reserves=%d block=%d\n"), dev->num_writers,
dev->num_reserved(), dev->blocked());
sendit(msg, len, sp);
- len = Mmsg(msg, _("Device parameters:\n"));
+ len = Mmsg(msg, _("Attached Jobs: "));
sendit(msg, len, sp);
+ DCR *dcr = NULL;
+ bool found = false;
+ dev->dlock();
+ foreach_dlist(dcr, dev->attached_dcrs) {
+ if (dcr->jcr) {
+ if (found) {
+ sendit(",", 1, sp);
+ }
+ len = Mmsg(msg, "%d", (int)dcr->jcr->JobId);
+ sendit(msg, len, sp);
+ found = true;
+ }
+ }
+ dev->dunlock();
+ sendit("\n", 1, sp);
- len = Mmsg(msg, _("Archive name: %s Device name: %s\n"), dev->archive_name(),
+ len = Mmsg(msg, _("Device parameters:\n"));
+ sendit(msg, len, sp);
+ len = Mmsg(msg, _(" Archive name: %s Device name: %s\n"), dev->archive_name(),
dev->name());
sendit(msg, len, sp);
-
- len = Mmsg(msg, _("File=%u block=%u\n"), dev->file, dev->block_num);
+ len = Mmsg(msg, _(" File=%u block=%u\n"), dev->file, dev->block_num);
sendit(msg, len, sp);
-
- len = Mmsg(msg, _("Min block=%u Max block=%u\n"), dev->min_block_size, dev->max_block_size);
+ len = Mmsg(msg, _(" Min block=%u Max block=%u\n"), dev->min_block_size, dev->max_block_size);
sendit(msg, len, sp);
}
static void list_running_jobs(STATUS_PKT *sp)
{
bool found = false;
- int bps, sec;
+ int avebps, bps, sec;
JCR *jcr;
DCR *dcr, *rdcr;
char JobName[MAX_NAME_LENGTH];
- char b1[30], b2[30], b3[30];
+ char b1[50], b2[50], b3[50], b4[50];
int len;
POOL_MEM msg(PM_MESSAGE);
+ time_t now = time(NULL);
len = Mmsg(msg, _("\nRunning Jobs:\n"));
if (!sp->api) sendit(msg, len, sp);
@@ -442,16 +496,27 @@ static void list_running_jobs(STATUS_PKT *sp)
dcr->spooling, dcr->despooling, dcr->despool_wait);
sendit(msg, len, sp);
}
- sec = time(NULL) - jcr->run_time;
+ if (jcr->last_time == 0) {
+ jcr->last_time = jcr->run_time;
+ }
+ sec = now - jcr->last_time;
if (sec <= 0) {
sec = 1;
}
- bps = jcr->JobBytes / sec;
- len = Mmsg(msg, _(" Files=%s Bytes=%s Bytes/sec=%s\n"),
+ bps = (jcr->JobBytes - jcr->LastJobBytes) / sec;
+ if (jcr->LastRate == 0) {
+ jcr->LastRate = bps;
+ }
+ avebps = (jcr->LastRate + bps) / 2;
+ len = Mmsg(msg, _(" Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s\n"),
edit_uint64_with_commas(jcr->JobFiles, b1),
edit_uint64_with_commas(jcr->JobBytes, b2),
- edit_uint64_with_commas(bps, b3));
+ edit_uint64_with_commas(avebps, b3),
+ edit_uint64_with_commas(bps, b4));
sendit(msg, len, sp);
+ jcr->LastRate = avebps;
+ jcr->LastJobBytes = jcr->JobBytes;
+ jcr->last_time = now;
found = true;
#ifdef DEBUG
if (jcr->file_bsock) {
@@ -695,8 +760,7 @@ bool qstatus_cmd(JCR *jcr)
sp.bs = dir;
if (sscanf(dir->msg, qstatus, cmd.c_str()) != 1) {
pm_strcpy(jcr->errmsg, dir->msg);
- Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg);
- dir->fsend(_("3900 Bad .status command, missing argument.\n"));
+ dir->fsend(_("3900 No arg in .status command: %s\n"), jcr->errmsg);
dir->signal(BNET_EOD);
return false;
}
@@ -704,7 +768,7 @@ bool qstatus_cmd(JCR *jcr)
Dmsg1(200, "cmd=%s\n", cmd.c_str());
- if (strcmp(cmd.c_str(), "current") == 0) {
+ if (strcasecmp(cmd.c_str(), "current") == 0) {
dir->fsend(OKqstatus, cmd.c_str());
foreach_jcr(njcr) {
if (njcr->JobId != 0) {
@@ -712,7 +776,7 @@ bool qstatus_cmd(JCR *jcr)
}
}
endeach_jcr(njcr);
- } else if (strcmp(cmd.c_str(), "last") == 0) {
+ } else if (strcasecmp(cmd.c_str(), "last") == 0) {
dir->fsend(OKqstatus, cmd.c_str());
if ((last_jobs) && (last_jobs->size() > 0)) {
job = (s_last_job*)last_jobs->last();
@@ -739,10 +803,12 @@ bool qstatus_cmd(JCR *jcr)
} else if (strcasecmp(cmd.c_str(), "terminated") == 0) {
sp.api = true;
list_terminated_jobs(&sp);
+ } else if (strcasecmp(cmd.c_str(), "resources") == 0) {
+ sp.api = true;
+ list_resources(&sp);
} else {
pm_strcpy(jcr->errmsg, dir->msg);
- Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg);
- dir->fsend(_("3900 Bad .status command, wrong argument.\n"));
+ dir->fsend(_("3900 Unknown arg in .status command: %s\n"), jcr->errmsg);
dir->signal(BNET_EOD);
return false;
}
diff --git a/bacula/src/stored/vol_mgr.c b/bacula/src/stored/vol_mgr.c
index 78feb55..7d12be9 100644
--- a/bacula/src/stored/vol_mgr.c
+++ b/bacula/src/stored/vol_mgr.c
@@ -181,6 +181,7 @@ void remove_read_volume(JCR *jcr, const char *VolumeName)
free_vol_item(fvol);
}
unlock_read_volumes();
+// pthread_cond_broadcast(&wait_next_vol);
}
/*
@@ -442,8 +443,11 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName)
vol->dev = dev; /* point the Volume at our drive */
dev->vol = vol; /* point our drive at the Volume */
} else {
- Dmsg5(dbglvl, "==== Swap not possible Vol busy=%d swap=%d vol=%s from dev=%s to %s\n",
- vol->dev->is_busy(), vol->is_swapping(),
+ Jmsg7(dcr->jcr, M_WARNING, 0, "Need volume from other drive, "
+ "but swap not possible. Status: read=%d num_writers=%d "
+ "num_reserve=%d swap=%d vol=%s from dev=%s to %s\n",
+ vol->dev->can_read(), vol->dev->num_writers,
+ vol->dev->num_reserved(), vol->is_swapping(),
VolumeName, vol->dev->print_name(), dev->print_name());
if (vol->is_swapping() && dev->swap_dev) {
Dmsg3(dbglvl, "Swap failed vol=%s from=%s to dev=%s\n",
@@ -600,6 +604,7 @@ bool free_volume(DEVICE *dev)
Dmsg1(dbglvl, "=== cannot clear swapping vol=%s\n", vol->vol_name);
}
unlock_volumes();
+// pthread_cond_broadcast(&wait_next_vol);
return true;
}
diff --git a/bacula/src/tools/Makefile.in b/bacula/src/tools/Makefile.in
index 2463957..3bdacc8 100644
--- a/bacula/src/tools/Makefile.in
+++ b/bacula/src/tools/Makefile.in
@@ -1,8 +1,6 @@
#
# Bacula Tools Makefile
#
-# Version $Id$
-#
@MCOMMON@
PYTHON_INC = @PYTHON_INCDIR@
@@ -37,7 +35,7 @@ EXTRAOBJS = @OBJLIST@
DIRCONFOBJS = ../dird/dird_conf.o ../dird/ua_acl.o ../dird/run_conf.o ../dird/inc_conf.o
NODIRTOOLS = bsmtp
-DIRTOOLS = bsmtp dbcheck drivetype fstype testfind testls bregex bwild bbatch bregtest bvfs_test ing_test bpluginfo
+DIRTOOLS = bsmtp dbcheck drivetype fstype testfind testls bregex bwild bbatch bregtest bvfs_test ing_test bpluginfo timelimit
TOOLS = $(@DIR_TOOLS@)
INSNODIRTOOLS = bsmtp
@@ -88,6 +86,10 @@ run_conf.o: ../dird/run_conf.c
inc_conf.o: ../dird/inc_conf.c
$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
+timelimit: timelimit.o
+ ${CC} ${DEFS} ${DEBUG} -pipe -DHAVE_ERRNO_H -DHAVE_SETITIMER -DHAVE_SIGACTION -c timelimit.c
+ ${CC} -o timelimit timelimit.o
+
testfind: Makefile ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) \
../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) $(FINDOBJS)
$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -o $@ $(FINDOBJS) -L. -L../lib -L../findlib \
diff --git a/bacula/src/tools/timelimit.1 b/bacula/src/tools/timelimit.1
new file mode 100644
index 0000000..1d3a7c9
--- /dev/null
+++ b/bacula/src/tools/timelimit.1
@@ -0,0 +1,217 @@
+.\" Copyright (c) 2001, 2007 - 2010 Peter Pentchev
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Ringlet$
+.\"
+.Dd September 29, 2010
+.Dt TIMELIMIT 1
+.Os
+.Sh NAME
+.Nm timelimit
+.Nd effectively limit the absolute execution time of a process
+.Sh SYNOPSIS
+.Nm
+.Op Fl pq
+.Op Fl S Ar killsig
+.Op Fl s Ar warnsig
+.Op Fl T Ar killtime
+.Op Fl t Ar warntime
+.Ar command
+.Op Ar arguments ...
+.Sh DESCRIPTION
+The
+.Nm
+utility executes a given
+.Ar command
+with the supplied
+.Ar arguments
+and terminates the spawned process after a given time with a given signal.
+If the process exits before the time limit has elapsed,
+.Nm
+will silently exit, too.
+.Pp
+Options:
+.Bl -tag -width indent
+.It Fl p
+If the child process is terminated by a signal,
+.Nm
+propagates this condition, i.e. sends the same signal to itself.
+This allows the program executing
+.Nm
+to determine whether the child process was terminated by a signal or
+actually exited with an exit code larger than 128.
+.It Fl q
+Quiet operation -
+.Nm
+does not output diagnostic messages about signals sent to the child process.
+.It Fl S Ar killsig
+Specify the number of the signal to be sent to the process
+.Ar killtime
+seconds after
+.Ar warntime
+has expired.
+Defaults to 9 (SIGKILL).
+.It Fl s Ar warnsig
+Specify the number of the signal to be sent to the process
+.Ar warntime
+seconds after it has been started.
+Defaults to 15 (SIGTERM).
+.It Fl T Ar killtime
+Specify the maximum execution time of the process before sending
+.Ar killsig
+after
+.Ar warnsig
+has been sent.
+Defaults to 120 seconds.
+.It Fl t Ar warntime
+Specify the maximum execution time of the process in seconds before sending
+.Ar warnsig .
+Defaults to 3600 seconds.
+.El
+.Pp
+On systems that support the
+.Xr setitimer 2
+system call, the
+.Ar warntime
+and
+.Ar killtime
+values may be specified in fractional seconds with microsecond precision.
+.Sh ENVIRONMENT
+.Bl -tag -width indent
+.It Ev KILLSIG
+The
+.Ar killsig
+to use if the
+.Fl S
+option was not specified.
+.It Ev KILLTIME
+The
+.Ar killtime
+to use if the
+.Fl T
+option was not specified.
+.It Ev WARNSIG
+The
+.Ar warnsig
+to use if the
+.Fl s
+option was not specified.
+.It Ev WARNTIME
+The
+.Ar warntime
+to use if the
+.Fl t
+option was not specified.
+.El
+.Sh EXIT STATUS
+If the child process exits normally, the
+.Nm
+utility will pass its exit code on up.
+If the child process is terminated by a signal and the
+.Fl p
+flag was not specified, the
+.Nm
+utility's exit status is 128 plus the signal number, similar to
+.Xr sh 1 .
+If the
+.Fl p
+flag was specified, the
+.Nm
+utility will raise the signal itself so that its own parent process
+may in turn reliably distinguish between a signal and a larger than 128
+exit code.
+.Pp
+In rare cases, the
+.Nm
+utility may encounter a system or user error; then, its exit status is one
+of the standard
+.Xr sysexits 3
+values:
+.Bl -tag -width indent
+.It Dv EX_USAGE
+The command-line parameters and options were incorrectly specified.
+.It Dv EX_SOFTWARE
+The
+.Nm
+utility itself received an unexpected signal while waiting for the child
+process to terminate.
+.It Dv EX_OSERR
+The
+.Nm
+utility was unable to execute the child process, wait for it to terminate,
+or examine its exit status.
+.El
+.Sh EXAMPLES
+.Pp
+The following examples are shown as given to the shell:
+.Pp
+.Dl timelimit -p /usr/local/bin/rsync rsync://some.host/dir /opt/mirror
+.Pp
+Run the rsync program to mirror a WWW or FTP site and kill it if it
+runs longer than 1 hour (that is 3600 seconds) with SIGTERM.
+If the rsync process does not exit after receiving the SIGTERM,
+.Nm
+issues a SIGKIL...
[truncated message content] |