1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

3750 Commits

Author SHA1 Message Date
Martin Schwenke
2396846ca1 Tests: Oops! Add bin directory for eventscript tests.
It was matched by .gitignore.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ef7e5da6241e326267800cd2bd53fb33a0386c2d)
2011-08-08 13:38:07 +10:00
Martin Schwenke
652899e692 Git should ignore tests/eventscripts/var.x
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bc94197025a1ec6efaed5586a725f698991b2b17)
2011-08-08 13:38:07 +10:00
Martin Schwenke
f43ae500be Tests: initial eventscript unit tests.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b675ca3c25b7155b9681128822d1280018ef68bb)
2011-08-08 13:38:07 +10:00
Martin Schwenke
46c908d542 Merge remote-tracking branch 'origin/master' into eventscripts_relative
(This used to be ctdb commit b723f23fc9c38e75b91d43306d606be26c55d31d)
2011-08-08 13:25:40 +10:00
Martin Schwenke
394bbe8454 Eventscript functions - use $CTDB_VARDIR instead of local $ctdb_spool_dir.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d0c6d9b19f0dd8946f9504b0d1cf50dd21f7a592)
2011-08-08 13:21:23 +10:00
David Disseldorp
e097b7f8ff io: Make queue_io_read() safe for reentry
queue_io_read() may be reentered via the queue callback, recoverd is
particularly guilty of this.

queue_io_read() is not safe for reentry if more than one packet is
received and partial chunks follow - data read off the pipe on re-entry
is assumed to be the start-of-packet four byte length. This leads to a
wrongly aligned stream and the notorious "Invalid packet of length 0"
errors.

This change fixes queue_io_read() to be safe under reentry, only a
single packet is processed per call.

https://bugzilla.samba.org/show_bug.cgi?id=8319

(This used to be ctdb commit 9ea41d2fab612772f861270c8a59c01c43bd3a4c)
2011-08-05 14:27:18 +10:00
Ronnie Sahlberg
fea64f65b5 Remove a log message about setting linkstate for an unknown interface.
sometimes we do want to try to set the linkstate for interfaces that are not in use by public addresses right now (but posisbly by other mechanisms) and these messages just spam the logs

S1026357

(This used to be ctdb commit f2fe0a090a9650910ebe49514b3ca01dc593bea3)
2011-08-05 10:05:12 +10:00
Martin Schwenke
b0e7237653 Eventscripts - remove some more absolute paths to commands.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f5b7cb03aaf19fb4b12fc3f0c14d98ee2d7b0798)
2011-08-04 17:14:11 +10:00
Ronnie Sahlberg
10caf186e1 remove log message we dont need
S1026492

(This used to be ctdb commit c5f6e44b92210519d4bfc24611cae3f9978cc2e5)
2011-08-04 13:49:57 +10:00
Ronnie Sahlberg
a9eba762d7 remove a non-error logmessage about persistent databases being healthy, as expected
S1026492

(This used to be ctdb commit da9e02085523e27fa29e35c60034f6a8aaaa81e8)
2011-08-04 13:49:48 +10:00
Ronnie Sahlberg
629f4da55a remove a log message we dont need about "allow clients to attach to databases"
S1026492

(This used to be ctdb commit 42c3e4c5216000c370814441e38c7a8180047aaf)
2011-08-04 13:49:38 +10:00
Ronnie Sahlberg
44dd9b458d Change the message when we start the daemon to "CTDB starting on node"
S1026492

