1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-21 09:34:19 +03:00

ctdb-scripts: Support CTDB_STATD_CALLOUT_SHARED_STORAGE=none

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2024-04-30 12:12:32 +10:00 committed by Amitay Isaacs
parent 112c6b43bc
commit 16df4de954
11 changed files with 125 additions and 1 deletions

View 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>

View File

@ -36,11 +36,15 @@
*
* 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();

View 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,

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.001.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.002.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.003.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.004.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.005.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.006.sh"

View File

@ -0,0 +1,6 @@
#!/bin/sh
CTDB_STATD_CALLOUT_SHARED_STORAGE="none"
_dir=$(dirname "$0")
. "${_dir}/statd-callout.007.sh"

View File

@ -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()
{