]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Support CTDB_STATD_CALLOUT_SHARED_STORAGE=none
authorMartin Schwenke <mschwenke@ddn.com>
Tue, 30 Apr 2024 02:12:32 +0000 (12:12 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 13 Dec 2024 13:57:32 +0000 (13:57 +0000)
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/doc/ctdb-script.options.5.xml
ctdb/failover/statd_callout.c
ctdb/tests/UNIT/eventscripts/scripts/statd-callout.sh
ctdb/tests/UNIT/eventscripts/statd-callout.201.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.202.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.203.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.204.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.205.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.206.sh [new file with mode: 0755]
ctdb/tests/UNIT/eventscripts/statd-callout.207.sh [new file with mode: 0755]
ctdb/tools/statd_callout_helper

index acfb9d082f87812050d33406af58cabded712ed4..9f04bcfa2681828392acbc338487323037c2e4eb 100644 (file)
@@ -1096,6 +1096,27 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
                  </para>
                </listitem>
              </varlistentry>
+             <varlistentry>
+               <term>
+                 none
+               </term>
+               <listitem>
+                 <para>
+                   No cluster-aware handling of NFSv3 statd state is
+                   done.  NFSv3 lock reclaim will not occur and
+                   applications that use locking over NFSv3 are
+                   likely to lose or corrupt data.
+                 </para>
+                 <para>
+                   This should be used with care and only in the case
+                   where no applications are using POSIX locks in
+                   NFSv3 mounts.  It should probably be considered an
+                   option to test the latency of
+                   <filename>statd_callout</filename>, without
+                   including any storage costs.
+                 </para>
+               </listitem>
+             </varlistentry>
            </variablelist>
          </listitem>
        </varlistentry>
index 6123316c6a74c024112954430addafd3bfab3f36..8064432b21f4d52b4a519d5407f6d5bb98693118 100644 (file)
  *
  *   persistent_db
  *   shared_dir
+ *   none
  *
- * In these modes, the file contains 2 subsequent lines of text:
+ * In persistent_db and shared_dir modes, the file contains 2
+ * subsequent lines of text:
  *
  *   path: directory where files should be created
  *   ips_file: file containing node's currently assigned public IP addresses
+ *
+ * In none mode, there are no subsequent lines.
  */
 #define CONFIG_FILE CTDB_VARDIR "/scripts/statd_callout.conf"
 
@@ -50,6 +54,7 @@ struct {
        enum {
                CTDB_SC_MODE_PERSISTENT_DB,
                CTDB_SC_MODE_SHARED_DIR,
+               CTDB_SC_MODE_NONE,
        } mode;
        union {
                struct {
@@ -94,6 +99,9 @@ static void free_config(void)
                config.path = NULL;
                free(config.ips_file);
                config.ips_file = NULL;
+               break;
+       case CTDB_SC_MODE_NONE:
+               break;
        }
 }
 
@@ -132,6 +140,8 @@ static void read_config(void)
                config.mode = CTDB_SC_MODE_PERSISTENT_DB;
        } else if (strcmp(mode, "shared_dir") == 0) {
                config.mode = CTDB_SC_MODE_SHARED_DIR;
+       } else if (strcmp(mode, "none") == 0) {
+               config.mode = CTDB_SC_MODE_NONE;
        } else {
                fprintf(stderr,
                        "%s: unknown mode=%s in %s\n",
@@ -156,6 +166,8 @@ static void read_config(void)
                        goto parse_error;
                }
 
+               break;
+       case CTDB_SC_MODE_NONE:
                break;
        }
 
@@ -367,6 +379,8 @@ int main(int argc, const char *argv[])
                case CTDB_SC_MODE_SHARED_DIR:
                        add_client_shared_dir(mon_name);
                        break;
+               case CTDB_SC_MODE_NONE:
+                       break;
                }
        } else if (strcmp(event, "del-client") == 0) {
                mon_name = argv[2];
@@ -377,6 +391,8 @@ int main(int argc, const char *argv[])
                case CTDB_SC_MODE_SHARED_DIR:
                        del_client_shared_dir(mon_name);
                        break;
+               case CTDB_SC_MODE_NONE:
+                       break;
                }
        } else {
                usage();
index 53b8dbc485b4fe0f3180006c7648b4bb66ed37e7..fea83fde2f8639b6490d557203ebd411da4f3cde 100644 (file)
@@ -106,11 +106,20 @@ check_shared_storage_statd_state()
                esac
                check_shared_dir_statd_state "$@"
                ;;
+       none)
+               :
+               ;;
        esac
 }
 
 check_statd_callout_smnotify()
 {
+       case "$statd_callout_mode" in
+       none)
+               return
+               ;;
+       esac
+
        # The state here doesn't really matter because the date stub
        # generates a fixed value (as per above setup() function,
        # which happens to set it to an even value).  In reality,
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.201.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.201.sh
new file mode 100755 (executable)
index 0000000..95a95e0
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.001.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.202.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.202.sh
new file mode 100755 (executable)
index 0000000..e448974
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.002.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.203.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.203.sh
new file mode 100755 (executable)
index 0000000..9938a80
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.003.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.204.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.204.sh
new file mode 100755 (executable)
index 0000000..d2b8009
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.004.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.205.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.205.sh
new file mode 100755 (executable)
index 0000000..31867e3
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.005.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.206.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.206.sh
new file mode 100755 (executable)
index 0000000..5bd031d
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.006.sh"
diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.207.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.207.sh
new file mode 100755 (executable)
index 0000000..3995e23
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
+
+_dir=$(dirname "$0")
+. "${_dir}/statd-callout.007.sh"
index 0ef88f06c96e5b3f291066a0859584bd1efb4cf3..11018029412e2954f7b5f3503d47deecaa2517af 100755 (executable)
@@ -116,6 +116,9 @@ shared_dir)
                statd_callout_shared_dir="$t"
        fi
        ;;
+none)
+       :
+       ;;
 *)
        mode="$statd_callout_mode"
        die "error: unknown CTDB_STATD_CALLOUT_SHARED_STORAGE mode ${mode}"
@@ -335,6 +338,39 @@ cleanup_shared_dir()
 
 ############################################################
 
+# No-op implementation
+
+startup_none()
+{
+       _config_file="$1"
+
+       cat >"$_config_file" <<EOF
+none
+EOF
+}
+
+update_none()
+{
+       :
+}
+
+list_records_none()
+{
+       :
+}
+
+delete_records_none()
+{
+       :
+}
+
+cleanup_none()
+{
+       :
+}
+
+############################################################
+
 # Per-mode initialisation
 startup()
 {