(This used to be ctdb commit 4dfe85dc19eea7b3382a005f63e1a3ef824aea90)
2011-08-04 13:49:30 +10:00
Martin Schwenke
8026b3ce5a Eventscripts - Rework the use of get_proc() for the bonding checks.
Call call_proc(), put the output into a variable and then use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2dfdc997f432d522034922b43cb6f8f878d11ba7)
2011-08-03 20:12:48 +10:00
Martin Schwenke
6fd94af5cc Eventscripts: update 60.nfs service() start to use set_proc().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 70ebb30b90956bb1212287d267ccb72ea83740ca)
2011-08-03 20:01:38 +10:00
Martin Schwenke
4b516600a2 Eventscripts: update 10.interface to use set_proc() and get_proc().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 61b7f0172ba5c83c847c29fac3582c25c7754b68)
2011-08-03 19:58:25 +10:00
Martin Schwenke
cfdccc5cac Eventscripts: use set_proc() in startstop_nfs().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5a3d5c6b1ca3682bb45104e50061871dec6e9b1d)
2011-08-03 19:57:40 +10:00
Martin Schwenke
75bbc93c0b Eventscripts: remove unnecessary absolute paths from external commands.
For eventscript unit testing it will be necessary to override external
commands to allow stub implementations to be used.  If absolute paths
aren't used then this can be done using either a fake bin/
subdirectory or by using shell functions.

This removes all of the simple cases of absolute paths.

Signed-off-by: Martin Schwenke <martin@meltin.net>

Conflicts:

	config/ctdb.init
	config/events.d/50.samba

        Keep old code but remove absolute paths.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 05851d50b0078de8bf4691442d718825adca6fe8)
2011-08-03 17:19:15 +10:00
Martin Schwenke
5f4ab05766 Eventscripts: new functions set_proc() and get_proc().
These provide a thin layer around writing and reading files in /proc.
They can be easily replaced by stubs for unit testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 637f9d8af517b73c72ed8f3cc2a2661f11eb2126)
2011-08-03 17:04:58 +10:00
Martin Schwenke
571e55ac0d Eventscripts: remove ctdb_wait_command() and ctdb_wait_tcp_ports() functions.
These haven't been used for a long time.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f5fd361cadb3ea18d29e2d7215a7853718e48d00)
2011-08-03 17:02:41 +10:00
Ronnie Sahlberg
c6c3d83477 Merge remote branch 'martins/test_suite'
(This used to be ctdb commit 113c763f15ab1db3810f40504b60bab5d3f2f212)
2011-08-03 16:56:26 +10:00
Martin Schwenke
e3a9991e46 Eventscripts: iptables() should put lock in $CTDB_VARDIR.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3f04793f391c63b78ffb9c9851ab3f0daf3ed50a)
2011-08-03 16:55:43 +10:00
Martin Schwenke
3bbfdfcdd3 Make Emacs recognise that the eventscript functions file is a shell script.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a6dfb76cfa759f6f9409f24368111c4f85ca0fbf)
2011-08-03 16:49:38 +10:00
Martin Schwenke
3380c6ce1d Eventscript functions: add $CTDB_ETCDIR and hook service() functions.
* $CTDB_ETCDIR defaults to /etc but can be changed for testing.  All
  hard-coded instances of /etc have been changed to $CTDB_ETCDIR.
  This includes references to /etc/init.d and /etc/sysconfig.

* service() and nice_service() functions now call new function
  _service().  This makes it easier to override these functions (say,
  in rc.local) for testing and call most of the existing functionality
  using _service().

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f43c9a7604b779bb6257ddb2bf3cbe266d496a63)
2011-08-03 16:45:54 +10:00
Martin Schwenke
d31fbcab4b Set $CTDB_VARDIR in the functions file.
This will be needed when eventscripts that use it are called
externally.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ebd53b66b0cc66d9d04830781886234167fc2164)
2011-08-03 16:44:49 +10:00
Ronnie Sahlberg
8f03eed985 Merge remote branch 'martins/onnode_tests'
(This used to be ctdb commit 0384f1902bb64d6683b689de226fff4e54331c24)
2011-08-03 16:26:43 +10:00
Ronnie Sahlberg
8a0e932008 Merge remote branch 'martins/lcp2_sim'
(This used to be ctdb commit cc9a09b2cbe300ad5848932b9273270ad50ea6b0)
2011-08-03 16:25:46 +10:00
Martin Schwenke
000fbb607e Test suite: when the cluster flip-flops (un)healthy, using "ctdb status -Y".
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d3dc9410501767c07d9b0106bb73c979d869c127)
2011-08-03 16:06:40 +10:00
Martin Schwenke
7e48ba58c6 Test suite: Print debug info from cluster nodes when time jumps occur.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 21cdc7ed6942238faeb42983c862d4abc3f54ffb)
2011-08-03 16:06:40 +10:00
Martin Schwenke
372f0a1bff Test suite: Add debug for cluster (un)healthy flip-flop after restart.
We're seeing the cluster become healthy after a restart and then
revert to being unhealthy.  It looks like there's a race and the
cluster shouldn't have been healthy, given that we seem to see that
the monitor cycle hasn't yet been run.

