[pve-devel] [PATCH] bump sheepdog 0.6 + add new features
Alexandre Derumier
aderumier at odiso.com
Thu Jun 6 09:36:47 CEST 2013
This bump sheepdog to 0.6, with some changes:
Now, we only 1 daemon to manage multiple disks.
default root directory is :
/var/lib/sheepdog/
This is the default if you don't have dedicated disk.
Both metadatastore and objet store are in the root directory.
If you want to use, 1 or more dedicated disk:
simply create mounts in
/var/lib/sheepdog/disc0
/var/lib/sheepdog/disc1
/var/lib/sheepdog/discN
No more limit in number of disk, and no more need of a startup file tricks.
The metadata-store is always in /var/lib/sheepdog/. (spof, so you need raid)
But the object-storage are in /var/lib/sheepdog/discN. You can hotplug/unplug theses disks, have failures,...
https://github.com/collie/sheepdog/wiki/Multi-disk-on-Single-Node-Support
You can also use a journal on separate disk, like ssd, for fast write.
simply create a mount:
/var/lib/sheepdog/journal
Some tunnables variables in /etc/default/sheepdog:
ROOTDIR=/var/lib/sheepdog/
By example,users can change it to /var/lib/vz/sheepdog if they want (As this is the location where we have the more space by default)
JOURNALSIZE=256
User can tune the journal size, 256M by default
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
Makefile | 2 +-
debian/changelog | 6 ++++
debian/patches/simplify-log-rotation.patch | 33 +++++++++++------
debian/pve-sheepdog.sheepdog.default | 4 ++-
debian/pve-sheepdog.sheepdog.init.d | 53 +++++++++++-----------------
5 files changed, 53 insertions(+), 45 deletions(-)
diff --git a/Makefile b/Makefile
index f78d485..ffeacc1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ RELEASE=3.0
PACKAGE=pve-sheepdog
PKGREL=1
-SDVER=0.5.6
+SDVER=0.6.0
DEB=${PACKAGE}_${SDVER}-${PKGREL}_amd64.deb
diff --git a/debian/changelog b/debian/changelog
index 54fa4c1..f750a24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pve-sheepdog (0.6.0-1) unstable; urgency=low
+
+ * Bump to sheepdog 0.6.0
+
+ -- Proxmox Support Team <support at proxmox.com> Tue, 5 Jun 2013 16:00:00 +0200
+
pve-sheepdog (0.5.6-1) unstable; urgency=low
* Bump to sheepdog 0.5.6
diff --git a/debian/patches/simplify-log-rotation.patch b/debian/patches/simplify-log-rotation.patch
index 95b04db..5f48319 100644
--- a/debian/patches/simplify-log-rotation.patch
+++ b/debian/patches/simplify-log-rotation.patch
@@ -1,23 +1,30 @@
-simplify logfile rotation
+From fefd0589f89fb3948723f7a5cda7f734d13b30a6 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Thu, 6 Jun 2013 09:17:02 +0200
+Subject: [PATCH] simplify logfile rotation
we simply rename <logfile> to <logfile>.1. That way we do not need
any logrotate script. max_logfile is set to 256MB.
+Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
+---
+ lib/logger.c | 11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
-Index: new/lib/logger.c
-===================================================================
---- new.orig/lib/logger.c 2013-02-28 07:15:26.000000000 +0100
-+++ new/lib/logger.c 2013-02-28 07:29:55.000000000 +0100
-@@ -75,7 +75,7 @@
+diff --git a/lib/logger.c b/lib/logger.c
+index ba9f5db..23635c2 100644
+--- a/lib/logger.c
++++ b/lib/logger.c
+@@ -113,7 +113,7 @@ static pid_t logger_pid;
static key_t semkey;
static char *log_buff;
-static int64_t max_logsize = 500 * 1024 * 1024; /*500MB*/
-+static int64_t max_logsize = 256 * 1024 * 1024; /*500MB*/
++static int64_t max_logsize = 256 * 1024 * 1024; /*256MB*/
static pthread_mutex_t logsize_lock = PTHREAD_MUTEX_INITIALIZER;
-@@ -243,13 +243,7 @@
+@@ -405,14 +405,7 @@ static notrace void rotate_log(void)
if (access(log_nowname, R_OK) == 0) {
char old_logfile[256];
@@ -25,10 +32,14 @@ Index: new/lib/logger.c
- struct tm tm;
- time(&t);
- localtime_r((const time_t *)&t, &tm);
-- sprintf(old_logfile, "%s.%04d-%02d-%02d-%02d-%02d",
-- log_nowname, tm.tm_year + 1900, tm.tm_mon + 1,
-- tm.tm_mday, tm.tm_hour, tm.tm_min);
+- snprintf(old_logfile, sizeof(old_logfile),
+- "%s.%04d-%02d-%02d-%02d-%02d",
+- log_nowname, tm.tm_year + 1900, tm.tm_mon + 1,
+- tm.tm_mday, tm.tm_hour, tm.tm_min);
+ sprintf(old_logfile, "%s.1", log_nowname);
rename(log_nowname, old_logfile);
}
new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644);
+--
+1.7.10.4
+
diff --git a/debian/pve-sheepdog.sheepdog.default b/debian/pve-sheepdog.sheepdog.default
index c66a001..a4bf78a 100644
--- a/debian/pve-sheepdog.sheepdog.default
+++ b/debian/pve-sheepdog.sheepdog.default
@@ -3,4 +3,6 @@
# start sheepdog at boot [yes|no]
START=yes
-
+#sheepdog root directory
+ROOTDIR=/var/lib/sheepdog/
+JOURNALSIZE=256
diff --git a/debian/pve-sheepdog.sheepdog.init.d b/debian/pve-sheepdog.sheepdog.init.d
index 39aa36a..2de8744 100644
--- a/debian/pve-sheepdog.sheepdog.init.d
+++ b/debian/pve-sheepdog.sheepdog.init.d
@@ -17,15 +17,13 @@ DESC="Sheepdog Server" # Introduce a short description here
NAME=sheepdog # Introduce the short server's name here
DAEMON=/usr/sbin/sheep # Introduce the server's location here
SCRIPTNAME=/etc/init.d/$NAME
+PIDFILE="/var/run/sheep.pid"
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
-DISKLIST=$(echo /var/lib/sheepdog/disc[0123456789])
-RDISKLIST=
-for dir in ${DISKLIST}; do
- RDISKLIST="${dir} ${RDISKLIST}"
-done
+ROOTDIR="/var/lib/sheepdog/"
+JOURNALSIZE="256"
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
@@ -47,21 +45,25 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
-
- for dir in ${DISKLIST}; do
- test -f "${dir}/startup" || continue
- DAEMON_ARGS=$(head -n1 "${dir}/startup");
- DISKID=${dir##/var/lib/sheepdog/disc}
- PIDFILE="$dir/sheep.pid"
- DAEMON_ARGS="${DAEMON_ARGS} --pidfile ${PIDFILE}"
- if ! test "$(echo ${DAEMON_ARGS}|grep -c '\-p ')" -eq 1 ; then
- DAEMON_ARGS="${DAEMON_ARGS} -p $((7000 + ${DISKID}))"
+ ulimit -n 1024000 #avoid check_host_env(395) WARN: Allowed open files 1024 too small, suggested 1024000 warning message
+ ulimit -c unlimited #avoid check_host_env(404) Allowed core file size 0, suggested unlimited warning message
+ DAEMON_ARGS="--pidfile ${PIDFILE}"
+ DAEMON_ARGS="${DAEMON_ARGS} $ROOTDIR"
+
+ # /path/to/meta-store,/path/to/disk1{,/path/to/disk2,...}
+ for d in $ROOTDIR/disc*
+ do
+ if [ -d "$d" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS},$d"
fi
+ done
- status_of_proc -p ${PIDFILE} $DAEMON "$NAME" >/dev/null && continue
+ if [ -d "$ROOTDIR/journal" ]; then
+ DAEMON_ARGS="${DAEMON_ARGS} -j dir=$ROOTDIR/journal,size=$JOURNALSIZE"
- start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec $DAEMON -- $DAEMON_ARGS ${dir} || return 2
- done
+ fi
+ status_of_proc -p ${PIDFILE} $DAEMON "$NAME" >/dev/null && continue
+ start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec $DAEMON -- $DAEMON_ARGS || return 2
return 0
}
@@ -77,14 +79,7 @@ do_stop()
# 2 if daemon could not be stopped
# other if a failure occurred
- RETVAL=0
- for dir in ${RDISKLIST}; do
- test -f "${dir}/startup" || continue
- PIDFILE="$dir/sheep.pid"
- start-stop-daemon --stop --oknodo --retry=TERM/20/KILL/5 --quiet --pidfile ${PIDFILE} --exec $DAEMON || RETVAL=2
- done
-
- return "$RETVAL"
+ start-stop-daemon --stop --oknodo --retry=TERM/20/KILL/5 --quiet --pidfile ${PIDFILE} --exec $DAEMON || return 2
}
case "$1" in
@@ -106,13 +101,7 @@ case "$1" in
;;
status)
- RETVAL=0
- for dir in ${DISKLIST}; do
- test -f "${dir}/startup" || continue
- PIDFILE="$dir/sheep.pid"
- status_of_proc -p ${PIDFILE} $DAEMON "$NAME ${dir}" || RETVAL=1
- done
- exit $RETVAL
+ status_of_proc -p ${PIDFILE} $DAEMON "$NAME ${dir}" || exit 1
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
--
1.7.10.4
More information about the pve-devel
mailing list