1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

3426 Commits

Author SHA1 Message Date
Rusty Russell
55010cab63 tdb: fix short write logic in tdb_new_database
Commit 207a213c/24fed55d purported to fix the problem of signals during
tdb_new_database (which could cause a spurious short write, hence a failure).
However, the code is wrong: newdb+written is not correct.

Fix this by introducing a general tdb_write_all() and using it here and in
the tracing code.

Cc: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 27ba0e5a6681063225df7244a85aa304c51c6948)
2010-08-16 10:20:19 +09:30
Martin Schwenke
03aa9ee702 Test suite: strengthen function _cluster_is_healthy().
If there's a chance that "ctdb status -Y" can return 0 but print
garbage then this function might return a false positive.

So, we do 2 things:

* Redirect stderr to >/dev/null rather than looking at it.  This
  minimises the chance that we will see garbage.

* Since we need at least 1 good line to decide the cluster is healthy,
  we sanity check each line to esnure it starts with :[0-9].

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

(This used to be ctdb commit d4189c7c3fceaa833f9f0446a2b06af6fed714ec)
2010-08-13 17:01:54 +10:00
Martin Schwenke
a9fb1e318b Test suite: use $CTDB rather than ctdb everywhere in ctdb_test_functions.sh.
Also ensure that $CTDB is set by default it to "ctdb".

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

(This used to be ctdb commit 8222fef1e61836b9bfd406205f9ffb9396aa7480)
2010-08-12 14:13:07 +10:00
Martin Schwenke
00fec0e76c Test suite: improve wait_until_node_has_status()
This currently does "onnode any ... wait_until ...".  If ctdbd is
being shutdown on a node then that node might be chosen anyway, if it
is asked early enough.  Then we'll loop on that node but our ctdb
client command may always fail, causing a timeout rather than the
expected behaviour.

This puts the loop on the outside of the "onnode any" so that if the
"wrong" node is chosen initially then on the next iteration the choice
can be remade.

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

(This used to be ctdb commit a88ee78686bd5aa2b789f5959e0562315a13525d)
2010-08-12 13:48:33 +10:00
Martin Schwenke
d549c31031 Test suite: make addip test use $CTDB rather than ctdb in debug code.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5bb6b28ab7b45b7242d100ae8f1483d02e1d0d1d)
2010-08-11 16:55:33 +10:00
Ronnie Sahlberg
8b0bbf960b Create a new command "ctdb sync" that isd just an alias for "ctdb ipreallocate"
(This used to be ctdb commit eededd592c92c59b435f0046989b2327fcc280b1)
2010-08-10 09:49:55 +10:00
Ronnie Sahlberg
7139faaeac Update a log message to reflect that this does no longer only happen
when trying/failing to ban a node.

(This used to be ctdb commit dc6b143c4785449e8c4ef7a46bf16adba750ab56)
2010-08-10 09:48:50 +10:00
Rusty Russell
a65cb6a9ae libctdb: add synchronous message handling and unregister, with tests.
It turns out that we *do* want a separate private arg for the message
handler and the completion callback, so we change that.

We also fix the prototypes of the remove_message functions as we
implement them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 332375246eccd95da626f434f6d49dd9458a9787)
2010-08-09 15:41:32 +09:30
Ronnie Sahlberg
f7ead50738 Merge remote branch 'martins/master'
(This used to be ctdb commit 9ca09ee9129b787428a2ceac9731b12166dc8718)
2010-08-09 11:35:38 +10:00
Martin Schwenke
0f18859a6c Add some command-line options to ctdb_diagnostics.
In some contexts ctdb_diagnostics generates too many errors when it is
run on heterogeneous and machine-configured clusters.  In some
clusters some nodes are expected to be differently configured and also
machine-generated configured files can have comments containing
timestamps.

This adds some command-line options that can be used to reduce the
number of errors reported:

    -n <nodes>  Comma separated list of nodes to operate on
    -c          Ignore comment lines (starting with '#') in file comparisons
    -w          Ignore whitespace in file comparisons
    --no-ads    Do not use commands that assume an Active Directory Server

The -n option simply allows ctdb_diagnostics to operate on a subset of
nodes, avoiding file comparisons with and data collection on nodes
that are differently configured.  For file comparisons, instead of
showing each file on the current node and then comparing other nodes
to that file, the file from the first (available or requested) nodes
is shown and then other nodes are compared to that.  That has resulted
in changes in output - that is, ctdb diagnostics no longer prints
messages referencing the current node.

-c and -w are used to weaken comparisons between configuration files.

--no-ads can be used to avoid running ADS-specific commands if a
cluster uses LDAP (or other non-ADS) configuration.

This also fixes a number of bugs in related code:

