[sys-cluster/glusterfs] try py3k13

This commit is contained in:
2025-04-06 20:56:13 +02:00
parent 2c704daf1d
commit 1db773241a
10 changed files with 551 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
;;; puppet-mode site-lisp configuration
(add-to-list 'load-path "@SITELISP@")
(autoload 'glusterfs-mode "glusterfs-mode" "Major mode for editing glusterfs manifests")

View File

@@ -0,0 +1,32 @@
#!/sbin/openrc-run
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="Gluster elastic volume management daemon"
command="/usr/sbin/glusterd"
pidfile="/run/${SVCNAME}.pid"
command_args="-N"
command_background="yes"
depend() {
need net
before netmount
}
start_pre() {
# Ensure that the GlusterFS auxiliary mount parent directory exists
checkpath --directory --owner gluster:gluster --mode 0775 /run/gluster
}
start_post() {
local c=0
ebegin "Waiting for glusterd to start up"
while ! /usr/sbin/gluster volume list >/dev/null 2>&1 && [ "${c}" -lt "${glusterd_max_wait_start-60}" ]; do
c=$(( c+1 ))
done
[ "${c}" -lt "${glusterd_max_wait_start-60}" ]
eend $?
return 0
}

View File

@@ -0,0 +1,85 @@
From 26126dd1467fc40af372b9f2ba6ab167e5b9f309 Mon Sep 17 00:00:00 2001
From: Jaco Kroon <jaco@uls.co.za>
Date: Mon, 28 Aug 2023 09:54:47 +0200
Subject: [PATCH] extras: defer invoking of gluster volume set help as late as
we can.
---
extras/command-completion/gluster.bash | 44 +++++++++++++++++++-------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/extras/command-completion/gluster.bash b/extras/command-completion/gluster.bash
index 70f8e19558..a096b62890 100644
--- a/extras/command-completion/gluster.bash
+++ b/extras/command-completion/gluster.bash
@@ -1,15 +1,5 @@
#!/bin/bash
-if pidof glusterd > /dev/null 2>&1; then
- GLUSTER_SET_OPTIONS="
- $(for token in `gluster volume set help 2>/dev/null | grep "^Option:" | cut -d ' ' -f 2`
- do
- echo "{$token},"
- done)
- "
- GLUSTER_RESET_OPTIONS="$GLUSTER_SET_OPTIONS"
-fi
-
GLUSTER_TOP_SUBOPTIONS1="
{nfs},
{brick},
@@ -161,12 +151,14 @@ GLUSTER_VOLUME_OPTIONS="
},
{reset
{__VOLNAME
- [ $GLUSTER_RESET_OPTIONS ]
+ {__VOLOPTIONS
+ },
}
},
{set
{__VOLNAME
- [ $GLUSTER_SET_OPTIONS ]
+ {__VOLOPTIONS
+ },
}
},
{start
@@ -280,6 +272,34 @@ __VOLNAME ()
return 0
}
+__VOLOPTIONS()
+{
+ local zero=0
+ local ret=0
+ local cur_word="$2"
+ local list=""
+
+ if [ "X$1" == "X" ]; then
+ return
+
+ elif [ "$1" == "match" ]; then
+ return 0
+
+ elif [ "$1" == "complete" ]; then
+ if ! pidof glusterd > /dev/null 2>&1; then
+ list='';
+ else
+ list=`gluster volume set help 2>/dev/null | grep "^Option:" | cut -d ' ' -f 2`
+ fi
+ else
+ return 0
+ fi
+
+ func_return=`echo $(compgen -W "$list" -- $cur_word)`
+
+ return 0
+}
+
_gluster_throw () {
#echo $1 >&2
COMPREPLY=''
--
2.41.0

View File

@@ -0,0 +1,6 @@
#glusterfsd_mountpoint=""
#glusterfsd_log=""
#glusterfsd_vol=""
#glusterfsd_port=""
#glusterfsd_transport=""
#glusterfsd_opts=""

View File

@@ -0,0 +1,34 @@
# Rotate client logs
/var/log/glusterfs/*.log {
weekly
rotate 52
missingok
# compress the logs, but from the .2 onwards
compress
delaycompress
notifempty
sharedscripts
postrotate
/usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
/usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
endscript
}
# Rotate server logs
/var/log/glusterfs/bricks/*.log {
weekly
rotate 52
missingok
# compress the logs, but from the .2 onwards
compress
delaycompress
notifempty
sharedscripts
postrotate
/usr/bin/killall -HUP glusterfsd > /dev/null 2>&1 || true
endscript
}

View File

@@ -0,0 +1,8 @@
if &compatible || v:version < 603
finish
endif
" GlusterFS Volume files
au BufNewFile,BufRead *.vol
\ set filetype=glusterfs

View File

@@ -0,0 +1,121 @@
#!/sbin/openrc-run
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
if [ "${SVCNAME}" != "glusterfs" ]
then
GLUSTERFS_NAME="${SVCNAME#glusterfs.}"
else
GLUSTERFS_NAME="glusterfs"
fi
GLUSTERFS_PIDFILE="/var/run/${SVCNAME}.pid"
eval 'GLUSTERFS_LOGFILE="${'${GLUSTERFS_NAME}'_log:-/var/log/glusterfs/'${GLUSTERFS_NAME}'.log}"'
eval 'GLUSTERFS_VOLFILE="${'${GLUSTERFS_NAME}'_vol:-/etc/glusterfs/'${GLUSTERFS_NAME}'.vol}"'
eval 'GLUSTERFS_SERVER="${'${GLUSTERFS_NAME}'_server}"'
eval 'GLUSTERFS_PORT="${'${GLUSTERFS_NAME}'_port:-6996}"'
eval 'GLUSTERFS_TRANSPORT="${'${GLUSTERFS_NAME}'_transport:-socket}"'
eval 'GLUSTERFS_OPTS="${'${GLUSTERFS_NAME}'_opts}"'
eval 'GLUSTERFS_MOUNTPOINT="${'${GLUSTERFS_NAME}'_mountpoint}"'
depend() {
need net
[ -n "${GLUSTERFS_MOUNTPOINT}" ] && need fuse
use dns
before netmount
after firewall ntp-client ntpd
}
checkconfig() {
if [ -z "${GLUSTERFS_NAME}" ]
then
eerror "The service name is not properly formatted."
return 1
fi
if [ -z "${GLUSTERFS_SERVER}" ]
then
if [ -z "${GLUSTERFS_VOLFILE}" ]
then
eerror "No GlusterFS volume file source has been defined. Edit /etc/conf.d/glusterfs"
eerror "and configure a volume file source for ${SVCNAME}."
return 1
else
if [ ! -f "${GLUSTERFS_VOLFILE}" ]
then
eerror "Cannot find volume file: ${GLUSTERFS_VOLFILE}"
return 1
fi
fi
fi
if [ -n "${GLUSTERFS_MOUNTPOINT}" -a ! -d "${GLUSTERFS_MOUNTPOINT}" ]
then
eerror "The mountpoint ${GLUSTERFS_MOUNTPOINT} does not exist."
return 1
fi
}
start() {
local status daemon
checkconfig || return 1
ebegin "Starting GlusterFS (${SVCNAME})"
eindent
if [ -z "${GLUSTERFS_MOUNTPOINT}" ]
then
einfo "Starting in server mode ..."
daemon="glusterfsd"
else
einfo "Starting in client mode. Mounting filesystem ..."
daemon="glusterfs"
fi
if [ -n "${GLUSTERFS_SERVER}" ]
then
einfo "Using server supplied volume file"
start-stop-daemon --start --pidfile ${GLUSTERFS_PIDFILE} \
--exec /usr/sbin/${daemon} -- \
--pid-file=${GLUSTERFS_PIDFILE} \
--log-file=${GLUSTERFS_LOGFILE} \
--volfile-server=${GLUSTERFS_SERVER} \
--volfile-server-port=${GLUSTERFS_PORT} \
--volfile-server-transport=${GLUSTERFS_TRANSPORT} \
${GLUSTERFS_OPTS} ${GLUSTERFS_MOUNTPOINT}
status="$?"
else
einfo "Using local volume file"
start-stop-daemon --start --pidfile ${GLUSTERFS_PIDFILE} \
--exec /usr/sbin/${daemon} -- \
--pid-file=${GLUSTERFS_PIDFILE} \
--log-file=${GLUSTERFS_LOGFILE} \
--volfile=${GLUSTERFS_VOLFILE} \
${GLUSTERFS_OPTS} ${GLUSTERFS_MOUNTPOINT}
status="$?"
fi
eoutdent
eend ${status}
}
stop() {
local status
ebegin "Stopping GlusterFS (${SVCNAME})"
eindent
if [ -z "${GLUSTERFS_MOUNTPOINT}" ]
then
einfo "Stopping server process ..."
start-stop-daemon --stop --pidfile ${GLUSTERFS_PIDFILE}
status="$?"
else
einfo "Unmounting ${GLUSTERFS_MOUNTPOINT} ..."
umount "${GLUSTERFS_MOUNTPOINT}"
status="$?"
fi
eoutdent
eend ${status}
}