[SCM] Samba Shared Repository - branch master updated

David Disseldorp ddiss at samba.org
Thu Sep 24 00:53:02 UTC 2020


The branch, master has been updated
       via  68b981ee8a1 ctdb/test_ceph_rados_reclock: check for service registration
       via  55dbd1080d8 ctdb/doc: mention ctdb_mutex_ceph_rados_helper mgr registration
       via  ff36cb74025 ctdb/ceph: register recovery lock holder with ceph-mgr
      from  56f022c3f8b smbd: Propagate reload-config message to all worker smbds

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 68b981ee8a1f2feb39ea679ac504f398ad5d71e8
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Sep 23 00:14:25 2020 +0200

    ctdb/test_ceph_rados_reclock: check for service registration
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Thu Sep 24 00:52:42 UTC 2020 on sn-devel-184

commit 55dbd1080d876c92eebf31c50b8b38a11bb7a8de
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Sep 22 23:53:58 2020 +0200

    ctdb/doc: mention ctdb_mutex_ceph_rados_helper mgr registration
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit ff36cb740251e64661f3877397b7c97efc4f2b4d
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Sep 22 23:17:14 2020 +0200

    ctdb/ceph: register recovery lock holder with ceph-mgr
    
    The Ceph Manager's service map is useful for tracking the status of
    Ceph related services. By registering the CTDB recovery lock holder,
    Ceph storage administrators can more easily identify where and when a
    CTDB cluster is up and running.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml    |  4 ++++
 ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c | 33 +++++++++++++++++++++++++-
 ctdb/utils/ceph/test_ceph_rados_reclock.sh     |  8 ++++++-
 3 files changed, 43 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml b/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml
index b9a5d3aecc3..e055dbba614 100644
--- a/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml
+++ b/ctdb/doc/ctdb_mutex_ceph_rados_helper.7.xml
@@ -42,6 +42,10 @@ Object: Ceph RADOS object name
       located in a librados default search path (e.g. /etc/ceph/).
       <parameter>Pool</parameter> must already exist.
     </para>
+    <para>
+      For informational purposes, ctdb_mutex_ceph_rados_helper will also
+      register the recovery lock holder in Ceph Manager's service map.
+    </para>
   </refsect1>
 
   <refsect1>
diff --git a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c
index 7ef76c26e02..bdbb8df7104 100644
--- a/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c
+++ b/ctdb/utils/ceph/ctdb_mutex_ceph_rados_helper.c
@@ -1,7 +1,7 @@
 /*
    CTDB mutex helper using Ceph librados locks
 
-   Copyright (C) David Disseldorp 2016-2018
+   Copyright (C) David Disseldorp 2016-2020
 
    Based on ctdb_mutex_fcntl_helper.c, which is:
    Copyright (C) Martin Schwenke 2015
@@ -267,6 +267,31 @@ static int ctdb_mutex_rados_state_destroy(struct ctdb_mutex_rados_state *cmr_sta
 	return 0;
 }
 
+/* register this host+service with ceph-mgr for visibility */
+static int ctdb_mutex_rados_mgr_reg(rados_t ceph_cluster)
+{
+	int ret;
+	uint64_t instance_guid;
+	char id_buf[128];
+
+	instance_guid = rados_get_instance_id(ceph_cluster);
+	ret = snprintf(id_buf, sizeof(id_buf), "%s:0x%016llx",
+			"ctdb_mutex_ceph_rados_helper",
+			(unsigned long long)instance_guid);
+	if (ret < 0 || ret >= sizeof(id_buf)) {
+		fprintf(stderr, "Ceph instance name too long\n");
+		return -ENAMETOOLONG;
+	}
+
+	ret = rados_service_register(ceph_cluster, "ctdb", id_buf, "");
+	if (ret < 0) {
+		fprintf(stderr, "failed to register service with ceph-mgr\n");
+		return ret;
+	}
+
+	return 0;
+}
+
 int main(int argc, char *argv[])
 {
 	int ret;
@@ -380,6 +405,12 @@ int main(int argc, char *argv[])
 		goto err_ctx_cleanup;
 	}
 
+	ret = ctdb_mutex_rados_mgr_reg(cmr_state->ceph_cluster);
+	if (ret < 0) {
+		fprintf(stderr, "Failed to register with ceph-mgr\n");
+		/* ignore: ceph-mgr service registration is informational */
+	}
+
 	ret = ctdb_mutex_rados_lock(cmr_state->ioctx, cmr_state->object,
 				    cmr_state->lock_duration_s,
 				    0);
diff --git a/ctdb/utils/ceph/test_ceph_rados_reclock.sh b/ctdb/utils/ceph/test_ceph_rados_reclock.sh
index 68b44ff997f..1848c104ea5 100755
--- a/ctdb/utils/ceph/test_ceph_rados_reclock.sh
+++ b/ctdb/utils/ceph/test_ceph_rados_reclock.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 # standalone test for ctdb_mutex_ceph_rados_helper
 #
-# Copyright (C) David Disseldorp 2016
+# Copyright (C) David Disseldorp 2016-2020
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@ OBJECT="ctdb_reclock"			# RADOS object: target for lock requests
 # - using ctdb_mutex_ceph_rados_helper, take a lock on the Ceph RADOS object at
 #   CLUSTER/$POOL/$OBJECT using the Ceph keyring for $USER
 #   + confirm that lock is obtained, via ctdb_mutex_ceph_rados_helper "0" output
+# - check for ceph-mgr service registration
 # - check RADOS object lock state, using the "rados lock info" command
 # - attempt to obtain the lock again, using ctdb_mutex_ceph_rados_helper
 #   + confirm that the lock is not successfully taken ("1" output=contention)
@@ -41,6 +42,7 @@ function _fail() {
 # this test requires the Ceph "rados" binary, and "jq" json parser
 which jq > /dev/null || exit 1
 which rados > /dev/null || exit 1
+which ceph > /dev/null || exit 1
 which ctdb_mutex_ceph_rados_helper || exit 1
 
 TMP_DIR="$(mktemp --directory)" || exit 1
@@ -60,6 +62,10 @@ first_out=$(cat ${TMP_DIR}/first)
 [ "$first_out" == "0" ] \
 	|| _fail "expected lock acquisition (0), but got $first_out"
 
+ceph service dump > ${TMP_DIR}/service_dump
+SERVICE_COUNT=$(jq -r '.services.ctdb.daemons | length' ${TMP_DIR}/service_dump)
+[ $SERVICE_COUNT -gt 0 ] || _fail "lock holder missing from ceph service dump"
+
 rados -p "$POOL" lock info "$OBJECT" ctdb_reclock_mutex \
 						> ${TMP_DIR}/lock_state_first
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list