* A call to onnode was losing the >> NODE ...  << lines because they
  now go to stderr.  This was changed in onnode long ago but
  ctdb_diagnostics was never updated to match.

* ctdb_diagnostics was counting lines in /etc/ctdb/nodes to determine
  what nodes to operate on.  For some time the nodes file has
  supported syntax that makes this invalid.  "ctdb listnodes -Y" is
  now used to list available nodes.

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

(This used to be ctdb commit 36c8244a0f68c7c9bbee40982f230e9d14d3c0ea)
2010-08-06 11:10:56 +10:00
Ronnie Sahlberg
4424c115cb iupdate the docs that ctdb freeze is no more
(This used to be ctdb commit 79ef9909dfa0904d789c69eb6b9c80e8908a1100)
2010-08-05 16:35:37 +10:00
Ronnie Sahlberg
043045dcc5 remove the "ctdb freeze" debugging command
(This used to be ctdb commit bd005b987255eb65cd3826dce984281ee757daf6)
2010-08-05 16:30:47 +10:00
Martin Schwenke
b50ec65963 Test suite: remove unnecessary verbosity from enable/continue tests.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 69c95b2a42f55b80cd8d91a90ab55166f964163b)
2010-08-05 16:03:21 +10:00
Martin Schwenke
f66b5b46d6 Test suite: Fix typo in continue test.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c2bce140da7c4b118394ee77bb9d0348d27e7e95)
2010-08-05 16:01:23 +10:00
Martin Schwenke
77ad2be488 Test suite: weaken ctdb continue/enable tests for non-deterministic IPs.
These tests currently wait for the old IPs to fail back to the test
node.  This isn't guaranteed with DeterministicIPs disabled.

This changes those tests to wait until the test node gets at least 1
IP assigned.

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

(This used to be ctdb commit e9b3f5b1b51d541a911a27eb4348b368f28d185e)
2010-08-05 15:58:56 +10:00
Martin Schwenke
b930c885b3 initscript: wait until we can ping ctdbd before setting tunables.
Currently we do a "sleep 1" after starting and before running
set_ctdb_variables to set the tunables.  This is too arbitrary and
might fail if the system is heavily loaded.  This, for example, could
result in some nodes running with DeterministicIPs and some without,
in which case a different IP allocation algorithm would run depending
on who is the recmaster!

This makes the start function wait until "ctdb ping" succeeds (with 10
second timeout) before trying to run set_ctdb_variables.  If a timeout
occurs then the start function attempts to kill ctdbd before exiting
with a failure.

It also cleans up the status reporting code for Red Hat and SUSE so
that the final status code is reported.  Currently there are cases
where a correct status is prematurely reported before a failure
occurs.

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

(This used to be ctdb commit cdcd05662a30b51caaeeab4ac44138cac2474e0a)
2010-08-05 15:29:40 +10:00
Martin Schwenke
774582c360 Test suite - make the ctdb_fetch test cope with "Reqid wrap!" messages.
Recent CTDB notice the wrap and print this message.  The test needs to
cope.

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

(This used to be ctdb commit b93b60ec96d02ce4f54921e85a5c5554d1fc0c55)
2010-08-05 13:43:50 +10:00
Martin Schwenke
dff9282917 Test suite: remove thaw/freeze tests.
They test debugging commands that no longer operate as expected.

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

(This used to be ctdb commit d33fa4d6557aab1938049f194c2de55f2c395bd2)
2010-08-05 11:40:05 +10:00
Martin Schwenke
4817f7e4ba Test suite - fix addip test.
The test currently checks that all existing IPs plus the newly added
IP are on the test node after "ctdb addip" is run.  With
DeterministicIPs enabled, if the new IP is "before" other IPs then the
other IPs may be shuffled by the deterministic IPs modulo algorithm.
This will happen on the 1st recovery after the move.  Sometimes this
recovery happens before we get the list of IPs to check and sometimes
after, so the test is racy.

The fix is to simply check for the presence of the new IP and not
worry about the others.  This reduces whatever value this test
had... but you can't have everything.

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

(This used to be ctdb commit 1ef7c8e64c7a39330be09ae4d00b70238133e0b5)
2010-08-04 16:08:12 +10:00
Martin Schwenke
9aa6a99740 Merge remote branch 'martins/master'
(This used to be ctdb commit 5d9e4b6ee7d2b5290a74e7be79bdf51a43b72f43)
2010-08-04 16:05:39 +10:00
Martin Schwenke
7edcb89857 Test suite - try to make addip test more reliable and add some debugging.
This test is failing in some situations.  The "ctdb addip" command
works but the IP never appears in the "ctdb ip" output.

