[SCM] Samba Shared Repository - branch v4-6-stable updated

Karolin Seeger kseeger at samba.org
Tue Jun 6 08:01:47 UTC 2017


The branch, v4-6-stable has been updated
       via  1d13a64 VERSION: Disable GIT_SNAPSHOTS for the 4.6.5 release.
       via  c9ad5ad WHATSNEW: Add release notes for Samba 4.6.5.
       via  66529e1 ctdb-common: Fix crash in logging initialisation
       via  620aac7 s3:smbd: Set up local and remote address for fake connection
       via  b925818 s3:smbd: Pass down remote and local address to get_referred_path()
       via  4fc1e91 s4/torture: test for bug 12798
       via  29196ec s3/smbd: fix exclusive lease optimisation
       via  44ca450 s3/locking: make find_share_mode_entry public
       via  06e8eec s3: VFS: Catia: Ensure path name is also converted.
       via  c9b3e8f ctdb-tests: Add some extra tests for "ctdb nodestatus"
       via  0089a4c ctdb-tools: "ctdb nodestatus" should only display header for "all"
       via  3c596dc ctdb-tools: Stop "ctdb nodestatus" from always showing all nodes
       via  5906140 ctdb-readonly: Avoid a tight loop waiting for revoke to complete
       via  049484b Revert "ctdb-readonly: Avoid a tight loop waiting for revoke to complete"
       via  96b8f72 VERSION: Bump version up to 4.6.5.
       via  e3f2d7f Merge tag 'samba-4.6.4' into v4-6-test
       via  4de3ddc s3: smbd: Fix open_files.idl to correctly ignore share_mode_lease *lease in share_mode_entry.
       via  f71feca ctdb-tests: Use tighter pattern for matching expected output
       via  4a33726 ctdb-tests: Explicitly search for the specific log entry
       via  3e50a50 ctdb-logging: Initialize DEBUGLEVEL before changing the value
       via  10b04d7 s3:smbcacls add prompt for password
       via  db9553e idmap_rfc2307: Test unix-ids-to-sids with 35 groups
       via  ea5dd00 selftest: Avoid idmap caching when testing idmap_rfc2307
       via  e0060df idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
       via  0160f27 idmap_rfc2307: Don't stop after 30 entries
       via  c66a8b0 test_idmap_rfc2307: Test wbinfo -r for 35 supplementary group memberships
       via  cbf96d9 test_idmap_rfc2307: Do a recursive delete in ou=idmap
       via  bdea676 test_idmap_rfc2307: Correct usage
       via  301abae test_idmap_rfc2307: Avoid a tmpfile
       via  c2d7a72 test_idmap_rfc2307: Remove the correct file
       via  c73b49e idmap_rfc2307: "ldap_next_entry" needs the previous entry, not the start
       via  117547d idmap_rfc2307: Don't stop after 30 entries
       via  c7bead7 samba-tool: let 'samba-tool user syncpasswords' report deletions immediately
       via  ade0e8f4 s3/smbd: update exclusive oplock optimisation to the lease area
       via  6b3ebfb s3/smbd: update exclusive oplock optimisation to the lease area
       via  11a866e s3/locking: helper functions for lease types
       via  c82072f s3/locking: add const to fsp_lease_type
       via  82317ad systemd: fix detection of libsystemd
       via  17d5052 s3: smbd: inotify_map_mask_to_filter incorrectly indexes an array.
       via  0636b93 s3-tests: assignement in shell shall have no spaces around equal sign
       via  249607c _netr_ServerPasswordSet2: use info level 26 to set plain text machine password
       via  30586d3 vfs_fruit: lp_case_sensitive() does not return a bool
       via  6ffea89 winbindd: only use the domain name from lookup sids if the domain matches
       via  37e26bf winbindd: handling of SIDs without domain reference in wb_sids2xids_lookupsids_done()
       via  73e1f00 vfs_acl_xattr|tdb: ensure create mask is at least 0666 if ignore_system_acls is set
       via  6915ad5 notify: Fix ordering of events in notifyd
       via  9602cd0 VERSION: Bump version up to 4.6.4...
      from  b0b0bf1 VERSION: Disable GIT_SNAPSHOTS for the 4.6.4 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       |  87 +++++++++++++-
 ctdb/common/logging.c                              |   3 +
 ctdb/server/ctdb_call.c                            |  93 +++++++++------
 ctdb/tests/eventd/eventd_051.sh                    |   2 +-
 ctdb/tests/eventd/scripts/local.sh                 |   2 +-
 ...db.nodestatus.001.sh => ctdb.nodestatus.003.sh} |  12 +-
 ...db.nodestatus.001.sh => ctdb.nodestatus.004.sh} |  13 +--
 ctdb/tests/tool/ctdb.nodestatus.005.sh             |  28 +++++
 ctdb/tests/tool/ctdb.nodestatus.006.sh             |  40 +++++++
 ctdb/tools/ctdb.c                                  |  29 ++---
 lib/util/wscript_configure                         |  15 +--
 nsswitch/tests/test_idmap_rfc2307.sh               | 130 ++++++++++++++++-----
 python/samba/netcmd/user.py                        |   2 +-
 selftest/target/Samba3.pm                          |   2 +
 source3/librpc/idl/open_files.idl                  |   2 +-
 source3/locking/leases_util.c                      |  19 ++-
 source3/locking/locking.c                          |   2 +-
 source3/locking/proto.h                            |   6 +-
 source3/locking/share_mode_lock.c                  |   4 +-
 source3/modules/vfs_acl_tdb.c                      |  24 +++-
 source3/modules/vfs_acl_xattr.c                    |  24 +++-
 source3/modules/vfs_catia.c                        |  41 ++++++-
 source3/modules/vfs_default.c                      |   2 +
 source3/modules/vfs_fruit.c                        |  20 +++-
 source3/rpc_server/dfs/srv_dfs_nt.c                |   6 +
 source3/rpc_server/netlogon/srv_netlog_nt.c        |  79 ++++++++++---
 source3/script/tests/test_net_cred_change.sh       |   6 +-
 source3/selftest/tests.py                          |  12 +-
 source3/smbd/msdfs.c                               |  36 +++++-
 source3/smbd/notify_inotify.c                      |   2 +-
 source3/smbd/notifyd/notifyd.c                     |   3 +-
 source3/smbd/oplock.c                              |  37 +++++-
 source3/smbd/proto.h                               |  12 +-
 source3/utils/smbcacls.c                           |   1 +
 source3/winbindd/idmap_rfc2307.c                   |   9 +-
 source3/winbindd/idmap_util.c                      |   5 +-
 source3/winbindd/wb_sids2xids.c                    |  37 +++++-
 source4/torture/smb2/lease.c                       |  82 +++++++++++++
 source4/torture/vfs/fruit.c                        |   4 +-
 40 files changed, 753 insertions(+), 182 deletions(-)
 copy ctdb/tests/tool/{ctdb.nodestatus.001.sh => ctdb.nodestatus.003.sh} (73%)
 copy ctdb/tests/tool/{ctdb.nodestatus.001.sh => ctdb.nodestatus.004.sh} (64%)
 create mode 100755 ctdb/tests/tool/ctdb.nodestatus.005.sh
 create mode 100755 ctdb/tests/tool/ctdb.nodestatus.006.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index b70a49f..8ed646d 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=6