This collects some state debug info from all nodes after the cluster
becomes healthy.  This is printed if the cluster is then unexpectedly
unhealthy a short time later.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c2efb5897e4258df649149f9904d7ac47322e1b4)
2011-08-03 16:06:40 +10:00
Martin Schwenke
659f54e61a Test suite: add more debug to time jump post mortem.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit fed3c2b80b8add8d1cf33abdd5dd8d8001af44d4)
2011-08-03 16:06:40 +10:00
Martin Schwenke
e05b902f99 Test suite: add automated checking of time logs.
This depends on the format of onnode output and also depends on
simple/00_ctdb_onnode.sh having been run.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 93b53b186df55942bf4d9e90cae329f47889af72)
2011-08-03 16:06:40 +10:00
Martin Schwenke
7e5549a54e Test suite: make time log use seconds since epoch.
Easier to implement automatic checking.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 18db530880849b59445d7aa508bf218bdd77ea1c)
2011-08-03 16:06:40 +10:00
Martin Schwenke
88fc88caf5 Test suite: CTDB_SAMBA_SKIP_SHARE_CHECK test now uses _loadconfig().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 651e6703b6dc4d11ba7d6d0b44d3be1f485a0f75)
2011-08-03 16:06:40 +10:00
Martin Schwenke
3a18451cef Test suite: CTDB_NFS_SKIP_SHARE_CHECK test now uses _loadconfig().
The manual replacement of loadconfig() had bit rotted and no longer
worked.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bf23e7166385d305c6860b37c120f70a9aa33aa5)
2011-08-03 16:06:40 +10:00
Martin Schwenke
4f4cf7b100 Test suite: make time logging only happen on a real cluster, not local daemons.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a6b3a7b7db9aa5fc971aae11b9b012e72c7d240c)
2011-08-03 16:06:40 +10:00
Martin Schwenke
bb32a6cf70 Test suite: add time logging.
We're seeing some weirdness with CTDB controls timing out.  We're
wondering if time is jumping forward, so this creates a time log on
each node that we can examine later if tests fail weirdly.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5d82d89ee99f10bead101aebda645a80435ba246)
2011-08-03 16:06:40 +10:00
Martin Schwenke
7cec7807e1 Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.
This sets up a more useful convention and avoids future .gitignore
problems.

Resolved conflict while cherry-picking this:

  Don't take the eventscripts files for this branch.  We'll put them
  elsewhere.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a9879e37d4e3bb714ef6c0c4144c6949daec0b53)
2011-08-03 15:55:35 +10:00
Martin Schwenke
8006aec7b1 Tests: run_tests script no longer prints filename in summary descriptions.
If filenames should be printed in descriptions in the summary then the
descriptions should include the filename.  A better option is to
include something more human-readable that makes the test just as
easily identifiable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0efdbd61bdc2343e5459959b300bccc9986b1d78)
2011-08-03 15:51:44 +10:00
Martin Schwenke
3ee6a63e47 Tests: onnode tests changed to use a simple define_test() function.
This makes global changes easier.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3af086398fecb5f7c501190f9620b9c7b201f0ca)
2011-08-03 15:51:44 +10:00
Martin Schwenke
51ef4b4e55 Tests: add initial onnode tests
Add some simple tests for the onnode command.  These use fake ssh and
ctdb commands that are added to $PATH.  The infrastructure used is
quite flexible and would allow more complex tests to be written.