Try restricting the last octet to be between 101-199.  At the moment
addresses like 10.0.2.1 are being chosen and these are often the
address of the host machine in autocluster configurations... so might
cause weirdness.

Also add some debugging if checking for the IP address times out.

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

(This used to be ctdb commit ae52cb63756bc60de8d32e01bac5d70975a1c7a0)
2010-08-04 13:16:06 +10:00
Martin Schwenke
807567e992 Testing: IP allocation simulation - add option to change odds of a failure.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b2a2e301025d7fbfe5eeaac436693cde6d404490)
2010-08-03 11:51:14 +10:00
Martin Schwenke
4ffb6495ff Testing: IP allocation simulation - clean up usage message.
Group options better and make the language consistent between options.

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

(This used to be ctdb commit bc38c17e4115fae00c89d00537fdcfe621111b37)
2010-08-03 11:41:50 +10:00
Martin Schwenke
4728bf6ece Testing: IP allocation simulation - print maximum number of unhealthy nodes.
This can imply something about imbalance.

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

(This used to be ctdb commit ecb80e2b6be9326708d1fc87ad3028c6836d5858)
2010-08-03 11:37:34 +10:00
Martin Schwenke
8ca925fe5d Testing: IP allocation simulation - improve help for options.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 058501b92f602e7d2240d1cb08ed78a807564c48)
2010-08-03 11:36:33 +10:00
Martin Schwenke
8cc6ed1d0e Testing: IP allocation simulation - make usage/failure more obvious.
Tweak the usage message for -g option.

Print an error if no node groups defined, instead of curious Python
error.

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

(This used to be ctdb commit 8b883eb9346b8278d268e35b56ac680cd9526b97)
2010-08-02 15:46:23 +10:00
Martin Schwenke
326514f152 Testing: IP allocation simulation - rename an example to node_group_extra.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 974f849df0aca2cfedb38fa815894955e32803a8)
2010-08-02 15:09:13 +10:00
Martin Schwenke
d438b2398f Testing: IP allocation simulation - rename an example to node_group_simple.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0a2a5602233a8208e2729192e50d816faed0151a)
2010-08-02 15:07:56 +10:00
Martin Schwenke
4af049780a Testing: IP allocation simulation - add general node group example.
This allows node pool configuration to be specifed on the
command-line.

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

(This used to be ctdb commit d382d9023928f75f360a115ae1e9c1036423416e)
2010-08-02 15:06:39 +10:00
Martin Schwenke
0fdd7566c7 Testing: IP allocation simulation - update options processing in examples.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a65ca1a71386f40080dd553756f3600d3b20d523)
2010-08-02 15:01:47 +10:00
Martin Schwenke
ecdbd99557 Testing: IP allocation simulation - Update README.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ed64b7f2b3cd920bb0f5dfd7f64ed0afc0b99fc1)
2010-08-02 14:58:15 +10:00
Martin Schwenke
ae0f339173 Testing: IP allocation simulation - fix nondeterminism in do_something_random().
The current code makes random choices from unsorted lists.  This
ensures the lists are sorted.

Also, make the code easier to read by doing the random selction from
lists of PNNs rather than lists of Node objects.

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

(This used to be ctdb commit a01244499dc3567f5aa934b1864b9bc183a6c242)
2010-08-02 14:24:00 +10:00
Martin Schwenke
eac5edf322 Testing: IP allocation simulation - Tweak options handling and Cluster.diff().
process_args() must now be called by programs inporting this module.
Options are put into global variable "options", which can be
references using "ctdb_takeover.options".

Can now pass extra option specifications to process_args().

Remove global variable prev and make it a Cluster object variable.

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

(This used to be ctdb commit a32298e7bc819694518e859f100f9444ff5663cd)
2010-08-02 14:20:12 +10:00
Martin Schwenke
ef77f613fa Testing: IP allocation simulation - update copyright message.
There's a lot of new code here, so let's make the copyright message
make sense.

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

(This used to be ctdb commit e6e56e5989def6704b116e806c1f261c7f3fc03f)
2010-08-02 14:16:02 +10:00
Martin Schwenke
de4223fa54 Testing: IP allocation simulation - add command line option for random seed.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8362029c7cfc1041e46ee2116aa5cade6edce435)
2010-08-01 11:53:28 +10:00
Martin Schwenke
2e570851d5 Testing: IP allocation simulation - save some warnings for verbose mode.
We don't need to see warnings about unallocatable IPs unless we're in
verbose mode.  Can node be run with -n (and without -v or -d) to see
just the statistics.

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

(This used to be ctdb commit 55370936ac5def5ebf138910388a2ddc2df9c20f)
2010-08-01 11:41:52 +10:00
Martin Schwenke
d7d2c64834 Testing: IP allocation simulation prints final imbalance in statistics.
This is useful to know.  When things get unbalance they tend to stay
that way.

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

