Hello community, here is the log from the commit of package sbd for openSUSE:Factory checked in at 2014-03-28 16:28:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sbd (Old) and /work/SRC/openSUSE:Factory/.sbd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sbd" Changes: -------- --- /work/SRC/openSUSE:Factory/sbd/sbd.changes 2013-10-19 11:19:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.sbd.new/sbd.changes 2014-03-28 16:28:14.000000000 +0100 @@ -1,0 +2,18 @@ +Thu Mar 27 14:12:30 UTC 2014 - l...@suse.com + +- sbd: Allow the watchdog to be explicitly disabled (bnc#865365) +- rpm: use the short git hash in the changelog from now on. +- cs: b96ac28 + +------------------------------------------------------------------- +Thu Mar 27 08:10:46 UTC 2014 - l...@suse.com + +- systemd: ensure that sbd is activated after systemd module loading and + the iSCSI initator (bnc#869612) +- Start-up: make sbd wait a configurable amount of time for devices to + appear on boot (bnc#869612) +- Downgrade the logging during the initial wait to a debug log to avoid + log flooding. +- cs: 512b71dc209744e505bf62d7ccddb70854fe7407 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sbd.spec ++++++ --- /var/tmp/diff_new_pack.rjtsWq/_old 2014-03-28 16:28:14.000000000 +0100 +++ /var/tmp/diff_new_pack.rjtsWq/_new 2014-03-28 16:28:14.000000000 +0100 @@ -1,6 +1,7 @@ # # spec file for package sbd # +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2013 Lars Marowsky-Bree # # All modifications and additions to the file contributed by third parties @@ -15,24 +16,32 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild Name: sbd Summary: Storage-based death +License: GPL-2.0+ +Group: Productivity/Clustering/HA Version: 1.2.1 Release: 0 -License: GPL-2.0+ Url: https://github.com/l-mb/sbd -Group: Productivity/Clustering/HA Source: sbd-%{version}.tar.bz2 Patch1: add-explicit-libs.patch Patch2: sbd-configure-libcoroipcc.patch Patch3: sbd-pacemaker.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build -AutoReqProv: on -BuildRequires: autoconf automake e2fsprogs-devel glib2-devel libtool libxml2-devel pkgconfig python-devel libaio-devel libuuid-devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: e2fsprogs-devel +BuildRequires: glib2-devel +BuildRequires: libaio-devel +BuildRequires: libcorosync-devel BuildRequires: libglue-devel -BuildRequires: libpacemaker-devel libcorosync-devel +BuildRequires: libpacemaker-devel +BuildRequires: libtool +BuildRequires: libuuid-devel +BuildRequires: libxml2-devel +BuildRequires: pkgconfig +BuildRequires: python-devel Conflicts: ClusterTools2 < 2.3.2 Requires(pre): %fillup_prereq @@ -54,6 +63,7 @@ %build autoreconf -i +export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror" %configure make %{?_smp_mflags} ########################################################### ++++++ sbd-1.2.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/README.md new/sbd-1.2.1/README.md --- old/sbd-1.2.1/README.md 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/README.md 2014-03-27 15:12:13.000000000 +0100 @@ -2,9 +2,8 @@ A highly reliable fencing or Shoot-the-other-node-in-the-head (STONITH) mechanism that works by utilizing shared storage. -The component works with Pacemaker clusters. (Currently, it is only -tested on clusters using the "old" plugin to corosync, not yet the MCP -code. Patches are welcome.) +The component works with Pacemaker clusters, and is currently known to +compile and function on Pacemaker 1.1.7+ and corosync 1.4.x or 2.3.x. Please see https://github.com/l-mb/sbd/blob/master/man/sbd.8.pod for the full documentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/man/sbd.8.pod new/sbd-1.2.1/man/sbd.8.pod --- old/sbd-1.2.1/man/sbd.8.pod 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/man/sbd.8.pod 2014-03-27 15:12:13.000000000 +0100 @@ -225,7 +225,11 @@ =item B<-W> -Enable use of the system watchdog. This is I<highly> recommended. +Enable or disable use of the system watchdog to protect against the sbd +processes failing and the node being left in an undefined state. Specify +this once to enable, twice to disable. + +Defaults to I<enabled>. =item B<-w> F</dev/watchdog> @@ -276,6 +280,15 @@ sbd -d /dev/sda1 message node1 clear +=item B<-s> I<N> + +Set the start-up wait time for devices. (Defaults to I<120>.) + +Dynamic block devices such as iSCSI might not be fully initialized and +present yet. This allows to set a timeout for waiting for devices to +appear on start-up. If set to 0, start-up will be aborted immediately if +no devices are available. + =item B<-Z> Enable trace mode. B<Warning: this is unsafe for production, use at your diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/src/sbd-common.c new/sbd-1.2.1/src/sbd-common.c --- old/sbd-1.2.1/src/sbd-common.c 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/src/sbd-common.c 2014-03-27 15:12:13.000000000 +0100 @@ -29,8 +29,9 @@ int timeout_loop = 1; int timeout_msgwait = 10; int timeout_io = 3; +int timeout_startup = 120; -int watchdog_use = 0; +int watchdog_use = 1; int watchdog_set_timeout = 1; unsigned long timeout_watchdog_crashdump = 240; int skip_rt = 0; @@ -63,6 +64,7 @@ "-W Use watchdog (recommended) (watch only)\n" "-w <dev> Specify watchdog device (optional) (watch only)\n" "-T Do NOT initialize the watchdog timeout (watch only)\n" +"-S <0|1> Set start mode if the node was previously fenced (watch only)\n" "-p <path> Write pidfile to the specified path (watch only)\n" "-v Enable some verbose debug logging (optional)\n" "\n" @@ -74,6 +76,7 @@ " (default is 3, set to 0 to disable)\n" "-C <N> Watchdog timeout to set before crashdumping (def: 240s, optional)\n" "-I <N> Async IO read timeout (defaults to 3 * loop timeout, optional)\n" +"-s <N> Timeout to wait for devices to become available (def: 120s)\n" "-t <N> Dampening delay before faulty servants are restarted (optional)\n" " (default is 5, set to 0 to disable)\n" "-F <N> # of failures before a servant is considered faulty (optional)\n" @@ -226,7 +229,7 @@ } struct sbd_context * -open_device(const char* devname) +open_device(const char* devname, int loglevel) { struct sbd_context *st; @@ -247,7 +250,11 @@ st->devfd = open(devname, O_SYNC|O_RDWR|O_DIRECT); if (st->devfd == -1) { - cl_perror("Opening device %s failed.", devname); + if (loglevel == LOG_DEBUG) { + DBGLOG(loglevel, "Opening device %s failed.", devname); + } else { + cl_log(loglevel, "Opening device %s failed.", devname); + } free(st); return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/src/sbd-md.c new/sbd-1.2.1/src/sbd-md.c --- old/sbd-1.2.1/src/sbd-md.c 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/src/sbd-md.c 2014-03-27 15:12:13.000000000 +0100 @@ -28,6 +28,9 @@ static int start_mode = 0; static char* pidfile = NULL; +static void open_any_device(void); +static int check_timeout_inconsistent(struct sector_header_s *hdr); + int quorum_write(int good_servants) { return (good_servants > servant_count/2); @@ -71,7 +74,7 @@ for (s = servants_leader; s; s = s->next) { fprintf(stdout, "Initializing device %s\n", s->devname); - st = open_device(s->devname); + st = open_device(s->devname, LOG_ERR); if (!st) { return -1; } @@ -92,7 +95,7 @@ struct sbd_context *st; const struct slot_msg_arg_t* arg = (const struct slot_msg_arg_t*)argp; - st = open_device(devname); + st = open_device(devname, LOG_WARNING); if (!st) return -1; cl_log(LOG_INFO, "Delivery process handling %s", @@ -108,7 +111,7 @@ const char* name = (const char*)argp; struct sbd_context *st; - st = open_device(devname); + st = open_device(devname, LOG_WARNING); if (!st) return -1; rc = slot_ping(st, name); @@ -126,7 +129,7 @@ fprintf(stdout, "Trying to allocate slot for %s on device %s.\n", name, s->devname); - st = open_device(s->devname); + st = open_device(s->devname, LOG_WARNING); if (!st) { return -1; } @@ -148,7 +151,7 @@ struct sbd_context *st; for (s = servants_leader; s; s = s->next) { - st = open_device(s->devname); + st = open_device(s->devname, LOG_WARNING); if (!st) { fprintf(stdout, "== disk %s unreadable!\n", s->devname); continue; @@ -215,6 +218,7 @@ int servant(const char *diskname, const void* argp) { struct sector_mbox_s *s_mbox = NULL; + struct sector_node_s *s_node = NULL; struct sector_header_s *s_header = NULL; int mbox; int rc = 0; @@ -247,7 +251,7 @@ atexit(servant_exit); servant_inform_parent = 1; - st = open_device(diskname); + st = open_device(diskname, LOG_WARNING); if (!st) { return -1; } @@ -258,6 +262,12 @@ return -1; } + if (check_timeout_inconsistent(s_header) < 0) { + cl_log(LOG_ERR, "Timeouts on %s do not match first device", + diskname); + return -1; + } + if (s_header->minor_version > 0) { uuid_unparse_lower(s_header->uuid, uuid); cl_log(LOG_INFO, "Device %s uuid: %s", diskname, uuid); @@ -271,6 +281,13 @@ rc = -1; goto out; } + s_node = sector_alloc(); + if (slot_read(st, mbox, s_node) < 0) { + cl_log(LOG_ERR, "Unable to read node entry on %s", + diskname); + exit(1); + } + DBGLOG(LOG_INFO, "Monitoring slot %d on disk %s", mbox, diskname); if (s_header->minor_version == 0) { set_proc_title("sbd: watcher: %s - slot: %d", diskname, mbox); @@ -308,6 +325,9 @@ memset(&signal_value, 0, sizeof(signal_value)); while (1) { + struct sector_header_s *s_header_retry = NULL; + struct sector_node_s *s_node_retry = NULL; + t0 = time(NULL); sleep(timeout_loop); @@ -319,6 +339,32 @@ do_reset(); } + /* These attempts are, by definition, somewhat racy. If + * the device is wiped out or corrupted between here and + * us reading our mbox, there is nothing we can do about + * that. But at least we tried. */ + s_header_retry = header_get(st); + if (!s_header_retry) { + cl_log(LOG_ERR, "No longer found a valid header on %s", diskname); + exit(1); + } + if (memcmp(s_header, s_header_retry, sizeof(*s_header)) != 0) { + cl_log(LOG_ERR, "Header on %s changed since start-up!", diskname); + exit(1); + } + free(s_header_retry); + + s_node_retry = sector_alloc(); + if (slot_read(st, mbox, s_node_retry) < 0) { + cl_log(LOG_ERR, "slot read failed in servant."); + exit(1); + } + if (memcmp(s_node, s_node_retry, sizeof(*s_node)) != 0) { + cl_log(LOG_ERR, "Node entry on %s changed since start-up!", diskname); + exit(1); + } + free(s_node_retry); + if (mbox_read(st, mbox, s_mbox) < 0) { cl_log(LOG_ERR, "mbox read failed in servant."); exit(1); @@ -494,44 +540,72 @@ } } -int check_timeout_inconsistent(void) +void open_any_device(void) { - struct sbd_context *st; - struct sector_header_s *hdr_cur = 0, *hdr_last = 0; - struct servants_list_item* s; - int inconsistent = 0; + struct sector_header_s *hdr_cur = NULL; + struct timespec t_0; + int t_wait = 0; - for (s = servants_leader; s; s = s->next) { - st = open_device(s->devname); - if (!st) - continue; - hdr_cur = header_get(st); - close_device(st); - if (!hdr_cur) - continue; - if (hdr_last) { - if (hdr_last->timeout_watchdog != hdr_cur->timeout_watchdog - || hdr_last->timeout_allocate != hdr_cur->timeout_allocate - || hdr_last->timeout_loop != hdr_cur->timeout_loop - || hdr_last->timeout_msgwait != hdr_cur->timeout_msgwait) - inconsistent = 1; - free(hdr_last); - } - hdr_last = hdr_cur; - } - - if (hdr_last) { - timeout_watchdog = hdr_last->timeout_watchdog; - timeout_allocate = hdr_last->timeout_allocate; - timeout_loop = hdr_last->timeout_loop; - timeout_msgwait = hdr_last->timeout_msgwait; + clock_gettime(CLOCK_MONOTONIC, &t_0); + + while (!hdr_cur && t_wait < timeout_startup) { + struct timespec t_now; + struct servants_list_item* s; + + for (s = servants_leader; s; s = s->next) { + struct sbd_context *st = open_device(s->devname, LOG_DEBUG); + if (!st) + continue; + hdr_cur = header_get(st); + close_device(st); + if (hdr_cur) + break; + } + clock_gettime(CLOCK_MONOTONIC, &t_now); + t_wait = t_now.tv_sec - t_0.tv_sec; + if (!hdr_cur) { + sleep(timeout_loop); + } + } + + if (hdr_cur) { + timeout_watchdog = hdr_cur->timeout_watchdog; + timeout_allocate = hdr_cur->timeout_allocate; + timeout_loop = hdr_cur->timeout_loop; + timeout_msgwait = hdr_cur->timeout_msgwait; } else { - cl_log(LOG_ERR, "No devices were available at start-up."); + cl_log(LOG_ERR, "No devices were available at start-up within %i seconds.", + timeout_startup); exit(1); } - free(hdr_last); - return inconsistent; + free(hdr_cur); + return; +} + +int check_timeout_inconsistent(struct sector_header_s *hdr) +{ + if (timeout_watchdog != hdr->timeout_watchdog) { + cl_log(LOG_WARNING, "watchdog timeout: %d versus %d on this device", + (int)timeout_watchdog, (int)hdr->timeout_watchdog); + return -1; + } + if (timeout_allocate != hdr->timeout_allocate) { + cl_log(LOG_WARNING, "allocate timeout: %d versus %d on this device", + (int)timeout_allocate, (int)hdr->timeout_allocate); + return -1; + } + if (timeout_loop != hdr->timeout_loop) { + cl_log(LOG_WARNING, "loop timeout: %d versus %d on this device", + (int)timeout_loop, (int)hdr->timeout_loop); + return -1; + } + if (timeout_msgwait != hdr->timeout_msgwait) { + cl_log(LOG_WARNING, "msgwait timeout: %d versus %d on this device", + (int)timeout_msgwait, (int)hdr->timeout_msgwait); + return -1; + } + return 0; } inline void cleanup_servant_by_pid(pid_t pid) @@ -810,11 +884,7 @@ sigaddset(&procmask, SIG_LIVENESS); sigprocmask(SIG_BLOCK, &procmask, NULL); - if (check_timeout_inconsistent() == 1) { - fprintf(stderr, "Timeout settings are different across SBD devices!\n"); - fprintf(stderr, "You have to correct them and re-start SBD again.\n"); - return -1; - } + open_any_device(); inquisitor_pid = make_daemon(); if (inquisitor_pid == 0) { @@ -908,7 +978,7 @@ for (s = servants_leader; s; s = s->next) { fprintf(stdout, "==Dumping header on disk %s\n", s->devname); - st = open_device(s->devname); + st = open_device(s->devname, LOG_WARNING); if (!st) { fprintf(stdout, "== disk %s unreadable!\n", s->devname); continue; @@ -930,6 +1000,7 @@ { int exit_status = 0; int c; + int w = 0; if ((cmdname = strrchr(argv[0], '/')) == NULL) { cmdname = argv[0]; @@ -943,7 +1014,7 @@ sbd_get_uname(); - while ((c = getopt(argc, argv, "C:DPRTWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:")) != -1) { + while ((c = getopt(argc, argv, "C:DPRTWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:s:")) != -1) { switch (c) { case 'D': break; @@ -959,6 +1030,10 @@ start_mode = atoi(optarg); cl_log(LOG_INFO, "Start mode set to: %d", (int)start_mode); break; + case 's': + timeout_startup = atoi(optarg); + cl_log(LOG_INFO, "Start timeout set to: %d", (int)timeout_startup); + break; case 'v': debug = 1; cl_log(LOG_INFO, "Verbose mode enabled."); @@ -968,8 +1043,7 @@ cl_log(LOG_INFO, "Setting watchdog timeout disabled; using defaults."); break; case 'W': - watchdog_use = 1; - cl_log(LOG_INFO, "Watchdog enabled."); + w++; break; case 'w': watchdogdev = strdup(optarg); @@ -1034,7 +1108,17 @@ break; } } - + + if (w > 0) { + watchdog_use = w % 2; + } + + if (watchdog_use) { + cl_log(LOG_INFO, "Watchdog enabled."); + } else { + cl_log(LOG_INFO, "Watchdog disabled."); + } + if (servant_count < 1 || servant_count > 3) { fprintf(stderr, "You must specify 1 to 3 devices via the -d option.\n"); exit_status = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/src/sbd.h new/sbd-1.2.1/src/sbd.h --- old/sbd-1.2.1/src/sbd.h 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/src/sbd.h 2014-03-27 15:12:13.000000000 +0100 @@ -117,7 +117,7 @@ int watchdog_init(void); void sysrq_init(void); void watchdog_close(void); -struct sbd_context *open_device(const char* devname); +struct sbd_context *open_device(const char* devname, int loglevel); void close_device(struct sbd_context *st); signed char cmd2char(const char *cmd); void * sector_alloc(void); @@ -160,6 +160,7 @@ extern int timeout_loop; extern int timeout_msgwait; extern int timeout_io; +extern int timeout_startup; extern int watchdog_use; extern int watchdog_set_timeout; extern int skip_rt; @@ -201,7 +202,6 @@ int inquisitor(void); int inquisitor_decouple(void); int messenger(const char *name, const char *msg); -int check_timeout_inconsistent(void); void cleanup_servant_by_pid(pid_t pid); int quorum_write(int good_servants); int quorum_read(int good_servants); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/src/sbd.service new/sbd-1.2.1/src/sbd.service --- old/sbd-1.2.1/src/sbd.service 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/src/sbd.service 2014-03-27 15:12:13.000000000 +0100 @@ -1,7 +1,7 @@ [Unit] Description=Shared-storage based fencing daemon Before=pacemaker.service -After=corosync.service +After=corosync.service systemd-modules-load.service iscsi.service PartOf=pacemaker.service RefuseManualStop=true RefuseManualStart=true @@ -11,7 +11,6 @@ ExecStart=/usr/share/sbd/sbd.sh start ExecStop=/usr/share/sbd/sbd.sh stop PIDFile=/var/run/sbd.pid -Restart=no # Could this benefit from exit codes for restart? # Does this need to be set to msgwait * 1.2? # TimeoutSec= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/src/sbd.sh new/sbd-1.2.1/src/sbd.sh --- old/sbd-1.2.1/src/sbd.sh 2013-10-10 11:11:59.000000000 +0200 +++ new/sbd-1.2.1/src/sbd.sh 2014-03-27 15:12:13.000000000 +0100 @@ -47,11 +47,11 @@ SBD_OPTS+=" -P" fi : ${SBD_WATCHDOG:="true"} -if ocf_is_true "$SBD_WATCHDOG" ; then - SBD_OPTS+=" -W" +if ! ocf_is_true "$SBD_WATCHDOG" ; then + SBD_OPTS+=" -W -W" fi if [ -n "$SBD_WATCHDOG_DEV" ]; then - SBD_OPTS+="-w $SBD_WATCHDOG_DEV" + SBD_OPTS+=" -w $SBD_WATCHDOG_DEV" fi : ${SBD_STARTMODE:="always"} case "$SBD_STARTMODE" in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sbd-1.2.1/tests/regressions.sh new/sbd-1.2.1/tests/regressions.sh --- old/sbd-1.2.1/tests/regressions.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/sbd-1.2.1/tests/regressions.sh 2014-03-27 15:12:13.000000000 +0100 @@ -0,0 +1,174 @@ +#!/bin/bash +# +# Copyright (C) 2013 Lars Marowsky-Bree <l...@suse.com> +# +# 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 the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# TODO: +# - More tests +# - Handle optional, long-running tests better +# - Support for explicitly running a single test +# - Verify output from commands +# - Normalize uuids and device names so they are diffable +# - Log to file, instead of syslog is needed +# - How to test watch mode? +# - Can the unit/service file be tested? or at least the wrapper? + +sbd_setup() { + trap sbd_teardown EXIT + for N in $(seq 3) ; do + F[$N]=$(mktemp /tmp/sbd.device.$N.XXXXXX) + dd if=/dev/zero of=${F[$N]} count=2048 + L[$N]=$(losetup -f) + losetup ${L[$N]} ${F[$N]} + D[$N]="/dev/mapper/sbd_$N" + dmsetup create sbd_$N --table "0 2048 linear ${L[$N]} 0" + done +} + +sbd_teardown() { + for N in $(seq 3) ; do + dmsetup remove sbd_$N + losetup -d ${L[$N]} + rm -f ${F[$N]} + done +} + +sbd_dev_fail() { + dmsetup wipe_table sbd_$1 +} + +sbd_dev_resume() { + dmsetup suspend sbd_$1 + dmsetup load sbd_$1 --table "0 2048 linear ${L[$1]} 0" + dmsetup resume sbd_$1 +} + +_ok() { + echo -- $@ + $@ + rc=$? + if [ $rc -ne 0 ]; then + echo "$@ failed with $rc" + exit + fi +} + +_no() { + echo -- $@ + $@ + rc=$? + if [ $rc -eq 0 ]; then + echo "$@ did NOT fail ($rc)" + exit + fi + return 0 +} + +test_1() { + echo "Creating three devices" + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} create + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} dump +} + +test_2() { + echo "Basic functionality" + for S in `seq 2` ; do + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} allocate "test-$S" + done + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-1 message test-2 reset + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} list +} + +test_3() { + echo "Start mode (expected not to start, because reset was written in test_2)" + _no sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-2 -Z -Z -Z -S 1 watch +} + +test_4() { + echo "Deliver message with 1 failure" + sbd_dev_fail 1 + _no sbd -d ${D[1]} -n test-1 message test-2 exit + _no sbd -d ${D[1]} -d ${D[2]} -n test-1 message test-2 exit + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-1 message test-2 exit + sbd_dev_resume 1 + +} + +test_5() { + echo "Deliver message with 2 failures" + sbd_dev_fail 1 + sbd_dev_fail 2 + _no sbd -d ${D[1]} -d ${D[2]} -n test-1 message test-2 exit + _no sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-1 message test-2 exit + sbd_dev_resume 1 + sbd_dev_resume 2 + +} + +test_6() { + echo "Deliver message with 3 failures" + sbd_dev_fail 1 + sbd_dev_fail 2 + sbd_dev_fail 3 + _no sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-1 message test-2 exit + sbd_dev_resume 1 + sbd_dev_resume 2 + sbd_dev_resume 3 +} + +test_101() { + echo "Creating one device" + _ok sbd -d ${D[1]} create +} + +test_102() { + echo "Creating two devices" + _ok sbd -d ${D[1]} -d ${D[2]} create +} + +test_7() { + echo "Allocate all slots plus 1" + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -2 0 create + for S in `seq 255` ; do + _ok sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} allocate "test-$S" + done + _no sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} allocate "test-256" +} + +test_8() { + echo "Non-existent device path" + _no sbd -d /dev/kfdifdifdfdlfd -create 2>/dev/null +} + +test_9() { + echo "Basic sbd invocation" + _no sbd + _ok sbd -h +} + +sbd_setup + +for T in $(seq 9); do + if ! test_$T ; then + echo "FAILURE: Test $T" + break + fi + echo "SUCCESS: Test $T" +done + +echo "SUCCESS: All tests completed" + -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org