As-is, these tests expose some bugs in the an older version of onnode
that is included so it can be used to validate some of the tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f7f9d0943474cb2de7832d7ca95210ea9e9c772b)
2011-08-03 15:51:44 +10:00
Martin Schwenke
8d2c726deb Tests: change output format of run_tests script and add -q option
Putting PASSED/FAILED on the left makes it easier to scan the results
and simplifies the code.  Also put starts around the word "*FAILED*"
to make it more obvious.

Also add a -q option to throw away test output and only display the
summary (if -s is also specified).

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c44b632b010b7d57007f3c8f294271c7e0217e0d)
2011-08-03 15:51:44 +10:00
Martin Schwenke
eae91c959e Test suite: add a -d option to the run_tests script.
This causes summary lines (when used with -s) to be pretty printed and
include the test description.  This is the 4th line of the test output
- that is, immediately after the header.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0e5cc2a58b0d38e10a2ef9e81dc887c20f3fbdcb)
2011-08-03 15:51:44 +10:00
Martin Schwenke
07d2ecfbcc ctdb natgwlist should return non-zero when there is no natgw.
This makes it 2, since this error corresponds loosely to ENOENT.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1bf289abdd3067a40e9a67091aba78222d13eddf)
2011-08-03 15:39:33 +10:00
Ronnie Sahlberg
82d59bbc8e make test: add two missing events to the special test eventscript
(This used to be ctdb commit 771b1e9c2e694ccc8825fb8088174c122532e74d)
2011-08-02 19:25:14 +10:00
Martin Schwenke
652bf326e1 Eventscripts - 10.interfaces should not check orphaned interfaces.
If the last IP address on an interfaces is removed then that
interfaces should no longer be checked by 10.interfaces.  However,
"ctdb ifaces" still lists such interfaces so they are currently
checked.

The problem really needs to be addressed in ctdbd but a neat quick
eventscript fix will be minimally invasive...

This changes the code to use "ctdb -Y ip -v" instead of "ctdb -Y
ifaces".  The former includes details of all public addresses and
associated interfaces, so when an address is removed there is no
output for it.  This avoids orphaned interfaces from being listed.

The logic is also slightly improved so that $IFACES includes just a
(non-uniquified) list of interfaces, allowing an existing loop to be
removed.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 49b2d1bd9554461ed8edbfc21e777c0eca9e1443)
2011-08-02 16:53:14 +10:00
Martin Schwenke
7fcfea6141 IP allocation simulation - Pad IPv4 addresses in LCP2 algorithm.
This makes IPv4 addresses comparable with IPv6 but reduces the overall
effectiveness of the algorithm.  The alternative would be to treat
these addresses separately while trying to keep all the IPs in overall
balance...  which is basically the problem that LCP2 solves.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3a7624f9d468b99714a7b6a45313f9e7f66011ed)
2011-07-29 14:32:07 +10:00
Martin Schwenke
0a96e936f2 IP allocation simulation - make stats label for LCP2 imbalance more meaningful.
This time in the stats summary.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit aabb2507dacc63ae026e6c99704a2fb79950e82c)
2011-07-29 14:32:07 +10:00
Martin Schwenke
581375d56d IP allocation simulation - make stats label for LCP2 imbalance more meaningful.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 721a06e28bacf9e03fd8eb4aff53dd17c363ffa1)
2011-07-29 14:32:07 +10:00
Martin Schwenke
adf8dbe8c0 IP allocation simulation - add examples.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8a1ae0c5a3aa788ed0f29c264249ba7bc5d226a7)
2011-07-29 14:32:07 +10:00
Martin Schwenke
85c0b10a38 IP allocation simulation - tighten up termination condition for -x.
When there are IP groups, do not terminate when the overall cluster
goes out of balance.

Also make explicit that grat_ip_moves is an integer not a boolean, so
only terminate if it is greater than 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0899f14b1483682d73d1ee2d2419db54ffeadc4b)
2011-07-29 14:32:07 +10:00