(This used to be ctdb commit a40faa2096effc2657ac05b729f3259bbb2e1fed)
2010-08-01 11:41:02 +10:00
Martin Schwenke
d7e996915c Testing: In IP allocation simulation count total number of events.
This starts at -1 because we always have to do the initial allocation.

No longer print event number for each event by default, only when
verbose is enabled.

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

(This used to be ctdb commit c9a761726d141bcaa8ba7851150f71a8130b473a)
2010-08-01 11:39:30 +10:00
Martin Schwenke
88337cb080 Testing: Add imbalance information to IP allocation simulation.
Implement the imbalance calculations.

Also add command-line option to display imbalance for each step.

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

(This used to be ctdb commit f50a12f6d06ed67efadd2a892d62c01e67310e7d)
2010-08-01 11:37:35 +10:00
Martin Schwenke
3db0288a41 Merge branch 'master' of git://git.samba.org/sahlberg/ctdb
(This used to be ctdb commit 12e07ccb4b57aca8b5b1b38ce711c7755c67f106)
2010-07-31 20:34:45 +10:00
Martin Schwenke
f73f2d7581 Testing: Add Python IP allocation simulation.
Includes simulation module and example scenarios.  This allows you to
test and perhaps tweak an algorithm that should be the same as the
current CTDB IP reallocation one.

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

(This used to be ctdb commit d148e7a7cb840febbdf56ba2e39c314cc2d7ac24)
2010-07-30 16:50:45 +10:00
Martin Schwenke
fe64a8f87a Optimise 61.nfstickle to write the tickles more efficiently.
Currently the file for each IP address is reopened to append the
details of each source socket.

This optimisation puts all the logic into awk, including the matching
of output lines from netstat.  The source sockets for each for each
destination IP are written into an array entry and then each array
entry is written to the corresponding file in a single operation.

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

(This used to be ctdb commit 6549e9b01538998d51a5f72bfc569776d232b024)
2010-07-30 16:50:18 +10:00
Martin Schwenke
5027d2b8b0 Test suite: handle extra lines in statistics output.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b2362cc7773bb08c7dfdaf2c87d4b59460686659)
2010-07-30 16:50:00 +10:00
Martin Schwenke
697fcfd15a Test suite: handle change to disconnected node error message.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 20ea31e4ed893eb58cb2efa0b6fb13bcf4031918)
2010-07-30 16:49:51 +10:00
Martin Schwenke
7c939e5fbf Testing: Add Python IP allocation simulation.
Includes simulation module and example scenarios.  This allows you to
test and perhaps tweak an algorithm that should be the same as the
current CTDB IP reallocation one.

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

(This used to be ctdb commit 10e701fa9bba2a166c947a5a18f231ff64d9b861)
2010-07-30 16:45:36 +10:00
Ronnie Sahlberg
ddb1c74066 Add a code-style document.
Shamelessly sto^H^H^Hborrowed from samba3.

(This used to be ctdb commit 8024d9e2d589bfe4dee1cb9a79bec663738cb7fa)
2010-07-30 16:37:22 +10:00
Stefan Metzmacher
794230775c events/10.interface: we need to mark interfaces as "up" if we don't know how to monitor them
metze

(This used to be ctdb commit 1e08d1578d1960fcfc5fdd85492fbd6d194e5e94)
2010-07-30 16:33:27 +10:00
Ronnie Sahlberg
c5de7cfb8c Merge commit 'rusty/master'
(This used to be ctdb commit b4391c00476cde74101736986dfcd2be6c959edc)
2010-07-30 16:25:40 +10:00
Evan Kinney
0557c418e3 ctdb: Fixed use of reserved word "private" in typedefs
In include/ctdb.h, ctdb_callback_t and ctdb_rrl_callback_t were
defined with a void *private variable. The variable name was
changed to void *private_data to avoid issues encountered in
the Samba autoconf script.

Evan Kinney <evan.kinney@sas.com>

(This used to be ctdb commit 1f453aa4b5e749468c7788afac09c6f0900ea18f)
2010-07-29 17:16:36 +10:00
Martin Schwenke
320d85195d Optimise 61.nfstickle to write the tickles more efficiently.
Currently the file for each IP address is reopened to append the
details of each source socket.

This optimisation puts all the logic into awk, including the matching
of output lines from netstat.  The source sockets for each for each
destination IP are written into an array entry and then each array
entry is written to the corresponding file in a single operation.

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

(This used to be ctdb commit 53e6b9d1ba379ae27433871d1741c894cd71ccc1)
2010-07-26 16:22:59 +10:00