-SAMBA_VERSION_RELEASE=4
+SAMBA_VERSION_RELEASE=5
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index fb533f3..ab2182c 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,87 @@
                    =============================
+                   Release Notes for Samba 4.6.5
+                            June 6, 2017
+                   =============================
+
+
+This is the latest stable release of the Samba 4.6 release series.
+
+
+Changes since 4.6.4:
+---------------------
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 12804: s3: VFS: Catia: Ensure path name is also converted.
+
+o  Christian Ambach <ambi at samba.org>
+   * BUG 12765: s3:smbcacls add prompt for password.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 12562: vfs_acl_xattr|tdb: Ensure create mask is at least 0666 if
+     ignore_system_acls is set.
+   * BUG 12702: Wrong sid->uid mapping for SIDs residing in sIDHistory.
+   * BUG 12749: vfs_fruit: lp_case_sensitive() does not return a bool.
+   * BUG 12766: s3/smbd: Update exclusive oplock optimisation to the lease area.
+   * BUG 12798: s3/smbd: Fix exclusive lease optimisation.
+
+o  Alexander Bokovoy <ab at samba.org>
+   * BUG 12751: Allow passing trusted domain password as plain-text to PASSDB
+     layer.
+   * BUG 12764: systemd: Fix detection of libsystemd.
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 12697: ctdb-readonly: Avoid a tight loop waiting for revoke to
+     complete.
+   * BUG 12770: ctdb-logging: Initialize DEBUGLEVEL before changing the value.
+
+o  Shilpa Krishnareddy <skrishnareddy at panzura.com>
+   * BUG 12756: notify: Fix ordering of events in notifyd.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 12757: idmap_rfc2307: Lookup of more than two SIDs fails.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 12767: samba-tool: Let 'samba-tool user syncpasswords' report deletions
+     immediately.
+
+o  Doug Nazar <nazard at nazar.ca>
+   * BUG 12760: s3: smbd: inotify_map_mask_to_filter incorrectly indexes an
+     array.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 12687: vfs_expand_msdfs tries to open the remote address as a file
+     path.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 12802: 'ctdb nodestatus' incorrectly displays status for all nodes with
+     wrong exit code.
+   * BUG 12814: ctdb-common: Fix crash in logging initialisation.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the "Samba 4.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.6.4
                             May 24, 2017
                    =============================
@@ -47,8 +130,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.6.3
diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index 8e547c9..0e3efe0 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -354,6 +354,7 @@ static int syslog_log_setup_common(TALLOC_CTX *mem_ctx, const char *app_name,
 	state->app_name = app_name;
 	talloc_set_destructor(state, syslog_log_state_destructor);
 
+	*result = state;
 	return 0;
 }
 
@@ -501,6 +502,8 @@ int logging_init(TALLOC_CTX *mem_ctx, const char *logging,
 	char *str, *name, *option;
 	int ret, i;
 
+	setup_logging(app_name, DEBUG_STDERR);
+
 	if (debug_level == NULL) {
 		debug_level = getenv("CTDB_DEBUGLEVEL");
 	}
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 8ce3928..b3bc9cf 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -1562,6 +1562,7 @@ void ctdb_send_keepalive(struct ctdb_context *ctdb, uint32_t destnode)
 
 
 struct revokechild_deferred_call {
+	struct revokechild_deferred_call *prev, *next;
 	struct ctdb_context *ctdb;
 	struct ctdb_req_header *hdr;
 	deferred_requeue_fn fn;
@@ -1577,50 +1578,31 @@ struct revokechild_handle {
 	int fd[2];
 	pid_t child;
 	TDB_DATA key;
-};
-
-struct revokechild_requeue_handle {
-	struct ctdb_context *ctdb;
-	struct ctdb_req_header *hdr;
-	deferred_requeue_fn fn;
-	void *ctx;
+	struct revokechild_deferred_call *deferred_call_list;
 };
 
 static void deferred_call_requeue(struct tevent_context *ev,
 				  struct tevent_timer *te,
 				  struct timeval t, void *private_data)
 {
-	struct revokechild_requeue_handle *requeue_handle = talloc_get_type(private_data, struct revokechild_requeue_handle);
-
-	requeue_handle->fn(requeue_handle->ctx, requeue_handle->hdr);
-	talloc_free(requeue_handle);
-}
+	struct revokechild_deferred_call *dlist = talloc_get_type_abort(
+		private_data, struct revokechild_deferred_call);
 
-static int deferred_call_destructor(struct revokechild_deferred_call *deferred_call)
-{
-	struct ctdb_context *ctdb = deferred_call->ctdb;
-	struct revokechild_requeue_handle *requeue_handle = talloc(ctdb, struct revokechild_requeue_handle);
-
-	requeue_handle->ctdb = ctdb;
-	requeue_handle->hdr  = deferred_call->hdr;
-	requeue_handle->fn   = deferred_call->fn;
-	requeue_handle->ctx  = deferred_call->ctx;
-	talloc_steal(requeue_handle, requeue_handle->hdr);
-
-	/* Always delay revoke requests.  Either wait for the read/write
-	 * operation to complete, or if revoking failed wait for recovery to
-	 * complete
-	 */
-	tevent_add_timer(ctdb->ev, requeue_handle,
-			 timeval_current_ofs(1, 0),
-			 deferred_call_requeue, requeue_handle);
+	while (dlist != NULL) {
+		struct revokechild_deferred_call *dcall = dlist;
 
-	return 0;
+		DLIST_REMOVE(dlist, dcall);
+		dcall->fn(dcall->ctx, dcall->hdr);
+		talloc_free(dcall);
+	}
 }
 
 
 static int revokechild_destructor(struct revokechild_handle *rc)
 {
+	struct revokechild_deferred_call *now_list = NULL;
+	struct revokechild_deferred_call *delay_list = NULL;
+
 	if (rc->fde != NULL) {
 		talloc_free(rc->fde);
 	}
@@ -1634,6 +1616,48 @@ static int revokechild_destructor(struct revokechild_handle *rc)
 	ctdb_kill(rc->ctdb, rc->child, SIGKILL);
 
 	DLIST_REMOVE(rc->ctdb_db->revokechild_active, rc);
+
+	while (rc->deferred_call_list != NULL) {
+		struct revokechild_deferred_call *dcall;
+
+		dcall = rc->deferred_call_list;
+		DLIST_REMOVE(rc->deferred_call_list, dcall);
+
+		/* If revoke is successful, then first process all the calls
+		 * that need write access, and delay readonly requests by 1
+		 * second grace.
+		 *
+		 * If revoke is unsuccessful, most likely because of node
+		 * failure, delay all the pending requests, so database can
+		 * be recovered.
+		 */
+
+		if (rc->status == 0) {
+			struct ctdb_req_call_old *c;
+
+			c = (struct ctdb_req_call_old *)dcall->hdr;
+			if (c->flags & CTDB_WANT_READONLY) {
+				DLIST_ADD(delay_list, dcall);
+			} else {
+				DLIST_ADD(now_list, dcall);
+			}
+		} else {
+			DLIST_ADD(delay_list, dcall);
+		}
+	}
+
+	if (now_list != NULL) {
+		tevent_add_timer(rc->ctdb->ev, rc->ctdb_db,
+				 tevent_timeval_current_ofs(0, 0),
+				 deferred_call_requeue, now_list);
+	}
+
+	if (delay_list != NULL) {
+		tevent_add_timer(rc->ctdb->ev, rc->ctdb_db,
+				 tevent_timeval_current_ofs(1, 0),
+				 deferred_call_requeue, delay_list);
+	}
+
 	return 0;
 }
 
@@ -1911,19 +1935,18 @@ int ctdb_add_revoke_deferred_call(struct ctdb_context *ctdb, struct ctdb_db_cont
 		return -1;
 	}
 
-	deferred_call = talloc(rc, struct revokechild_deferred_call);
+	deferred_call = talloc(ctdb_db, struct revokechild_deferred_call);
 	if (deferred_call == NULL) {
 		DEBUG(DEBUG_ERR,("Failed to allocate deferred call structure for revoking record\n"));
 		return -1;
 	}
 
 	deferred_call->ctdb = ctdb;
-	deferred_call->hdr  = hdr;
+	deferred_call->hdr  = talloc_steal(deferred_call, hdr);
 	deferred_call->fn   = fn;
 	deferred_call->ctx  = call_context;
 
-	talloc_set_destructor(deferred_call, deferred_call_destructor);
-	talloc_steal(deferred_call, hdr);
+	DLIST_ADD(rc->deferred_call_list, deferred_call);
 
 	return 0;
 }
diff --git a/ctdb/tests/eventd/eventd_051.sh b/ctdb/tests/eventd/eventd_051.sh
index 213965a..46162de 100755
--- a/ctdb/tests/eventd/eventd_051.sh
+++ b/ctdb/tests/eventd/eventd_051.sh
@@ -20,4 +20,4 @@ simple_test run monitor 30
 required_result 0 <<EOF
 ctdb-eventd[PID]: 01.test: Running event monitor
 EOF
-unit_test tail -n 1 "$eventd_logfile"
+unit_test grep "01.test:" "$eventd_logfile"
diff --git a/ctdb/tests/eventd/scripts/local.sh b/ctdb/tests/eventd/scripts/local.sh
index 61fff8c..343205e 100644
--- a/ctdb/tests/eventd/scripts/local.sh
+++ b/ctdb/tests/eventd/scripts/local.sh
@@ -122,7 +122,7 @@ simple_test ()
 
 result_filter ()
 {
-	_duration="[0-9]*\.[0-9][0-9][0-9]"
+	_duration="\<[0-9][0-9]*\.[0-9][0-9][0-9]\>"
 	_day="\(Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun\)"
 	_month="\(Jan\|Feb\|Mar\|Apr\|May\|Jun\|Jul\|Aug\|Sep\|Oct\|Nov\|Dec\)"
 	_date="\( [0-9]\|[0-9][0-9]\)"
diff --git a/ctdb/tests/tool/ctdb.nodestatus.001.sh b/ctdb/tests/tool/ctdb.nodestatus.003.sh
similarity index 73%
copy from ctdb/tests/tool/ctdb.nodestatus.001.sh
copy to ctdb/tests/tool/ctdb.nodestatus.003.sh
index 2217afc..5912e65 100755
--- a/ctdb/tests/tool/ctdb.nodestatus.001.sh
+++ b/ctdb/tests/tool/ctdb.nodestatus.003.sh
@@ -2,11 +2,11 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "all, 3 nodes, all OK"
+define_test "all, 3 nodes, 1 unhealthy"
 
 setup_ctdbd <<EOF
 NODEMAP
-0       192.168.20.41   0x0
+0       192.168.20.41   0x2
 1       192.168.20.42   0x0
 2       192.168.20.43   0x0     CURRENT RECMASTER
 
@@ -16,17 +16,17 @@ IFACES
 :eth1:1:4:
 EOF
 
-required_result 0 <<EOF
+required_result 2 <<EOF
 Number of nodes:3
-pnn:0 192.168.20.41    OK
+pnn:0 192.168.20.41    UNHEALTHY
 pnn:1 192.168.20.42    OK
 pnn:2 192.168.20.43    OK (THIS NODE)
 EOF
 simple_test all
 
-required_result 0 <<EOF
+required_result 2 <<EOF
 |Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
-|0|192.168.20.41|0|0|0|0|0|0|0|N|
+|0|192.168.20.41|0|0|0|1|0|0|0|N|
 |1|192.168.20.42|0|0|0|0|0|0|0|N|
 |2|192.168.20.43|0|0|0|0|0|0|0|Y|
 EOF
diff --git a/ctdb/tests/tool/ctdb.nodestatus.001.sh b/ctdb/tests/tool/ctdb.nodestatus.004.sh
similarity index 64%
copy from ctdb/tests/tool/ctdb.nodestatus.001.sh
copy to ctdb/tests/tool/ctdb.nodestatus.004.sh
index 2217afc..01ccd51 100755
--- a/ctdb/tests/tool/ctdb.nodestatus.001.sh
+++ b/ctdb/tests/tool/ctdb.nodestatus.004.sh
@@ -2,11 +2,11 @@
 
 . "${TEST_SCRIPTS_DIR}/unit.sh"
 
-define_test "all, 3 nodes, all OK"
+define_test "current, 3 nodes, node 0 unhealthy"
 
 setup_ctdbd <<EOF
 NODEMAP
-0       192.168.20.41   0x0
+0       192.168.20.41   0x2
 1       192.168.20.42   0x0
 2       192.168.20.43   0x0     CURRENT RECMASTER
 
@@ -17,17 +17,12 @@ IFACES
 EOF
 
 required_result 0 <<EOF
-Number of nodes:3
-pnn:0 192.168.20.41    OK
-pnn:1 192.168.20.42    OK
 pnn:2 192.168.20.43    OK (THIS NODE)
 EOF
-simple_test all
+simple_test
 
 required_result 0 <<EOF
 |Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
-|0|192.168.20.41|0|0|0|0|0|0|0|N|
-|1|192.168.20.42|0|0|0|0|0|0|0|N|
 |2|192.168.20.43|0|0|0|0|0|0|0|Y|
 EOF
-simple_test -X all
+simple_test -X
diff --git a/ctdb/tests/tool/ctdb.nodestatus.005.sh b/ctdb/tests/tool/ctdb.nodestatus.005.sh
new file mode 100755
index 0000000..0cd24ba
--- /dev/null
+++ b/ctdb/tests/tool/ctdb.nodestatus.005.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "current, 3 nodes, node 0 unhealthy, query node 0"
+
+setup_ctdbd <<EOF
+NODEMAP
+0       192.168.20.41   0x2
+1       192.168.20.42   0x0
+2       192.168.20.43   0x0     CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF
+
+required_result 2 <<EOF
+pnn:0 192.168.20.41    UNHEALTHY
+EOF
+simple_test 0
+
+required_result 2 <<EOF
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
+|0|192.168.20.41|0|0|0|1|0|0|0|N|
+EOF
+simple_test -X 0
diff --git a/ctdb/tests/tool/ctdb.nodestatus.006.sh b/ctdb/tests/tool/ctdb.nodestatus.006.sh
new file mode 100755
index 0000000..ec189fc
--- /dev/null
+++ b/ctdb/tests/tool/ctdb.nodestatus.006.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "current, 3 nodes, node 0 disabled+stopped, various queries"
+
+setup_ctdbd <<EOF
+NODEMAP
+0       192.168.20.41   0x24
+1       192.168.20.42   0x0
+2       192.168.20.43   0x0     CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF
+
+required_result 36 <<EOF
+pnn:0 192.168.20.41    DISABLED|STOPPED|INACTIVE
+EOF
+simple_test 0
+
+required_result 36 <<EOF
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
+|0|192.168.20.41|0|0|1|0|1|1|0|N|
+EOF
+simple_test -X 0
+
+required_result 36 <<EOF
+pnn:0 192.168.20.41    DISABLED|STOPPED|INACTIVE
+pnn:1 192.168.20.42    OK
+EOF
+simple_test 0,1
+
+required_result 0 <<EOF
+pnn:1 192.168.20.42    OK
+pnn:2 192.168.20.43    OK (THIS NODE)
+EOF
+simple_test 1,2
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 050906c..93e4802 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -802,7 +802,8 @@ static void print_nodemap_machine(TALLOC_CTX *mem_ctx,
 }
 
 static void print_nodemap(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
-			  struct ctdb_node_map *nodemap, uint32_t mypnn)
+			  struct ctdb_node_map *nodemap, uint32_t mypnn,
+			  bool print_header)
 {
 	struct ctdb_node_and_flags *node;
 	int num_deleted_nodes = 0;
@@ -814,11 +815,14 @@ static void print_nodemap(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
 		}
 	}
 
-	if (num_deleted_nodes == 0) {
-		printf("Number of nodes:%d\n", nodemap->num);
-	} else {
-		printf("Number of nodes:%d (including %d deleted nodes)\n",
-		       nodemap->num, num_deleted_nodes);
+	if (print_header) {
+		if (num_deleted_nodes == 0) {
+			printf("Number of nodes:%d\n", nodemap->num);
+		} else {
+			printf("Number of nodes:%d "
+			       "(including %d deleted nodes)\n",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list