From fabbione@sourceware.org Tue Apr 1 20:56:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 01 Apr 2008 20:56:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-121-gf278c0e Message-ID: <20080401205607.29688.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f278c0e58794894a504eb792d3ca436eab961e65 The branch, master has been updated via f278c0e58794894a504eb792d3ca436eab961e65 (commit) via 0bdc0eddcc10a7bd81d5afa45de88420bd0deeae (commit) via 6a66b93f612ea0671702b7bedc95101643595509 (commit) via 41164823f8f6b6a6e0b4bad820bc7bc11e456879 (commit) via f1ab76af7ab8a67278600cb5196e4dcfe47a8360 (commit) via 9db1bf64daef6ab7341b7f187d668e5536a374f2 (commit) via a482403b1b85055e0cafad3d87302804ac33d9b9 (commit) via 528d4c6d0093581da0663bb6990e837372d20016 (commit) via ba078f25df29f3de660df8e2721f1c2daedfd92b (commit) via da29fbd9cbb2b56ac5f0fdbda0c7072e66016eee (commit) from ce24486a968d36e3c7852ba02a38384929ca809a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f278c0e58794894a504eb792d3ca436eab961e65 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:53:09 2008 +0200 [FENCE] Make sure to version and copyright all built files Like all fence agents, those info can be useful. Store them in the modules even if only the libs print them out. Signed-off-by: Fabio M. Di Nitto commit 0bdc0eddcc10a7bd81d5afa45de88420bd0deeae Author: Fabio M. Di Nitto Date: Tue Apr 1 22:50:28 2008 +0200 [FENCE] Fix fencelib to pring version and copyright Signed-off-by: Fabio M. Di Nitto commit 6a66b93f612ea0671702b7bedc95101643595509 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:24:15 2008 +0200 [BUILD] Enable build and install of experimental fence agents Signed-off-by: Fabio M. Di Nitto commit 41164823f8f6b6a6e0b4bad820bc7bc11e456879 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:18:12 2008 +0200 [BUILD] Royal cleanup of the fence agents build system Collapse fenceperl and fencepy into fencebuild. fencebuild now use a much simpler and slightly more clever shell script scripts/fenceparse instead of scripts/define2var that was no longer used anywhere in the tree. update all the fence/agents/ Makefile to use fencebuild.mk. make fencebuild understand more than one target at a time. Signed-off-by: Fabio M. Di Nitto commit f1ab76af7ab8a67278600cb5196e4dcfe47a8360 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:09:53 2008 +0200 [FENCE] Remove obsoleted fence_apc perl implementation Signed-off-by: Fabio M. Di Nitto commit 9db1bf64daef6ab7341b7f187d668e5536a374f2 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:09:17 2008 +0200 [FENCE] Move apc_snmp README where it belongs Signed-off-by: Fabio M. Di Nitto commit a482403b1b85055e0cafad3d87302804ac33d9b9 Author: Fabio M. Di Nitto Date: Tue Apr 1 22:07:55 2008 +0200 [FENCE] Move apc_snmp README where it belongs Signed-off-by: Fabio M. Di Nitto commit 528d4c6d0093581da0663bb6990e837372d20016 Author: Fabio M. Di Nitto Date: Tue Apr 1 11:46:29 2008 +0200 [BUILD] add enable_experimental_fence_agents configure option Signed-off-by: Fabio M. Di Nitto commit ba078f25df29f3de660df8e2721f1c2daedfd92b Author: Fabio M. Di Nitto Date: Tue Apr 1 10:34:23 2008 +0200 [BUILD] Add fencelibdir support The new fence agents share a common python library. Make it's location configurable at build time (default to /usr/lib/fence). Update all targets required to handle it. Update the agents accordingly. NOTE: you will need to re-run configure to propagate the new configuration option. The new agents are not used/build/installed yet. This will happen shortly. NOTE to packagers: the new library depends on pexpect. Signed-off-by: Fabio M. Di Nitto commit da29fbd9cbb2b56ac5f0fdbda0c7072e66016eee Author: Fabio M. Di Nitto Date: Tue Apr 1 06:59:30 2008 +0200 [BUILD] Fix fenceperl and fencepy make snippets to allow multiple targets Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- configure | 15 + fence/agents/Makefile | 2 +- fence/agents/apc/Makefile | 9 +- fence/agents/apc/apc.py | 8 +- fence/agents/apc/fence_apc.pl | 469 ------------------------ fence/agents/apc_snmp/Makefile | 2 +- fence/agents/{apc => apc_snmp}/README | 0 fence/agents/baytech/Makefile | 2 +- fence/agents/bladecenter/Makefile | 9 +- fence/agents/bladecenter/bladecenter.py | 8 +- fence/agents/brocade/Makefile | 2 +- fence/agents/bullpap/Makefile | 2 +- fence/agents/cpint/Makefile | 2 +- fence/agents/drac/Makefile | 9 +- fence/agents/drac/drac5.py | 8 +- fence/agents/egenera/Makefile | 2 +- fence/agents/ibmblade/Makefile | 2 +- fence/agents/ilo/Makefile | 9 +- fence/agents/ilo/ilo.py | 8 +- fence/agents/{apc => lib}/Makefile | 19 +- fence/agents/lib/{fencing.py => fencing.py.py} | 10 +- fence/agents/mcdata/Makefile | 2 +- fence/agents/rsa/Makefile | 2 +- fence/agents/rsb/Makefile | 2 +- fence/agents/sanbox2/Makefile | 2 +- fence/agents/scsi/Makefile | 32 +-- fence/agents/vixel/Makefile | 2 +- fence/agents/vmware/Makefile | 2 +- fence/agents/wti/Makefile | 9 +- fence/agents/wti/wti.py | 8 +- fence/agents/xcat/Makefile | 2 +- fence/agents/zvm/Makefile | 2 +- make/clean.mk | 2 +- make/defines.mk.input | 5 +- make/fencebuild.mk | 24 ++ make/fenceperl.mk | 18 - make/fencepy.mk | 21 - make/install.mk | 4 + make/uninstall.mk | 3 + scripts/define2var | 71 ---- scripts/fenceparse | 47 +++ 42 files changed, 209 insertions(+), 650 deletions(-) delete mode 100755 fence/agents/apc/fence_apc.pl rename fence/agents/{apc => apc_snmp}/README (100%) copy fence/agents/{apc => lib}/Makefile (70%) rename fence/agents/lib/{fencing.py => fencing.py.py} (97%) create mode 100644 make/fencebuild.mk delete mode 100644 make/fenceperl.mk delete mode 100644 make/fencepy.mk delete mode 100755 scripts/define2var create mode 100755 scripts/fenceparse diff --git a/Makefile b/Makefile index 7346272..63c03c3 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ all: scripts ${SUBDIRS} # Fix scripts permissions scripts: - chmod 755 ${SRCDIR}/scripts/*.pl ${SRCDIR}/scripts/define2var + chmod 755 ${SRCDIR}/scripts/*.pl ${SRCDIR}/scripts/fenceparse ${SUBDIRS}: [ -n "${without_$@}" ] || ${MAKE} -C $@ all diff --git a/configure b/configure index 7f97c1f..4be68df 100755 --- a/configure +++ b/configure @@ -81,6 +81,8 @@ my %options = ( confdir => \$confdir, conffile => \$conffile, fence_agents => \$fence_agents, + fencelibdir => \$fencelibdir, + enable_experimental_fence_agents => \$enable_experimental_fence_agents, enable_xen => \$enable_xen, somajor => \$somajor, sominor => \$sominor, @@ -151,6 +153,8 @@ my $err = &GetOptions (\%options, 'sominor=s', 'release_version=s', 'fence_agents=s', + 'fencelibdir=s', + 'enable_experimental_fence_agents', 'enable_xen', 'without_ccs', 'without_cman', @@ -224,6 +228,8 @@ if ($help || !$err) { print "--xenlibdir=\tthe base directory for xen libraries. (Default: {libdir})\n"; print "--fence_agents=\tlist of fence agents to configure. (Default: all)\n"; print "\t\tUse --fence_agents=help for a list\n"; + print "--fencelibdir=\tspecify directory where to install common fence python lib. (Default: /usr/lib/fence)\n"; + print "--enable_experimental_fence_agents\tEnable build and install of experimental fence agents. (Default: no)\n"; print "--enable_xen\tEnable building of Xen-specific pieces\n"; print "--without_ccs\tDisable ccs building (Default: enabled)\n"; print "--without_cman\tDisable cman building (Default: enabled)\n"; @@ -506,6 +512,12 @@ if (!$conffile) { if (!$fence_agents) { $fence_agents="all"; } +if (!$fencelibdir) { + $fencelibdir="/usr/lib/fence"; +} +if (!$enable_experimental_fence_agents) { + $enable_experimental_fence_agents=""; +} if (!$enable_xen) { $enable_xen=""; } @@ -554,6 +566,7 @@ open (IFILE, "@args |"); while () { chomp; s|fence\/agents\/| |g; + s|lib ||g; $all_fence = $_; } close IFILE; @@ -622,6 +635,8 @@ while () { $_ =~ s/\@CONFDIR\@/$confdir/; $_ =~ s/\@CONFFILE\@/$conffile/; $_ =~ s/\@FENCE_AGENTS\@/$fence_agents/; + $_ =~ s/\@FENCELIBDIR\@/$fencelibdir/; + $_ =~ s/\@ENABLE_EXPERIMENTAL_FENCE_AGENTS\@/$enable_experimental_fence_agents/; $_ =~ s/\@ENABLE_XEN\@/$enable_xen/; $_ =~ s/\@DISABLE_CCS\@/$without_ccs/; $_ =~ s/\@DISABLE_CMAN\@/$without_cman/; diff --git a/fence/agents/Makefile b/fence/agents/Makefile index a349cea..c90dcb3 100644 --- a/fence/agents/Makefile +++ b/fence/agents/Makefile @@ -13,7 +13,7 @@ include ../../make/defines.mk -SUBDIRS = ${fence_agents} +SUBDIRS = ${fence_agents} lib all: ${SUBDIRS} diff --git a/fence/agents/apc/Makefile b/fence/agents/apc/Makefile index 7292eb8..6d25dfe 100644 --- a/fence/agents/apc/Makefile +++ b/fence/agents/apc/Makefile @@ -11,7 +11,12 @@ ############################################################################### ############################################################################### +include ../../../make/defines.mk + TARGET= fence_apc -include ../../../make/defines.mk -include $(OBJDIR)/make/fencepy.mk +ifdef enable_experimental_fence_agents +TARGET += apc +endif + +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/apc/apc.py b/fence/agents/apc/apc.py index bcea997..e26c2ca 100755 --- a/fence/agents/apc/apc.py +++ b/fence/agents/apc/apc.py @@ -13,9 +13,15 @@ ##### import sys, re, pexpect -sys.path.append("../lib/") +sys.path.append("@FENCELIBDIR@") from fencing import * +#BEGIN_VERSION_GENERATION +RELEASE_VERSION="New APC Agent - test release on steroids" +REDHAT_COPYRIGHT="" +BUILD_DATE="March, 2008" +#END_VERSION_GENERATION + def get_power_status(conn, options): result = "" try: diff --git a/fence/agents/apc/fence_apc.pl b/fence/agents/apc/fence_apc.pl deleted file mode 100755 index 7ab2060..0000000 --- a/fence/agents/apc/fence_apc.pl +++ /dev/null @@ -1,469 +0,0 @@ -#!/usr/bin/perl - -############################################################################### -############################################################################### -## -## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. -## -## This copyrighted material is made available to anyone wishing to use, -## modify, copy, or redistribute it subject to the terms and conditions -## of the GNU General Public License v.2. -## -############################################################################### -############################################################################### - -use Getopt::Std; -use Net::Telnet (); - -# Get the program name from $0 and strip directory names -$_=$0; -s/.*\///; -my $pname = $_; - -# Change these if the text returned by your equipment is different. -# Test by running script with options -t -v and checking /tmp/apclog - -my $immediate = 'immediate'; # # Or 'delayed' - action string prefix on menu -my $masterswitch = 'masterswitch plus '; # 'Device Manager' option to choose -my $login_prompt = '/: /'; -my $cmd_prompt = '/> $/'; - -my $max_open_tries = 3; # How many telnet attempts to make. Because the - # APC can fail repeated login attempts, this number - # should be more than 1 -my $open_wait = 5; # Seconds to wait between each telnet attempt -my $telnet_timeout = 2; # Seconds to wait for matching telent response -my $debuglog = '/tmp/apclog';# Location of debugging log when in verbose mode -$opt_o = 'reboot'; # Default fence action. - -my $logged_in = 0; - -my $t = new Net::Telnet; - - - -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - -#BEGIN_VERSION_GENERATION -$RELEASE_VERSION=""; -$REDHAT_COPYRIGHT=""; -$BUILD_DATE=""; -#END_VERSION_GENERATION - -sub usage -{ - print "Usage:\n"; - print "\n"; - print "$pname [options]\n"; - print "\n"; - print "Options:\n"; - print " -a IP address or hostname of MasterSwitch\n"; - print " -h usage\n"; - print " -l Login name\n"; - print " -n Outlet number to change: [:] \n"; - print " -o Action: Reboot (default), Off or On\n"; - print " -p Login password\n"; - print " -q quiet mode\n"; - print " -T Test mode (cancels action)\n"; - print " -V version\n"; - print " -v Log to file /tmp/apclog\n"; - - exit 0; -} - -sub fail -{ - ($msg)=@_; - print $msg."\n" unless defined $opt_q; - - if (defined $t) - { - # make sure we don't get stuck in a loop due to errors - $t->errmode('return'); - - logout() if $logged_in; - $t->close(); - } - exit 1; -} - -sub fail_usage -{ - ($msg)=@_; - print STDERR $msg."\n" if $msg; - print STDERR "Please use '-h' for usage.\n"; - exit 1; -} - -sub version -{ - print "$pname $RELEASE_VERSION $BUILD_DATE\n"; - print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); - exit 0; -} - - -sub login -{ - for (my $i=0; $i<$max_open_tries; $i++) - { - $t->open($opt_a); - ($_) = $t->waitfor($login_prompt); - - # Expect 'User Name : ' - if (! /name/i) { - $t->close(); - sleep($open_wait); - next; - } - - $t->print($opt_l); - ($_) = $t->waitfor($login_prompt); - - # Expect 'Password : ' - if (! /password/i ) { - $t->close(); - sleep($open_wait); - next; - } - - # Send password - $t->print($opt_p); - - (my $dummy, $_) = $t->waitfor('/(>|(?i:user name|password)\s*:) /'); - if (/> /) - { - $logged_in = 1; - - # send newline to flush prompt - $t->print(""); - - return; - } - else - { - fail "invalid username or password"; - } - } - fail "failed: telnet failed: ". $t->errmsg."\n" -} - -# print_escape_char() -- utility subroutine for sending the 'Esc' character -sub print_escape_char -{ - # The APC menu uses "" to go 'up' menues. We must set - # the output_record_separator to "" so that "\n" is not printed - # after the "" character - - $ors=$t->output_record_separator; - $t->output_record_separator(""); - $t->print("\x1b"); # send escape - $t->output_record_separator("$ors"); -} - - -# Determine if the switch is a working state. Also check to make sure that -# the switch has been specified in the case that there are slave switches -# present. This assumes that we are at the main menu. -sub identify_switch -{ - - ($_) = $t->waitfor($cmd_prompt); - print_escape_char(); - - # determine what type of switch we are dealling with - ($_) = $t->waitfor($cmd_prompt); - if ( /Switched Rack PDU: Communication Established/i) - { - # No further test needed - } - elsif ( /MS plus 1 : Serial Communication Established/i ) - { - if ( defined $switchnum ) - { - $masterswitch = $masterswitch . $switchnum; - } - elsif ( /MS plus [^1] : Serial Communication Established/i ) - { - fail "multiple switches detected. 'switch' must be defined."; - } - else - { - $switchnum = 1; - } - } - else - { - fail "APC is in undetermined state" - } - - # send a newline to cause APC to reprint the menu - $t->print(""); -} - - -# Navigate through menus to the appropriate outlet control menu of the apc -# MasterSwitch and 79xx series switches. Uses multi-line (mostly) -# case-insensitive matches to recognise menus and works out what option number -# to select from each menu. -sub navigate -{ - # Limit the ammount of menu depths to 20. We should never be this deep - for(my $i=20; $i ; $i--) - { - # Get the new text from the menu - (($_) = $t->waitfor($cmd_prompt)) or next; - - # Identify next option - if ( - # "Control Console", "1- Device Manager" - /--\s*control console.*(\d+)\s*-\s*device manager/is || - - # - # APC MasterSwitch Menus - # - # "Device Manager", "1- MasterSwitch plus 1" - /--\s*device manager.*(\d+)\s*-\s*$masterswitch/is || - - # "Device Manager", "1- Cluster Node 0 ON" - /--\s*(?:device manager|$masterswitch).*(\d+)\s*-\s+Outlet\s+$switchnum:$opt_n\D[^\n]*\s(?-i:ON|OFF)\*?\s/ism || - - # "MasterSwitch plus 1", "1- Outlet 1:1 Outlet #1 ON" - /--\s*$masterswitch.*(\d+)\s*-\s*Outlet\s+$switchnum:$opt_n\s[^\n]*\s(?-i:ON|OFF)\*?\s/ism || - - # Administrator outlet control menu - /--\s*Outlet $switchnum:$opt_n\D.*(\d+)\s*-\s*outlet control\s*$switchnum:?$opt_n\D/ism || - - - # - # APC 79XX Menus - # - # "3- Outlet Control/Configuration" - /--\s*device manager.*(\d+)\s*-\s*Outlet Control/is || - - # "Device Manager", "1- Cluster Node 0 ON" - /--\s*Outlet Control.*\s+?(\d+)\s*-\s+[^\n\r]*\s*Outlet\s+$opt_n\D[^\n]*\s(?-i:ON|OFF)\*?\s/ism || - - # Administrator Outlet Control menu - /--[^\n\r]*Outlet\s+$opt_n\D.*(\d+)\s*-\s*control\s*outlet\s+$opt_n\D/ism || - /--[^\n\r]*Outlet\s+$opt_n\D.*(\d+)\s*-\s*control\s*outlet/ism - ) { - $t->print($1); - next; - } - - if (/.*Press ([^\n\r]+) to continue.*$/) { - $t->print(""); - next; - } - - # "Outlet Control X:N", "4- Immediate Reboot" - if ( /(\d+)\s*-\s*$immediate $opt_o/i || - /--\s*Control Outlet\D.*(\d+)\s*-\s*Immediate\s*$opt_o/is ) { - $t->print($1); - last; - } - - fail "failed: unrecognised menu response\n"; - } -} - - -sub logout -{ - # send a newline to make sure that we refresh the menus - # ($t->waitfor() can hang otherwise) - $t->print(""); - - # Limit the ammount of menu depths to 20. We should never be this deep - for(my $i=20; $i ; $i--) - { - - # Get the new text from the menu - ($_) = $t->waitfor($cmd_prompt); - - if ( - # "Control Console", "4- Logout" - /--\s*control console.*(\d+)\s*-\s*Logout/is - ) { - $t->print($1); - last; - } - else - { - print_escape_char(); - next; - } - } -} - - -sub action -{ - # "Enter 'YES' to continue or to cancel : " - ($_) = $t->waitfor('/: /'); - if (! /$immediate $opt_o.*outlet $opt_n\s.*YES.*to continue/si ) { - fail "failed: unrecognised $opt_o response\n"; - } - - # Test mode? - $t->print($opt_T?'NO':'YES'); - - # "Success", "Press to continue..." - ($_) = $t->waitfor('/continue/'); - $t->print(''); - - if (defined $opt_T) { - logout(); - print "success: test outlet $opt_n $opt_o\n" unless defined $opt_q; - $t->close(); - - # Allow the APC some time to clean connection - # before next login. - sleep 1; - - exit 0; - } elsif ( /Success/i ) { - logout(); - print "success: outlet $opt_n $opt_o\n" unless defined $opt_q; - $t->close(); - - # Allow the APC some time to clean connection - # before next login. - sleep 1; - - exit 0; - } - - fail "failed: unrecognised action response\n"; -} - - -sub get_options_stdin -{ - my $opt; - my $line = 0; - while( defined($in = <>) ) - { - $_ = $in; - chomp; - - # strip leading and trailing whitespace - s/^\s*//; - s/\s*$//; - - # skip comments - next if /^#/; - - $line+=1; - $opt=$_; - next unless $opt; - - ($name,$val)=split /\s*=\s*/, $opt; - - if ( $name eq "" ) - { - print STDERR "parse error: illegal name in option $line\n"; - exit 2; - } - # DO NOTHING -- this field is used by fenced - elsif ($name eq "agent" ) - { - } - elsif ($name eq "ipaddr" ) - { - $opt_a = $val; - } - elsif ($name eq "login" ) - { - $opt_l = $val; - } - elsif ($name eq "option" ) - { - $opt_o = $val; - } - elsif ($name eq "passwd" ) - { - $opt_p = $val; - } - elsif ($name eq "port" ) - { - $opt_n = $val; - } - elsif ($name eq "switch" ) - { - $switchnum = $val; - } - elsif ($name eq "test" ) - { - $opt_T = $val; - } - elsif ($name eq "verbose" ) - { - $opt_v = $val; - } - } -} - - -sub telnet_error -{ - if ($t->errmsg ne "pattern match timed-out") { - fail "failed: telnet returned: ".$t->errmsg."\n"; - } else { - $t->print(""); - } -} - - -### MAIN ####################################################### - -if (@ARGV > 0) { - getopts("a:hl:n:o:p:qTvV") || fail_usage ; - - usage if defined $opt_h; - version if defined $opt_V; - - fail_usage "Unkown parameter." if (@ARGV > 0); - - fail_usage "No '-a' flag specified." unless defined $opt_a; - fail_usage "No '-n' flag specified." unless defined $opt_n; - fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; - fail_usage "Unrecognised action '$opt_o' for '-o' flag" - unless $opt_o =~ /^(Off|On|Reboot)$/i; - - if ( $opt_n =~ /(\d+):(\d+)/ ) { - $switchnum=($1); - $opt_n = ($2); - } -} else { - get_options_stdin(); - - fail "failed: no IP address" unless defined $opt_a; - fail "failed: no plug number" unless defined $opt_n; - fail "failed: no login name" unless defined $opt_l; - fail "failed: no password" unless defined $opt_p; - fail "failed: unrecognised action: $opt_o" - unless $opt_o =~ /^(Off|On|Reboot)$/i; -} - -$t->timeout($telnet_timeout); -$t->input_log($debuglog) if $opt_v; -$t->errmode('return'); - -&login; - -&identify_switch; - -# Abort on failure beyond here -$t->errmode(\&telnet_error); - -&navigate; -&action; - -exit 0; - - diff --git a/fence/agents/apc_snmp/Makefile b/fence/agents/apc_snmp/Makefile index 136bf11..8471db4 100644 --- a/fence/agents/apc_snmp/Makefile +++ b/fence/agents/apc_snmp/Makefile @@ -15,4 +15,4 @@ TARGET= fence_apc_snmp MIBRESOURCE= powernet369.mib include ../../../make/defines.mk -include $(OBJDIR)/make/fencepy.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/apc/README b/fence/agents/apc_snmp/README similarity index 100% rename from fence/agents/apc/README rename to fence/agents/apc_snmp/README diff --git a/fence/agents/baytech/Makefile b/fence/agents/baytech/Makefile index 97c2a89..00cf95c 100644 --- a/fence/agents/baytech/Makefile +++ b/fence/agents/baytech/Makefile @@ -14,4 +14,4 @@ TARGET= fence_baytech include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/bladecenter/Makefile b/fence/agents/bladecenter/Makefile index 4c4390c..98c54a0 100644 --- a/fence/agents/bladecenter/Makefile +++ b/fence/agents/bladecenter/Makefile @@ -11,7 +11,12 @@ ############################################################################### ############################################################################### +include ../../../make/defines.mk + TARGET= fence_bladecenter -include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +ifdef enable_experimental_fence_agents +TARGET += bladecenter +endif + +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/bladecenter/bladecenter.py b/fence/agents/bladecenter/bladecenter.py index cbc7daa..675b921 100755 --- a/fence/agents/bladecenter/bladecenter.py +++ b/fence/agents/bladecenter/bladecenter.py @@ -14,9 +14,15 @@ ##### import sys, re, pexpect -sys.path.append("../lib/") +sys.path.append("@FENCELIBDIR@") from fencing import * +#BEGIN_VERSION_GENERATION +RELEASE_VERSION="New Bladecenter Agent - test release on steroids" +REDHAT_COPYRIGHT="" +BUILD_DATE="March, 2008" +#END_VERSION_GENERATION + def get_power_status(conn, options): try: node_cmd = "system:blade\[" + options["-n"] + "\]>" diff --git a/fence/agents/brocade/Makefile b/fence/agents/brocade/Makefile index bc008e4..5b58409 100644 --- a/fence/agents/brocade/Makefile +++ b/fence/agents/brocade/Makefile @@ -14,4 +14,4 @@ TARGET= fence_brocade include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/bullpap/Makefile b/fence/agents/bullpap/Makefile index d4d0145..e303558 100644 --- a/fence/agents/bullpap/Makefile +++ b/fence/agents/bullpap/Makefile @@ -14,4 +14,4 @@ TARGET= fence_bullpap include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/cpint/Makefile b/fence/agents/cpint/Makefile index dd001cd..e6fb49e 100644 --- a/fence/agents/cpint/Makefile +++ b/fence/agents/cpint/Makefile @@ -14,4 +14,4 @@ TARGET= fence_cpint include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/drac/Makefile b/fence/agents/drac/Makefile index 390e210..f862d4b 100644 --- a/fence/agents/drac/Makefile +++ b/fence/agents/drac/Makefile @@ -11,7 +11,12 @@ ############################################################################### ############################################################################### +include ../../../make/defines.mk + TARGET= fence_drac -include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +ifdef enable_experimental_fence_agents +TARGET += drac5 +endif + +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/drac/drac5.py b/fence/agents/drac/drac5.py index 63012fc..a94c5f6 100755 --- a/fence/agents/drac/drac5.py +++ b/fence/agents/drac/drac5.py @@ -14,9 +14,15 @@ ##### import sys, re, pexpect -sys.path.append("../lib/") +sys.path.append("@FENCELIBDIR@") from fencing import * +#BEGIN_VERSION_GENERATION +RELEASE_VERSION="New Drac5 Agent - test release on steroids" +REDHAT_COPYRIGHT="" +BUILD_DATE="March, 2008" +#END_VERSION_GENERATION + def get_power_status(conn, options): try: conn.sendline("racadm serveraction powerstatus") diff --git a/fence/agents/egenera/Makefile b/fence/agents/egenera/Makefile index 7e15c87..c980b45 100644 --- a/fence/agents/egenera/Makefile +++ b/fence/agents/egenera/Makefile @@ -14,4 +14,4 @@ TARGET= fence_egenera include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/ibmblade/Makefile b/fence/agents/ibmblade/Makefile index dfa1d5a..50053a1 100644 --- a/fence/agents/ibmblade/Makefile +++ b/fence/agents/ibmblade/Makefile @@ -14,4 +14,4 @@ TARGET= fence_ibmblade include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/ilo/Makefile b/fence/agents/ilo/Makefile index eb51656..c0a0290 100644 --- a/fence/agents/ilo/Makefile +++ b/fence/agents/ilo/Makefile @@ -11,7 +11,12 @@ ############################################################################### ############################################################################### +include ../../../make/defines.mk + TARGET= fence_ilo -include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +ifdef enable_experimental_fence_agents +TARGET += ilo +endif + +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/ilo/ilo.py b/fence/agents/ilo/ilo.py index 1f3e330..0db971b 100755 --- a/fence/agents/ilo/ilo.py +++ b/fence/agents/ilo/ilo.py @@ -13,9 +13,15 @@ ##### import sys, re, pexpect -sys.path.append("../lib/") +sys.path.append("@FENCELIBDIR@") from fencing import * +#BEGIN_VERSION_GENERATION +RELEASE_VERSION="New ILO Agent - test release on steroids" +REDHAT_COPYRIGHT="" +BUILD_DATE="March, 2008" +#END_VERSION_GENERATION + def get_power_status(conn, options): try: conn.send("POWER\r\n") diff --git a/fence/agents/apc/Makefile b/fence/agents/lib/Makefile similarity index 70% copy from fence/agents/apc/Makefile copy to fence/agents/lib/Makefile index 7292eb8..4ef2edc 100644 --- a/fence/agents/apc/Makefile +++ b/fence/agents/lib/Makefile @@ -1,8 +1,8 @@ -############################################################################### +############################################################################## ############################################################################### ## -## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2008 Fabio M. Di Nitto $(TARGET) - awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).pl >> $(TARGET) - echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET) - ${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET) - echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET) - awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).pl >> $(TARGET) - chmod +x $(TARGET) - -$(TARGET)_test: - : > $(TARGET)_test - awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET)_test.pl >> $(TARGET)_test - echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET)_test - ${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)_test - echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET)_test - awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET)_test.pl >> $(TARGET)_test - chmod +x $(TARGET)_test - -clean: generalclean +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/vixel/Makefile b/fence/agents/vixel/Makefile index 2bbc0fc..828f3ea 100644 --- a/fence/agents/vixel/Makefile +++ b/fence/agents/vixel/Makefile @@ -14,4 +14,4 @@ TARGET= fence_vixel include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/vmware/Makefile b/fence/agents/vmware/Makefile index cdf42bb..6c2b911 100644 --- a/fence/agents/vmware/Makefile +++ b/fence/agents/vmware/Makefile @@ -14,4 +14,4 @@ TARGET= fence_vmware include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/wti/Makefile b/fence/agents/wti/Makefile index 21716cc..3a59521 100644 --- a/fence/agents/wti/Makefile +++ b/fence/agents/wti/Makefile @@ -11,7 +11,12 @@ ############################################################################### ############################################################################### +include ../../../make/defines.mk + TARGET= fence_wti -include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +ifdef enable_experimental_fence_agents +TARGET += wti +endif + +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/wti/wti.py b/fence/agents/wti/wti.py index 926d347..c118af3 100755 --- a/fence/agents/wti/wti.py +++ b/fence/agents/wti/wti.py @@ -13,9 +13,15 @@ ##### import sys, re, pexpect -sys.path.append("../lib/") +sys.path.append("@FENCELIBDIR@") from fencing import * +#BEGIN_VERSION_GENERATION +RELEASE_VERSION="New WTI Agent - test release on steroids" +REDHAT_COPYRIGHT="" +BUILD_DATE="March, 2008" +#END_VERSION_GENERATION + def get_power_status(conn, options): try: conn.send("/S"+"\r\n") diff --git a/fence/agents/xcat/Makefile b/fence/agents/xcat/Makefile index d45e0bd..6c1db95 100644 --- a/fence/agents/xcat/Makefile +++ b/fence/agents/xcat/Makefile @@ -14,4 +14,4 @@ TARGET= fence_xcat include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/fence/agents/zvm/Makefile b/fence/agents/zvm/Makefile index 64cc46b..2094a2b 100644 --- a/fence/agents/zvm/Makefile +++ b/fence/agents/zvm/Makefile @@ -14,4 +14,4 @@ TARGET= fence_zvm include ../../../make/defines.mk -include $(OBJDIR)/make/fenceperl.mk +include $(OBJDIR)/make/fencebuild.mk diff --git a/make/clean.mk b/make/clean.mk index 68a0980..a8b9af6 100644 --- a/make/clean.mk +++ b/make/clean.mk @@ -1,5 +1,5 @@ generalclean: - rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d + rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc rm -rf core core.* .depend cscope.* *.orig *.rej rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d rm -rf ${TARGET} ${TARGETS} ${TARGET}_test diff --git a/make/defines.mk.input b/make/defines.mk.input index 1e6f8df..1ea77f4 100644 --- a/make/defines.mk.input +++ b/make/defines.mk.input @@ -66,6 +66,8 @@ xenlibdir ?= @XENLIBDIR@ virtincdir ?= @VIRTINCDIR@ virtlibdir ?= @VIRTLIBDIR@ fence_agents ?= @FENCE_AGENTS@ +fencelibdir ?= @FENCELIBDIR@ +enable_experimental_fence_agents ?= @ENABLE_EXPERIMENTAL_FENCE_AGENTS@ enable_xen ?= @ENABLE_XEN@ without_gnbd-kernel/src ?= @DISABLE_GNBD@ without_gfs-kernel/src/gfs ?= @DISABLE_GFS@ @@ -87,5 +89,4 @@ CONFDIR=@CONFDIR@ CONFFILE=@CONFFILE@ UNINSTALL = @SRCDIR@/scripts/uninstall.pl -DEF2VAR = @SRCDIR@/scripts/define2var - +FENCEPARSE = @SRCDIR@/scripts/fenceparse diff --git a/make/fencebuild.mk b/make/fencebuild.mk new file mode 100644 index 0000000..c0671e0 --- /dev/null +++ b/make/fencebuild.mk @@ -0,0 +1,24 @@ +ifndef FENCELIB +SBINDIRT=$(TARGET) +endif + +all: $(TARGET) + +include $(OBJDIR)/make/clean.mk +include $(OBJDIR)/make/install.mk +include $(OBJDIR)/make/uninstall.mk + +$(TARGET): + ${FENCEPARSE} \ + ${SRCDIR}/config/copyright.cf REDHAT_COPYRIGHT \ + ${RELEASE_VERSION} \ + $(S) $@ | \ + sed \ + -e 's#@FENCELIBDIR@#${fencelibdir}#g' \ + -e 's#@MIBDIR@#${mibdir}#g' \ + -e 's#@SNMPBIN@#${snmpbin}#g' \ + > $@ + + chmod +x $@ + +clean: generalclean diff --git a/make/fenceperl.mk b/make/fenceperl.mk deleted file mode 100644 index 9c60726..0000000 --- a/make/fenceperl.mk +++ /dev/null @@ -1,18 +0,0 @@ -SBINDIRT=$(TARGET) - -all: $(TARGET) - -include $(OBJDIR)/make/clean.mk -include $(OBJDIR)/make/install.mk -include $(OBJDIR)/make/uninstall.mk - -$(TARGET): - : > $(TARGET) - awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).pl >> $(TARGET) - echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET) - ${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET) - echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET) - awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).pl >> $(TARGET) - chmod +x $(TARGET) - -clean: generalclean diff --git a/make/fencepy.mk b/make/fencepy.mk deleted file mode 100644 index 7f58241..0000000 --- a/make/fencepy.mk +++ /dev/null @@ -1,21 +0,0 @@ -SBINDIRT=$(TARGET) - -all: $(TARGET) - -include $(OBJDIR)/make/clean.mk -include $(OBJDIR)/make/install.mk -include $(OBJDIR)/make/uninstall.mk - -$(TARGET): - : > $(TARGET) - awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).py >> $(TARGET) - echo "RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET) - ${DEF2VAR} ${SRCDIR}/config/copyright.cf sh REDHAT_COPYRIGHT >> $(TARGET) - echo "BUILD_DATE=\"(built `date`)\";" >> $(TARGET) - awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).py >> $(TARGET) - chmod +x $(TARGET) -ifdef MIBRESOURCE - sed -i -e 's#@MIBDIR@#${mibdir}#g' -e 's#@SNMPBIN@#${snmpbin}#g' $(TARGET) -endif - -clean: generalclean diff --git a/make/install.mk b/make/install.mk index 6c43538..6260e50 100644 --- a/make/install.mk +++ b/make/install.mk @@ -51,3 +51,7 @@ ifdef MIBRESOURCE install -d ${mibdir} install -m644 $(S)/${MIBRESOURCE} ${mibdir} endif +ifdef FENCELIB + install -d ${DESTDIR}/${fencelibdir} + install -m644 $(S)/${FENCELIB} ${DESTDIR}/${fencelibdir} +endif diff --git a/make/uninstall.mk b/make/uninstall.mk index 544ec68..e6211c6 100644 --- a/make/uninstall.mk +++ b/make/uninstall.mk @@ -32,3 +32,6 @@ endif ifdef MIBRESOURCE ${UNINSTALL} ${MIBRESOURCE} ${mibdir} endif +ifdef FENCELIB + ${UNINSTALL} ${FENCELIB}* ${DESTDIR}/${fencelibdir} +endif diff --git a/scripts/define2var b/scripts/define2var deleted file mode 100755 index 6f0ef5b..0000000 --- a/scripts/define2var +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - -############################################################################### -############################################################################### -## -## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. -## -## This copyrighted material is made available to anyone wishing to use, -## modify, copy, or redistribute it subject to the terms and conditions -## of the GNU General Public License v.2. -## -############################################################################### -############################################################################### - -## -## This script will pull out #define's and convert them into variables that -## can be used for shell or perl scripts. -## -## It takes 2 or 3 parameters. The first parameter is the filename to search -## in. The second paramter is the desired output format. Supported types -## ar sh and perl. An optional third parameter may be given. If specified, -## only that partiucular #define will be extracted, otherwise, all #defines -## are extracted. This script is not capable of handling condiitional rules. -## - -$usage = "usage: define2var [define]"; - -if (@ARGV != 2 && @ARGV != 3) -{ - die "$usage\n"; -} - -my ($filename, $type, $define ) = @ARGV; -my $pfx,$sfx; - -if ($type eq "sh") -{ - ($pfx,$sfx) = ("",""); i -} -elsif ($type eq "perl" ) -{ - ($pfx,$sfx) = ("\$",";"); -} -else -{ - die "Unknown type: $type\n"; -} - -open FILE, "< $filename" or die "error opening $filename: $!\n"; - -while () -{ - chomp; - if ($_ =~ /^#define\s+(\S+)\s+(.*)/) - { - if(! $define ) - { - print "$pfx$1=$2$sfx\n"; - } - elsif ($define eq $1 ) - { - print "$pfx$1=$2$sfx\n"; - exit 0; - } - } -} - -die "\"$define\" not found\n" if ($define); - -exit 0; diff --git a/scripts/fenceparse b/scripts/fenceparse new file mode 100755 index 0000000..de2ec7a --- /dev/null +++ b/scripts/fenceparse @@ -0,0 +1,47 @@ +#!/bin/bash + +############################################################################### +############################################################################### +## +## Copyright (C) 2008 Fabio M. Di Nitto +## +## This copyrighted material is made available to anyone wishing to use, +## modify, copy, or redistribute it subject to the terms and conditions +## of the GNU General Public License v.2. +## +############################################################################### +############################################################################### + +set -e + +definefile="$1" +define="$2" +release="$3" +srcdir="$4" +infile="$5" + +definedata="$(cat $definefile | grep "^\#define $define" | sed -e 's/.*'$define' //')" + +realinfile="$(ls $srcdir/$infile.*)" + +interpreter="$(cat $realinfile | head -n 1 | awk -F "/" '{print $NF}')" +interpreter="$(echo $interpreter)" + +case "$interpreter" in + perl) + start="\$" + end=";" + ;; + *) + start="" + end="" + ;; +esac + +awk "{print}(\$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $realinfile +echo ${start}RELEASE_VERSION=\"${release}\"${end} +echo ${start}REDHAT_COPYRIGHT=${definedata}${end} +echo ${start}BUILD_DATE=\"\(built $(date)\)\"${end} +awk -v p=0 "(\$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $realinfile + +exit 0 hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Tue Apr 1 21:01:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Tue, 01 Apr 2008 21:01:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-21-gd0aecbf Message-ID: <20080401210128.31480.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d0aecbf552f27bb2bf9d3c66015dd4d8df559dd8 The branch, RHEL4 has been updated via d0aecbf552f27bb2bf9d3c66015dd4d8df559dd8 (commit) from 2114f9e99321008beef4cc18bcbe4aa8712015f9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0aecbf552f27bb2bf9d3c66015dd4d8df559dd8 Author: Jonathan Brassow Date: Tue Apr 1 15:24:50 2008 -0500 rgmanager/lvm.sh: Fix bug bz242798 Allow a machine to fence itself in the event that it cannot deactivate logical volumes. (The user must explicitly enable this option.) This is useful in cases where one machine in the cluster looses connectivity to its resources, but the others don't. The machine fences itself and the service moves to another machine. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.metadata | 13 ++++++++++++- rgmanager/src/resources/lvm.sh | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletions(-) diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata index 03a5655..61a740b 100755 --- a/rgmanager/src/resources/lvm.metadata +++ b/rgmanager/src/resources/lvm.metadata @@ -39,7 +39,18 @@ If you can see this, your GUI is broken. - + + + + + If set and the clean up of the tags fails, the node will + immediately reboot. + + + Fence the node if it is not able to clean up LVM tags + + + diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index 6cfb19a..f45e50d 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -293,6 +293,13 @@ lv_activate_and_tag() declare action=$1 declare tag=$2 declare lv_path=$3 + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" @@ -314,6 +321,14 @@ lv_activate_and_tag() else ocf_log notice "Deactivating $lv_path" if ! lv_activate_resilient $action $lv_path; then + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path REBOOT" + sync + reboot -fn + else + ocf_log err "Unable to deactivate $lv_path" + fi + ocf_log err "Unable to deactivate $lv_path" return $OCF_ERR_GENERIC fi hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Tue Apr 1 21:40:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Tue, 01 Apr 2008 21:40:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-122-ge82959a Message-ID: <20080401214009.23416.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e82959afc8e649029122bfb8a491abef861105e2 The branch, master has been updated via e82959afc8e649029122bfb8a491abef861105e2 (commit) from f278c0e58794894a504eb792d3ca436eab961e65 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e82959afc8e649029122bfb8a491abef861105e2 Author: Jonathan Brassow Date: Tue Apr 1 16:24:53 2008 -0500 rgmanager/lvm.sh: Fix bug bz242798 Allow a machine to fence itself in the event that it cannot deactivate logical volumes. (The user must explicitly enable this option.) This is useful in cases where one machine in the cluster looses connectivity to its resources, but the others don't. The machine fences itself and the service moves to another machine. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.metadata | 13 ++++++++++++- rgmanager/src/resources/lvm_by_lv.sh | 15 ++++++++++++++- rgmanager/src/resources/lvm_by_vg.sh | 17 +++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata index 03a5655..650675b 100755 --- a/rgmanager/src/resources/lvm.metadata +++ b/rgmanager/src/resources/lvm.metadata @@ -39,7 +39,18 @@ If you can see this, your GUI is broken. - + + + + + If set and the clean up of the tags fails, the node will + immediately reboot. + + + Fence the node if it is not able to clean up LVM tags + + + diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh index e14540f..6691181 100644 --- a/rgmanager/src/resources/lvm_by_lv.sh +++ b/rgmanager/src/resources/lvm_by_lv.sh @@ -173,6 +173,13 @@ lv_activate_and_tag() declare action=$1 declare tag=$2 declare lv_path=$3 + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" @@ -194,7 +201,13 @@ lv_activate_and_tag() else ocf_log notice "Deactivating $lv_path" if ! lv_activate_resilient $action $lv_path; then - ocf_log err "Unable to deactivate $lv_path" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path: REBOOTING" + sync + reboot -fn + else + ocf_log err "Unable to deactivate $lv_path" + fi return $OCF_ERR_GENERIC fi diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index b1840a1..8fa36d6 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -242,17 +242,30 @@ function vg_stop { local a local results + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac # Shut down the volume group # Do we need to make this resilient? vgchange -an $OCF_RESKEY_vg_name # Make sure all the logical volumes are inactive - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ${results[$(($a + 1))]} =~ ....a. ]]; then - ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path REBOOT" + sync + reboot -fn + else + ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + fi return $OCF_ERR_GENERIC fi a=$(($a + 2)) hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Tue Apr 1 21:56:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Tue, 01 Apr 2008 21:56:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-29-gfb8ff41 Message-ID: <20080401215656.29351.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=fb8ff413588b1404d99b78adf30987beaea9db32 The branch, RHEL5 has been updated via fb8ff413588b1404d99b78adf30987beaea9db32 (commit) from 3183d505bd43e6d981686b86e97e92eea0f85341 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fb8ff413588b1404d99b78adf30987beaea9db32 Author: Jonathan Brassow Date: Tue Apr 1 16:18:52 2008 -0500 rgmanager/lvm.sh: Fix bug bz242798 Allow a machine to fence itself in the event that it cannot deactivate logical volumes. (The user must explicitly enable this option.) This is useful in cases where one machine in the cluster looses connectivity to its resources, but the others don't. The machine fences itself and the service moves to another machine. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.metadata | 13 ++++++++++++- rgmanager/src/resources/lvm_by_lv.sh | 15 ++++++++++++++- rgmanager/src/resources/lvm_by_vg.sh | 17 +++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata index 03a5655..650675b 100755 --- a/rgmanager/src/resources/lvm.metadata +++ b/rgmanager/src/resources/lvm.metadata @@ -39,7 +39,18 @@ If you can see this, your GUI is broken. - + + + + + If set and the clean up of the tags fails, the node will + immediately reboot. + + + Fence the node if it is not able to clean up LVM tags + + + diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh index e14540f..6691181 100644 --- a/rgmanager/src/resources/lvm_by_lv.sh +++ b/rgmanager/src/resources/lvm_by_lv.sh @@ -173,6 +173,13 @@ lv_activate_and_tag() declare action=$1 declare tag=$2 declare lv_path=$3 + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" @@ -194,7 +201,13 @@ lv_activate_and_tag() else ocf_log notice "Deactivating $lv_path" if ! lv_activate_resilient $action $lv_path; then - ocf_log err "Unable to deactivate $lv_path" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path: REBOOTING" + sync + reboot -fn + else + ocf_log err "Unable to deactivate $lv_path" + fi return $OCF_ERR_GENERIC fi diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index b1840a1..8fa36d6 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -242,17 +242,30 @@ function vg_stop { local a local results + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac # Shut down the volume group # Do we need to make this resilient? vgchange -an $OCF_RESKEY_vg_name # Make sure all the logical volumes are inactive - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ${results[$(($a + 1))]} =~ ....a. ]]; then - ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path REBOOT" + sync + reboot -fn + else + ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + fi return $OCF_ERR_GENERIC fi a=$(($a + 2)) hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 2 03:55:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 02 Apr 2008 03:55:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-31-g3db96e8 Message-ID: <20080402035541.4096.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=3db96e8cb13b9fc9f60045832d7de02400e06679 The branch, STABLE2 has been updated via 3db96e8cb13b9fc9f60045832d7de02400e06679 (commit) from 25beb8a99636615abd6fca9223fe20b672070b87 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3db96e8cb13b9fc9f60045832d7de02400e06679 Author: Jonathan Brassow Date: Tue Apr 1 16:24:53 2008 -0500 rgmanager/lvm.sh: Fix bug bz242798 Allow a machine to fence itself in the event that it cannot deactivate logical volumes. (The user must explicitly enable this option.) This is useful in cases where one machine in the cluster looses connectivity to its resources, but the others don't. The machine fences itself and the service moves to another machine. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.metadata | 13 ++++++++++++- rgmanager/src/resources/lvm_by_lv.sh | 15 ++++++++++++++- rgmanager/src/resources/lvm_by_vg.sh | 17 +++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata index 03a5655..650675b 100755 --- a/rgmanager/src/resources/lvm.metadata +++ b/rgmanager/src/resources/lvm.metadata @@ -39,7 +39,18 @@ If you can see this, your GUI is broken. - + + + + + If set and the clean up of the tags fails, the node will + immediately reboot. + + + Fence the node if it is not able to clean up LVM tags + + + diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh index e14540f..6691181 100644 --- a/rgmanager/src/resources/lvm_by_lv.sh +++ b/rgmanager/src/resources/lvm_by_lv.sh @@ -173,6 +173,13 @@ lv_activate_and_tag() declare action=$1 declare tag=$2 declare lv_path=$3 + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" @@ -194,7 +201,13 @@ lv_activate_and_tag() else ocf_log notice "Deactivating $lv_path" if ! lv_activate_resilient $action $lv_path; then - ocf_log err "Unable to deactivate $lv_path" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path: REBOOTING" + sync + reboot -fn + else + ocf_log err "Unable to deactivate $lv_path" + fi return $OCF_ERR_GENERIC fi diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index b1840a1..8fa36d6 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -242,17 +242,30 @@ function vg_stop { local a local results + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac # Shut down the volume group # Do we need to make this resilient? vgchange -an $OCF_RESKEY_vg_name # Make sure all the logical volumes are inactive - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ${results[$(($a + 1))]} =~ ....a. ]]; then - ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path REBOOT" + sync + reboot -fn + else + ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + fi return $OCF_ERR_GENERIC fi a=$(($a + 2)) hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Wed Apr 2 19:39:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Wed, 02 Apr 2008 19:39:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-23-g36e10fa Message-ID: <20080402193912.18875.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=36e10fa435afc59e5a0e658c1b9b7ee2c34f184a The branch, RHEL4 has been updated via 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a (commit) via a0e32d4eea87f15b2e07c8f61ecd53bd2462e73f (commit) from d0aecbf552f27bb2bf9d3c66015dd4d8df559dd8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a Author: Jonathan Brassow Date: Wed Apr 2 14:25:22 2008 -0500 rgmanager/lvm.sh: Make lvm.sh call into lvm_by_*.sh (RE: bz427377) lvm_by_*.sh scripts are updated. Now call them. This makes lvm.sh a wrapper around lvm_by_*.sh scripts commit a0e32d4eea87f15b2e07c8f61ecd53bd2462e73f Author: Jonathan Brassow Date: Wed Apr 2 14:19:02 2008 -0500 rgmanager/lvm.sh: Updated fix for bz242798 When fixing bug Bug 427377 (allow multiple LVs / VG), I failed to commit the changes to lvm.sh - which effectively just became a shell that called functions in other files. Now, I need to update the other files with recent bug fixes and then make the change that was necessary for bug 427377 - removing the functional contents of lvm.sh. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.metadata | 16 +- rgmanager/src/resources/lvm.sh | 500 ++++------------------------------ rgmanager/src/resources/lvm_by_lv.sh | 15 +- rgmanager/src/resources/lvm_by_vg.sh | 17 +- 4 files changed, 94 insertions(+), 454 deletions(-) diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata index 61a740b..650675b 100755 --- a/rgmanager/src/resources/lvm.metadata +++ b/rgmanager/src/resources/lvm.metadata @@ -42,14 +42,14 @@ - - If set and the clean up of the tags fails, the node will - immediately reboot. - - - Fence the node if it is not able to clean up LVM tags - - + + If set and the clean up of the tags fails, the node will + immediately reboot. + + + Fence the node if it is not able to clean up LVM tags + + diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index f45e50d..82f3383 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -21,19 +21,7 @@ # # LVM Failover Script. -# -# This script correctly handles: -# - Relocation -# - Fail-over -# - Disk failure + Fail-over -# If you don't know what those mean, ASK! (jbrassow@redhat.com) # NOTE: Changes to /etc/lvm/lvm.conf are required for proper operation. -# -# This script should handle (but doesn't right now): -# - Operations on VG level. Make lv_name optional. This would have -# the effect of moving all LVs in a VG, not just one LV - - LC_ALL=C LANG=C @@ -42,466 +30,82 @@ export LC_ALL LANG PATH . $(dirname $0)/ocf-shellfuncs . $(dirname $0)/utils/member_util.sh +. $(dirname $0)/lvm_by_lv.sh +. $(dirname $0)/lvm_by_vg.sh rv=0 -meta_data() -{ - cat < - - 1.0 - - - This defines a LVM volume group that is ... - - - - LVM Failover script - - - - - - Descriptive name LVM Volume group - - - Name - - - - - - - If you can see this, your GUI is broken. - - - If you can see this, your GUI is broken. - - - - - - - If you can see this, your GUI is broken. - - - If you can see this, your GUI is broken. - - - - - - - If set and unmounting the file system fails, the node will - try to kill lockd and issue reclaims across all remaining - network interface cards. - - - Enable NFS lock workarounds - - - - - - - - - - - - - - - - - - - - - - -EOT -} - -# verify_all -# -# Verify the parameters passed in +################################################################################ +# clvm_check # -verify_all() -{ - declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name" - declare -i ret=0 - - # Anything to verify? Perhaps the names? - ocf_log notice "Verifying $lv_path" - - return $ret -} - -vg_status() -{ - return $OCF_ERR_GENERIC -} - -vg_activate() +################################################################################ +function clvm_check { - return $OCF_ERR_GENERIC -} - -# lvm_exec_resilient -# -# Sometimes, devices can come back. Their metadata will conflict -# with the good devices that remain. This function filters out those -# failed devices when executing the given command -# -# Finishing with vgscan resets the cache/filter -lvm_exec_resilient() -{ - declare command=$1 - declare all_pvs - - ocf_log notice "Making resilient : $command" - - if [ -z $command ]; then - ocf_log err "lvm_exec_resilient: Arguments not supplied" - return $OCF_ERR_ARGS + if [[ $(vgs -o attr --noheadings $1) =~ .....c ]]; then + return 1 fi - # pvs will print out only those devices that are valid - # If a device dies and comes back, it will not appear - # in pvs output (but you will get a Warning). - all_pvs=(`pvs --noheadings -o pv_name | grep -v Warning`) - - # Now we use those valid devices in a filter which we set up. - # The device will then be activated because there are no - # metadata conflicts. - command=$command" --config devices{filter=["; - for i in ${all_pvs[*]}; do - command=$command'"a|'$i'|",' - done - command=$command"\"r|.*|\"]}" - - ocf_log notice "Resilient command: $command" - if ! $command ; then - ocf_log err "lvm_exec_resilient failed" - vgscan - return $OCF_ERR_GENERIC - else - vgscan - return $OCF_SUCCESS - fi + return 0 } -# lv_activate_resilient +################################################################################ +# ha_lvm_proper_setup_check # -# Sometimes, devices can come back. Their metadata will conflict -# with the good devices that remain. We must filter out those -# failed devices when trying to reactivate -lv_activate_resilient() +################################################################################ +function ha_lvm_proper_setup_check { - declare action=$1 - declare lv_path=$2 - declare op="-ay" - - if [ -z $action ] || [ -z $lv_path ]; then - ocf_log err "lv_activate_resilient: Arguments not supplied" - return $OCF_ERR_ARGS - fi - - if [ $action != "start" ]; then - op="-an" - fi - - if ! lvm_exec_resilient "lvchange $op $lv_path" ; then - ocf_log err "lv_activate_resilient $action failed on $lv_path" - return $OCF_ERR_GENERIC - else - return $OCF_SUCCESS - fi -} - -# lv_status -# -# Is the LV active? -lv_status() -{ - declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name" - declare dev="/dev/$lv_path" - declare realdev - declare owner - declare my_name - - # - # Check if device is active - # - if [[ ! $(lvs -o attr --noheadings $lv_path) =~ ....a. ]]; then - return $OCF_ERR_GENERIC - fi - - if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then - ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume. Ignoring..." - return $OCF_SUCCESS - fi - - # - # Check if all links/device nodes are present - # - if [ -h "$dev" ]; then - realdev=$(readlink -f $dev) - if [ $? -ne 0 ]; then - ocf_log err "Failed to follow link, $dev" - return $OCF_ERR_ARGS - fi - - if [ ! -b $realdev ]; then - ocf_log err "Device node for $lv_path is not present" - return $OCF_ERR_GENERIC - fi - else - ocf_log err "Symbolic link for $lv_path is not present" - return $OCF_ERR_GENERIC - fi - - # - # Verify that we are the correct owner - # - owner=`lvs -o tags --noheadings $lv_path` - my_name=$(local_node_name) - if [ -z $my_name ]; then - ocf_log err "Unable to determine local machine name" - - # FIXME: I don't really want to fail on 1st offense - return $OCF_SUCCESS - fi - - if [ -z $owner ] || [ $my_name != $owner ]; then - ocf_log err "WARNING: $lv_path should not be active" - ocf_log err "WARNING: $my_name does not own $lv_path" - ocf_log err "WARNING: Attempting shutdown of $lv_path" - - lv_activate_resilient "stop" $lv_path - return $OCF_ERR_GENERIC - fi - - return $OCF_SUCCESS -} - -# lv_activate_and_tag -lv_activate_and_tag() -{ - declare action=$1 - declare tag=$2 - declare lv_path=$3 - typeset self_fence="" - - case ${OCF_RESKEY_self_fence} in - "yes") self_fence=1 ;; - 1) self_fence=1 ;; - *) self_fence="" ;; - esac - - if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then - ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" - return $OCF_ERR_ARGS - fi - - if [ $action == "start" ]; then - ocf_log notice "Activating $lv_path" - lvchange --addtag $tag $lv_path - if [ $? -ne 0 ]; then - ocf_log err "Unable to add tag to $lv_path" - return $OCF_ERR_GENERIC - fi - - if ! lv_activate_resilient $action $lv_path; then - ocf_log err "Unable to activate $lv_path" - return $OCF_ERR_GENERIC - fi - else - ocf_log notice "Deactivating $lv_path" - if ! lv_activate_resilient $action $lv_path; then - if [ "$self_fence" ]; then - ocf_log err "Unable to deactivate $lv_path REBOOT" - sync - reboot -fn - else - ocf_log err "Unable to deactivate $lv_path" - fi - - ocf_log err "Unable to deactivate $lv_path" - return $OCF_ERR_GENERIC - fi - - ocf_log notice "Removing ownership tag ($tag) from $lv_path" - - lvchange --deltag $tag $lv_path - if [ $? -ne 0 ]; then - ocf_log err "Unable to delete tag from $lv_path" - return $OCF_ERR_GENERIC - fi - fi - - return $OCF_SUCCESS -} - -# lv_activate -# $1: start/stop only -# -# Basically, if we want to [de]activate an LVM volume, -# we must own it. That means that our tag must be on it. -# This requires a change to /etc/lvm/lvm.conf: -# volume_list = [ "root_volume", "@my_hostname" ] -# where "root_volume" is your root volume group and -# "my_hostname" is $(local_node_name) -# -# If there is a node failure, we may wish to "steal" the -# LV. For that, we need to check if the node that owns -# it is still part of the cluster. We use the tag to -# determine who owns the volume then query for their -# liveness. If they are dead, we can steal. -lv_activate() -{ - declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name" - declare owner=`lvs -o tags --noheadings $lv_path` - declare my_name=$(local_node_name) - - if [ -z $my_name ]; then - ocf_log err "Unable to determine cluster node name" - return $OCF_ERR_GENERIC - fi - - # - # FIXME: This code block is repeated below... might be - # nice to put it in a function - # - if [ ! -z $owner ] && [ $owner != $my_name ]; then - if is_node_member_clustat $owner ; then - ocf_log err "$owner owns $lv_path unable to $1" - return $OCF_ERR_GENERIC - fi - ocf_log notice "Owner of $lv_path is not in the cluster" - ocf_log notice "Stealing $lv_path" - - lvchange --deltag $owner $lv_path - if [ $? -ne 0 ]; then - ocf_log err "Failed to steal $lv_path from $owner" - return $OCF_ERR_GENERIC - fi - - # Warning --deltag doesn't always result in failure - if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then - ocf_log err "Failed to steal $lv_path from $owner." - return $OCF_ERR_GENERIC - fi - fi - - if ! lv_activate_and_tag $1 $my_name $lv_path; then - ocf_log err "Failed to $1 $lv_path" - - if [ "$1" == "start" ]; then - ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name" - - if vgreduce --removemissing --config \ - "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \ - $OCF_RESKEY_vg_name; then - ocf_log notice "$OCF_RESKEY_vg_name now consistent" - owner=`lvs -o tags --noheadings $lv_path` - if [ ! -z $owner ] && [ $owner != $my_name ]; then - if is_node_member_clustat $owner ; then - ocf_log err "$owner owns $lv_path unable to $1" - return $OCF_ERR_GENERIC - fi - ocf_log notice "Owner of $lv_path is not in the cluster" - ocf_log notice "Stealing $lv_path" - - lvchange --deltag $owner $lv_path - if [ $? -ne 0 ]; then - ocf_log err "Failed to steal $lv_path from $owner" - return $OCF_ERR_GENERIC - fi - - # Warning --deltag doesn't always result in failure - if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then - ocf_log err "Failed to steal $lv_path from $owner." - return $OCF_ERR_GENERIC - fi - fi - - if ! lv_activate_and_tag $1 $my_name $lv_path; then - ocf_log err "Failed second attempt to $1 $lv_path" - return $OCF_ERR_GENERIC - else - ocf_log notice "Second attempt to $1 $lv_path successful" - return $OCF_SUCCESS - fi - else - ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent" - return $OCF_ERR_GENERIC - fi - else - ocf_log err "Failed to $1 $lv_path" - return $OCF_ERR_GENERIC - fi - fi - return $OCF_SUCCESS -} - -ha_lvm_proper_setup_check() -{ - # First, let's check that they have setup their lvm.conf correctly + ## + # Machine's cluster node name must be present as + # a tag in lvm.conf:activation/volume_list + ## if ! lvm dumpconfig activation/volume_list >& /dev/null || ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then ocf_log err "lvm.conf improperly configured for HA LVM." return $OCF_ERR_GENERIC fi + ## # Next, we need to ensure that their initrd has been updated - if [ -e /boot/initrd-`uname -r`.img ]; then - if [ "$(find /boot/initrd-`uname -r`.img -newer /etc/lvm/lvm.conf)" == "" ]; then - ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf" - return $OCF_ERR_GENERIC - fi - else - # Best guess... - if [ "$(find /boot/*.img -newer /etc/lvm/lvm.conf)" == "" ]; then - ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf" - return $OCF_ERR_GENERIC - fi + # If not, the machine could boot and activate the VG outside + # the control of rgmanager + ## + # Fixme: we might be able to perform a better check... + if [ "$(find /boot/*.img -newer /etc/lvm/lvm.conf)" == "" ]; then + ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf" + return $OCF_ERR_GENERIC fi return $OCF_SUCCESS } +################################################################################ +# MAIN +################################################################################ + case $1 in start) - if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then + ## + # We can safely ignore clustered volume groups (VGs handled by CLVM) + ## + if ! clvm_check $OCF_RESKEY_vg_name; then ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume. Ignoring..." exit 0 fi - if ! lvs $OCF_RESKEY_vg_name >& /dev/null; then - lv_count=0 - else - lv_count=`lvs --noheadings -o name $OCF_RESKEY_vg_name | grep -v _mlog | grep -v _mimage | grep -v nconsistent | wc -l` - fi - if [ $lv_count -gt 1 ]; then - ocf_log err "HA LVM requires Only one logical volume per volume group." - ocf_log err "There are currently $lv_count logical volumes in $OCF_RESKEY_vg_name" - ocf_log err "Failing HA LVM start of $OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name" - exit $OCF_ERR_GENERIC - fi ha_lvm_proper_setup_check || exit 1 - + + rv=0 + if [ -z $OCF_RESKEY_lv_name ]; then - vg_activate start || exit 1 + vg_start || exit 1 else - lv_activate start || exit 1 + lv_start || exit 1 fi - rv=0 ;; status|monitor) + ocf_log notice "Getting status" + if [ -z $OCF_RESKEY_lv_name ]; then vg_status || exit 1 else @@ -511,7 +115,10 @@ status|monitor) ;; stop) - if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then + ## + # We can safely ignore clustered volume groups (VGs handled by CLVM) + ## + if ! clvm_check $OCF_RESKEY_vg_name; then ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume. Ignoring..." exit 0 fi @@ -521,9 +128,9 @@ stop) fi if [ -z $OCF_RESKEY_lv_name ]; then - vg_activate stop || exit 1 + vg_stop || exit 1 else - lv_activate stop || exit 1 + lv_stop || exit 1 fi rv=0 ;; @@ -535,18 +142,25 @@ recover|restart) ;; meta-data) - meta_data + cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'` rv=0 ;; verify-all) - if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then + ## + # We can safely ignore clustered volume groups (VGs handled by CLVM) + ## + if ! clvm_check $OCF_RESKEY_vg_name; then ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume. Ignoring..." exit 0 fi - verify_all - rv=$? + if [ -z $OCF_RESKEY_lv_name ]; then + vg_verify || exit 1 + else + lv_verify || exit 1 + fi + rv=0 ;; *) echo "usage: $0 {start|status|monitor|stop|restart|meta-data|verify-all}" diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh index e14540f..6691181 100644 --- a/rgmanager/src/resources/lvm_by_lv.sh +++ b/rgmanager/src/resources/lvm_by_lv.sh @@ -173,6 +173,13 @@ lv_activate_and_tag() declare action=$1 declare tag=$2 declare lv_path=$3 + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path" @@ -194,7 +201,13 @@ lv_activate_and_tag() else ocf_log notice "Deactivating $lv_path" if ! lv_activate_resilient $action $lv_path; then - ocf_log err "Unable to deactivate $lv_path" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path: REBOOTING" + sync + reboot -fn + else + ocf_log err "Unable to deactivate $lv_path" + fi return $OCF_ERR_GENERIC fi diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index b1840a1..8fa36d6 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -242,17 +242,30 @@ function vg_stop { local a local results + typeset self_fence="" + + case ${OCF_RESKEY_self_fence} in + "yes") self_fence=1 ;; + 1) self_fence=1 ;; + *) self_fence="" ;; + esac # Shut down the volume group # Do we need to make this resilient? vgchange -an $OCF_RESKEY_vg_name # Make sure all the logical volumes are inactive - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ${results[$(($a + 1))]} =~ ....a. ]]; then - ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + if [ "$self_fence" ]; then + ocf_log err "Unable to deactivate $lv_path REBOOT" + sync + reboot -fn + else + ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown" + fi return $OCF_ERR_GENERIC fi a=$(($a + 2)) hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 2 19:50:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 02 Apr 2008 19:50:00 -0000 Subject: Cluster Project tag, rgmanager_1_9_75, created. gfs-kernel_2_6_9_76-23-g36e10fa Message-ID: <20080402195020.27001.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=36e10fa435afc59e5a0e658c1b9b7ee2c34f184a The tag, rgmanager_1_9_75 has been created at 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a (commit) - Log ----------------------------------------------------------------- commit 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a Author: Jonathan Brassow Date: Wed Apr 2 14:25:22 2008 -0500 rgmanager/lvm.sh: Make lvm.sh call into lvm_by_*.sh (RE: bz427377) lvm_by_*.sh scripts are updated. Now call them. This makes lvm.sh a wrapper around lvm_by_*.sh scripts ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Wed Apr 2 19:52:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Wed, 02 Apr 2008 19:52:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-123-g4081566 Message-ID: <20080402195228.27547.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4081566d3829750925f474d0698d30aa5ac6c598 The branch, master has been updated via 4081566d3829750925f474d0698d30aa5ac6c598 (commit) from e82959afc8e649029122bfb8a491abef861105e2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4081566d3829750925f474d0698d30aa5ac6c598 Author: Jonathan Brassow Date: Wed Apr 2 14:38:53 2008 -0500 rgmanager/lvm.sh: change argument order of shell command Nice to have output redirect at end of line... cosmetic change only. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm_by_vg.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index 8fa36d6..3ee343e 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -203,7 +203,7 @@ function vg_start else # The activation commands succeeded, but did they do anything? # Make sure all the logical volumes are active - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ! ${results[$(($a + 1))]} =~ ....a. ]]; then hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Wed Apr 2 21:22:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Wed, 02 Apr 2008 21:22:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-30-g82d50be Message-ID: <20080402212256.20219.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=82d50be085f83d31486796a3a7bac162a98e6024 The branch, RHEL5 has been updated via 82d50be085f83d31486796a3a7bac162a98e6024 (commit) from fb8ff413588b1404d99b78adf30987beaea9db32 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 82d50be085f83d31486796a3a7bac162a98e6024 Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index 28be42a..fa560fc 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -683,11 +683,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Wed Apr 2 21:25:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Wed, 02 Apr 2008 21:25:00 -0000 Subject: Cluster Project branch, RHEL52, updated. cmirror_1_1_15-19-gc53ff8e Message-ID: <20080402212504.20889.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c53ff8ef75c67fb53955905db96c9f96c28da7bf The branch, RHEL52 has been updated via c53ff8ef75c67fb53955905db96c9f96c28da7bf (commit) from 0bb606fa87d35682d520ef93e837b0c746fb1cdf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c53ff8ef75c67fb53955905db96c9f96c28da7bf Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index 28be42a..fa560fc 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -683,11 +683,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Wed Apr 2 21:29:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Wed, 02 Apr 2008 21:29:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-124-ga740fce Message-ID: <20080402212901.23555.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a740fce541402c9efa42e12eef8f632920c53cb7 The branch, master has been updated via a740fce541402c9efa42e12eef8f632920c53cb7 (commit) from 4081566d3829750925f474d0698d30aa5ac6c598 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a740fce541402c9efa42e12eef8f632920c53cb7 Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index 8d28a4c..3d6da84 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -683,11 +683,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From fabbione@sourceware.org Thu Apr 3 03:55:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Thu, 03 Apr 2008 03:55:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-33-g3ed9000 Message-ID: <20080403035513.23795.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=3ed90000f931a576c807d3e8ad7602c359f3dd0e The branch, STABLE2 has been updated via 3ed90000f931a576c807d3e8ad7602c359f3dd0e (commit) via ea6492830de8c15e487b5929ab0c9cf861e48121 (commit) from 3db96e8cb13b9fc9f60045832d7de02400e06679 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3ed90000f931a576c807d3e8ad7602c359f3dd0e Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent commit ea6492830de8c15e487b5929ab0c9cf861e48121 Author: Jonathan Brassow Date: Wed Apr 2 14:38:53 2008 -0500 rgmanager/lvm.sh: change argument order of shell command Nice to have output redirect at end of line... cosmetic change only. ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- rgmanager/src/resources/lvm_by_vg.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index 8d28a4c..3d6da84 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -683,11 +683,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh index 8fa36d6..3ee343e 100755 --- a/rgmanager/src/resources/lvm_by_vg.sh +++ b/rgmanager/src/resources/lvm_by_vg.sh @@ -203,7 +203,7 @@ function vg_start else # The activation commands succeeded, but did they do anything? # Make sure all the logical volumes are active - results=(`lvs -o name,attr --noheadings 2> /dev/null $OCF_RESKEY_vg_name`) + results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`) a=0 while [ ! -z ${results[$a]} ]; do if [[ ! ${results[$(($a + 1))]} =~ ....a. ]]; then hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Thu Apr 3 13:47:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Thu, 03 Apr 2008 13:47:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-24-g0536f85 Message-ID: <20080403134725.26850.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0536f85e62db2ac86b0f47c6e6089090261eceae The branch, RHEL4 has been updated via 0536f85e62db2ac86b0f47c6e6089090261eceae (commit) from 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0536f85e62db2ac86b0f47c6e6089090261eceae Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index e43fa20..4a2494a 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -684,11 +684,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Thu Apr 3 15:38:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 03 Apr 2008 15:38:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-125-g41b62e9 Message-ID: <20080403153759.14532.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=41b62e9de6bc4f553bae5aec08080019947d6a9e The branch, master has been updated via 41b62e9de6bc4f553bae5aec08080019947d6a9e (commit) from a740fce541402c9efa42e12eef8f632920c53cb7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 41b62e9de6bc4f553bae5aec08080019947d6a9e Author: Jonathan Brassow Date: Thu Apr 3 10:24:21 2008 -0500 rgmanager/lvm.sh: Minor comment updates Just moving/expanding some comments. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.sh | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index 3b851d8..4c93249 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -55,9 +55,8 @@ function clvm_check function ha_lvm_proper_setup_check { ## - # Machine's cluster node name must be present as - # a tag in lvm.conf:activation/volume_list and the volume group - # to be failed over must NOT be there. + # The default for lvm.conf:activation/volume_list is empty, + # this must be changed for HA LVM. ## if ! lvm dumpconfig activation/volume_list >& /dev/null; then ocf_log err "HA LVM: Improper setup detected" @@ -65,12 +64,21 @@ function ha_lvm_proper_setup_check return $OCF_ERR_GENERIC fi + ## + # Machine's cluster node name must be present as + # a tag in lvm.conf:activation/volume_list + ## if ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then ocf_log err "HA LVM: Improper setup detected" ocf_log err "- @$(local_node_name) missing from \"volume_list\" in lvm.conf" return $OCF_ERR_GENERIC fi + ## + # The volume group to be failed over must NOT be in + # lvm.conf:activation/volume_list; otherwise, machines + # will be able to activate the VG regardless of the tags + ## if lvm dumpconfig activation/volume_list | grep $OCF_RESKEY_vg_name; then ocf_log err "HA LVM: Improper setup detected" ocf_log err "- $OCF_RESKEY_vg_name found in \"volume_list\" in lvm.conf" hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Thu Apr 3 15:53:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 03 Apr 2008 15:53:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-31-ge4703d7 Message-ID: <20080403155303.21644.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e4703d7a4881dea28096770e07c70935180140f1 The branch, RHEL5 has been updated via e4703d7a4881dea28096770e07c70935180140f1 (commit) from 82d50be085f83d31486796a3a7bac162a98e6024 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e4703d7a4881dea28096770e07c70935180140f1 Author: Jonathan Brassow Date: Thu Apr 3 10:35:28 2008 -0500 rgmanager/lvm.sh: Fix for bug 431713 - Add another check for improper HA LVM setup. Specifically, check for fail-over VG name in 'volume_list', which would allow a machine to activate a VG regardless of tagging. - Clearer error messages - Better comments ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.sh | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index 12649fd..4c93249 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -55,12 +55,33 @@ function clvm_check function ha_lvm_proper_setup_check { ## + # The default for lvm.conf:activation/volume_list is empty, + # this must be changed for HA LVM. + ## + if ! lvm dumpconfig activation/volume_list >& /dev/null; then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- \"volume_list\" not specified in lvm.conf." + return $OCF_ERR_GENERIC + fi + + ## # Machine's cluster node name must be present as # a tag in lvm.conf:activation/volume_list ## - if ! lvm dumpconfig activation/volume_list >& /dev/null || - ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then - ocf_log err "lvm.conf improperly configured for HA LVM." + if ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- @$(local_node_name) missing from \"volume_list\" in lvm.conf" + return $OCF_ERR_GENERIC + fi + + ## + # The volume group to be failed over must NOT be in + # lvm.conf:activation/volume_list; otherwise, machines + # will be able to activate the VG regardless of the tags + ## + if lvm dumpconfig activation/volume_list | grep $OCF_RESKEY_vg_name; then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- $OCF_RESKEY_vg_name found in \"volume_list\" in lvm.conf" return $OCF_ERR_GENERIC fi @@ -71,7 +92,8 @@ function ha_lvm_proper_setup_check ## # Fixme: we might be able to perform a better check... if [ "$(find /boot/*.img -newer /etc/lvm/lvm.conf)" == "" ]; then - ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf" + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- initrd image needs to be newer than lvm.conf" return $OCF_ERR_GENERIC fi @@ -146,7 +168,7 @@ meta-data) rv=0 ;; -verify-all) +validate-all|verify-all) ## # We can safely ignore clustered volume groups (VGs handled by CLVM) ## hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Thu Apr 3 16:03:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Thu, 03 Apr 2008 16:03:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-25-gc128baa Message-ID: <20080403160319.27480.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c128baa7cc5397f1fcfc72d35cdb39c089c56043 The branch, RHEL4 has been updated via c128baa7cc5397f1fcfc72d35cdb39c089c56043 (commit) from 0536f85e62db2ac86b0f47c6e6089090261eceae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c128baa7cc5397f1fcfc72d35cdb39c089c56043 Author: Jonathan Brassow Date: Thu Apr 3 10:48:46 2008 -0500 rgmanager/lvm.sh: Fix bug 431705 - Add another check for improper HA LVM setup. Specifically, check for fail-over VG name in 'volume_list', which would allow a machine to activate a VG regardless of tagging. - Clearer error messages - Better comments ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.sh | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index 82f3383..fc44b09 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -55,12 +55,33 @@ function clvm_check function ha_lvm_proper_setup_check { ## + # The default for lvm.conf:activation/volume_list is empty, + # this must be changed for HA LVM. + ## + if ! lvm dumpconfig activation/volume_list >& /dev/null; then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- \"volume_list\" not specified in lvm.conf." + return $OCF_ERR_GENERIC + fi + + ## # Machine's cluster node name must be present as # a tag in lvm.conf:activation/volume_list ## - if ! lvm dumpconfig activation/volume_list >& /dev/null || - ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then - ocf_log err "lvm.conf improperly configured for HA LVM." + if ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- @$(local_node_name) missing from \"volume_list\" in lvm.conf" + return $OCF_ERR_GENERIC + fi + + ## + # The volume group to be failed over must NOT be in + # lvm.conf:activation/volume_list; otherwise, machines + # will be able to activate the VG regardless of the tags + ## + if lvm dumpconfig activation/volume_list | grep $OCF_RESKEY_vg_name; then + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- $OCF_RESKEY_vg_name found in \"volume_list\" in lvm.conf" return $OCF_ERR_GENERIC fi @@ -71,7 +92,8 @@ function ha_lvm_proper_setup_check ## # Fixme: we might be able to perform a better check... if [ "$(find /boot/*.img -newer /etc/lvm/lvm.conf)" == "" ]; then - ocf_log err "HA LVM requires the initrd image to be newer than lvm.conf" + ocf_log err "HA LVM: Improper setup detected" + ocf_log err "- initrd image needs to be newer than lvm.conf" return $OCF_ERR_GENERIC fi hooks/post-receive -- Cluster Project From fabbione@sourceware.org Fri Apr 4 03:51:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Fri, 04 Apr 2008 03:51:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-34-g2182e21 Message-ID: <20080404035151.14931.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=2182e21187edf46d5d4832abf847fe824893a61c The branch, STABLE2 has been updated via 2182e21187edf46d5d4832abf847fe824893a61c (commit) from 3ed90000f931a576c807d3e8ad7602c359f3dd0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2182e21187edf46d5d4832abf847fe824893a61c Author: Jonathan Brassow Date: Thu Apr 3 10:24:21 2008 -0500 rgmanager/lvm.sh: Minor comment updates Just moving/expanding some comments. ----------------------------------------------------------------------- Summary of changes: rgmanager/src/resources/lvm.sh | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh index 3b851d8..4c93249 100755 --- a/rgmanager/src/resources/lvm.sh +++ b/rgmanager/src/resources/lvm.sh @@ -55,9 +55,8 @@ function clvm_check function ha_lvm_proper_setup_check { ## - # Machine's cluster node name must be present as - # a tag in lvm.conf:activation/volume_list and the volume group - # to be failed over must NOT be there. + # The default for lvm.conf:activation/volume_list is empty, + # this must be changed for HA LVM. ## if ! lvm dumpconfig activation/volume_list >& /dev/null; then ocf_log err "HA LVM: Improper setup detected" @@ -65,12 +64,21 @@ function ha_lvm_proper_setup_check return $OCF_ERR_GENERIC fi + ## + # Machine's cluster node name must be present as + # a tag in lvm.conf:activation/volume_list + ## if ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then ocf_log err "HA LVM: Improper setup detected" ocf_log err "- @$(local_node_name) missing from \"volume_list\" in lvm.conf" return $OCF_ERR_GENERIC fi + ## + # The volume group to be failed over must NOT be in + # lvm.conf:activation/volume_list; otherwise, machines + # will be able to activate the VG regardless of the tags + ## if lvm dumpconfig activation/volume_list | grep $OCF_RESKEY_vg_name; then ocf_log err "HA LVM: Improper setup detected" ocf_log err "- $OCF_RESKEY_vg_name found in \"volume_list\" in lvm.conf" hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Fri Apr 4 17:33:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 04 Apr 2008 17:33:00 -0000 Subject: Cluster Project branch, RHEL51, updated. cman_2_0_74-12-g8f28897 Message-ID: <20080404173328.1434.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=8f28897241537e5bac05f6a732216484c0e433bf The branch, RHEL51 has been updated via 8f28897241537e5bac05f6a732216484c0e433bf (commit) from 24fabdf057dcc2ec114f34e7b94b320c32f6d226 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8f28897241537e5bac05f6a732216484c0e433bf Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index 3bd7ff6..5a92059 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -683,11 +683,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From rohara@sourceware.org Fri Apr 4 22:54:00 2008 From: rohara@sourceware.org (rohara@sourceware.org) Date: Fri, 04 Apr 2008 22:54:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-26-g6626fda Message-ID: <20080404225421.9945.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=6626fda2200aa1abed902646371eee265be7fc04 The branch, RHEL4 has been updated via 6626fda2200aa1abed902646371eee265be7fc04 (commit) from c128baa7cc5397f1fcfc72d35cdb39c089c56043 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6626fda2200aa1abed902646371eee265be7fc04 Author: Ryan O'Hara Date: Fri Apr 4 17:52:41 2008 -0500 BZ 409391 : fence_scsi and scsi_reserve script no longer use state file for tracking registered devices (/var/run/scsi_reserve). ----------------------------------------------------------------------- Summary of changes: fence/agents/scsi/scsi_reserve.sysconfig | 4 --- fence/agents/scsi/scsi_watchdog | 40 ------------------------------ fence/agents/scsi/scsi_watchdog.conf | 1 - 3 files changed, 0 insertions(+), 45 deletions(-) delete mode 100644 fence/agents/scsi/scsi_reserve.sysconfig delete mode 100755 fence/agents/scsi/scsi_watchdog delete mode 100644 fence/agents/scsi/scsi_watchdog.conf diff --git a/fence/agents/scsi/scsi_reserve.sysconfig b/fence/agents/scsi/scsi_reserve.sysconfig deleted file mode 100644 index 06441f4..0000000 --- a/fence/agents/scsi/scsi_reserve.sysconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Enable the watchdog daemon by setting WATCHDOG to "yes". -# This will result in the machine being rebooted if/when it is -# fenced from the cluster. Default is "no". -WATCHDOG=no diff --git a/fence/agents/scsi/scsi_watchdog b/fence/agents/scsi/scsi_watchdog deleted file mode 100755 index 8e59de8..0000000 --- a/fence/agents/scsi/scsi_watchdog +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -if [ ! -f "/var/lock/subsys/scsi_reserve" ]; then - logger -p user.warning -t scsi_reserve "file /var/lock/subsys/scsi_reserve does not exist" - exit 0 -fi - -if [ ! -f "/var/run/scsi_reserve" ]; then - logger -p user.warning -t scsi_reserve "file /var/run scsi_reserve does not exist" - exit 0 -fi - -key=$( cat /var/lock/subsys/scsi_reserve ) - -if [ -z "$key" ]; then - logger -p user.warning -t scsi_reserve "unable to determine reservation key" - exit 0 -fi - -scsi_devices=$( cat /var/run/scsi_reserve ) - -if [ -z "$scsi_devices" ]; then - logger -p user.warning -t scsi_reserve "no devices found" - exit 0 -fi - -for dev in $scsi_devices -do - if sg_persist -d $dev -i -k 2>/dev/null | grep -qiE "${key#0}" ; then - devices[${#devices[@]}]=$dev - fi -done - -if [ -z "$devices" ]; then - logger -p user.warning -t scsi_reserve "no registered devices found" - exit -1 -fi - -exit 0 - diff --git a/fence/agents/scsi/scsi_watchdog.conf b/fence/agents/scsi/scsi_watchdog.conf deleted file mode 100644 index 34ecd47..0000000 --- a/fence/agents/scsi/scsi_watchdog.conf +++ /dev/null @@ -1 +0,0 @@ -test-binary = /sbin/scsi_watchdog hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 4 22:58:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 04 Apr 2008 22:58:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-35-gf8e55ed Message-ID: <20080404225825.11730.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f8e55ed986aa3fb37e943224689e21f451e79692 The branch, STABLE2 has been updated via f8e55ed986aa3fb37e943224689e21f451e79692 (commit) from 2182e21187edf46d5d4832abf847fe824893a61c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f8e55ed986aa3fb37e943224689e21f451e79692 Author: Abhijith Das Date: Fri Apr 4 17:54:01 2008 -0600 gfs2_tool: remove 'gfs2_tool counters' as they aren't implemented anymore gfs2 doesn't implement counters anymore so we remove them. BZ 438759 came up because we gfs2 stopped implementing counters. Conflicts: gfs2/tool/Makefile ----------------------------------------------------------------------- Summary of changes: gfs2/tool/Makefile | 3 +- gfs2/tool/counters.c | 203 -------------------------------------------------- gfs2/tool/main.c | 5 - 3 files changed, 1 insertions(+), 210 deletions(-) delete mode 100644 gfs2/tool/counters.c diff --git a/gfs2/tool/Makefile b/gfs2/tool/Makefile index effcfa9..37c844f 100644 --- a/gfs2/tool/Makefile +++ b/gfs2/tool/Makefile @@ -23,8 +23,7 @@ include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -OBJS= counters.o \ - df.o \ +OBJS= df.o \ layout.o \ main.o \ misc.o \ diff --git a/gfs2/tool/counters.c b/gfs2/tool/counters.c deleted file mode 100644 index 60f1256..0000000 --- a/gfs2/tool/counters.c +++ /dev/null @@ -1,203 +0,0 @@ - /****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define __user -#include "osi_list.h" - -#include "gfs2_tool.h" -#include "libgfs2.h" - -#define SIZE (65536) - -struct token_list { - osi_list_t list; - char *token; - unsigned int last; -}; - -static osi_list_decl(token_list); -int first = TRUE; - -#define maybe_printf(fmt, args...) \ -do { \ - if (!continuous || !first) \ - printf(fmt, ##args); \ -} while (0) - -/** - * find_update_last - find and update the last value of a token - * @token: the token to look for - * @this: the current value of the token - * - * Returns: the last value of the token - */ - -static unsigned int -find_update_last(char *token, unsigned int this) -{ - osi_list_t *tmp, *head; - struct token_list *tl; - unsigned int last; - - for (head = &token_list, tmp = head->next; tmp != head; tmp = tmp->next) { - tl = osi_list_entry(tmp, struct token_list, list); - if (strcmp(tl->token, token)) - continue; - - last = tl->last; - tl->last = this; - return last; - } - - tl = malloc(sizeof (struct token_list) + strlen(token) + 1); - if (!tl) - die("out of memory\n"); - tl->token = (char *) (tl + 1); - strcpy(tl->token, token); - tl->last = this; - osi_list_add(&tl->list, &token_list); - - return 0; -} - -/** - * print_line - print out a counter - * @token: the name of the counter - * @description: the text description of the counter - * @diff: 1 if you want diffs on continuous output - * - */ - -static void -print_line(char *fsname, char *token, char *description, int diff) -{ - char *value; - char counters_base[PATH_MAX] = "counters/"; - static unsigned int log_blks_free; - unsigned int this, last; - - value = get_sysfs(fsname, strcat(counters_base, token)); - - if (!strcmp(token, "log_blks_free")) - sscanf(value, "%u", &log_blks_free); - - else if (!strcmp(token, "jd_blocks")) { - sscanf(value, "%u", &this); - maybe_printf("%39s %.2f%% (%u of %u)\n", - "log space used", - 100.0 * (this - log_blks_free) / this, - this - log_blks_free, this); - - } else if (continuous && diff) { - sscanf(value, "%u", &this); - last = find_update_last(token, this); - maybe_printf("%39s %-10s %d/s\n", - description, value, - (this - last + interval - 1) / interval); - - } else - maybe_printf("%39s %s\n", description, value); -} - -/** - * print_counters - print out the current countersable parameters for a filesystem - * @argc: - * @argv: - * - */ - -void -print_counters(int argc, char **argv) -{ - unsigned int i = interval; - char *fs; - struct gfs2_sbd sbd; - - interval = 1; - - if (optind < argc) - sbd.path_name = argv[optind++]; - else - die("Usage: gfs2_tool counters \n"); - - check_for_gfs2(&sbd); - - fs = mp2fsname(sbd.path_name); - - for (;;) { - print_line(fs, "glock_count", "locks", 0); - print_line(fs, "glock_held_count", "locks held", 0); - print_line(fs, "inode_count", "incore inodes", 0); - print_line(fs, "reclaimed", "glocks reclaimed", 1); -#if GFS2_TOOL_FEATURE_IMPLEMENTED - print_line(fs, "bufdata_count", "metadata buffers", 0); - print_line(fs, "unlinked_count", "unlinked inodes", 0); - print_line(fs, "quota_count", "quota IDs", 0); - print_line(fs, "log_num_gl", "Glocks in current transaction", - 0); - print_line(fs, "log_num_buf", "Blocks in current transaction", - 0); - print_line(fs, "log_num_revoke", - "Revokes in current transaction", 0); - print_line(fs, "log_num_rg", "RGs in current transaction", 0); - print_line(fs, "log_num_databuf", - "Databufs in current transaction", 0); - print_line(fs, "log_blks_free", "log blks free", 0); - print_line(fs, "jd_blocks", "log blocks total", 0); - print_line(fs, "reclaim_count", "glocks on reclaim list", 0); - print_line(fs, "log_wraps", "log wraps", 0); - print_line(fs, "fh2dentry_misses", "fh2dentry misses", 1); - print_line(fs, "log_flush_incore", "log incore flushes", 1); - print_line(fs, "log_flush_ondisk", "log ondisk flushes", 1); - print_line(fs, "glock_nq_calls", "glock dq calls", 1); - print_line(fs, "glock_dq_calls", "glock dq calls", 1); - print_line(fs, "glock_prefetch_calls", "glock prefetch calls", - 1); - print_line(fs, "lm_lock_calls", "lm_lock calls", 1); - print_line(fs, "lm_unlock_calls", "lm_unlock calls", 1); - print_line(fs, "lm_callbacks", "lm callbacks", 1); - print_line(fs, "ops_address", "address operations", 1); - print_line(fs, "ops_dentry", "dentry operations", 1); - print_line(fs, "ops_export", "export operations", 1); - print_line(fs, "ops_file", "file operations", 1); - print_line(fs, "ops_inode", "inode operations", 1); - print_line(fs, "ops_super", "super operations", 1); - print_line(fs, "ops_vm", "vm operations", 1); -#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ - - if (!continuous) - break; - - fflush(stdout); - - sleep(interval); - - if (first) { - interval = i; - first = FALSE; - } - } -} diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c index 67088eb..d2817ec 100644 --- a/gfs2/tool/main.c +++ b/gfs2/tool/main.c @@ -42,9 +42,6 @@ static const char *usage[] = { "Clear a flag on a inode\n", " gfs2_tool clearflag flag \n", "\n", - "Print the counters for a filesystem\n", - " gfs2_tool counters \n", - "\n", "Do a GFS2 specific \"df\":\n", " gfs2_tool df \n", "\n", @@ -231,8 +228,6 @@ main(int argc, char *argv[]) if (strcmp(action, "clearflag") == 0) set_flag(argc, argv); - else if (strcmp(action, "counters") == 0) - print_counters(argc, argv); else if (strcmp(action, "df") == 0) print_df(argc, argv); else if (strcmp(action, "freeze") == 0) hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 4 23:09:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 04 Apr 2008 23:09:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-32-g2c4347d Message-ID: <20080404230914.25718.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=2c4347d9746d16196fb57967b70d025bdac9dadd The branch, RHEL5 has been updated via 2c4347d9746d16196fb57967b70d025bdac9dadd (commit) from e4703d7a4881dea28096770e07c70935180140f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2c4347d9746d16196fb57967b70d025bdac9dadd Author: Abhijith Das Date: Fri Apr 4 17:16:13 2008 -0600 gfs2_tool: remove 'gfs2_tool counters' as they aren't implemented anymore gfs2 doesn't implement counters anymore so we remove them. BZ 438759 came up because we gfs2 stopped implementing counters. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/Makefile | 2 +- gfs2/tool/counters.c | 203 -------------------------------------------------- gfs2/tool/main.c | 5 - 3 files changed, 1 insertions(+), 209 deletions(-) delete mode 100644 gfs2/tool/counters.c diff --git a/gfs2/tool/Makefile b/gfs2/tool/Makefile index a83822c..359cb10 100644 --- a/gfs2/tool/Makefile +++ b/gfs2/tool/Makefile @@ -30,7 +30,7 @@ LIBS=${top_srcdir}/libgfs2 .PHONY: all clean distclean -SOURCES= counters.c df.c layout.c main.c misc.c ondisk.c sb.c tune.c +SOURCES= df.c layout.c main.c misc.c ondisk.c sb.c tune.c OBJECTS=$(subst .c,.o,${SOURCES}) diff --git a/gfs2/tool/counters.c b/gfs2/tool/counters.c deleted file mode 100644 index 60f1256..0000000 --- a/gfs2/tool/counters.c +++ /dev/null @@ -1,203 +0,0 @@ - /****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define __user -#include "osi_list.h" - -#include "gfs2_tool.h" -#include "libgfs2.h" - -#define SIZE (65536) - -struct token_list { - osi_list_t list; - char *token; - unsigned int last; -}; - -static osi_list_decl(token_list); -int first = TRUE; - -#define maybe_printf(fmt, args...) \ -do { \ - if (!continuous || !first) \ - printf(fmt, ##args); \ -} while (0) - -/** - * find_update_last - find and update the last value of a token - * @token: the token to look for - * @this: the current value of the token - * - * Returns: the last value of the token - */ - -static unsigned int -find_update_last(char *token, unsigned int this) -{ - osi_list_t *tmp, *head; - struct token_list *tl; - unsigned int last; - - for (head = &token_list, tmp = head->next; tmp != head; tmp = tmp->next) { - tl = osi_list_entry(tmp, struct token_list, list); - if (strcmp(tl->token, token)) - continue; - - last = tl->last; - tl->last = this; - return last; - } - - tl = malloc(sizeof (struct token_list) + strlen(token) + 1); - if (!tl) - die("out of memory\n"); - tl->token = (char *) (tl + 1); - strcpy(tl->token, token); - tl->last = this; - osi_list_add(&tl->list, &token_list); - - return 0; -} - -/** - * print_line - print out a counter - * @token: the name of the counter - * @description: the text description of the counter - * @diff: 1 if you want diffs on continuous output - * - */ - -static void -print_line(char *fsname, char *token, char *description, int diff) -{ - char *value; - char counters_base[PATH_MAX] = "counters/"; - static unsigned int log_blks_free; - unsigned int this, last; - - value = get_sysfs(fsname, strcat(counters_base, token)); - - if (!strcmp(token, "log_blks_free")) - sscanf(value, "%u", &log_blks_free); - - else if (!strcmp(token, "jd_blocks")) { - sscanf(value, "%u", &this); - maybe_printf("%39s %.2f%% (%u of %u)\n", - "log space used", - 100.0 * (this - log_blks_free) / this, - this - log_blks_free, this); - - } else if (continuous && diff) { - sscanf(value, "%u", &this); - last = find_update_last(token, this); - maybe_printf("%39s %-10s %d/s\n", - description, value, - (this - last + interval - 1) / interval); - - } else - maybe_printf("%39s %s\n", description, value); -} - -/** - * print_counters - print out the current countersable parameters for a filesystem - * @argc: - * @argv: - * - */ - -void -print_counters(int argc, char **argv) -{ - unsigned int i = interval; - char *fs; - struct gfs2_sbd sbd; - - interval = 1; - - if (optind < argc) - sbd.path_name = argv[optind++]; - else - die("Usage: gfs2_tool counters \n"); - - check_for_gfs2(&sbd); - - fs = mp2fsname(sbd.path_name); - - for (;;) { - print_line(fs, "glock_count", "locks", 0); - print_line(fs, "glock_held_count", "locks held", 0); - print_line(fs, "inode_count", "incore inodes", 0); - print_line(fs, "reclaimed", "glocks reclaimed", 1); -#if GFS2_TOOL_FEATURE_IMPLEMENTED - print_line(fs, "bufdata_count", "metadata buffers", 0); - print_line(fs, "unlinked_count", "unlinked inodes", 0); - print_line(fs, "quota_count", "quota IDs", 0); - print_line(fs, "log_num_gl", "Glocks in current transaction", - 0); - print_line(fs, "log_num_buf", "Blocks in current transaction", - 0); - print_line(fs, "log_num_revoke", - "Revokes in current transaction", 0); - print_line(fs, "log_num_rg", "RGs in current transaction", 0); - print_line(fs, "log_num_databuf", - "Databufs in current transaction", 0); - print_line(fs, "log_blks_free", "log blks free", 0); - print_line(fs, "jd_blocks", "log blocks total", 0); - print_line(fs, "reclaim_count", "glocks on reclaim list", 0); - print_line(fs, "log_wraps", "log wraps", 0); - print_line(fs, "fh2dentry_misses", "fh2dentry misses", 1); - print_line(fs, "log_flush_incore", "log incore flushes", 1); - print_line(fs, "log_flush_ondisk", "log ondisk flushes", 1); - print_line(fs, "glock_nq_calls", "glock dq calls", 1); - print_line(fs, "glock_dq_calls", "glock dq calls", 1); - print_line(fs, "glock_prefetch_calls", "glock prefetch calls", - 1); - print_line(fs, "lm_lock_calls", "lm_lock calls", 1); - print_line(fs, "lm_unlock_calls", "lm_unlock calls", 1); - print_line(fs, "lm_callbacks", "lm callbacks", 1); - print_line(fs, "ops_address", "address operations", 1); - print_line(fs, "ops_dentry", "dentry operations", 1); - print_line(fs, "ops_export", "export operations", 1); - print_line(fs, "ops_file", "file operations", 1); - print_line(fs, "ops_inode", "inode operations", 1); - print_line(fs, "ops_super", "super operations", 1); - print_line(fs, "ops_vm", "vm operations", 1); -#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ - - if (!continuous) - break; - - fflush(stdout); - - sleep(interval); - - if (first) { - interval = i; - first = FALSE; - } - } -} diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c index 8761b69..65c8d85 100644 --- a/gfs2/tool/main.c +++ b/gfs2/tool/main.c @@ -42,9 +42,6 @@ static const char *usage[] = { "Clear a flag on a inode\n", " gfs2_tool clearflag flag \n", "\n", - "Print the counters for a filesystem\n", - " gfs2_tool counters \n", - "\n", "Do a GFS2 specific \"df\":\n", " gfs2_tool df \n", "\n", @@ -231,8 +228,6 @@ main(int argc, char *argv[]) if (strcmp(action, "clearflag") == 0) set_flag(argc, argv); - else if (strcmp(action, "counters") == 0) - print_counters(argc, argv); else if (strcmp(action, "df") == 0) print_df(argc, argv); else if (strcmp(action, "freeze") == 0) hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 4 23:17:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 04 Apr 2008 23:17:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-126-gb260be8 Message-ID: <20080404231711.27478.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b260be88b6ba2ac50c27d9df9ad3785c1a1ad002 The branch, master has been updated via b260be88b6ba2ac50c27d9df9ad3785c1a1ad002 (commit) from 41b62e9de6bc4f553bae5aec08080019947d6a9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b260be88b6ba2ac50c27d9df9ad3785c1a1ad002 Author: Abhijith Das Date: Fri Apr 4 17:54:01 2008 -0600 gfs2_tool: remove 'gfs2_tool counters' as they aren't implemented anymore gfs2 doesn't implement counters anymore so we remove them. BZ 438759 came up because we gfs2 stopped implementing counters. Conflicts: gfs2/tool/Makefile ----------------------------------------------------------------------- Summary of changes: gfs2/tool/Makefile | 3 +- gfs2/tool/counters.c | 203 -------------------------------------------------- gfs2/tool/main.c | 5 - 3 files changed, 1 insertions(+), 210 deletions(-) delete mode 100644 gfs2/tool/counters.c diff --git a/gfs2/tool/Makefile b/gfs2/tool/Makefile index a70fac9..66890c8 100644 --- a/gfs2/tool/Makefile +++ b/gfs2/tool/Makefile @@ -23,8 +23,7 @@ include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -OBJS= counters.o \ - df.o \ +OBJS= df.o \ layout.o \ main.o \ misc.o \ diff --git a/gfs2/tool/counters.c b/gfs2/tool/counters.c deleted file mode 100644 index 60f1256..0000000 --- a/gfs2/tool/counters.c +++ /dev/null @@ -1,203 +0,0 @@ - /****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define __user -#include "osi_list.h" - -#include "gfs2_tool.h" -#include "libgfs2.h" - -#define SIZE (65536) - -struct token_list { - osi_list_t list; - char *token; - unsigned int last; -}; - -static osi_list_decl(token_list); -int first = TRUE; - -#define maybe_printf(fmt, args...) \ -do { \ - if (!continuous || !first) \ - printf(fmt, ##args); \ -} while (0) - -/** - * find_update_last - find and update the last value of a token - * @token: the token to look for - * @this: the current value of the token - * - * Returns: the last value of the token - */ - -static unsigned int -find_update_last(char *token, unsigned int this) -{ - osi_list_t *tmp, *head; - struct token_list *tl; - unsigned int last; - - for (head = &token_list, tmp = head->next; tmp != head; tmp = tmp->next) { - tl = osi_list_entry(tmp, struct token_list, list); - if (strcmp(tl->token, token)) - continue; - - last = tl->last; - tl->last = this; - return last; - } - - tl = malloc(sizeof (struct token_list) + strlen(token) + 1); - if (!tl) - die("out of memory\n"); - tl->token = (char *) (tl + 1); - strcpy(tl->token, token); - tl->last = this; - osi_list_add(&tl->list, &token_list); - - return 0; -} - -/** - * print_line - print out a counter - * @token: the name of the counter - * @description: the text description of the counter - * @diff: 1 if you want diffs on continuous output - * - */ - -static void -print_line(char *fsname, char *token, char *description, int diff) -{ - char *value; - char counters_base[PATH_MAX] = "counters/"; - static unsigned int log_blks_free; - unsigned int this, last; - - value = get_sysfs(fsname, strcat(counters_base, token)); - - if (!strcmp(token, "log_blks_free")) - sscanf(value, "%u", &log_blks_free); - - else if (!strcmp(token, "jd_blocks")) { - sscanf(value, "%u", &this); - maybe_printf("%39s %.2f%% (%u of %u)\n", - "log space used", - 100.0 * (this - log_blks_free) / this, - this - log_blks_free, this); - - } else if (continuous && diff) { - sscanf(value, "%u", &this); - last = find_update_last(token, this); - maybe_printf("%39s %-10s %d/s\n", - description, value, - (this - last + interval - 1) / interval); - - } else - maybe_printf("%39s %s\n", description, value); -} - -/** - * print_counters - print out the current countersable parameters for a filesystem - * @argc: - * @argv: - * - */ - -void -print_counters(int argc, char **argv) -{ - unsigned int i = interval; - char *fs; - struct gfs2_sbd sbd; - - interval = 1; - - if (optind < argc) - sbd.path_name = argv[optind++]; - else - die("Usage: gfs2_tool counters \n"); - - check_for_gfs2(&sbd); - - fs = mp2fsname(sbd.path_name); - - for (;;) { - print_line(fs, "glock_count", "locks", 0); - print_line(fs, "glock_held_count", "locks held", 0); - print_line(fs, "inode_count", "incore inodes", 0); - print_line(fs, "reclaimed", "glocks reclaimed", 1); -#if GFS2_TOOL_FEATURE_IMPLEMENTED - print_line(fs, "bufdata_count", "metadata buffers", 0); - print_line(fs, "unlinked_count", "unlinked inodes", 0); - print_line(fs, "quota_count", "quota IDs", 0); - print_line(fs, "log_num_gl", "Glocks in current transaction", - 0); - print_line(fs, "log_num_buf", "Blocks in current transaction", - 0); - print_line(fs, "log_num_revoke", - "Revokes in current transaction", 0); - print_line(fs, "log_num_rg", "RGs in current transaction", 0); - print_line(fs, "log_num_databuf", - "Databufs in current transaction", 0); - print_line(fs, "log_blks_free", "log blks free", 0); - print_line(fs, "jd_blocks", "log blocks total", 0); - print_line(fs, "reclaim_count", "glocks on reclaim list", 0); - print_line(fs, "log_wraps", "log wraps", 0); - print_line(fs, "fh2dentry_misses", "fh2dentry misses", 1); - print_line(fs, "log_flush_incore", "log incore flushes", 1); - print_line(fs, "log_flush_ondisk", "log ondisk flushes", 1); - print_line(fs, "glock_nq_calls", "glock dq calls", 1); - print_line(fs, "glock_dq_calls", "glock dq calls", 1); - print_line(fs, "glock_prefetch_calls", "glock prefetch calls", - 1); - print_line(fs, "lm_lock_calls", "lm_lock calls", 1); - print_line(fs, "lm_unlock_calls", "lm_unlock calls", 1); - print_line(fs, "lm_callbacks", "lm callbacks", 1); - print_line(fs, "ops_address", "address operations", 1); - print_line(fs, "ops_dentry", "dentry operations", 1); - print_line(fs, "ops_export", "export operations", 1); - print_line(fs, "ops_file", "file operations", 1); - print_line(fs, "ops_inode", "inode operations", 1); - print_line(fs, "ops_super", "super operations", 1); - print_line(fs, "ops_vm", "vm operations", 1); -#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ - - if (!continuous) - break; - - fflush(stdout); - - sleep(interval); - - if (first) { - interval = i; - first = FALSE; - } - } -} diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c index 67088eb..d2817ec 100644 --- a/gfs2/tool/main.c +++ b/gfs2/tool/main.c @@ -42,9 +42,6 @@ static const char *usage[] = { "Clear a flag on a inode\n", " gfs2_tool clearflag flag \n", "\n", - "Print the counters for a filesystem\n", - " gfs2_tool counters \n", - "\n", "Do a GFS2 specific \"df\":\n", " gfs2_tool df \n", "\n", @@ -231,8 +228,6 @@ main(int argc, char *argv[]) if (strcmp(action, "clearflag") == 0) set_flag(argc, argv); - else if (strcmp(action, "counters") == 0) - print_counters(argc, argv); else if (strcmp(action, "df") == 0) print_df(argc, argv); else if (strcmp(action, "freeze") == 0) hooks/post-receive -- Cluster Project From lhh@sourceware.org Mon Apr 7 13:47:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Mon, 07 Apr 2008 13:47:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-27-g481965d Message-ID: <20080407134758.14338.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=481965dc9ddb3cbbe06e82ecd507a2b77621206a The branch, RHEL4 has been updated via 481965dc9ddb3cbbe06e82ecd507a2b77621206a (commit) from 6626fda2200aa1abed902646371eee265be7fc04 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 481965dc9ddb3cbbe06e82ecd507a2b77621206a Author: Lon Hohberger Date: Mon Apr 7 09:47:01 2008 -0400 [cman] Resolve 441266 - uninitialized variable causing qdiskd to fail ----------------------------------------------------------------------- Summary of changes: cman/qdisk/disk.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cman/qdisk/disk.c b/cman/qdisk/disk.c index 25405d5..cd9a462 100644 --- a/cman/qdisk/disk.c +++ b/cman/qdisk/disk.c @@ -215,7 +215,7 @@ int qdisk_open(char *name, target_info_t *disk) { int ret; - unsigned long ssz; + int ssz; /* * Open for synchronous writes to insure all writes go directly @@ -231,6 +231,7 @@ qdisk_open(char *name, target_info_t *disk) return -1; } + disk->d_blksz = ssz; disk->d_pagesz = sysconf(_SC_PAGESIZE); /* Check to verify that the partition is large enough.*/ hooks/post-receive -- Cluster Project From adas@sourceware.org Mon Apr 7 15:58:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 15:58:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-34-gd5f18f2 Message-ID: <20080407155803.30742.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d5f18f291be1d57a31b972810c7a9f00c2c92e59 The branch, RHEL5 has been updated via d5f18f291be1d57a31b972810c7a9f00c2c92e59 (commit) via 25599b70074abf814f1a8492ccfbba4576a00eb3 (commit) from 2c4347d9746d16196fb57967b70d025bdac9dadd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d5f18f291be1d57a31b972810c7a9f00c2c92e59 Merge: 25599b70074abf814f1a8492ccfbba4576a00eb3 2c4347d9746d16196fb57967b70d025bdac9dadd Author: Abhijith Das Date: Mon Apr 7 10:55:11 2008 -0500 Merge branch 'RHEL5' of ssh://sources.redhat.com/git/cluster into myRHEL5 commit 25599b70074abf814f1a8492ccfbba4576a00eb3 Author: Abhijith Das Date: Mon Apr 7 10:39:42 2008 -0500 gfs-kernel: fix for bz 429343 gfs_glock_is_locked_by_me assertion This assertion shows up when gfs_readpage gets called without the inode glock being held through the madvise syscall when the kernel attempts to readahead. This patch unlocks the page, locks the inode glock and returns AOP_TRUNCATED_PAGE. I had to change gfs_glock_is_locked_by_me() to return the holder if glock is held or NULL otherwise (instead of the TRUE/FALSE integer value it used to return earlier). I also added a new GL_READPAGE flag. If we need to get an inode glock in gfs_readpage(), this flag is set on the holder. We must not unlock another holder that we might have had on the glock before we entered gfs_readpage; checking for this flag before unlocking ensures that. ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.h | 15 +++++++-------- gfs-kernel/src/gfs/ops_address.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index 37630b0..fb1e210 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -33,16 +33,16 @@ #define GL_NOCACHE (0x00000400) /* Release glock when done, don't cache */ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ +#define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) -static __inline__ int +static __inline__ struct gfs_holder* gfs_glock_is_locked_by_me(struct gfs_glock *gl) { struct list_head *tmp, *head; struct gfs_holder *gh; - int locked = FALSE; /* Look in glock's list of holders for one with current task as owner */ spin_lock(&gl->gl_spin); @@ -50,14 +50,13 @@ gfs_glock_is_locked_by_me(struct gfs_glock *gl) tmp != head; tmp = tmp->next) { gh = list_entry(tmp, struct gfs_holder, gh_list); - if (gh->gh_owner == current) { - locked = TRUE; - break; - } + if (gh->gh_owner == current) + goto out; } + gh = NULL; +out: spin_unlock(&gl->gl_spin); - - return locked; + return gh; } static __inline__ int gfs_glock_is_held_excl(struct gfs_glock *gl) diff --git a/gfs-kernel/src/gfs/ops_address.c b/gfs-kernel/src/gfs/ops_address.c index 05a550e..cc64122 100644 --- a/gfs-kernel/src/gfs/ops_address.c +++ b/gfs-kernel/src/gfs/ops_address.c @@ -272,13 +272,33 @@ gfs_readpage(struct file *file, struct page *page) { struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; + struct gfs_holder *gh; int error; atomic_inc(&sdp->sd_ops_address); - if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl))) { + /* When gfs_readpage is called from the sys_madvise code through the + * readahead code, the inode glock is not held. In this case, we hold + * the inode glock, unlock the page and return AOP_TRUNCATED_PAGE. The + * caller will then reload the page and call gfs_readpage again. We + * also add the flag GL_READPAGE to denote that the glock was held in + * this function and if so, we unlock it before leaving this function + */ + gh = gfs_glock_is_locked_by_me(ip->i_gl); + if (!gh) { + gh = kmalloc(sizeof(struct gfs_holder), GFP_NOFS); + if (!gh) + return -ENOBUFS; + gfs_holder_init(ip->i_gl, LM_ST_SHARED, + GL_READPAGE | LM_FLAG_ANY, gh); unlock_page(page); - return -ENOSYS; + error = gfs_glock_nq(gh); + if (error) { + gfs_holder_uninit(gh); + kfree(gh); + goto out; + } + return AOP_TRUNCATED_PAGE; } if (!gfs_is_jdata(ip)) { @@ -293,6 +313,11 @@ gfs_readpage(struct file *file, struct page *page) if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; + if (gh->gh_flags & GL_READPAGE) { /* If we grabbed the glock here */ + gfs_glock_dq_uninit(gh); + kfree(gh); + } +out: return error; } hooks/post-receive -- Cluster Project From adas@sourceware.org Mon Apr 7 16:06:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 16:06:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-127-g9d6c867 Message-ID: <20080407160640.7582.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9d6c867f74914193edc05c3821ec73b01481f181 The branch, master has been updated via 9d6c867f74914193edc05c3821ec73b01481f181 (commit) from b260be88b6ba2ac50c27d9df9ad3785c1a1ad002 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9d6c867f74914193edc05c3821ec73b01481f181 Author: Abhijith Das Date: Mon Apr 7 10:39:42 2008 -0500 gfs-kernel: fix for bz 429343 gfs_glock_is_locked_by_me assertion This assertion shows up when gfs_readpage gets called without the inode glock being held through the madvise syscall when the kernel attempts to readahead. This patch unlocks the page, locks the inode glock and returns AOP_TRUNCATED_PAGE. I had to change gfs_glock_is_locked_by_me() to return the holder if glock is held or NULL otherwise (instead of the TRUE/FALSE integer value it used to return earlier). I also added a new GL_READPAGE flag. If we need to get an inode glock in gfs_readpage(), this flag is set on the holder. We must not unlock another holder that we might have had on the glock before we entered gfs_readpage; checking for this flag before unlocking ensures that. ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.h | 15 +++++++-------- gfs-kernel/src/gfs/ops_address.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index 37630b0..fb1e210 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -33,16 +33,16 @@ #define GL_NOCACHE (0x00000400) /* Release glock when done, don't cache */ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ +#define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) -static __inline__ int +static __inline__ struct gfs_holder* gfs_glock_is_locked_by_me(struct gfs_glock *gl) { struct list_head *tmp, *head; struct gfs_holder *gh; - int locked = FALSE; /* Look in glock's list of holders for one with current task as owner */ spin_lock(&gl->gl_spin); @@ -50,14 +50,13 @@ gfs_glock_is_locked_by_me(struct gfs_glock *gl) tmp != head; tmp = tmp->next) { gh = list_entry(tmp, struct gfs_holder, gh_list); - if (gh->gh_owner == current) { - locked = TRUE; - break; - } + if (gh->gh_owner == current) + goto out; } + gh = NULL; +out: spin_unlock(&gl->gl_spin); - - return locked; + return gh; } static __inline__ int gfs_glock_is_held_excl(struct gfs_glock *gl) diff --git a/gfs-kernel/src/gfs/ops_address.c b/gfs-kernel/src/gfs/ops_address.c index cee591d..9360ebe 100644 --- a/gfs-kernel/src/gfs/ops_address.c +++ b/gfs-kernel/src/gfs/ops_address.c @@ -272,13 +272,33 @@ gfs_readpage(struct file *file, struct page *page) { struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; + struct gfs_holder *gh; int error; atomic_inc(&sdp->sd_ops_address); - if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl))) { + /* When gfs_readpage is called from the sys_madvise code through the + * readahead code, the inode glock is not held. In this case, we hold + * the inode glock, unlock the page and return AOP_TRUNCATED_PAGE. The + * caller will then reload the page and call gfs_readpage again. We + * also add the flag GL_READPAGE to denote that the glock was held in + * this function and if so, we unlock it before leaving this function + */ + gh = gfs_glock_is_locked_by_me(ip->i_gl); + if (!gh) { + gh = kmalloc(sizeof(struct gfs_holder), GFP_NOFS); + if (!gh) + return -ENOBUFS; + gfs_holder_init(ip->i_gl, LM_ST_SHARED, + GL_READPAGE | LM_FLAG_ANY, gh); unlock_page(page); - return -ENOSYS; + error = gfs_glock_nq(gh); + if (error) { + gfs_holder_uninit(gh); + kfree(gh); + goto out; + } + return AOP_TRUNCATED_PAGE; } if (!gfs_is_jdata(ip)) { @@ -293,6 +313,11 @@ gfs_readpage(struct file *file, struct page *page) if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; + if (gh->gh_flags & GL_READPAGE) { /* If we grabbed the glock here */ + gfs_glock_dq_uninit(gh); + kfree(gh); + } +out: return error; } hooks/post-receive -- Cluster Project From adas@sourceware.org Mon Apr 7 16:07:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 16:07:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-36-gbd99cec Message-ID: <20080407160731.15209.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=bd99cecbf93fb6105b2503d24d0da3b3b00ed38e The branch, STABLE2 has been updated via bd99cecbf93fb6105b2503d24d0da3b3b00ed38e (commit) from f8e55ed986aa3fb37e943224689e21f451e79692 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bd99cecbf93fb6105b2503d24d0da3b3b00ed38e Author: Abhijith Das Date: Mon Apr 7 10:39:42 2008 -0500 gfs-kernel: fix for bz 429343 gfs_glock_is_locked_by_me assertion This assertion shows up when gfs_readpage gets called without the inode glock being held through the madvise syscall when the kernel attempts to readahead. This patch unlocks the page, locks the inode glock and returns AOP_TRUNCATED_PAGE. I had to change gfs_glock_is_locked_by_me() to return the holder if glock is held or NULL otherwise (instead of the TRUE/FALSE integer value it used to return earlier). I also added a new GL_READPAGE flag. If we need to get an inode glock in gfs_readpage(), this flag is set on the holder. We must not unlock another holder that we might have had on the glock before we entered gfs_readpage; checking for this flag before unlocking ensures that. ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.h | 15 +++++++-------- gfs-kernel/src/gfs/ops_address.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index 37630b0..fb1e210 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -33,16 +33,16 @@ #define GL_NOCACHE (0x00000400) /* Release glock when done, don't cache */ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ +#define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) -static __inline__ int +static __inline__ struct gfs_holder* gfs_glock_is_locked_by_me(struct gfs_glock *gl) { struct list_head *tmp, *head; struct gfs_holder *gh; - int locked = FALSE; /* Look in glock's list of holders for one with current task as owner */ spin_lock(&gl->gl_spin); @@ -50,14 +50,13 @@ gfs_glock_is_locked_by_me(struct gfs_glock *gl) tmp != head; tmp = tmp->next) { gh = list_entry(tmp, struct gfs_holder, gh_list); - if (gh->gh_owner == current) { - locked = TRUE; - break; - } + if (gh->gh_owner == current) + goto out; } + gh = NULL; +out: spin_unlock(&gl->gl_spin); - - return locked; + return gh; } static __inline__ int gfs_glock_is_held_excl(struct gfs_glock *gl) diff --git a/gfs-kernel/src/gfs/ops_address.c b/gfs-kernel/src/gfs/ops_address.c index cee591d..9360ebe 100644 --- a/gfs-kernel/src/gfs/ops_address.c +++ b/gfs-kernel/src/gfs/ops_address.c @@ -272,13 +272,33 @@ gfs_readpage(struct file *file, struct page *page) { struct gfs_inode *ip = get_v2ip(page->mapping->host); struct gfs_sbd *sdp = ip->i_sbd; + struct gfs_holder *gh; int error; atomic_inc(&sdp->sd_ops_address); - if (gfs_assert_warn(sdp, gfs_glock_is_locked_by_me(ip->i_gl))) { + /* When gfs_readpage is called from the sys_madvise code through the + * readahead code, the inode glock is not held. In this case, we hold + * the inode glock, unlock the page and return AOP_TRUNCATED_PAGE. The + * caller will then reload the page and call gfs_readpage again. We + * also add the flag GL_READPAGE to denote that the glock was held in + * this function and if so, we unlock it before leaving this function + */ + gh = gfs_glock_is_locked_by_me(ip->i_gl); + if (!gh) { + gh = kmalloc(sizeof(struct gfs_holder), GFP_NOFS); + if (!gh) + return -ENOBUFS; + gfs_holder_init(ip->i_gl, LM_ST_SHARED, + GL_READPAGE | LM_FLAG_ANY, gh); unlock_page(page); - return -ENOSYS; + error = gfs_glock_nq(gh); + if (error) { + gfs_holder_uninit(gh); + kfree(gh); + goto out; + } + return AOP_TRUNCATED_PAGE; } if (!gfs_is_jdata(ip)) { @@ -293,6 +313,11 @@ gfs_readpage(struct file *file, struct page *page) if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) error = -EIO; + if (gh->gh_flags & GL_READPAGE) { /* If we grabbed the glock here */ + gfs_glock_dq_uninit(gh); + kfree(gh); + } +out: return error; } hooks/post-receive -- Cluster Project From rohara@sourceware.org Mon Apr 7 16:14:00 2008 From: rohara@sourceware.org (rohara@sourceware.org) Date: Mon, 07 Apr 2008 16:14:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-28-g9133a64 Message-ID: <20080407161415.20731.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9133a6446a47c56bd735d01d761f0c91f8491fe0 The branch, RHEL4 has been updated via 9133a6446a47c56bd735d01d761f0c91f8491fe0 (commit) from 481965dc9ddb3cbbe06e82ecd507a2b77621206a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9133a6446a47c56bd735d01d761f0c91f8491fe0 Author: Ryan O'Hara Date: Mon Apr 7 11:13:40 2008 -0500 BZ 409391 : fence_scsi and scsi_reserve script no longer use state file for tracking registered devices (/var/run/scsi_reserve). ----------------------------------------------------------------------- Summary of changes: fence/agents/scsi/fence_scsi.pl | 80 ++++---- fence/agents/scsi/fence_scsi_test.pl | 174 ++++++++--------- fence/agents/scsi/scsi_reserve | 356 +++++++++++++++++++--------------- 3 files changed, 328 insertions(+), 282 deletions(-) diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl index 51531ce..c2dea6f 100755 --- a/fence/agents/scsi/fence_scsi.pl +++ b/fence/agents/scsi/fence_scsi.pl @@ -11,9 +11,6 @@ $_ = $0; s/.*\///; my $pname = $_; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; $REDHAT_COPYRIGHT=""; @@ -195,7 +192,6 @@ sub get_key return $key; } - sub get_options_stdin { my $opt; @@ -232,6 +228,10 @@ sub get_options_stdin { $opt_n = $val; } + elsif ($name eq "nodename") + { + $opt_n = $val; + } elsif ($name eq "verbose") { $opt_v = $val; @@ -248,7 +248,8 @@ sub get_key_list ($dev) = @_; my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -i -k"; + + my $cmd = "sg_persist -n -d $dev -i -k"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); @@ -274,46 +275,36 @@ sub get_key_list return %key_list; } -#sub get_scsi_devices -#{ -# my ($in, $out, $err); -# my $cmd = "lvs --noheadings --separator : -o vg_attr,devices"; -# my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; -# -# waitpid($pid, 0); -# -# die "Unable to execute lvs.\n" if ($?>>8); -# -# while (<$out>) -# { -# chomp; -# print "OUT: $_\n" if $opt_v; -# -# my ($vg_attrs, $device) = split(/:/, $_); -# -# if ($vg_attrs =~ /.*c$/) -# { -# $device =~ s/\(.*\)//; -# push(@volumes, $device); -# } -# } -# -# close($in); -# close($out); -# close($err); -#} - sub get_scsi_devices { - open(FILE, "/var/run/scsi_reserve") or die "$!\n"; + my ($in, $out, $err); + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name 2> /dev/null"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); - while () + die "Unable to execute lvs.\n" if ($?>>8); + + while (<$out>) { chomp; - push(@volumes, $_); + print "OUT: $_\n" if $opt_v; + + my ($vg_attrs, $device) = split(/:/, $_); + + if ($vg_attrs =~ /.*c$/) + { + $device =~ s/\(.*\)//; + push(@volumes, $device); + } } - close FILE; + close($in); + close($out); + close($err); } sub check_sg_persist @@ -342,7 +333,7 @@ sub do_register ($dev, $key) = @_; my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -o -G -S $key"; + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); @@ -379,13 +370,18 @@ sub fence_node do_register($dev, $host_key); } + if (!$key_list{$node_key}) + { + next; + } + if ($host_key eq $node_key) { - $cmd = "sg_persist -d $dev -o -G -K $host_key -S 0"; + $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0"; } else { - $cmd = "sg_persist -d $dev -o -A -K $host_key -S $node_key -T 5"; + $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5"; } my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; @@ -415,7 +411,7 @@ if (@ARGV > 0) { usage if defined $opt_h; version if defined $opt_V; - fail_usage "Unkown parameter." if (@ARGV > 0); + fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-n' flag specified." unless defined $opt_n; diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl index 7a7bbc3..35bea49 100755 --- a/fence/agents/scsi/fence_scsi_test.pl +++ b/fence/agents/scsi/fence_scsi_test.pl @@ -1,125 +1,96 @@ #!/usr/bin/perl +use POSIX; use IPC::Open3; -use Sys::Hostname; +use XML::LibXML; use Getopt::Std; -use POSIX; my @devices; my %results; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; $REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION -sub get_key +sub get_scsi_block_devices { - my $name = @_; - my $addr = gethostbyname($name) or die "$!\n"; + my $block_dir = "/sys/block"; - return unpack("H*", $addr); -} + opendir(DIR, $block_dir) or die "$!\n"; -sub register_device -{ - my $func = (caller(0))[3]; - my ($dev, $key) = @_; + my @block_devices = grep { /^sd*/ } readdir(DIR); + + closedir(DIR); - print "DEBUG: $func ($dev, $key)\n" if ($opt_d); + for $block_dev (@block_devices) + { + push(@devices, "/dev/" . $block_dev); + } +} +sub get_cluster_vol_devices +{ my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -o -G -S $key"; + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); + die "[error] unable to execute vgs command.\n" if WEXITSTATUS($?); + + while (<$out>) + { + chomp; + + my ($vg_attr, $pv_name) = split(/:/, $_); - $results{$dev}[0] = $rval; + if ($vg_attr =~ /.*c$/) + { + ###### DEBUG ###### + print "DEBUG: pv_name = $pv_name\n"; - print "DEBUG: [$rval] $cmd\n" if ($opt_d); + push(@devices, $pv_name); + } + } close($in); close($out); close($err); - - return $rval; } -sub unregister_device +sub register_device { - my $func = (caller(0))[3]; my ($dev, $key) = @_; - - print "DEBUG: $func ($dev, $key)\n" if ($opt_d); - my ($in, $out, $err); - my $cmd = "sg_persist -d $dev -o -G -K $key -S 0"; + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); - - $results{$dev}[1] = $rval; - - print "DEBUG: [$rval] $cmd\n" if ($opt_d); + $results{$dev}[0] = WEXITSTATUS($?); close($in); close($out); close($err); - - return $rval; } -sub get_block_devices -{ - my $block_dir = "/sys/block"; - - opendir(DIR, $block_dir) or die "Error: $! $block_dir\n"; - - my @block_devices = grep { /^sd*/ } readdir(DIR); - - closedir(DIR); - - for $dev (@block_devices) - { - push @devices, "/dev/" . $dev; - } -} - -sub get_cluster_devices +sub unregister_device { + my ($dev, $key) = @_; my ($in, $out, $err); - my $cmd = "vgs --config 'global { locking_type = 0 }'" . - " --noheadings --separator : -o vg_attr,pv_name"; - + my $cmd = "sg_persist -n -d $dev -o -G -K $key -S 0"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - die "Error: unable to exec vgs command.\n" if WEXITSTATUS($?); - - while (<$out>) - { - chomp; - - my ($vg_attr, $dev) = split(/:/, $_); - - if ($vg_attr =~ /.*c$/) - { - $dev =~ s/\(.*\)//; - push @devices, $dev; - } - } + $results{$dev}[1] = WEXITSTATUS($?); close($in); close($out); @@ -128,20 +99,38 @@ sub get_cluster_devices sub test_devices { - my $name = hostname() or die "$!\n"; - my $key = get_key($name); + my $key = "0xDEADBEEF"; foreach $dev (@devices) { - if (register_device($dev, $key) != 0) - { - } - if (unregister_device($dev, $key) != 0) - { - } + register_device($dev, $key); + unregister_device($dev, $key); } } +sub check_config_fence +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/fencedevices/fencedevice"; + + my $xpath_fence = "count(${root}[\@agent='fence_scsi'])"; + + return ( ! $tree->findvalue($xpath_fence)); +} + +sub check_config_nodes +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/clusternodes/clusternode"; + + my $xpath_name = "count(${root}/\@name)"; + my $xpath_nodeid = "count(${root}/\@nodeid)"; + + return ($tree->findvalue($xpath_name) != $tree->findvalue($xpath_nodeid)); +} + sub print_results { my $device_count = scalar(@devices); @@ -198,9 +187,9 @@ sub print_usage print " -h Help. Prints out this usage information.\n\n"; } -### MAIN ####################################################### +### MAIN ####################################################################### -if (getopts("cdhsv") == 0) +if (getopts("cdhst:v") == 0) { print_usage; exit(1); @@ -215,25 +204,34 @@ if ($opt_h) if ($opt_c) { print "\nTesting devices in cluster volumes...\n"; - get_cluster_devices; + get_cluster_vol_devices; + test_devices; + print_results; } if ($opt_s) { print "\nTesting all SCSI block devices...\n"; - get_block_devices; + get_scsi_block_devices; + test_devices; + print_results; } -if (!$opt_c && !$opt_s) +if ($opt_t) +{ + if ($opt_t eq "fence") + { + exit check_config_fence; + } + if ($opt_t eq "nodes") + { + exit check_config_nodes; + } +} + +if (!$opt_c && !$opt_s && !$opt_t) { print "\nPlease specify either cluster or SCSI mode.\n"; print_usage; exit(1); } - -test_devices; - -print_results; - -exit 0; - diff --git a/fence/agents/scsi/scsi_reserve b/fence/agents/scsi/scsi_reserve index 4c2f114..67c0d2d 100755 --- a/fence/agents/scsi/scsi_reserve +++ b/fence/agents/scsi/scsi_reserve @@ -1,21 +1,50 @@ #!/bin/bash # +# scsi_reserve: +# # chkconfig: 345 25 75 # description: start/stop persistent reservation service for lvm +# config: /etc/sysconfig/scsi_reserve . /etc/init.d/functions -[ -f /etc/sysconfig/scsi_reserve ] && . /etc/sysconfig/scsi_reserve +# read in config file if it exists +# +if [ -f /etc/sysconfig/scsi_reserve ] ; then + . /etc/sysconfig/scsi_reserve +fi + +# check if cluster is configured for fence_scsi +# +if ! fence_scsi_test -t fence ; then + logger -t scsi_reserve \ + "[error] cluster not configured for scsi reservations" + exit 1 +fi + +# check for nodeids in config file +# +if ! fence_scsi_test -t nodes ; then + logger -t scsi_reserve \ + "[error] cluster must define nodeid for all nodes" + exit 1 +fi # check for sg_persist command provided by sg3_utils package # if ! sg_persist -V &> /dev/null ; then - echo "error: sg_persist not found" - exit 2 + logger -t scsi_reserve \ + "[error] unable to exec sg_persist" + exit 1 fi -# get scsi devices that are part of clustered volumes +# check that cman is running # +if ! cman_tool status &> /dev/null ; then + logger -t scsi_reserve \ + "[error] cman does not appear to be running" + exit 1 +fi # get physical volumes (devices) that are part of cluster volumes # @@ -23,174 +52,197 @@ scsi_devices=$( vgs --config 'global { locking_type = 0 }' \ --noheadings -o vg_attr,pv_name 2> /dev/null \ | awk ' $1 ~ /.*c$/ { print $2 } ' ) -# if no scsi devices were found we can exit now -# -[ -z "$scsi_devices" ] && exit 0 - -# get the node name and node addr from cman -# -node_name=$( cman_tool status | grep "Node name" | awk -F": " '{ print $2 }' ) -node_addr=$( cman_tool status | grep "Node addr" | awk -F": " '{ print $2 }' ) +if [ -z "$scsi_devices" ] ; then + logger -t scsi_reserve \ + "[error] did not find devices in cluster volumes" + exit 1 +fi -# get cluster id and node id from cman +# get the cluster id from cman # -c_id=$( cman_tool status | grep "Cluster ID" | awk -F": " '{ print $2 }' ) -n_id=$( cman_tool status | grep "Node ID" | awk -F": " '{ print $2 }' ) +cluster_id=$( cman_tool status | grep -i "Cluster ID" \ + | awk -F": " '{ print $2 }' ) -[ -z "$c_id" ] && exit 1 -[ -z "$n_id" ] && exit 1 +if [ -z "$cluster_id" ] ; then + logger -s -t scsi_reserve \ + "[error] unable to determine cluster id" + exit 1 +fi -# create unique key for this host +# get the node id from cman # -key=$( printf "%x%.4x" $c_id $n_id ) - -############################################################################### - -case $1 in - -start) - -rval=0 +node_id=$( cman_tool status | grep -i "Node ID" \ + | awk -F": " '{ print $2 }' ) -echo "$key" > /var/lock/subsys/scsi_reserve - -cat /dev/null > /var/run/scsi_reserve +if [ -z "$node_id" ] ; then + logger -t scsi_reserve \ + "[error] unable to determine node id" + exit 1 +fi -# register each device using our key +# generate unique key using cluster_id and node_id # -for dev in $scsi_devices -do - - echo -n "Registering device: $dev" - - for error in 1 - do - sg_persist -d $dev -o -G -S $key &>/dev/null || break - error=0 - done - - if [ $error -eq 0 ]; then - echo $dev >> /var/run/scsi_reserve - success "register of device $dev" - else - # perhaps we are already resgistered - # - if sg_persist -d $dev -i -k 2>/dev/null | grep -qiE "$key" ; then - echo $dev >> /var/run/scsi_reserve - success "register device $dev" - else - failure - rval=1 - fi - fi - - echo - - # create a reservation - # - sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null - -done - -# start the watchdog if configured and registration was successful -# -if [ "$rval" == 0 ] && [ "${WATCHDOG}" == yes ] ; then - echo -n "Starting watchdog: " - if watchdog -c /etc/cluster/scsi_watchdog.conf ; then - success "watchdog start" - else - failure "watchdog start" - fi - echo +key=$( printf "%x%.4x" $cluster_id $node_id ) + +if [ -z "$key" ] ; then + logger -t scsi_reserve \ + "[error] unable to generate key" + exit 1 fi -;; -stop) +################################################################################ -rval=0 +case $1 in -# stop the watchdog before we unregister -# -if [ "${WATCHDOG}" == yes ] ; then - echo -n "Stopping watchdog: " - - if killproc watchdog ; then - success "watchdog stop" - else - failure "watchdog stop" - fi - echo -fi + start) -# unregister each device for this node -# -for dev in $scsi_devices -do - echo -n "Unregistering device: $dev" - - # get list of keys registered for this device - # - reg_keys=$( sg_persist -d $dev -i -k | grep '^[[:space:]]*0x' ) - - # check if this node/key is the node/key holding the reservation - # - if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "$key" ; then - if echo "$reg_keys" | grep -qivE "${key#0}" ; then - error=1 - else - for error in 1 - do - sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break - error=0 - done - fi - else - for error in 1 - do - sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break error=0 - done - fi + count=0 + + echo -n "Starting scsi_reserve:" + + for dev in $scsi_devices + do + # check if our key is already resgistered with this device + # + if sg_persist -n -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] already registered with $dev (key=0x$key)" + continue + fi + + # create the scsi registration + # + if ! sg_persist -n -d $dev -o -I -S $key &> /dev/null ; then + logger -t scsi_reserve \ + "[error] unable to register device $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] registered with device $dev (key=0x$key)" + fi + + # check to see if reservation already exists + # + if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then + logger -t scsi_reserve \ + "[info] reservation already exists on $dev" + continue + fi + + # create the scsi reservation + # + if ! sg_persist -n -d $dev -o -R -K $key -T 5 &> /dev/null ; then + logger -t scsi_reserver \ + "[error] unable to create reservation on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + fi + done + + # leave fence domain if any errors occured during registration + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors during registration" + logger -t scsi_reserve \ + "[info] leaving the fence domain" + fence_tool leave + failure + fi + + echo + + ;; # end of start + + stop) - if [ $error -eq 0 ] ; then - success "unregister device $dev" - else - failure - rval=1 - fi - - echo -done + error=0 + count=0 + + echo -n "Stopping scsi_reserve:" + + for dev in $scsi_devices + do + # get list of keys registered with this device + # + key_list=$( sg_persist -n -d $dev -i -k | grep -iE "^[[:space:]]*0x" ) + + # check that our key is registered with this device + # + if ! sg_persist -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] not registered with $dev (key=0x$key)" + continue + fi + + # check if our key is the reservation holder + # + if sg_persist -n -d $dev -i -r 2>/dev/null | grep -qiE "$key" ; then + if echo "$key_list" | grep -qivE "$key" ; then + logger -t scsi_reserve \ + "[error] unable to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + continue + fi + fi + + # remove registration for this device + # + if ! sg_persist -n -d $dev -o -G -K $key -S 0 &> /dev/null ; then + logger -t scsi_reserve \ + "[error] failed to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] removed registration on $dev (key=0x$key)" + fi + + done + + # report success or failure + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors occured during unregistration" + failure + fi + + echo + + ;; # end of stop + + status) -rm -f /var/lock/subsys/scsi_reserve + error=0 -;; + for dev in $scsi_devices + do + if sg_persist -n -d $dev -i -k | grep -qiE "$key" ; then + devices[${#devices[@]}]=$dev + fi + done -status) + if [ -z "$devices" ] ; then + echo "No registered devices found." + else + echo "Found ${#devices[@]} registered device(s):" -rval=0 + for i in "${devices[@]}" + do + echo $i + done + fi -# find devices that are registered with our key -# -for dev in $scsi_devices -do - if sg_persist -d $dev -i -k 2>/dev/null | grep -qiE "$key" ; then - devices[${#devices[@]}]=$dev - fi -done - -if [ -z "$devices" ]; then - echo "No devices resgistered." -else - echo "Found ${#devices[@]} registered device(s):" - - for i in "${devices[@]}" ; do - echo $i - done -fi -;; + ;; # end of status esac -exit $rval - +exit $error hooks/post-receive -- Cluster Project From rohara@sourceware.org Mon Apr 7 16:17:00 2008 From: rohara@sourceware.org (rohara@sourceware.org) Date: Mon, 07 Apr 2008 16:17:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-35-g5ca1096 Message-ID: <20080407161713.21907.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5ca10968fb04d0ea485d7f52451d266ec581aad2 The branch, RHEL5 has been updated via 5ca10968fb04d0ea485d7f52451d266ec581aad2 (commit) from d5f18f291be1d57a31b972810c7a9f00c2c92e59 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ca10968fb04d0ea485d7f52451d266ec581aad2 Author: Ryan O'Hara Date: Mon Apr 7 11:16:55 2008 -0500 BZ 441323 : Redirect stderr to /dev/null when getting list of devices. ----------------------------------------------------------------------- Summary of changes: fence/agents/scsi/fence_scsi.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl index 51c75ae..5074af3 100755 --- a/fence/agents/scsi/fence_scsi.pl +++ b/fence/agents/scsi/fence_scsi.pl @@ -280,7 +280,7 @@ sub get_scsi_devices my ($in, $out, $err); my $cmd = "vgs --config 'global { locking_type = 0 }'" . - " --noheadings --separator : -o vg_attr,pv_name"; + " --noheadings --separator : -o vg_attr,pv_name 2> /dev/null"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Mon Apr 7 20:11:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 07 Apr 2008 20:11:00 -0000 Subject: conga ./clustermon.spec.in.in ./conga.spec.in. ... Message-ID: <20080407201144.25852.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-07 20:11:44 Modified files: . : clustermon.spec.in.in conga.spec.in.in make : version.in Log message: - Update changelogs - Bump version Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.25.2.10&r2=1.25.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.21&r2=1.67.2.22 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.28.2.9&r2=1.28.2.10 From adas@sourceware.org Mon Apr 7 20:48:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 20:48:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-128-g6719f1e Message-ID: <20080407204842.18038.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=6719f1e1eb9a1543c53721f201befec081b4b78d The branch, master has been updated via 6719f1e1eb9a1543c53721f201befec081b4b78d (commit) from 9d6c867f74914193edc05c3821ec73b01481f181 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6719f1e1eb9a1543c53721f201befec081b4b78d Author: Abhijith Das Date: Mon Apr 7 15:44:35 2008 -0500 gfs2_tool manpage: gfs2_tool counters doesn't exist anymore. This patch reflects the removal of the 'counters' command from gfs2_tool. bz 438759 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 022b164..36b90b7 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -18,10 +18,6 @@ gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. \fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR Clear an attribute flag on a file. See \fBsetflag\fP for available flags. .TP -\fBcounters\fP \fIMountPoint\fR [-c] -Print out statistics about a filesystem. If -c is used, gfs2_tool continues -to run printing out the stats once a second. -.TP \fBdf\fP \fIMountPoint\fR Print out a space usage summary of a given filesystem. The information printed is more detailed than a standard "df". hooks/post-receive -- Cluster Project From adas@sourceware.org Mon Apr 7 20:49:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 20:49:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-37-g0fe8d36 Message-ID: <20080407204951.19695.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0fe8d3648fd3e23828516c8f0346703b4d885739 The branch, STABLE2 has been updated via 0fe8d3648fd3e23828516c8f0346703b4d885739 (commit) from bd99cecbf93fb6105b2503d24d0da3b3b00ed38e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0fe8d3648fd3e23828516c8f0346703b4d885739 Author: Abhijith Das Date: Mon Apr 7 15:44:35 2008 -0500 gfs2_tool manpage: gfs2_tool counters doesn't exist anymore. This patch reflects the removal of the 'counters' command from gfs2_tool. bz 438759 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 022b164..36b90b7 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -18,10 +18,6 @@ gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. \fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR Clear an attribute flag on a file. See \fBsetflag\fP for available flags. .TP -\fBcounters\fP \fIMountPoint\fR [-c] -Print out statistics about a filesystem. If -c is used, gfs2_tool continues -to run printing out the stats once a second. -.TP \fBdf\fP \fIMountPoint\fR Print out a space usage summary of a given filesystem. The information printed is more detailed than a standard "df". hooks/post-receive -- Cluster Project From adas@sourceware.org Mon Apr 7 20:50:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Mon, 07 Apr 2008 20:50:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-36-gc9dcbe4 Message-ID: <20080407205013.20501.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c9dcbe4c750e249de6c5568dcaea244ad9e23647 The branch, RHEL5 has been updated via c9dcbe4c750e249de6c5568dcaea244ad9e23647 (commit) from 5ca10968fb04d0ea485d7f52451d266ec581aad2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c9dcbe4c750e249de6c5568dcaea244ad9e23647 Author: Abhijith Das Date: Mon Apr 7 15:44:35 2008 -0500 gfs2_tool manpage: gfs2_tool counters doesn't exist anymore. This patch reflects the removal of the 'counters' command from gfs2_tool. bz 438759 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 022b164..36b90b7 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -18,10 +18,6 @@ gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. \fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR Clear an attribute flag on a file. See \fBsetflag\fP for available flags. .TP -\fBcounters\fP \fIMountPoint\fR [-c] -Print out statistics about a filesystem. If -c is used, gfs2_tool continues -to run printing out the stats once a second. -.TP \fBdf\fP \fIMountPoint\fR Print out a space usage summary of a given filesystem. The information printed is more detailed than a standard "df". hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Tue Apr 8 16:32:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Tue, 08 Apr 2008 16:32:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-29-gaac75cb Message-ID: <20080408163205.12381.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=aac75cba36115a59a489c0b1a52be5259f54fb87 The branch, RHEL4 has been updated via aac75cba36115a59a489c0b1a52be5259f54fb87 (commit) from 9133a6446a47c56bd735d01d761f0c91f8491fe0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aac75cba36115a59a489c0b1a52be5259f54fb87 Author: Jonathan Brassow Date: Tue Apr 8 11:30:38 2008 -0500 dm-cmirror.ko: Part of the fix for bug 193067 (cluster pvmove) Allow mirror log to be created without the 'block_on_error' flag. ----------------------------------------------------------------------- Summary of changes: cmirror-kernel/src/dm-cmirror-client.c | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cmirror-kernel/src/dm-cmirror-client.c b/cmirror-kernel/src/dm-cmirror-client.c index c644c13..c11cedc 100644 --- a/cmirror-kernel/src/dm-cmirror-client.c +++ b/cmirror-kernel/src/dm-cmirror-client.c @@ -574,11 +574,13 @@ static int cluster_ctr(struct dirty_log *log, struct dm_target *ti, lc = log->context; + /* Pull this out to support pvmove if (lc->failure_response != FR_BLOCK) { DMERR("Clustered mirror requires \"block_on_error\" parameter"); error = -EINVAL; goto fail; } + */ atomic_set(&lc->in_sync, -1); lc->uuid_ref = 1; @@ -663,7 +665,7 @@ static int cluster_ctr(struct dirty_log *log, struct dm_target *ti, * clustered_core log constructor * (preceding args:: mirror clustered_core * - * Right now, 3 <= argc <= 4. "block_on_error" is required. + * Right now, 2 <= argc <= 4. * * argv contains: * [[no]sync] [block_on_error] @@ -671,9 +673,9 @@ static int cluster_ctr(struct dirty_log *log, struct dm_target *ti, static int cluster_core_ctr(struct dirty_log *log, struct dm_target *ti, unsigned int argc, char **argv) { int i; - if ((argc < 3) || (argc > 4)) { + if ((argc < 2) || (argc > 4)) { DMERR("Too %s arguments to clustered_core mirror log type.", - (argc < 3) ? "few" : "many"); + (argc < 2) ? "few" : "many"); DMERR(" %d arguments supplied:", argc); for (i = 0; i < argc; i++) DMERR(" %s", argv[i]); @@ -687,7 +689,7 @@ static int cluster_core_ctr(struct dirty_log *log, struct dm_target *ti, * clustered_disk log constructor * (preceding args:: mirror clustered_disk * - * Right now, 4 <= argc <= 5. "block_on_error" is required. + * Right now, 3 <= argc <= 5. * * argv contains: * [[no]sync] [block_on_error] @@ -695,9 +697,9 @@ static int cluster_core_ctr(struct dirty_log *log, struct dm_target *ti, static int cluster_disk_ctr(struct dirty_log *log, struct dm_target *ti, unsigned int argc, char **argv) { int i; - if ((argc < 4) || (argc > 5)) { + if ((argc < 3) || (argc > 5)) { DMERR("Too %s arguments to clustered_disk mirror log type.", - (argc < 4) ? "few" : "many"); + (argc < 3) ? "few" : "many"); DMERR(" %d arguments supplied:", argc); for (i = 0; i < argc; i++) DMERR(" %s", argv[i]); @@ -981,7 +983,8 @@ fail: if (r) { DMERR("Log flush failure: %d%s", r, (r == -EIO) ? " -EIO" : ""); - dm_table_event(lc->ti->table); + if (lc->failure_response == FR_BLOCK) + dm_table_event(lc->ti->table); lc->log_dev_failed = 1; } @@ -1213,7 +1216,7 @@ static int cluster_status(struct dirty_log *log, status_type_t status, char *result, unsigned int maxlen) { int sz = 0; - int arg_count=3; + int arg_count=2; struct log_c *lc = (struct log_c *) log->context; switch(status){ @@ -1275,6 +1278,9 @@ static int cluster_status(struct dirty_log *log, status_type_t status, if(lc->sync != DEFAULTSYNC) arg_count++; + if (lc->failure_response == FR_BLOCK) + arg_count++; + if (lc->log_dev) { arg_count++; @@ -1293,7 +1299,9 @@ static int cluster_status(struct dirty_log *log, status_type_t status, } if (lc->sync != DEFAULTSYNC) DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : ""); - DMEMIT("block_on_error "); + + if (lc->failure_response == FR_BLOCK) + DMEMIT("block_on_error "); } return sz; hooks/post-receive -- Cluster Project From jbrassow@sourceware.org Tue Apr 8 19:35:00 2008 From: jbrassow@sourceware.org (jbrassow@sourceware.org) Date: Tue, 08 Apr 2008 19:35:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-30-g625364c Message-ID: <20080408193513.14535.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=625364c99277445b97bbb3120736c358b802fb0f The branch, RHEL4 has been updated via 625364c99277445b97bbb3120736c358b802fb0f (commit) from aac75cba36115a59a489c0b1a52be5259f54fb87 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 625364c99277445b97bbb3120736c358b802fb0f Author: Jonathan Brassow Date: Mon Apr 7 10:48:24 2008 -0500 - dm-cmirror.ko: Fix infinite election loop (bug 217895) It was possible for an election to be run just before a machine that was next in line to be server suspened. This would cause the remaining nodes to think a suspended node was the active server - worse, the suspended node would allow itself to become server and then say in was not in charge of the log. This would simply keep going round and round. Fix is to increment 'suspended' before exiting postsuspend, and not allowing a node to be elected server if 'suspended' was set. ----------------------------------------------------------------------- Summary of changes: cmirror-kernel/src/dm-cmirror-client.c | 1 + cmirror-kernel/src/dm-cmirror-server.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmirror-kernel/src/dm-cmirror-client.c b/cmirror-kernel/src/dm-cmirror-client.c index c11cedc..43fe5ef 100644 --- a/cmirror-kernel/src/dm-cmirror-client.c +++ b/cmirror-kernel/src/dm-cmirror-client.c @@ -836,6 +836,7 @@ static int cluster_postsuspend(struct dirty_log *log) } } } + atomic_set(&lc->suspended, 2); return 0; } diff --git a/cmirror-kernel/src/dm-cmirror-server.c b/cmirror-kernel/src/dm-cmirror-server.c index 4252058..c8f77ea 100644 --- a/cmirror-kernel/src/dm-cmirror-server.c +++ b/cmirror-kernel/src/dm-cmirror-server.c @@ -939,10 +939,19 @@ static int process_election(struct log_request *lr, struct log_c *lc, if((lc->server_id == my_id) && !atomic_read(&lc->suspended)){ */ if (lc->server_id == my_id) { - if (atomic_read(&lc->suspended)) { - DMDEBUG("I'm suspended, but still responding as server: %s", + int r = atomic_read(&lc->suspended); + + if (r >= 2) { + DMDEBUG("I am the assigned server while suspended: %s", lc->uuid + (strlen(lc->uuid) - 8)); + lc->server_id = 0xDEAD; + lr->u.lr_node_count++; + return 0; } + + if (r == 1) + DMDEBUG("I'm suspended, but still responding as server: %s", + lc->uuid + (strlen(lc->uuid) - 8)); lr->u.lr_coordinator = my_id; if(!(saddr->sin_addr.s_addr = nodeid_to_ipaddr(lr->u.lr_starter))){ return -1; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 8 20:49:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 08 Apr 2008 20:49:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-130-gbdf3aa8 Message-ID: <20080408204953.9647.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=bdf3aa8831d5689dbdeb3ad74c6b5326ceddc5eb The branch, master has been updated via bdf3aa8831d5689dbdeb3ad74c6b5326ceddc5eb (commit) via fd7bce201861de1c3b1a047a93f1a76da284f2bc (commit) from 6719f1e1eb9a1543c53721f201befec081b4b78d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bdf3aa8831d5689dbdeb3ad74c6b5326ceddc5eb Author: Andrew Price Date: Tue Apr 8 22:48:05 2008 +0200 [[BUILD] Warn and continue if CONFIG_KERNELVERSION is not found Currently the configure script assumes that CONFIG_KERNELVERSION is defined in autoconf.h. This patch handles the case where it isn't defined there. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto commit fd7bce201861de1c3b1a047a93f1a76da284f2bc Author: Fabio M. Di Nitto Date: Tue Apr 8 22:46:19 2008 +0200 [BUILD] Fix clean target for experimental fence/agents/lib Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 5 +++++ fence/agents/lib/Makefile | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4be68df..451c777 100755 --- a/configure +++ b/configure @@ -268,6 +268,11 @@ sub kernel_version { } } close AUTOCONF; + # Warn and continue if CONFIG_KERNELVERSION was not found + if (!$current_version) { + print " WARNING: Could not determine kernel version.\n"; + return 1; + } # leaving only the numbers from the lines # this is faster then split and doesn't alocate useless arrays $current_version =~ s/.*"(.*)"\n/$1/; diff --git a/fence/agents/lib/Makefile b/fence/agents/lib/Makefile index 4ef2edc..c66c83c 100644 --- a/fence/agents/lib/Makefile +++ b/fence/agents/lib/Makefile @@ -19,6 +19,6 @@ TARGET= fencing.py FENCELIB= $(TARGET) -include $(OBJDIR)/make/fencebuild.mk - endif + +include $(OBJDIR)/make/fencebuild.mk hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 8 20:50:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 08 Apr 2008 20:50:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-38-g4a827a5 Message-ID: <20080408205051.10276.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4a827a5defcc8c5a843b12442e1411beffe712f5 The branch, STABLE2 has been updated via 4a827a5defcc8c5a843b12442e1411beffe712f5 (commit) from 0fe8d3648fd3e23828516c8f0346703b4d885739 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4a827a5defcc8c5a843b12442e1411beffe712f5 Author: Andrew Price Date: Tue Apr 8 22:48:05 2008 +0200 [[BUILD] Warn and continue if CONFIG_KERNELVERSION is not found Currently the configure script assumes that CONFIG_KERNELVERSION is defined in autoconf.h. This patch handles the case where it isn't defined there. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 44961b2..817ca4f 100755 --- a/configure +++ b/configure @@ -259,6 +259,11 @@ sub kernel_version { } } close AUTOCONF; + # Warn and continue if CONFIG_KERNELVERSION was not found + if (!$current_version) { + print " WARNING: Could not determine kernel version.\n"; + return 1; + } # leaving only the numbers from the lines # this is faster then split and doesn't alocate useless arrays $current_version =~ s/.*"(.*)"\n/$1/; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 9 03:38:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 09 Apr 2008 03:38:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-149-gabb6c8d Message-ID: <20080409033810.16358.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f The branch, master has been updated via abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f (commit) via 8df38eef89cef15c8fa5a206ae0678933a544e45 (commit) via 5aabcde2f5d491ba458995baf67fee640712cefb (commit) via 25db297266c0cbb9bab88de0cb0744a4f14b8b52 (commit) via fbe58e96cc24efd86a7414a30f6bffc2df97ed26 (commit) via c9a335dc94da64e72bd7dff54681d33a6631df8f (commit) via 3d977223d89aaffceb0164a520beeec323a325a7 (commit) via 00b4e7e8b7ef4fee16ef27b161dc14bae639df76 (commit) via 6f2dcc865aa13927baad8cdd2bbbd6d1e85c0347 (commit) via 9c762815ed9a2ec7747d60692ceb8042699a5f05 (commit) via 7094b509386a7eb4080ff342296c54852c604b4b (commit) via 49e6378f7737a03280df9087242e124385e26a4e (commit) via 7c4b9b16ce70cb47e9c39945689eea1f6e04416f (commit) via b8eb355ff5ab70b773d65648c7b84f9c3aef00b2 (commit) via 6888783349cecc81d43cf5ecafdd14db1e6a6b2a (commit) via 74394072b0ec11191a6917793d313992f7705db7 (commit) via 683538f4b998257ec50c53ba824f532c3ffab363 (commit) via dd7199c180b0a58b1ab8aebda852fb9c12e4a01a (commit) via 509a89968595d8793a484739c10aa8ae00107b3e (commit) from bdf3aa8831d5689dbdeb3ad74c6b5326ceddc5eb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f Author: Ryan O'Hara Date: Mon Apr 7 11:16:55 2008 -0500 BZ 441323 : Redirect stderr to /dev/null when getting list of devices. commit 8df38eef89cef15c8fa5a206ae0678933a544e45 Author: Chris Feist Date: Thu Jan 24 22:20:23 2008 +0000 Added back in change to description line to make chkconfig work properly. commit 5aabcde2f5d491ba458995baf67fee640712cefb Author: Ryan O'Hara Date: Fri Jan 18 23:02:58 2008 +0000 BZ: 373491, 373511, 373531, 373541, 373571, 429033 BZ: 373491, 373511, 373531, 373541, 373571, 429033 - Prevent "reservation conflict" messageswhen scsi_reserve starts. - Leave the fence domain if scsi_reserve fails to register with any device. - Improve logging in scsi_reserve script. - Use "locking_type = 0" for all lvm commands (ie. vgs). - Fix SCSI reservations scripts to handle LVM mirrors and stripes. - Not an error if fence_scsi attempts to remove a non-existent key from a device. commit 25db297266c0cbb9bab88de0cb0744a4f14b8b52 Author: Ryan O'Hara Date: Thu Nov 8 18:48:08 2007 +0000 BZ 248715 - Use cluster ID and node ID for key rather than IP address. commit fbe58e96cc24efd86a7414a30f6bffc2df97ed26 Author: Ryan McCabe Date: Fri Sep 21 03:09:04 2007 +0000 fix bz277781 by accepting "nodename" as a synonym for "node" commit c9a335dc94da64e72bd7dff54681d33a6631df8f Author: Ryan O'Hara Date: Tue Mar 6 19:10:34 2007 +0000 Fix help message to refer to script as 'fence_scsi_test'. commit 3d977223d89aaffceb0164a520beeec323a325a7 Author: Ryan O'Hara Date: Thu Dec 14 21:18:09 2006 +0000 Attempt to register the node in the case where it must perform fence_scsi fencing but is not registered with the device(s) that must be fence. With SCSI persistent reservations, in order to do a "preempt and abort" (which we are using to fence a node), the node doing this operation must be registered with the device. This fix will check to see the the node that is performing the fencing is registered with the device(s). If it is not, then it attempts to register with the device(s) so that it can then continue with the fence operation normally. Note that this situation should never happen, especially if things are configured properly. commit 00b4e7e8b7ef4fee16ef27b161dc14bae639df76 Author: Ryan O'Hara Date: Thu Dec 14 18:32:43 2006 +0000 Allow 'stop' to release the reservation if and only if there are no other keys registered with a given device. Prior to this fix, if was not possible for 'scsi_reserve stop' to unregister/release on the node that was holding the reservation. commit 6f2dcc865aa13927baad8cdd2bbbd6d1e85c0347 Author: Ryan O'Hara Date: Tue Dec 12 23:20:47 2006 +0000 Record devices that are successfully registered to /var/run/scsi_reserve. commit 9c762815ed9a2ec7747d60692ceb8042699a5f05 Author: Ryan O'Hara Date: Tue Dec 12 22:22:51 2006 +0000 Rewrite of get_scsi_devices function. It is no longer possible to use lvs to get a list of cluster volumes (and underlying devices) at fence time. For this reason we must "keep state" by recording which devices we register with at startup. The init script (scsi_reserve) will record each device it successfully registered with to a file (/var/run/scsi_reserve). Then, and fence time, the fence_scsi agent will unregister each device listed in the state file. commit 7094b509386a7eb4080ff342296c54852c604b4b Author: Ryan O'Hara Date: Tue Dec 12 21:32:53 2006 +0000 Fix success/failure reporting when registering devices at startup. If our node (key) is already registered with a given device, do not report failure since this is misleading. commit 49e6378f7737a03280df9087242e124385e26a4e Author: Ryan O'Hara Date: Fri Dec 8 22:22:34 2006 +0000 Replace /var/lock/subsys/${0##*/} with /var/lock/subsys/scsi_reserve. commit 7c4b9b16ce70cb47e9c39945689eea1f6e04416f Author: Ryan O'Hara Date: Fri Dec 8 21:23:00 2006 +0000 Fix split calls to be consistent. Remove the optional LIMIT parameter. commit b8eb355ff5ab70b773d65648c7b84f9c3aef00b2 Author: Ryan O'Hara Date: Fri Dec 8 20:48:00 2006 +0000 Fix code to use get_key subroutine. Fix sg_persist commands to specify device via -d parameter. commit 6888783349cecc81d43cf5ecafdd14db1e6a6b2a Author: Ryan O'Hara Date: Fri Dec 1 17:53:22 2006 +0000 Remove "self" parameter. This was used to specify the name of the node performing the fence operation, and was passed to the agent. This is no longer used. Instead, we get the name of the local node in the agent by parsing the output from 'cman_tool status'. commit 74394072b0ec11191a6917793d313992f7705db7 Author: Ryan O'Hara Date: Wed Nov 29 20:54:42 2006 +0000 Fix unregister code to report failure correctly. commit 683538f4b998257ec50c53ba824f532c3ffab363 Author: Ryan O'Hara Date: Wed Nov 29 20:50:22 2006 +0000 Variable should be quoted in conditional statement. commit dd7199c180b0a58b1ab8aebda852fb9c12e4a01a Author: Fabio M. Di Nitto Date: Wed Apr 9 05:33:54 2008 +0200 Revert "fix bz277781 by accepting "nodename" as a synonym for "node"" This reverts commit 57a07697afeb2e5d3bb2a4220e844bcdc44598cb. commit 509a89968595d8793a484739c10aa8ae00107b3e Author: Fabio M. Di Nitto Date: Wed Apr 9 05:33:18 2008 +0200 Revert "Fix help message to refer to script as 'fence_scsi_test'." This reverts commit e9b17a088668ceaba5c6ea35f8d22ec2613cfe96. ----------------------------------------------------------------------- Summary of changes: fence/agents/scsi/fence_scsi.pl | 248 ++++++++++++++++++++++++---- fence/agents/scsi/fence_scsi_test.pl | 171 ++++++++++---------- fence/agents/scsi/scsi_reserve | 300 +++++++++++++++++++++++----------- 3 files changed, 506 insertions(+), 213 deletions(-) diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl index 89822e8..b9aea99 100755 --- a/fence/agents/scsi/fence_scsi.pl +++ b/fence/agents/scsi/fence_scsi.pl @@ -1,19 +1,16 @@ #!/usr/bin/perl use Getopt::Std; +use XML::LibXML; use IPC::Open3; use POSIX; -my $verbose = 0; my @volumes; $_ = $0; s/.*\///; my $pname = $_; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $RELEASE_VERSION=""; $REDHAT_COPYRIGHT=""; @@ -62,13 +59,137 @@ sub fail_usage exit 1; } +sub get_cluster_id +{ + my $cluster_id; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Cluster Id") + { + $cluster_id = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $cluster_id; +} + +sub get_node_id +{ + ($node)=@_; + + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + + my $xpath = "//cluster/clusternodes/clusternode[\@name='$node']/\@nodeid"; + + my $node_id = $tree->findvalue($xpath); + + return $node_id; +} + +sub get_node_name +{ + return $opt_n; +} + +sub get_host_id +{ + my $host_id; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Node ID") + { + $host_id = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $host_id; +} + +sub get_host_name +{ + my $host_name; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Node name") + { + $host_name = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $host_name; +} + sub get_key { ($node)=@_; - my $addr = gethostbyname($node) or die "$!\n"; + my $cluster_id = get_cluster_id; + my $node_id = get_node_id($node); + + my $key = sprintf "%x%.4x", $cluster_id, $node_id; - return unpack("H*", $addr); + return $key; } sub get_options_stdin @@ -93,7 +214,7 @@ sub get_options_stdin next unless $opt; - ($name, $val) = split /\s*=\s*/, $opt; + ($name, $val) = split(/\s*=\s*/, $opt); if ($name eq "") { @@ -111,10 +232,6 @@ sub get_options_stdin { $opt_n = $val; } - elsif ($name eq "self") - { - $opt_s = $val; - } elsif ($name eq "verbose") { $opt_v = $val; @@ -126,10 +243,45 @@ sub get_options_stdin } } +sub get_key_list +{ + ($dev) = @_; + + my ($in, $out, $err); + + my $cmd = "sg_persist -n -d $dev -i -k"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute sg_persist.\n" if ($?>>8); + + while (<$out>) + { + chomp; + if ($_ =~ /^\s*0x/) + { + s/^\s+0x//; + s/\s+$//; + + $key_list{$_} = 1; + } + } + + close($in); + close($out); + close($err); + + return %key_list; +} + sub get_scsi_devices { my ($in, $out, $err); - my $cmd = "lvs --noheadings --separator : -o vg_attr,devices"; + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name 2> /dev/null"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); @@ -141,12 +293,12 @@ sub get_scsi_devices chomp; print "OUT: $_\n" if $opt_v; - my ($vg_attrs, $device) = split /:/, $_, 3; + my ($vg_attrs, $device) = split(/:/, $_); if ($vg_attrs =~ /.*c$/) { $device =~ s/\(.*\)//; - push @volumes, $device; + push(@volumes, $device); } } @@ -176,43 +328,74 @@ sub check_sg_persist close($err); } +sub do_register +{ + ($dev, $key) = @_; + + my ($in, $out, $err); + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute sg_persist ($dev).\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + } + + close($in); + close($out); + close($err); +} + sub fence_node { - # my $name = (POSIX::uname())[1]; + my $host_name = get_host_name(); + my $node_name = get_node_name(); + + my $host_key = get_key($host_name); + my $node_key = get_key($node_name); - my $host_key = get_key($opt_s); - my $node_key = get_key($opt_n); - - my $cmd; my ($in, $out, $err); foreach $dev (@volumes) { + my %key_list = get_key_list($dev); + + if (!$key_list{$host_key}) + { + do_register($dev, $host_key); + } + + if (!$key_list{$node_key}) + { + next; + } + if ($host_key eq $node_key) { - $cmd = "sg_persist -d $dev -o -G -K $host_key -S 0"; + $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0"; } else { - $cmd = "sg_persist -d $dev -o -A -K $host_key -S $node_key -T 5"; + $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5"; } my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - if ($opt_v) + die "Unable to execute sg_persist ($dev).\n" if ($?>>8); + + while (<$out>) { - print "$cmd\n"; - while (<$out>) - { - chomp; - print "OUT: $_\n"; - } + chomp; + print "OUT: $_\n" if $opt_v; } - die "Unable to execute sg_persist.\n" if ($?>>8); - close($in); close($out); close($err); @@ -228,16 +411,15 @@ if (@ARGV > 0) { usage if defined $opt_h; version if defined $opt_V; - fail_usage "Unkown parameter." if (@ARGV > 0); + fail_usage "Unknown parameter." if (@ARGV > 0); + fail_usage "No '-n' flag specified." unless defined $opt_n; - fail_usage "No '-s' flag specified." unless defined $opt_s; } else { get_options_stdin(); fail "failed: missing 'node'" unless defined $opt_n; - fail "failed: missing 'self'" unless defined $opt_s; } diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl index 0076144..b8e0cc0 100755 --- a/fence/agents/scsi/fence_scsi_test.pl +++ b/fence/agents/scsi/fence_scsi_test.pl @@ -1,121 +1,96 @@ #!/usr/bin/perl +use POSIX; use IPC::Open3; -use Sys::Hostname; +use XML::LibXML; use Getopt::Std; -use POSIX; my @devices; my %results; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $RELEASE_VERSION=""; $REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION -sub get_key +sub get_scsi_block_devices { - my $addr = gethostbyname($name) or die "$!\n"; + my $block_dir = "/sys/block"; - return unpack("H*", $addr); -} + opendir(DIR, $block_dir) or die "$!\n"; -sub register_device -{ - my $func = (caller(0))[3]; - my ($dev, $key) = @_; + my @block_devices = grep { /^sd*/ } readdir(DIR); - print "DEBUG: $func ($dev, $key)\n" if ($opt_d); + closedir(DIR); + for $block_dev (@block_devices) + { + push(@devices, "/dev/" . $block_dev); + } +} + +sub get_cluster_vol_devices +{ my ($in, $out, $err); - my $cmd = "sg_persist $dev -o -G -S $key"; + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); + die "[error] unable to execute vgs command.\n" if WEXITSTATUS($?); - $results{$dev}[0] = $rval; + while (<$out>) + { + chomp; - print "DEBUG: [$rval] $cmd\n" if $opt_d; + my ($vg_attr, $pv_name) = split(/:/, $_); + + if ($vg_attr =~ /.*c$/) + { + ###### DEBUG ###### + print "DEBUG: pv_name = $pv_name\n"; + + push(@devices, $pv_name); + } + } close($in); close($out); close($err); - - return $rval; } -sub unregister_device +sub register_device { - my $func = (caller(0))[3]; my ($dev, $key) = @_; - - print "DEBUG: $func ($dev, $key)\n" if $opt_d; - my ($in, $out, $err); - my $cmd = "sg_persist $dev -o -G -K $key -S 0"; + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); - - $results{$dev}[1] = $rval; - - print "DEBUG: [$rval] $cmd\n" if $opt_d; + $results{$dev}[0] = WEXITSTATUS($?); close($in); close($out); close($err); - - return $rval; -} - -sub get_block_devices -{ - my $block_dir = "/sys/block"; - - opendir(DIR, $block_dir) or die "Error: $! $block_dir\n"; - - my @block_devices = grep { /^sd*/ } readdir(DIR); - - closedir(DIR); - - for $dev (@block_devices) - { - push @devices, "/dev/" . $dev; - } } -sub get_cluster_devices +sub unregister_device { + my ($dev, $key) = @_; my ($in, $out, $err); - my $cmd = "lvs --noheadings --separator : -o vg_attr,devices"; + + my $cmd = "sg_persist -n -d $dev -o -G -K $key -S 0"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - die "Error: unable to exec lvs command.\n" if WEXITSTATUS($?); - - while (<$out>) - { - chomp; - - my ($vg_attr, $dev) = split /:/, $_, 3; - - if ($vg_attr =~ /.*c$/) - { - $dev =~ s/\(.*\)//; - push @devices, $dev; - } - } + $results{$dev}[1] = WEXITSTATUS($?); close($in); close($out); @@ -124,21 +99,38 @@ sub get_cluster_devices sub test_devices { - my $name = hostname() or die "$!\n"; - my $addr = gethostbyname($name) or die "$!\n"; - my $key = unpack("H*", $addr); + my $key = "0xDEADBEEF"; foreach $dev (@devices) { - if (register_device($dev, $key) != 0) - { - } - if (unregister_device($dev, $key) != 0) - { - } + register_device($dev, $key); + unregister_device($dev, $key); } } +sub check_config_fence +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/fencedevices/fencedevice"; + + my $xpath_fence = "count(${root}[\@agent='fence_scsi'])"; + + return ( ! $tree->findvalue($xpath_fence)); +} + +sub check_config_nodes +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/clusternodes/clusternode"; + + my $xpath_name = "count(${root}/\@name)"; + my $xpath_nodeid = "count(${root}/\@nodeid)"; + + return ($tree->findvalue($xpath_name) != $tree->findvalue($xpath_nodeid)); +} + sub print_results { my $device_count = scalar(@devices); @@ -195,9 +187,9 @@ sub print_usage print " -h Help. Prints out this usage information.\n\n"; } -### main ### +### MAIN ####################################################################### -if (getopts("cdhsv") == 0) +if (getopts("cdhst:v") == 0) { print_usage; exit(1); @@ -212,23 +204,34 @@ if ($opt_h) if ($opt_c) { print "\nTesting devices in cluster volumes...\n"; - get_cluster_devices; + get_cluster_vol_devices; + test_devices; + print_results; } if ($opt_s) { print "\nTesting all SCSI block devices...\n"; - get_block_devices; + get_scsi_block_devices; + test_devices; + print_results; } -if (!$opt_c && !$opt_s) +if ($opt_t) +{ + if ($opt_t eq "fence") + { + exit check_config_fence; + } + if ($opt_t eq "nodes") + { + exit check_config_nodes; + } +} + +if (!$opt_c && !$opt_s && !$opt_t) { print "\nPlease specify either cluster or SCSI mode.\n"; print_usage; exit(1); } - -test_devices; - -print_results; - diff --git a/fence/agents/scsi/scsi_reserve b/fence/agents/scsi/scsi_reserve index a4057c7..67c0d2d 100755 --- a/fence/agents/scsi/scsi_reserve +++ b/fence/agents/scsi/scsi_reserve @@ -1,140 +1,248 @@ #!/bin/bash # +# scsi_reserve: +# # chkconfig: 345 25 75 # description: start/stop persistent reservation service for lvm +# config: /etc/sysconfig/scsi_reserve . /etc/init.d/functions -# check for sg_persist command provided by sg3_utils package +# read in config file if it exists # -if ! sg_persist -V &> /dev/null ; then - echo "error: sg_persist not found" - exit 2 +if [ -f /etc/sysconfig/scsi_reserve ] ; then + . /etc/sysconfig/scsi_reserve fi -# check for gethostip command provided by syslinux package +# check if cluster is configured for fence_scsi # -if ! gethostip -h &> /dev/null ; then - echo "error: gethostip not found" - exit 3 +if ! fence_scsi_test -t fence ; then + logger -t scsi_reserve \ + "[error] cluster not configured for scsi reservations" + exit 1 fi -# get scsi devices that are part of clustered volumes +# check for nodeids in config file # -scsi_devices=$( lvs -o vg_attr,devices --noheadings \ - | awk --posix ' $1 ~ /[-a-z]{5}c/ { print $2 } ' \ - | sed -e 's/([0-9]*)//' | sort | uniq ) +if ! fence_scsi_test -t nodes ; then + logger -t scsi_reserve \ + "[error] cluster must define nodeid for all nodes" + exit 1 +fi -# if no scsi devices were found we can exit now +# check for sg_persist command provided by sg3_utils package # -[ -z $scsi_devices ] && exit 0 +if ! sg_persist -V &> /dev/null ; then + logger -t scsi_reserve \ + "[error] unable to exec sg_persist" + exit 1 +fi -# get the node name and node addr from cman +# check that cman is running # -node_name=$( cman_tool status | grep "Node name" | awk -F": " '{print $2}' ) -node_addr=$( cman_tool status | grep "Node addr" | awk -F": " '{print $2}' ) +if ! cman_tool status &> /dev/null ; then + logger -t scsi_reserve \ + "[error] cman does not appear to be running" + exit 1 +fi -# create unique key for this host +# get physical volumes (devices) that are part of cluster volumes # -key=$( gethostip -x $node_name ) - -case $1 in - -start) +scsi_devices=$( vgs --config 'global { locking_type = 0 }' \ + --noheadings -o vg_attr,pv_name 2> /dev/null \ + | awk ' $1 ~ /.*c$/ { print $2 } ' ) + +if [ -z "$scsi_devices" ] ; then + logger -t scsi_reserve \ + "[error] did not find devices in cluster volumes" + exit 1 +fi -rval=0 +# get the cluster id from cman +# +cluster_id=$( cman_tool status | grep -i "Cluster ID" \ + | awk -F": " '{ print $2 }' ) -touch /var/lock/subsys/${0##*/} +if [ -z "$cluster_id" ] ; then + logger -s -t scsi_reserve \ + "[error] unable to determine cluster id" + exit 1 +fi -# register each device using our key +# get the node id from cman # -for dev in $scsi_devices -do +node_id=$( cman_tool status | grep -i "Node ID" \ + | awk -F": " '{ print $2 }' ) - echo -n "Registering device: $dev" +if [ -z "$node_id" ] ; then + logger -t scsi_reserve \ + "[error] unable to determine node id" + exit 1 +fi - for error in 1 - do - sg_persist -d $dev -o -G -S $key &>/dev/null || break - # sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null || break - error=0 - done +# generate unique key using cluster_id and node_id +# +key=$( printf "%x%.4x" $cluster_id $node_id ) - if [ $error -eq 0 ]; then - success - else - failure - rval=1 - fi +if [ -z "$key" ] ; then + logger -t scsi_reserve \ + "[error] unable to generate key" + exit 1 +fi - echo +################################################################################ - # attempt to create a reservation - # - sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null +case $1 in -done -;; + start) -stop) + error=0 + count=0 -rval=0 + echo -n "Starting scsi_reserve:" -# unregister each device for this node -# -for dev in $scsi_devices -do - - if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "${key#0}" ; then - echo "Unable to unregister device: $dev" - error=1 - else - echo -n "Unregistering device: $dev" - for error in 1 + for dev in $scsi_devices do - sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break + # check if our key is already resgistered with this device + # + if sg_persist -n -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] already registered with $dev (key=0x$key)" + continue + fi + + # create the scsi registration + # + if ! sg_persist -n -d $dev -o -I -S $key &> /dev/null ; then + logger -t scsi_reserve \ + "[error] unable to register device $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] registered with device $dev (key=0x$key)" + fi + + # check to see if reservation already exists + # + if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then + logger -t scsi_reserve \ + "[info] reservation already exists on $dev" + continue + fi + + # create the scsi reservation + # + if ! sg_persist -n -d $dev -o -R -K $key -T 5 &> /dev/null ; then + logger -t scsi_reserver \ + "[error] unable to create reservation on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + fi + done + + # leave fence domain if any errors occured during registration + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors during registration" + logger -t scsi_reserve \ + "[info] leaving the fence domain" + fence_tool leave + failure + fi + + echo + + ;; # end of start + + stop) + error=0 - done - fi + count=0 - if [ $error -eq 0 ]; then - success - else - failure - rval=1 - fi + echo -n "Stopping scsi_reserve:" - echo -done + for dev in $scsi_devices + do + # get list of keys registered with this device + # + key_list=$( sg_persist -n -d $dev -i -k | grep -iE "^[[:space:]]*0x" ) + + # check that our key is registered with this device + # + if ! sg_persist -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] not registered with $dev (key=0x$key)" + continue + fi + + # check if our key is the reservation holder + # + if sg_persist -n -d $dev -i -r 2>/dev/null | grep -qiE "$key" ; then + if echo "$key_list" | grep -qivE "$key" ; then + logger -t scsi_reserve \ + "[error] unable to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + continue + fi + fi + + # remove registration for this device + # + if ! sg_persist -n -d $dev -o -G -K $key -S 0 &> /dev/null ; then + logger -t scsi_reserve \ + "[error] failed to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] removed registration on $dev (key=0x$key)" + fi + + done + + # report success or failure + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors occured during unregistration" + failure + fi + + echo + + ;; # end of stop + + status) -rm -f /var/lock/subsys/${0##*/} -;; + error=0 -status) + for dev in $scsi_devices + do + if sg_persist -n -d $dev -i -k | grep -qiE "$key" ; then + devices[${#devices[@]}]=$dev + fi + done -rval=0 + if [ -z "$devices" ] ; then + echo "No registered devices found." + else + echo "Found ${#devices[@]} registered device(s):" -# find devices that are registered with our key -# -for dev in $scsi_devices -do - if sg_persist -d $dev -i -k 2>/dev/null | grep -qiE "${key#0}" ; then - devices[${#devices[@]}]=$dev - fi -done - -if [ -z $devices ]; then - echo "No devices registered." -else - echo "Found ${#devices[@]} registered device(s):" - - for i in "${devices[@]}" ; do - echo $i - done -fi -;; + for i in "${devices[@]}" + do + echo $i + done + fi -esac + ;; # end of status -exit $rval +esac +exit $error hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 9 03:43:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 09 Apr 2008 03:43:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-57-g3467c2e Message-ID: <20080409034355.18754.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=3467c2e4c5133a1bc9b9bead66a211f0124ccf4f The branch, STABLE2 has been updated via 3467c2e4c5133a1bc9b9bead66a211f0124ccf4f (commit) via 970cba7cd07d69de25393e616c3daa0c1a9c3024 (commit) via 771f0c4dbe87acb758840efd13ef72c613379e0d (commit) via c38c8e4d437dcdac7b20692ce4c560c1a553c4f6 (commit) via 5efd73d766df4affbfca07ff92ce38b0de43f87e (commit) via 673896d5ea1aebd62a4ec011c049a99bd7e7c991 (commit) via 76d27b41a014efd9d9df974ac6ab640099b49c85 (commit) via 12f9632c7964891ca5a75ccad1cb29eec718dd20 (commit) via aa9b413135d2488c52a110dcb2d389080b81cc33 (commit) via b9eb7cfb68a26248702ef00b8b1c6d33c86fd549 (commit) via 0a6c6b19a6fe5c688c34d578542df8cce781f687 (commit) via b3cce8a1a61ff8e7b3d5ef9888e391abed672c91 (commit) via c828cabab9cc82b38b0f039b0d5f72682c4f836e (commit) via a17c7093b22fcbfc363f1808dc57b06aa47eb09d (commit) via 6c7aa8b977cb44a9c642778b3654af8f79da0d97 (commit) via a46629aff677ce45cacc4aa6dab26061fca004d3 (commit) via 3fb2ed252790c8c68f92b4a61abaa472a36a69bc (commit) via a14739496c021b6f950d46c38be04a1f44ae8bda (commit) via 13aeff6b6e6b4d439a0de0f1e006b8feceaeb9d1 (commit) from 4a827a5defcc8c5a843b12442e1411beffe712f5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3467c2e4c5133a1bc9b9bead66a211f0124ccf4f Author: Ryan O'Hara Date: Mon Apr 7 11:16:55 2008 -0500 BZ 441323 : Redirect stderr to /dev/null when getting list of devices. commit 970cba7cd07d69de25393e616c3daa0c1a9c3024 Author: Chris Feist Date: Thu Jan 24 22:20:23 2008 +0000 Added back in change to description line to make chkconfig work properly. commit 771f0c4dbe87acb758840efd13ef72c613379e0d Author: Ryan O'Hara Date: Fri Jan 18 23:02:58 2008 +0000 BZ: 373491, 373511, 373531, 373541, 373571, 429033 BZ: 373491, 373511, 373531, 373541, 373571, 429033 - Prevent "reservation conflict" messageswhen scsi_reserve starts. - Leave the fence domain if scsi_reserve fails to register with any device. - Improve logging in scsi_reserve script. - Use "locking_type = 0" for all lvm commands (ie. vgs). - Fix SCSI reservations scripts to handle LVM mirrors and stripes. - Not an error if fence_scsi attempts to remove a non-existent key from a device. commit c38c8e4d437dcdac7b20692ce4c560c1a553c4f6 Author: Ryan O'Hara Date: Thu Nov 8 18:48:08 2007 +0000 BZ 248715 - Use cluster ID and node ID for key rather than IP address. commit 5efd73d766df4affbfca07ff92ce38b0de43f87e Author: Ryan McCabe Date: Fri Sep 21 03:09:04 2007 +0000 fix bz277781 by accepting "nodename" as a synonym for "node" commit 673896d5ea1aebd62a4ec011c049a99bd7e7c991 Author: Ryan O'Hara Date: Tue Mar 6 19:10:34 2007 +0000 Fix help message to refer to script as 'fence_scsi_test'. commit 76d27b41a014efd9d9df974ac6ab640099b49c85 Author: Ryan O'Hara Date: Thu Dec 14 21:18:09 2006 +0000 Attempt to register the node in the case where it must perform fence_scsi fencing but is not registered with the device(s) that must be fence. With SCSI persistent reservations, in order to do a "preempt and abort" (which we are using to fence a node), the node doing this operation must be registered with the device. This fix will check to see the the node that is performing the fencing is registered with the device(s). If it is not, then it attempts to register with the device(s) so that it can then continue with the fence operation normally. Note that this situation should never happen, especially if things are configured properly. commit 12f9632c7964891ca5a75ccad1cb29eec718dd20 Author: Ryan O'Hara Date: Thu Dec 14 18:32:43 2006 +0000 Allow 'stop' to release the reservation if and only if there are no other keys registered with a given device. Prior to this fix, if was not possible for 'scsi_reserve stop' to unregister/release on the node that was holding the reservation. commit aa9b413135d2488c52a110dcb2d389080b81cc33 Author: Ryan O'Hara Date: Tue Dec 12 23:20:47 2006 +0000 Record devices that are successfully registered to /var/run/scsi_reserve. commit b9eb7cfb68a26248702ef00b8b1c6d33c86fd549 Author: Ryan O'Hara Date: Tue Dec 12 22:22:51 2006 +0000 Rewrite of get_scsi_devices function. It is no longer possible to use lvs to get a list of cluster volumes (and underlying devices) at fence time. For this reason we must "keep state" by recording which devices we register with at startup. The init script (scsi_reserve) will record each device it successfully registered with to a file (/var/run/scsi_reserve). Then, and fence time, the fence_scsi agent will unregister each device listed in the state file. commit 0a6c6b19a6fe5c688c34d578542df8cce781f687 Author: Ryan O'Hara Date: Tue Dec 12 21:32:53 2006 +0000 Fix success/failure reporting when registering devices at startup. If our node (key) is already registered with a given device, do not report failure since this is misleading. commit b3cce8a1a61ff8e7b3d5ef9888e391abed672c91 Author: Ryan O'Hara Date: Fri Dec 8 22:22:34 2006 +0000 Replace /var/lock/subsys/${0##*/} with /var/lock/subsys/scsi_reserve. commit c828cabab9cc82b38b0f039b0d5f72682c4f836e Author: Ryan O'Hara Date: Fri Dec 8 21:23:00 2006 +0000 Fix split calls to be consistent. Remove the optional LIMIT parameter. commit a17c7093b22fcbfc363f1808dc57b06aa47eb09d Author: Ryan O'Hara Date: Fri Dec 8 20:48:00 2006 +0000 Fix code to use get_key subroutine. Fix sg_persist commands to specify device via -d parameter. commit 6c7aa8b977cb44a9c642778b3654af8f79da0d97 Author: Ryan O'Hara Date: Fri Dec 1 17:53:22 2006 +0000 Remove "self" parameter. This was used to specify the name of the node performing the fence operation, and was passed to the agent. This is no longer used. Instead, we get the name of the local node in the agent by parsing the output from 'cman_tool status'. commit a46629aff677ce45cacc4aa6dab26061fca004d3 Author: Ryan O'Hara Date: Wed Nov 29 20:54:42 2006 +0000 Fix unregister code to report failure correctly. commit 3fb2ed252790c8c68f92b4a61abaa472a36a69bc Author: Ryan O'Hara Date: Wed Nov 29 20:50:22 2006 +0000 Variable should be quoted in conditional statement. commit a14739496c021b6f950d46c38be04a1f44ae8bda Author: Fabio M. Di Nitto Date: Wed Apr 9 05:40:44 2008 +0200 Revert "fix bz277781 by accepting "nodename" as a synonym for "node"" This reverts commit 57a07697afeb2e5d3bb2a4220e844bcdc44598cb. commit 13aeff6b6e6b4d439a0de0f1e006b8feceaeb9d1 Author: Fabio M. Di Nitto Date: Wed Apr 9 05:40:35 2008 +0200 Revert "Fix help message to refer to script as 'fence_scsi_test'." This reverts commit e9b17a088668ceaba5c6ea35f8d22ec2613cfe96. ----------------------------------------------------------------------- Summary of changes: fence/agents/scsi/fence_scsi.pl | 248 ++++++++++++++++++++++++---- fence/agents/scsi/fence_scsi_test.pl | 171 ++++++++++---------- fence/agents/scsi/scsi_reserve | 300 +++++++++++++++++++++++----------- 3 files changed, 506 insertions(+), 213 deletions(-) diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl index 89822e8..b9aea99 100755 --- a/fence/agents/scsi/fence_scsi.pl +++ b/fence/agents/scsi/fence_scsi.pl @@ -1,19 +1,16 @@ #!/usr/bin/perl use Getopt::Std; +use XML::LibXML; use IPC::Open3; use POSIX; -my $verbose = 0; my @volumes; $_ = $0; s/.*\///; my $pname = $_; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $RELEASE_VERSION=""; $REDHAT_COPYRIGHT=""; @@ -62,13 +59,137 @@ sub fail_usage exit 1; } +sub get_cluster_id +{ + my $cluster_id; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Cluster Id") + { + $cluster_id = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $cluster_id; +} + +sub get_node_id +{ + ($node)=@_; + + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + + my $xpath = "//cluster/clusternodes/clusternode[\@name='$node']/\@nodeid"; + + my $node_id = $tree->findvalue($xpath); + + return $node_id; +} + +sub get_node_name +{ + return $opt_n; +} + +sub get_host_id +{ + my $host_id; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Node ID") + { + $host_id = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $host_id; +} + +sub get_host_name +{ + my $host_name; + + my ($in, $out, $err); + my $cmd = "cman_tool status"; + + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute cman_tool.\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + + my ($name, $value) = split(/\s*:\s*/, $_); + + if ($name eq "Node name") + { + $host_name = $value; + last; + } + } + + close($in); + close($out); + close($err); + + return $host_name; +} + sub get_key { ($node)=@_; - my $addr = gethostbyname($node) or die "$!\n"; + my $cluster_id = get_cluster_id; + my $node_id = get_node_id($node); + + my $key = sprintf "%x%.4x", $cluster_id, $node_id; - return unpack("H*", $addr); + return $key; } sub get_options_stdin @@ -93,7 +214,7 @@ sub get_options_stdin next unless $opt; - ($name, $val) = split /\s*=\s*/, $opt; + ($name, $val) = split(/\s*=\s*/, $opt); if ($name eq "") { @@ -111,10 +232,6 @@ sub get_options_stdin { $opt_n = $val; } - elsif ($name eq "self") - { - $opt_s = $val; - } elsif ($name eq "verbose") { $opt_v = $val; @@ -126,10 +243,45 @@ sub get_options_stdin } } +sub get_key_list +{ + ($dev) = @_; + + my ($in, $out, $err); + + my $cmd = "sg_persist -n -d $dev -i -k"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute sg_persist.\n" if ($?>>8); + + while (<$out>) + { + chomp; + if ($_ =~ /^\s*0x/) + { + s/^\s+0x//; + s/\s+$//; + + $key_list{$_} = 1; + } + } + + close($in); + close($out); + close($err); + + return %key_list; +} + sub get_scsi_devices { my ($in, $out, $err); - my $cmd = "lvs --noheadings --separator : -o vg_attr,devices"; + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name 2> /dev/null"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); @@ -141,12 +293,12 @@ sub get_scsi_devices chomp; print "OUT: $_\n" if $opt_v; - my ($vg_attrs, $device) = split /:/, $_, 3; + my ($vg_attrs, $device) = split(/:/, $_); if ($vg_attrs =~ /.*c$/) { $device =~ s/\(.*\)//; - push @volumes, $device; + push(@volumes, $device); } } @@ -176,43 +328,74 @@ sub check_sg_persist close($err); } +sub do_register +{ + ($dev, $key) = @_; + + my ($in, $out, $err); + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; + my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; + + waitpid($pid, 0); + + die "Unable to execute sg_persist ($dev).\n" if ($?>>8); + + while (<$out>) + { + chomp; + print "OUT: $_\n" if $opt_v; + } + + close($in); + close($out); + close($err); +} + sub fence_node { - # my $name = (POSIX::uname())[1]; + my $host_name = get_host_name(); + my $node_name = get_node_name(); + + my $host_key = get_key($host_name); + my $node_key = get_key($node_name); - my $host_key = get_key($opt_s); - my $node_key = get_key($opt_n); - - my $cmd; my ($in, $out, $err); foreach $dev (@volumes) { + my %key_list = get_key_list($dev); + + if (!$key_list{$host_key}) + { + do_register($dev, $host_key); + } + + if (!$key_list{$node_key}) + { + next; + } + if ($host_key eq $node_key) { - $cmd = "sg_persist -d $dev -o -G -K $host_key -S 0"; + $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0"; } else { - $cmd = "sg_persist -d $dev -o -A -K $host_key -S $node_key -T 5"; + $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5"; } my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - if ($opt_v) + die "Unable to execute sg_persist ($dev).\n" if ($?>>8); + + while (<$out>) { - print "$cmd\n"; - while (<$out>) - { - chomp; - print "OUT: $_\n"; - } + chomp; + print "OUT: $_\n" if $opt_v; } - die "Unable to execute sg_persist.\n" if ($?>>8); - close($in); close($out); close($err); @@ -228,16 +411,15 @@ if (@ARGV > 0) { usage if defined $opt_h; version if defined $opt_V; - fail_usage "Unkown parameter." if (@ARGV > 0); + fail_usage "Unknown parameter." if (@ARGV > 0); + fail_usage "No '-n' flag specified." unless defined $opt_n; - fail_usage "No '-s' flag specified." unless defined $opt_s; } else { get_options_stdin(); fail "failed: missing 'node'" unless defined $opt_n; - fail "failed: missing 'self'" unless defined $opt_s; } diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl index 0076144..b8e0cc0 100755 --- a/fence/agents/scsi/fence_scsi_test.pl +++ b/fence/agents/scsi/fence_scsi_test.pl @@ -1,121 +1,96 @@ #!/usr/bin/perl +use POSIX; use IPC::Open3; -use Sys::Hostname; +use XML::LibXML; use Getopt::Std; -use POSIX; my @devices; my %results; -# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and -# "#END_VERSION_GENERATION" It is generated by the Makefile - #BEGIN_VERSION_GENERATION $RELEASE_VERSION=""; $REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION -sub get_key +sub get_scsi_block_devices { - my $addr = gethostbyname($name) or die "$!\n"; + my $block_dir = "/sys/block"; - return unpack("H*", $addr); -} + opendir(DIR, $block_dir) or die "$!\n"; -sub register_device -{ - my $func = (caller(0))[3]; - my ($dev, $key) = @_; + my @block_devices = grep { /^sd*/ } readdir(DIR); - print "DEBUG: $func ($dev, $key)\n" if ($opt_d); + closedir(DIR); + for $block_dev (@block_devices) + { + push(@devices, "/dev/" . $block_dev); + } +} + +sub get_cluster_vol_devices +{ my ($in, $out, $err); - my $cmd = "sg_persist $dev -o -G -S $key"; + + my $cmd = "vgs --config 'global { locking_type = 0 }'" . + " --noheadings --separator : -o vg_attr,pv_name"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); + die "[error] unable to execute vgs command.\n" if WEXITSTATUS($?); - $results{$dev}[0] = $rval; + while (<$out>) + { + chomp; - print "DEBUG: [$rval] $cmd\n" if $opt_d; + my ($vg_attr, $pv_name) = split(/:/, $_); + + if ($vg_attr =~ /.*c$/) + { + ###### DEBUG ###### + print "DEBUG: pv_name = $pv_name\n"; + + push(@devices, $pv_name); + } + } close($in); close($out); close($err); - - return $rval; } -sub unregister_device +sub register_device { - my $func = (caller(0))[3]; my ($dev, $key) = @_; - - print "DEBUG: $func ($dev, $key)\n" if $opt_d; - my ($in, $out, $err); - my $cmd = "sg_persist $dev -o -G -K $key -S 0"; + my $cmd = "sg_persist -n -d $dev -o -G -S $key"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - my $rval = WEXITSTATUS($?); - - $results{$dev}[1] = $rval; - - print "DEBUG: [$rval] $cmd\n" if $opt_d; + $results{$dev}[0] = WEXITSTATUS($?); close($in); close($out); close($err); - - return $rval; -} - -sub get_block_devices -{ - my $block_dir = "/sys/block"; - - opendir(DIR, $block_dir) or die "Error: $! $block_dir\n"; - - my @block_devices = grep { /^sd*/ } readdir(DIR); - - closedir(DIR); - - for $dev (@block_devices) - { - push @devices, "/dev/" . $dev; - } } -sub get_cluster_devices +sub unregister_device { + my ($dev, $key) = @_; my ($in, $out, $err); - my $cmd = "lvs --noheadings --separator : -o vg_attr,devices"; + + my $cmd = "sg_persist -n -d $dev -o -G -K $key -S 0"; my $pid = open3($in, $out, $err, $cmd) or die "$!\n"; waitpid($pid, 0); - die "Error: unable to exec lvs command.\n" if WEXITSTATUS($?); - - while (<$out>) - { - chomp; - - my ($vg_attr, $dev) = split /:/, $_, 3; - - if ($vg_attr =~ /.*c$/) - { - $dev =~ s/\(.*\)//; - push @devices, $dev; - } - } + $results{$dev}[1] = WEXITSTATUS($?); close($in); close($out); @@ -124,21 +99,38 @@ sub get_cluster_devices sub test_devices { - my $name = hostname() or die "$!\n"; - my $addr = gethostbyname($name) or die "$!\n"; - my $key = unpack("H*", $addr); + my $key = "0xDEADBEEF"; foreach $dev (@devices) { - if (register_device($dev, $key) != 0) - { - } - if (unregister_device($dev, $key) != 0) - { - } + register_device($dev, $key); + unregister_device($dev, $key); } } +sub check_config_fence +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/fencedevices/fencedevice"; + + my $xpath_fence = "count(${root}[\@agent='fence_scsi'])"; + + return ( ! $tree->findvalue($xpath_fence)); +} + +sub check_config_nodes +{ + my $xml = XML::LibXML->new(); + my $tree = $xml->parse_file("/etc/cluster/cluster.conf"); + my $root = "//cluster/clusternodes/clusternode"; + + my $xpath_name = "count(${root}/\@name)"; + my $xpath_nodeid = "count(${root}/\@nodeid)"; + + return ($tree->findvalue($xpath_name) != $tree->findvalue($xpath_nodeid)); +} + sub print_results { my $device_count = scalar(@devices); @@ -195,9 +187,9 @@ sub print_usage print " -h Help. Prints out this usage information.\n\n"; } -### main ### +### MAIN ####################################################################### -if (getopts("cdhsv") == 0) +if (getopts("cdhst:v") == 0) { print_usage; exit(1); @@ -212,23 +204,34 @@ if ($opt_h) if ($opt_c) { print "\nTesting devices in cluster volumes...\n"; - get_cluster_devices; + get_cluster_vol_devices; + test_devices; + print_results; } if ($opt_s) { print "\nTesting all SCSI block devices...\n"; - get_block_devices; + get_scsi_block_devices; + test_devices; + print_results; } -if (!$opt_c && !$opt_s) +if ($opt_t) +{ + if ($opt_t eq "fence") + { + exit check_config_fence; + } + if ($opt_t eq "nodes") + { + exit check_config_nodes; + } +} + +if (!$opt_c && !$opt_s && !$opt_t) { print "\nPlease specify either cluster or SCSI mode.\n"; print_usage; exit(1); } - -test_devices; - -print_results; - diff --git a/fence/agents/scsi/scsi_reserve b/fence/agents/scsi/scsi_reserve index a4057c7..67c0d2d 100755 --- a/fence/agents/scsi/scsi_reserve +++ b/fence/agents/scsi/scsi_reserve @@ -1,140 +1,248 @@ #!/bin/bash # +# scsi_reserve: +# # chkconfig: 345 25 75 # description: start/stop persistent reservation service for lvm +# config: /etc/sysconfig/scsi_reserve . /etc/init.d/functions -# check for sg_persist command provided by sg3_utils package +# read in config file if it exists # -if ! sg_persist -V &> /dev/null ; then - echo "error: sg_persist not found" - exit 2 +if [ -f /etc/sysconfig/scsi_reserve ] ; then + . /etc/sysconfig/scsi_reserve fi -# check for gethostip command provided by syslinux package +# check if cluster is configured for fence_scsi # -if ! gethostip -h &> /dev/null ; then - echo "error: gethostip not found" - exit 3 +if ! fence_scsi_test -t fence ; then + logger -t scsi_reserve \ + "[error] cluster not configured for scsi reservations" + exit 1 fi -# get scsi devices that are part of clustered volumes +# check for nodeids in config file # -scsi_devices=$( lvs -o vg_attr,devices --noheadings \ - | awk --posix ' $1 ~ /[-a-z]{5}c/ { print $2 } ' \ - | sed -e 's/([0-9]*)//' | sort | uniq ) +if ! fence_scsi_test -t nodes ; then + logger -t scsi_reserve \ + "[error] cluster must define nodeid for all nodes" + exit 1 +fi -# if no scsi devices were found we can exit now +# check for sg_persist command provided by sg3_utils package # -[ -z $scsi_devices ] && exit 0 +if ! sg_persist -V &> /dev/null ; then + logger -t scsi_reserve \ + "[error] unable to exec sg_persist" + exit 1 +fi -# get the node name and node addr from cman +# check that cman is running # -node_name=$( cman_tool status | grep "Node name" | awk -F": " '{print $2}' ) -node_addr=$( cman_tool status | grep "Node addr" | awk -F": " '{print $2}' ) +if ! cman_tool status &> /dev/null ; then + logger -t scsi_reserve \ + "[error] cman does not appear to be running" + exit 1 +fi -# create unique key for this host +# get physical volumes (devices) that are part of cluster volumes # -key=$( gethostip -x $node_name ) - -case $1 in - -start) +scsi_devices=$( vgs --config 'global { locking_type = 0 }' \ + --noheadings -o vg_attr,pv_name 2> /dev/null \ + | awk ' $1 ~ /.*c$/ { print $2 } ' ) + +if [ -z "$scsi_devices" ] ; then + logger -t scsi_reserve \ + "[error] did not find devices in cluster volumes" + exit 1 +fi -rval=0 +# get the cluster id from cman +# +cluster_id=$( cman_tool status | grep -i "Cluster ID" \ + | awk -F": " '{ print $2 }' ) -touch /var/lock/subsys/${0##*/} +if [ -z "$cluster_id" ] ; then + logger -s -t scsi_reserve \ + "[error] unable to determine cluster id" + exit 1 +fi -# register each device using our key +# get the node id from cman # -for dev in $scsi_devices -do +node_id=$( cman_tool status | grep -i "Node ID" \ + | awk -F": " '{ print $2 }' ) - echo -n "Registering device: $dev" +if [ -z "$node_id" ] ; then + logger -t scsi_reserve \ + "[error] unable to determine node id" + exit 1 +fi - for error in 1 - do - sg_persist -d $dev -o -G -S $key &>/dev/null || break - # sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null || break - error=0 - done +# generate unique key using cluster_id and node_id +# +key=$( printf "%x%.4x" $cluster_id $node_id ) - if [ $error -eq 0 ]; then - success - else - failure - rval=1 - fi +if [ -z "$key" ] ; then + logger -t scsi_reserve \ + "[error] unable to generate key" + exit 1 +fi - echo +################################################################################ - # attempt to create a reservation - # - sg_persist -d $dev -o -R -K $key -T 5 &>/dev/null +case $1 in -done -;; + start) -stop) + error=0 + count=0 -rval=0 + echo -n "Starting scsi_reserve:" -# unregister each device for this node -# -for dev in $scsi_devices -do - - if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "${key#0}" ; then - echo "Unable to unregister device: $dev" - error=1 - else - echo -n "Unregistering device: $dev" - for error in 1 + for dev in $scsi_devices do - sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break + # check if our key is already resgistered with this device + # + if sg_persist -n -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] already registered with $dev (key=0x$key)" + continue + fi + + # create the scsi registration + # + if ! sg_persist -n -d $dev -o -I -S $key &> /dev/null ; then + logger -t scsi_reserve \ + "[error] unable to register device $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] registered with device $dev (key=0x$key)" + fi + + # check to see if reservation already exists + # + if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then + logger -t scsi_reserve \ + "[info] reservation already exists on $dev" + continue + fi + + # create the scsi reservation + # + if ! sg_persist -n -d $dev -o -R -K $key -T 5 &> /dev/null ; then + logger -t scsi_reserver \ + "[error] unable to create reservation on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + fi + done + + # leave fence domain if any errors occured during registration + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors during registration" + logger -t scsi_reserve \ + "[info] leaving the fence domain" + fence_tool leave + failure + fi + + echo + + ;; # end of start + + stop) + error=0 - done - fi + count=0 - if [ $error -eq 0 ]; then - success - else - failure - rval=1 - fi + echo -n "Stopping scsi_reserve:" - echo -done + for dev in $scsi_devices + do + # get list of keys registered with this device + # + key_list=$( sg_persist -n -d $dev -i -k | grep -iE "^[[:space:]]*0x" ) + + # check that our key is registered with this device + # + if ! sg_persist -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then + logger -t scsi_reserve \ + "[info] not registered with $dev (key=0x$key)" + continue + fi + + # check if our key is the reservation holder + # + if sg_persist -n -d $dev -i -r 2>/dev/null | grep -qiE "$key" ; then + if echo "$key_list" | grep -qivE "$key" ; then + logger -t scsi_reserve \ + "[error] unable to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + continue + fi + fi + + # remove registration for this device + # + if ! sg_persist -n -d $dev -o -G -K $key -S 0 &> /dev/null ; then + logger -t scsi_reserve \ + "[error] failed to remove registration on $dev (key=0x$key)" + : $[ count = $count + 1 ] + error=1 + else + logger -t scsi_reserve \ + "[info] removed registration on $dev (key=0x$key)" + fi + + done + + # report success or failure + # + if [ $error -eq 0 ] ; then + success + else + logger -t scsi_reserve \ + "[info] $count errors occured during unregistration" + failure + fi + + echo + + ;; # end of stop + + status) -rm -f /var/lock/subsys/${0##*/} -;; + error=0 -status) + for dev in $scsi_devices + do + if sg_persist -n -d $dev -i -k | grep -qiE "$key" ; then + devices[${#devices[@]}]=$dev + fi + done -rval=0 + if [ -z "$devices" ] ; then + echo "No registered devices found." + else + echo "Found ${#devices[@]} registered device(s):" -# find devices that are registered with our key -# -for dev in $scsi_devices -do - if sg_persist -d $dev -i -k 2>/dev/null | grep -qiE "${key#0}" ; then - devices[${#devices[@]}]=$dev - fi -done - -if [ -z $devices ]; then - echo "No devices registered." -else - echo "Found ${#devices[@]} registered device(s):" - - for i in "${devices[@]}" ; do - echo $i - done -fi -;; + for i in "${devices[@]}" + do + echo $i + done + fi -esac + ;; # end of status -exit $rval +esac +exit $error hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Wed Apr 9 07:40:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 09 Apr 2008 07:40:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-37-g76161dd Message-ID: <20080409074007.5914.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=76161dd2dc6dc3030eac72342fe701519e8e53f2 The branch, RHEL5 has been updated via 76161dd2dc6dc3030eac72342fe701519e8e53f2 (commit) from c9dcbe4c750e249de6c5568dcaea244ad9e23647 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 76161dd2dc6dc3030eac72342fe701519e8e53f2 Author: Christine Caulfield Date: Wed Apr 9 08:38:54 2008 +0100 Remove references to broadcast. Fix entry for nodeid which seems to have got split up! Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/man/cman_tool.8 | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8 index ee15bae..554a316 100644 --- a/cman/man/cman_tool.8 +++ b/cman/man/cman_tool.8 @@ -176,30 +176,28 @@ existing cluster and reconfiguring it. Expected votes should be set to .TP .I -n Overrides the node name. By default the unqualified hostname is used. This -option can also be used to specify which interface is used for cluster -communication as cman_tool will (unless multicast is specified below) -use the broadcast address associated with that hostname. If you -are using IPv6 then you will have to use multicast rather than broadcast. +option is also used to specify which interface is used for cluster +communication. .TP .I -N Overrides the node ID for this node. Normally, nodes are assigned a node id in CCS. If you specify an incorrect node ID here, the -node might not be allowed to join the cluster. +node might not be allowed to join the cluster. Setting node IDs in +CCS is a far better way to do this. +.BR +Note that the node's application to join the cluster may be rejected if you +try to set the nodeid to one that has already been used, or if the node +was previously a member of the cluster but with a different nodeid. .TP .I -o Override the name this node will have in the cluster. This will normally be the hostname or the first name specified by -n. Note how this differs from -n: -n tells cman_tool how to find -the broadcast address and/or the entry in CCS. -o simply +the host address and/or the entry in CCS. -o simply changes the name the node will have in the cluster and has no bearing on the actual name of the machine. Use this option will extreme caution. .BR -Setting node IDs in CCS is a far better way to do this though. -.BR -Note that the node's application to join the cluster may be rejected if you -try to set the nodeid to one that has already been used, or if the node -was previously a member of the cluster but with a different nodeid. .TP .I -m Specifies a multicast address to use for cluster communication. This hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Wed Apr 9 07:46:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 09 Apr 2008 07:46:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-58-ga3ff336 Message-ID: <20080409074608.9811.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a3ff336f79cabcb020c750cb569de0872bf3e05d The branch, STABLE2 has been updated via a3ff336f79cabcb020c750cb569de0872bf3e05d (commit) from 3467c2e4c5133a1bc9b9bead66a211f0124ccf4f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a3ff336f79cabcb020c750cb569de0872bf3e05d Author: Christine Caulfield Date: Wed Apr 9 08:45:25 2008 +0100 Remove references to broadcast. Fix entry for nodeid which seems to have got split up! Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/man/cman_tool.8 | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8 index 726ca0e..8d7d573 100644 --- a/cman/man/cman_tool.8 +++ b/cman/man/cman_tool.8 @@ -176,30 +176,28 @@ existing cluster and reconfiguring it. Expected votes should be set to .TP .I -n Overrides the node name. By default the unqualified hostname is used. This -option can also be used to specify which interface is used for cluster -communication as cman_tool will (unless multicast is specified below) -use the broadcast address associated with that hostname. If you -are using IPv6 then you will have to use multicast rather than broadcast. +option is also used to specify which interface is used for cluster +communication. .TP .I -N Overrides the node ID for this node. Normally, nodes are assigned a node id in CCS. If you specify an incorrect node ID here, the -node might not be allowed to join the cluster. +node might not be allowed to join the cluster. Setting node IDs in +CCS is a far better way to do this. +.BR +Note that the node's application to join the cluster may be rejected if you +try to set the nodeid to one that has already been used, or if the node +was previously a member of the cluster but with a different nodeid. .TP .I -o Override the name this node will have in the cluster. This will normally be the hostname or the first name specified by -n. Note how this differs from -n: -n tells cman_tool how to find -the broadcast address and/or the entry in CCS. -o simply +the host address and/or the entry in CCS. -o simply changes the name the node will have in the cluster and has no bearing on the actual name of the machine. Use this option will extreme caution. .BR -Setting node IDs in CCS is a far better way to do this though. -.BR -Note that the node's application to join the cluster may be rejected if you -try to set the nodeid to one that has already been used, or if the node -was previously a member of the cluster but with a different nodeid. .TP .I -m Specifies a multicast address to use for cluster communication. This hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Wed Apr 9 07:49:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 09 Apr 2008 07:49:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-150-g4bcb36b Message-ID: <20080409074940.11192.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4bcb36b4ab8b063af84aa6a55278c74de44b16b8 The branch, master has been updated via 4bcb36b4ab8b063af84aa6a55278c74de44b16b8 (commit) from abb6c8df3cdf3f8bb034f2cd4a37af8e1050ab0f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4bcb36b4ab8b063af84aa6a55278c74de44b16b8 Author: Christine Caulfield Date: Wed Apr 9 08:49:09 2008 +0100 Remove references to broadcast. Remove references to CCSD. Fix entry for nodeid which seems to have got split up! Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/man/cman_tool.8 | 41 +++++++++++++++++++---------------------- 1 files changed, 19 insertions(+), 22 deletions(-) diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8 index 2082379..5813181 100644 --- a/cman/man/cman_tool.8 +++ b/cman/man/cman_tool.8 @@ -24,8 +24,8 @@ to join an existing cluster or (if no existing cluster exists) then to form a new one on its own. .br If no options are given to this command then it will take the cluster -configuration information from CCS. However, it is possible to provide -all the information on the command-line or to override CCS values by using +configuration information from cluster.conf. However, it is possible to provide +all the information on the command-line or to override cluster.conf values by using the command line. .TP @@ -131,7 +131,7 @@ name as it appears in 'cman_tool nodes'. .I -r The new config version. You don't need to use this when adding a new node, the new cman node will tell the rest of the cluster to get their latest -version of the config file from CCS automatically. +version of the config file automatically. .SH "WAIT" OPTIONS .TP .I -q @@ -161,9 +161,8 @@ Number of votes this node has in the cluster. Defaults to 1. Number of expected votes for the whole cluster. If different nodes provide different values then the highest is used. The cluster will only operate when quorum is reached - that is more than half the -available votes are available to the cluster. There is no default for -this value. If you are using CCS then ccs_tool will use the total -number of votes for all nodes in the configuration file. +available votes are available to the cluster. The default for +this value is the total number of votes for all nodes in the configuration file. .TP .I -2 Sets the cluster up for a special "two node only" mode. Because of the @@ -176,30 +175,28 @@ existing cluster and reconfiguring it. Expected votes should be set to .TP .I -n Overrides the node name. By default the unqualified hostname is used. This -option can also be used to specify which interface is used for cluster -communication as cman_tool will (unless multicast is specified below) -use the broadcast address associated with that hostname. If you -are using IPv6 then you will have to use multicast rather than broadcast. +option is also used to specify which interface is used for cluster +communication. .TP .I -N Overrides the node ID for this node. Normally, nodes are assigned a -node id in CCS. If you specify an incorrect node ID here, the -node might not be allowed to join the cluster. +node id in cluster.conf. If you specify an incorrect node ID here, the +node might not be allowed to join the cluster. Setting node IDs in the +configuration is a far better way to do this. +.BR +Note that the node's application to join the cluster may be rejected if you +try to set the nodeid to one that has already been used, or if the node +was previously a member of the cluster but with a different nodeid. .TP .I -o Override the name this node will have in the cluster. This will normally be the hostname or the first name specified by -n. Note how this differs from -n: -n tells cman_tool how to find -the broadcast address and/or the entry in CCS. -o simply +the host address and/or the entry in the configuration file. -o simply changes the name the node will have in the cluster and has no bearing on the actual name of the machine. Use this option will extreme caution. .BR -Setting node IDs in CCS is a far better way to do this though. -.BR -Note that the node's application to join the cluster may be rejected if you -try to set the nodeid to one that has already been used, or if the node -was previously a member of the cluster but with a different nodeid. .TP .I -m Specifies a multicast address to use for cluster communication. This @@ -234,7 +231,7 @@ Note that just because cman_tool has given up, does not mean that cman itself has stopped trying to join a cluster. .TP .I -X -Tells cman not to use CCS to get cluster information. If you use this option then cman will +Tells cman not to use the configuration file to get cluster information. If you use this option then cman will apply several defaults to the cluster to get it going. The cluster name will be "RHCluster", node IDs will default to the IP address of the node and remote node names will show up as Node. All of these, apart from the node names can @@ -242,7 +239,7 @@ be overridden on the cman_tool command-line if required. .br If you have to set up fence devices, services or anything else in cluster.conf then this option is probably not worthwhile to you - the extra readability of sensible node -names and numbers will make it worth using CCS for the cluster too. But for a simple +names and numbers will make it worth using cluster.conf for the cluster too. But for a simple failover cluster this might save you some effort. .br On each node using this configuration you will need to have the same authorization key @@ -258,7 +255,7 @@ then copy that file to all nodes you want to join the cluster. .br .TP .I -C -Overrides the default configuration module. Usually cman uses CCSD to load its +Overrides the default configuration module. Usually cman uses ccsd to load its configuration. If you have your configuration database held elsewhere (eg LDAP) and have a configuration plugin for it, then you should specify the name of the module (see the documentation for the module for the name of it - it's not necessarily the @@ -378,7 +375,7 @@ This section details how the configuration systems work in cman. You might need to cman_tool, or writing your own configuration subsystem. .br By default cman uses two configuration plugins to OpenAIS. The first, 'ccsconfig', reads the configuration information -stored in cluster.conf and stores it in an internal database, in the same schema as it finds in CCS. +stored in cluster.conf and stores it in an internal database, in the same schema as it finds in cluster.conf. The second plugin, 'cmanpreconfig', takes the information in that the database, adds several cman defaults, determines the OpenAIS node name and nodeID and formats the information in a similar manner to openais.conf(5). OpenAIS then reads those keys to start the cluster protocol. hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 9 14:33:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 09 Apr 2008 14:33:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-151-g9fecacd Message-ID: <20080409143304.25016.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9fecacd358dba0a191f29e7932281fc862a6ec33 The branch, master has been updated via 9fecacd358dba0a191f29e7932281fc862a6ec33 (commit) from 4bcb36b4ab8b063af84aa6a55278c74de44b16b8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9fecacd358dba0a191f29e7932281fc862a6ec33 Author: Fabio M. Di Nitto Date: Wed Apr 9 10:10:28 2008 +0200 [KERNEL] Update modules to build with 2.6.25 Update clean target to cope with a new file that Kbuild creates at build time. Bump minimum kernel requirements to 2.6.25. Port modules to new kobj api. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 2 +- gfs-kernel/src/gfs/sys.c | 25 +++++++++++-------------- gnbd-kernel/src/gnbd.c | 18 +++++++----------- make/clean.mk | 2 +- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/configure b/configure index 451c777..1b65c70 100755 --- a/configure +++ b/configure @@ -28,7 +28,7 @@ my $ret = 0; # this should be only the major version without the extra version # eg. only the first 3 digits -my $required_kernelversion = '2.6.24'; +my $required_kernelversion = '2.6.25'; my %options = ( help => \$help, diff --git a/gfs-kernel/src/gfs/sys.c b/gfs-kernel/src/gfs/sys.c index de64a3f..8afbebd 100644 --- a/gfs-kernel/src/gfs/sys.c +++ b/gfs-kernel/src/gfs/sys.c @@ -85,24 +85,20 @@ static struct kobj_type gfs_ktype = { .sysfs_ops = &gfs_attr_ops, }; -static struct kset gfs_kset = { - .ktype = &gfs_ktype, -}; +static struct kset *gfs_kset; int gfs_sys_fs_add(struct gfs_sbd *sdp) { int error; - sdp->sd_kobj.kset = &gfs_kset; - sdp->sd_kobj.ktype = &gfs_ktype; + sdp->sd_kobj.kset = gfs_kset; - error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); + error = kobject_init_and_add(&sdp->sd_kobj, &gfs_ktype, NULL, + "%s", sdp->sd_table_name); if (error) goto fail; - error = kobject_register(&sdp->sd_kobj); - if (error) - goto fail; + kobject_uevent(&sdp->sd_kobj, KOBJ_ADD); return 0; @@ -112,20 +108,21 @@ int gfs_sys_fs_add(struct gfs_sbd *sdp) void gfs_sys_fs_del(struct gfs_sbd *sdp) { - kobject_unregister(&sdp->sd_kobj); + kobject_put(&sdp->sd_kobj); } int gfs_sys_init(void) { gfs_sys_margs = NULL; spin_lock_init(&gfs_sys_margs_lock); - kobject_set_name(&gfs_kset.kobj, "gfs"); - kobj_set_kset_s(&gfs_kset, fs_subsys); - return kset_register(&gfs_kset); + gfs_kset = kset_create_and_add("gfs", NULL, fs_kobj); + if (!gfs_kset) + return -ENOMEM; + return 0; } void gfs_sys_uninit(void) { kfree(gfs_sys_margs); - kset_unregister(&gfs_kset); + kset_unregister(gfs_kset); } diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c index 1be2eee..9a6abe3 100644 --- a/gnbd-kernel/src/gnbd.c +++ b/gnbd-kernel/src/gnbd.c @@ -266,21 +266,19 @@ static const char *gnbdcmd_to_ascii(int cmd) static void gnbd_end_request(struct request *req) { - int uptodate = (req->errors == 0) ? 1 : 0; + int error = req->errors ? -EIO : 0; struct request_queue *q = req->q; unsigned long flags; dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name, - req, uptodate? "done": "failed"); + req, error ? "failed" : "done"); - if (!uptodate) + if (error) printk("%s %d called gnbd_end_request with an error\n", current->comm, current->pid); spin_lock_irqsave(q->queue_lock, flags); - if (!end_that_request_first(req, uptodate, req->nr_sectors)) { - end_that_request_last(req, uptodate); - } + __blk_end_request(req, error, req->nr_sectors << 9); spin_unlock_irqrestore(q->queue_lock, flags); } @@ -879,10 +877,8 @@ static int __init gnbd_init(void) struct timeval tv; int i; - if (sizeof(struct gnbd_request) != 28) { - printk(KERN_CRIT "gnbd: sizeof gnbd_request needs to be 28 in order to work!\n" ); - return -EIO; - } + BUILD_BUG_ON(sizeof(struct gnbd_request) != 28); + shutdown_req.cmd_type = REQ_TYPE_SPECIAL; gnbd_cmd(&shutdown_req) = GNBD_CMD_DISC; shutdown_req.sector = 0; @@ -984,7 +980,7 @@ static int __init gnbd_init(void) set_capacity(disk, 0); add_disk(disk); if(sysfs_create_link(&gnbd_dev[i].class_dev.kobj, - &gnbd_dev[i].disk->kobj, "block")) + &gnbd_dev[i].disk->dev.kobj, "block")) goto out_remove_disk; } diff --git a/make/clean.mk b/make/clean.mk index a8b9af6..560c4f9 100644 --- a/make/clean.mk +++ b/make/clean.mk @@ -1,6 +1,6 @@ generalclean: rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc rm -rf core core.* .depend cscope.* *.orig *.rej - rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d + rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d modules.order rm -rf ${TARGET} ${TARGETS} ${TARGET}_test rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6} hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:30:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:30:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-6-g0413a20 Message-ID: <20080409193008.4683.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0413a207c89b6b4d440b4f8bc27545ec4ee76528 The branch, RHEL46 has been updated via 0413a207c89b6b4d440b4f8bc27545ec4ee76528 (commit) from c22322ad43d192cdc2de77c6ceca782f5e35412b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0413a207c89b6b4d440b4f8bc27545ec4ee76528 Author: Benjamin Marzinski Date: Tue Jan 29 22:21:45 2008 +0000 Fix for bz #419391. gfs_glock_dq was traversing the gl_holders list without holding the gl_spin spinlock, this was causing a problem when the list item it was currently looking at got removed from the list. The solution is to not traverse the list, because it is unncessary. Unfortunately, there is also a bug in this section of code, where you can't guarantee that you will not cache a glock held with GL_NOCACHE. Fixing this issue requires significantly more work. 4.6.z bz#441747 ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.c | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c index 570ee8f..1014ea2 100644 --- a/gfs-kernel/src/gfs/glock.c +++ b/gfs-kernel/src/gfs/glock.c @@ -1608,8 +1608,6 @@ gfs_glock_dq(struct gfs_holder *gh) struct gfs_sbd *sdp = gl->gl_sbd; struct gfs_glock_operations *glops = gl->gl_ops; struct list_head *pos; - struct gfs_holder *tmp_gh = NULL; - int count = 0; atomic_inc(&gl->gl_sbd->sd_glock_dq_calls); @@ -1620,14 +1618,13 @@ gfs_glock_dq(struct gfs_holder *gh) set_bit(GLF_SYNC, &gl->gl_flags); /* Don't cache glock; request demote to unlock at inter-node scope */ - if (gh->gh_flags & GL_NOCACHE) { - list_for_each(pos, &gl->gl_holders) { - tmp_gh = list_entry(pos, struct gfs_holder, gh_list); - ++count; - } - if (tmp_gh == gh && count == 1) + if (gh->gh_flags & GL_NOCACHE && gl->gl_holders.next == &gh->gh_list && + gl->gl_holders.prev == &gh->gh_list) + /* There's a race here. If there are two holders, and both + * are dq'ed at almost the same time, you can't guarantee that + * you will call handle_callback. Fixing this will require + * some refactoring */ handle_callback(gl, LM_ST_UNLOCKED); - } lock_on_glock(gl); hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, gfs_6_1_17, created. gfs-kernel_2_6_9_76-24-g0536f85 Message-ID: <20080409193851.17847.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0536f85e62db2ac86b0f47c6e6089090261eceae The tag, gfs_6_1_17 has been created at 0536f85e62db2ac86b0f47c6e6089090261eceae (commit) - Log ----------------------------------------------------------------- commit 0536f85e62db2ac86b0f47c6e6089090261eceae Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, gfs_0_1_17, created. cmirror_1_1_15-19-gc53ff8e Message-ID: <20080409193850.17804.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c53ff8ef75c67fb53955905db96c9f96c28da7bf The tag, gfs_0_1_17 has been created at c53ff8ef75c67fb53955905db96c9f96c28da7bf (commit) - Log ----------------------------------------------------------------- commit c53ff8ef75c67fb53955905db96c9f96c28da7bf Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, rgmanager_1_9_76, created. gfs-kernel_2_6_9_76-25-gc128baa Message-ID: <20080409193851.17932.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c128baa7cc5397f1fcfc72d35cdb39c089c56043 The tag, rgmanager_1_9_76 has been created at c128baa7cc5397f1fcfc72d35cdb39c089c56043 (commit) - Log ----------------------------------------------------------------- commit c128baa7cc5397f1fcfc72d35cdb39c089c56043 Author: Jonathan Brassow Date: Thu Apr 3 10:48:46 2008 -0500 rgmanager/lvm.sh: Fix bug 431705 - Add another check for improper HA LVM setup. Specifically, check for fail-over VG name in 'volume_list', which would allow a machine to activate a VG regardless of tagging. - Clearer error messages - Better comments ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, cman_1_0_23, created. gfs-kernel_2_6_9_76-27-g481965d Message-ID: <20080409193849.17597.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=481965dc9ddb3cbbe06e82ecd507a2b77621206a The tag, cman_1_0_23 has been created at 481965dc9ddb3cbbe06e82ecd507a2b77621206a (commit) - Log ----------------------------------------------------------------- commit 481965dc9ddb3cbbe06e82ecd507a2b77621206a Author: Lon Hohberger Date: Mon Apr 7 09:47:01 2008 -0400 [cman] Resolve 441266 - uninitialized variable causing qdiskd to fail ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, cmirror-kernel_2_6_9_41, created. gfs-kernel_2_6_9_76-30-g625364c Message-ID: <20080409193850.17655.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=625364c99277445b97bbb3120736c358b802fb0f The tag, cmirror-kernel_2_6_9_41 has been created at 625364c99277445b97bbb3120736c358b802fb0f (commit) - Log ----------------------------------------------------------------- commit 625364c99277445b97bbb3120736c358b802fb0f Author: Jonathan Brassow Date: Mon Apr 7 10:48:24 2008 -0500 - dm-cmirror.ko: Fix infinite election loop (bug 217895) It was possible for an election to be run just before a machine that was next in line to be server suspened. This would cause the remaining nodes to think a suspended node was the active server - worse, the suspended node would allow itself to become server and then say in was not in charge of the log. This would simply keep going round and round. Fix is to increment 'suspended' before exiting postsuspend, and not allowing a node to be elected server if 'suspended' was set. ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, fence_1_32_52, created. gfs-kernel_2_6_9_76-28-g9133a64 Message-ID: <20080409193850.17690.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9133a6446a47c56bd735d01d761f0c91f8491fe0 The tag, fence_1_32_52 has been created at 9133a6446a47c56bd735d01d761f0c91f8491fe0 (commit) - Log ----------------------------------------------------------------- commit 9133a6446a47c56bd735d01d761f0c91f8491fe0 Author: Ryan O'Hara Date: Mon Apr 7 11:13:40 2008 -0500 BZ 409391 : fence_scsi and scsi_reserve script no longer use state file for tracking registered devices (/var/run/scsi_reserve). ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, gfs2_0_1_44, created. cmirror_1_1_15-8-g14e7029 Message-ID: <20080409193850.17733.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=14e702986f37607300cafdf68886daf15c10be38 The tag, gfs2_0_1_44 has been created at 14e702986f37607300cafdf68886daf15c10be38 (commit) - Log ----------------------------------------------------------------- commit 14e702986f37607300cafdf68886daf15c10be38 Author: Bob Peterson Date: Wed Mar 12 10:36:23 2008 -0500 Resolves: bz 435917: GFS2: mkfs.gfs2 default lock protocol differs from man page ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 9 19:38:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 09 Apr 2008 19:38:00 -0000 Subject: Cluster Project tag, cmirror-kernel_2_6_9_40, created. gfs-kernel_2_6_9_76-29-gaac75cb Message-ID: <20080409193850.17621.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=aac75cba36115a59a489c0b1a52be5259f54fb87 The tag, cmirror-kernel_2_6_9_40 has been created at aac75cba36115a59a489c0b1a52be5259f54fb87 (commit) - Log ----------------------------------------------------------------- commit aac75cba36115a59a489c0b1a52be5259f54fb87 Author: Jonathan Brassow Date: Tue Apr 8 11:30:38 2008 -0500 dm-cmirror.ko: Part of the fix for bug 193067 (cluster pvmove) Allow mirror log to be created without the 'block_on_error' flag. ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Wed Apr 9 22:07:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Wed, 09 Apr 2008 22:07:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-39-g73916dd Message-ID: <20080409220745.9339.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=73916dd1f4ce1fa237a8e01e682e6380132edeeb The branch, RHEL5 has been updated via 73916dd1f4ce1fa237a8e01e682e6380132edeeb (commit) via 3c709adffbfcaf7abd60792985631e4c677575cc (commit) from 76161dd2dc6dc3030eac72342fe701519e8e53f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 73916dd1f4ce1fa237a8e01e682e6380132edeeb Author: Bob Peterson Date: Wed Apr 9 17:03:46 2008 -0500 Resolves: bz 431952: GFS: gfs-kernel should use device major:minor commit 3c709adffbfcaf7abd60792985631e4c677575cc Author: Bob Peterson Date: Fri Mar 14 11:17:46 2008 -0500 Resolves: bz 421761: 'gfs_tool lockdump' wrongly says 'unknown mountpoint' re HP cciss RAID array ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/proc.c | 9 +++++- gfs/gfs_tool/util.c | 64 +++++++-------------------------------------- 2 files changed, 17 insertions(+), 56 deletions(-) diff --git a/gfs-kernel/src/gfs/proc.c b/gfs-kernel/src/gfs/proc.c index c86b4e6..1c38b0d 100644 --- a/gfs-kernel/src/gfs/proc.c +++ b/gfs-kernel/src/gfs/proc.c @@ -77,6 +77,7 @@ do_list(char *user_buf, size_t size) struct gfs_sbd *sdp = NULL; unsigned int x; char num[21]; + char device_id[32]; char *buf; int error = 0; @@ -85,8 +86,10 @@ do_list(char *user_buf, size_t size) x = 0; for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) { sdp = list_entry(tmp, struct gfs_sbd, sd_list); + sprintf(device_id, "%u:%u", MAJOR(sdp->sd_vfs->s_dev), + MINOR(sdp->sd_vfs->s_dev)); x += sprintf(num, "%lu", (unsigned long)sdp) + - strlen(sdp->sd_vfs->s_id) + + strlen(device_id) + strlen(sdp->sd_fsname) + 3; } @@ -105,8 +108,10 @@ do_list(char *user_buf, size_t size) x = 0; for (tmp = gfs_fs_list.next; tmp != &gfs_fs_list; tmp = tmp->next) { sdp = list_entry(tmp, struct gfs_sbd, sd_list); + sprintf(device_id, "%u:%u", MAJOR(sdp->sd_vfs->s_dev), + MINOR(sdp->sd_vfs->s_dev)); x += sprintf(buf + x, "%lu %s %s\n", - (unsigned long)sdp, sdp->sd_vfs->s_id, sdp->sd_fsname); + (unsigned long)sdp, device_id, sdp->sd_fsname); } if (copy_to_user(user_buf, buf, x)) diff --git a/gfs/gfs_tool/util.c b/gfs/gfs_tool/util.c index b9a4703..a4c1ab4 100644 --- a/gfs/gfs_tool/util.c +++ b/gfs/gfs_tool/util.c @@ -122,52 +122,6 @@ str2lines(char *str) } /** - * do_basename - Create dm-N style name for the device - * @device: - * - * Returns: Pointer to dm name or basename - */ - -static char * -do_basename(char *device) -{ - FILE *file; - int found = FALSE; - char line[256], major_name[256]; - unsigned int major_number; - struct stat st; - - file = fopen("/proc/devices", "r"); - if (!file) - goto punt; - - while (fgets(line, 256, file)) { - if (sscanf(line, "%u %s", &major_number, major_name) != 2) - continue; - if (strcmp(major_name, "device-mapper") != 0) - continue; - found = TRUE; - break; - } - - fclose(file); - - if (!found) - goto punt; - - if (stat(device, &st)) - goto punt; - if (major(st.st_rdev) == major_number) { - static char realname[16]; - snprintf(realname, 16, "dm-%u", minor(st.st_rdev)); - return realname; - } - - punt: - return basename(device); -} - -/** * mp2cookie - Find the cookie for a filesystem given its mountpoint * @mp: * @ioctl_ok: If this is FALSE, it's not acceptable to open() the mountpoint @@ -181,9 +135,9 @@ mp2cookie(char *mp, int ioctl_ok) char *cookie; char *list, **lines; FILE *file; - char line[256], device[256]; - char *dev = NULL; + char line[256], device[256], dev_id[256]; unsigned int x; + struct stat st; cookie = malloc(256); if (!cookie) @@ -196,6 +150,7 @@ mp2cookie(char *mp, int ioctl_ok) die("can't open /proc/mounts: %s\n", strerror(errno)); + memset(dev_id, 0, sizeof(dev_id)); while (fgets(line, 256, file)) { char path[256], type[256]; @@ -206,18 +161,19 @@ mp2cookie(char *mp, int ioctl_ok) if (strcmp(type, "gfs")) die("%s is not a GFS filesystem\n", mp); - dev = do_basename(device); - + if (stat(device, &st)) + continue; + sprintf(dev_id, "%u:%u", major(st.st_rdev),minor(st.st_rdev)); break; } fclose(file); for (x = 0; *lines[x]; x++) { - char s_id[256]; - sscanf(lines[x], "%s %s", cookie, s_id); - if (dev) { - if (strcmp(s_id, dev) == 0) + char device_id[256]; + sscanf(lines[x], "%s %s", cookie, device_id); + if (dev_id[0]) { + if (strcmp(device_id, dev_id) == 0) return cookie; } else { if (strcmp(cookie, mp) == 0) hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Thu Apr 10 20:38:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Thu, 10 Apr 2008 20:38:00 -0000 Subject: conga ./Plone-2.5.5-CMFPlone.patch luci/site/l ... Message-ID: <20080410203817.17125.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-10 20:38:17 Modified files: . : Plone-2.5.5-CMFPlone.patch luci/site/luci/var: Data.fs Log message: Fix plone weirdness on RHEL4 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/Plone-2.5.5-CMFPlone.patch.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.4.1&r2=1.1.4.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.20&r2=1.20.2.21 From rmccabe@sourceware.org Thu Apr 10 21:32:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Thu, 10 Apr 2008 21:32:00 -0000 Subject: conga/ricci/modules/cluster/clumon/src/snmp-ag ... Message-ID: <20080410213256.13410.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-10 21:32:56 Modified files: ricci/modules/cluster/clumon/src/snmp-agent: Makefile Log message: Fix 441947 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2 From rmccabe@sourceware.org Thu Apr 10 21:35:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Thu, 10 Apr 2008 21:35:00 -0000 Subject: conga/ricci/modules/cluster/clumon/src/snmp-ag ... Message-ID: <20080410213516.15248.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-10 21:35:16 Modified files: ricci/modules/cluster/clumon/src/snmp-agent: Makefile Log message: Fix 441966 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.4.3&r2=1.3.4.4 From rmccabe@sourceware.org Thu Apr 10 22:13:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Thu, 10 Apr 2008 22:13:00 -0000 Subject: conga/luci init.d/luci site/luci/var/certs/cac ... Message-ID: <20080410221349.8158.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-10 22:13:49 Modified files: luci/init.d : luci luci/site/luci/var/certs: cacert.config luci/utils : luci_admin Log message: Specifiy a serial number for our (self-signed) certificates to avoid firefox3 shutting us out if we generate a new cert for a host (e.g., when removing luci, wiping all its directories, then installing again). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.14.2.2&r2=1.14.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/certs/cacert.config.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.4.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.52.2.4&r2=1.52.2.5 From rmccabe@sourceware.org Fri Apr 11 06:30:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 06:30:00 -0000 Subject: conga luci/init.d/luci luci/site/luci/var/cert ... Message-ID: <20080411063025.19921.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-11 06:30:25 Modified files: luci/init.d : luci luci/site/luci/var/certs: cacert.config make : version.in Log message: Fix typo Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.14.2.3&r2=1.14.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/certs/cacert.config.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.4.1&r2=1.1.4.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.28.2.10&r2=1.28.2.11 From rmccabe@sourceware.org Fri Apr 11 06:48:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 06:48:00 -0000 Subject: conga ./clustermon.spec.in.in ./conga.spec.in. ... Message-ID: <20080411064811.25627.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-11 06:48:11 Modified files: . : clustermon.spec.in.in conga.spec.in.in luci/cluster : fence-macros luci/site/luci/Extensions: StorageReport.py Log message: Fix bz441574 (nodename" field for fence_scsi disabled when adding a new fence device/instance) Sync up spec files' %pre and %post sections with RHEL5. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.25.2.11&r2=1.25.2.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.22&r2=1.67.2.23 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.1&r2=1.2.4.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.22.2.4&r2=1.22.2.5 From rmccabe@sourceware.org Fri Apr 11 06:50:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 06:50:00 -0000 Subject: conga ./conga.spec.in.in luci/cluster/fence-ma ... Message-ID: <20080411065033.1990.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-11 06:50:33 Modified files: . : conga.spec.in.in luci/cluster : fence-macros luci/init.d : luci luci/site/luci/var/certs: cacert.config luci/utils : luci_admin Log message: Fix 441573: "nodename" field for fence_scsi disabled when adding a new fence device/instance Generate serial numbers for self-signed certs to avoid Firefox locking us out in certain situations. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.75&r2=1.45.2.76 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.11.2.4&r2=1.11.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/certs/cacert.config.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.50.2.6&r2=1.50.2.7 From rmccabe@sourceware.org Fri Apr 11 06:54:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 06:54:00 -0000 Subject: conga ./clustermon.spec.in.in ./conga.spec.in. ... Message-ID: <20080411065444.4351.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-11 06:54:44 Modified files: . : clustermon.spec.in.in conga.spec.in.in make : version.in Log message: Update changelogs and bump the version Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.36&r2=1.18.2.37 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.76&r2=1.45.2.77 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.36&r2=1.21.2.37 From rpeterso@sourceware.org Fri Apr 11 14:02:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 11 Apr 2008 14:02:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-155-g56e13f4 Message-ID: <20080411140214.21076.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=56e13f474bc8abf02324e294462527755f8752f4 The branch, master has been updated via 56e13f474bc8abf02324e294462527755f8752f4 (commit) via f0454169acbc4190d2c902a1b25cab35282351d5 (commit) via 19e98c46738e96f8aa2c4c1719075d8a4d369518 (commit) via 0e66ec5001902c704aadc0f6224ce3391ed643c6 (commit) from 9fecacd358dba0a191f29e7932281fc862a6ec33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 56e13f474bc8abf02324e294462527755f8752f4 Author: Bob Peterson Date: Thu Apr 10 10:45:47 2008 -0500 Fix some compiler warnings in gfs2_edit commit f0454169acbc4190d2c902a1b25cab35282351d5 Author: Bob Peterson Date: Thu Apr 10 10:45:47 2008 -0500 gfs2_edit was not recalculating the max block size after it figured that out. commit 19e98c46738e96f8aa2c4c1719075d8a4d369518 Author: Bob Peterson Date: Tue Mar 18 15:44:24 2008 -0500 Fix gfs2_edit print options (-p) to work properly for gfs-1 rgs and rindex. Also fixed rgflags option for gfs1. commit 0e66ec5001902c704aadc0f6224ce3391ed643c6 Author: Bob Peterson Date: Tue Mar 11 18:18:43 2008 -0500 Fix savemeta so it saves gfs-1 rg information properly Also add savergs option to facilitate rg-only repairs. ----------------------------------------------------------------------- Summary of changes: gfs2/edit/gfs2hex.c | 12 ++-- gfs2/edit/hexedit.c | 178 +++++++++++++++++++++++++++++++++++++++++--------- gfs2/edit/hexedit.h | 32 +++++++++ gfs2/edit/savemeta.c | 38 +++++++---- 4 files changed, 210 insertions(+), 50 deletions(-) diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c index dfd6c03..7262d78 100644 --- a/gfs2/edit/gfs2hex.c +++ b/gfs2/edit/gfs2hex.c @@ -70,9 +70,9 @@ void print_gfs2(const char *fmt, ...) va_start(args, fmt); vsprintf(string, fmt, args); if (termlines) - printw(string); + printw("%s", string); else - printf(string); + printf("%s", string); va_end(args); } @@ -127,9 +127,9 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) vsprintf(tmp_string, fmt, args); if (termlines) - printw(tmp_string); + printw("%s", tmp_string); else - printf(tmp_string); + printf("%s", tmp_string); check_highlight(FALSE); if (fmt2) { @@ -159,10 +159,10 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) fmtstring="(decimal)"; if (termlines) { move(line, 50); - printw(fmtstring); + printw("%s", fmtstring); } else - printf(fmtstring); + printf("%s", fmtstring); } if (termlines) { refresh(); diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index bd4f917..07edf81 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -387,7 +387,7 @@ int display_block_type(const char *lpBuffer, int from_restore) } if (block == RGLIST_DUMMY_BLOCK) { ret_type = GFS2_METATYPE_RG; - struct_len = sizeof(struct gfs2_rgrp); + struct_len = gfs1 ? sizeof(struct gfs_rgrp) : sizeof(struct gfs2_rgrp); } else if ((ret_type = get_block_type(lpBuffer))) { switch (*(lpBuffer+7)) { @@ -618,6 +618,17 @@ uint64_t masterblock(const char *fn) } /* ------------------------------------------------------------------------ */ +/* risize - size of one rindex entry, whether gfs1 or gfs2 */ +/* ------------------------------------------------------------------------ */ +static int risize(void) +{ + if (gfs1) + return sizeof(struct gfs_rindex); + else + return sizeof(struct gfs2_rindex); +} + +/* ------------------------------------------------------------------------ */ /* rgcount - return how many rgrps there are. */ /* ------------------------------------------------------------------------ */ void rgcount(void) @@ -633,7 +644,7 @@ void rgcount(void) ribh = bread(&sbd, block); riinode = inode_get(&sbd, ribh); printf("%lld RGs in this file system.\n", - riinode->i_di.di_size / sizeof(struct gfs2_rindex)); + riinode->i_di.di_size / risize()); inode_put(riinode, not_updated); exit(EXIT_SUCCESS); } @@ -646,10 +657,18 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) char buf[sizeof(struct gfs2_rindex)]; int amt; struct gfs2_rindex ri; + uint64_t offset, gfs1_adj = 0; - amt = gfs2_readi(di, (void *)&buf, - rg * sizeof(struct gfs2_rindex), - sizeof(struct gfs2_rindex)); + offset = rg * risize(); + if (gfs1) { + uint64_t sd_jbsize = + (sbd.bsize - sizeof(struct gfs2_meta_header)); + + gfs1_adj = (offset / sd_jbsize) * + sizeof(struct gfs2_meta_header); + gfs1_adj += sizeof(struct gfs2_meta_header); + } + amt = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, risize()); if (!amt) /* end of file */ return 0; gfs2_rindex_in(&ri, buf); @@ -657,6 +676,55 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) } /* ------------------------------------------------------------------------ */ +/* gfs_rgrp_in - Read in a resource group header */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf) +{ + struct gfs_rgrp *str = (struct gfs_rgrp *)buf; + + gfs2_meta_header_in(&rgrp->rg_header, buf); + rgrp->rg_flags = be32_to_cpu(str->rg_flags); + rgrp->rg_free = be32_to_cpu(str->rg_free); + rgrp->rg_useddi = be32_to_cpu(str->rg_useddi); + rgrp->rg_freedi = be32_to_cpu(str->rg_freedi); + gfs2_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list); + rgrp->rg_usedmeta = be32_to_cpu(str->rg_usedmeta); + rgrp->rg_freemeta = be32_to_cpu(str->rg_freemeta); +} + +/* ------------------------------------------------------------------------ */ +/* gfs_rgrp_out */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf) +{ + struct gfs_rgrp *str = (struct gfs_rgrp *)buf; + + gfs2_meta_header_out(&rgrp->rg_header, buf); + str->rg_flags = cpu_to_be32(rgrp->rg_flags); + str->rg_free = cpu_to_be32(rgrp->rg_free); + str->rg_useddi = cpu_to_be32(rgrp->rg_useddi); + str->rg_freedi = cpu_to_be32(rgrp->rg_freedi); + gfs2_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list); + str->rg_usedmeta = cpu_to_be32(rgrp->rg_usedmeta); + str->rg_freemeta = cpu_to_be32(rgrp->rg_freemeta); +} + +/* ------------------------------------------------------------------------ */ +/* gfs_rgrp_print - print a gfs1 resource group */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_print(struct gfs_rgrp *rg) +{ + gfs2_meta_header_print(&rg->rg_header); + pv(rg, rg_flags, "%u", "0x%x"); + pv(rg, rg_free, "%u", "0x%x"); + pv(rg, rg_useddi, "%u", "0x%x"); + pv(rg, rg_freedi, "%u", "0x%x"); + gfs2_inum_print(&rg->rg_freedi_list); + pv(rg, rg_usedmeta, "%u", "0x%x"); + pv(rg, rg_freemeta, "%u", "0x%x"); +} + +/* ------------------------------------------------------------------------ */ /* set_rgrp_flags - Set an rgrp's flags to a given value */ /* rgnum: which rg to print or modify flags for (0 - X) */ /* new_flags: value to set new rg_flags to (if modify == TRUE) */ @@ -665,7 +733,10 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) /* ------------------------------------------------------------------------ */ void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full) { - struct gfs2_rgrp rg; + union { + struct gfs2_rgrp rg2; + struct gfs_rgrp rg1; + } rg; struct gfs2_buffer_head *bh, *ribh; uint64_t rgblk, block; struct gfs2_inode *riinode; @@ -676,34 +747,43 @@ void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full) block = masterblock("rindex"); ribh = bread(&sbd, block); riinode = inode_get(&sbd, ribh); - if (rgnum >= riinode->i_di.di_size / sizeof(struct gfs2_rindex)) { + if (rgnum >= riinode->i_di.di_size / risize()) { fprintf(stderr, "Error: File system only has %lld RGs.\n", - riinode->i_di.di_size / sizeof(struct gfs2_rindex)); + riinode->i_di.di_size / risize()); inode_put(riinode, not_updated); brelse(ribh, not_updated); return; } rgblk = find_rgrp_block(riinode, rgnum); bh = bread(&sbd, rgblk); - gfs2_rgrp_in(&rg, bh->b_data); + if (gfs1) + gfs_rgrp_in(&rg.rg1, bh->b_data); + else + gfs2_rgrp_in(&rg.rg2, bh->b_data); if (modify) { printf("RG #%d (block %llu / 0x%llx) rg_flags changed from 0x%08x to 0x%08x\n", rgnum, (unsigned long long)rgblk, - (unsigned long long)rgblk, rg.rg_flags, new_flags); - rg.rg_flags = new_flags; - gfs2_rgrp_out(&rg, bh->b_data); + (unsigned long long)rgblk, rg.rg2.rg_flags, new_flags); + rg.rg2.rg_flags = new_flags; + if (gfs1) + gfs_rgrp_out(&rg.rg1, bh->b_data); + else + gfs2_rgrp_out(&rg.rg2, bh->b_data); brelse(bh, updated); } else { if (full) { print_gfs2("RG #%d", rgnum); print_gfs2(" located at: %llu (0x%llx)", rgblk, rgblk); eol(0); - gfs2_rgrp_print(&rg); + if (gfs1) + gfs_rgrp_print(&rg.rg1); + else + gfs2_rgrp_print(&rg.rg2); } else printf("RG #%d (block %llu / 0x%llx) rg_flags = 0x%08x\n", rgnum, (unsigned long long)rgblk, - (unsigned long long)rgblk, rg.rg_flags); + (unsigned long long)rgblk, rg.rg2.rg_flags); brelse(bh, not_updated); } inode_put(riinode, not_updated); @@ -718,20 +798,36 @@ int parse_rindex(struct gfs2_inode *di, int print_rindex) { int error, start_line; struct gfs2_rindex ri; - char buf[sizeof(struct gfs2_rindex)]; + char buf[sizeof(struct gfs_rindex)]; char highlighted_addr[32]; start_line = line; error = 0; - print_gfs2("RG index entries found: %d.", - di->i_di.di_size / sizeof(struct gfs2_rindex)); + print_gfs2("RG index entries found: %d.", di->i_di.di_size / risize()); eol(0); lines_per_row[dmode] = 6; memset(highlighted_addr, 0, sizeof(highlighted_addr)); + if (gfs1) { + /* gfs1 rindex files have the meta_header which is not + accounted for in gfs2's dinode size. Therefore, adjust. */ + di->i_di.di_size += ((di->i_di.di_size / sbd.bsize) + 1) * + sizeof(struct gfs2_meta_header); + } for (print_entry_ndx=0; ; print_entry_ndx++) { - error = gfs2_readi(di, (void *)&buf, - print_entry_ndx * sizeof(struct gfs2_rindex), - sizeof(struct gfs2_rindex)); + uint64_t gfs1_adj = 0; + uint64_t offset = print_entry_ndx * risize(); + + if (gfs1) { + uint64_t sd_jbsize = + (sbd.bsize - sizeof(struct gfs2_meta_header)); + + gfs1_adj = (offset / sd_jbsize) * + sizeof(struct gfs2_meta_header); + gfs1_adj += sizeof(struct gfs2_meta_header); + } + + error = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, + risize()); if (!error) /* end of file */ break; gfs2_rindex_in(&ri, buf); @@ -753,12 +849,18 @@ int parse_rindex(struct gfs2_inode *di, int print_rindex) if(print_rindex) gfs2_rindex_print(&ri); else { - struct gfs2_rgrp rg; struct gfs2_buffer_head *tmp_bh; tmp_bh = bread(&sbd, ri.ri_addr); - gfs2_rgrp_in(&rg, tmp_bh->b_data); - gfs2_rgrp_print(&rg); + if (gfs1) { + struct gfs_rgrp rg1; + gfs_rgrp_in(&rg1, tmp_bh->b_data); + gfs_rgrp_print(&rg1); + } else { + struct gfs2_rgrp rg; + gfs2_rgrp_in(&rg, tmp_bh->b_data); + gfs2_rgrp_print(&rg); + } brelse(tmp_bh, not_updated); } last_entry_onscreen[dmode] = print_entry_ndx; @@ -1283,7 +1385,10 @@ int display_extended(void) else if (display_indirect(indirect, indirect_blocks, 0, 0) == 0) return -1; else if (block_is_rglist()) { - tmp_bh = bread(&sbd, masterblock("rindex")); + if (gfs1) + tmp_bh = bread(&sbd, sbd1->sb_rindex_di.no_addr); + else + tmp_bh = bread(&sbd, masterblock("rindex")); tmp_inode = inode_get(&sbd, tmp_bh); parse_rindex(tmp_inode, FALSE); brelse(tmp_bh, not_updated); @@ -1380,9 +1485,12 @@ int display(int identify_only) { uint64_t blk; - if (block == RGLIST_DUMMY_BLOCK) - blk = masterblock("rindex"); - else + if (block == RGLIST_DUMMY_BLOCK) { + if (gfs1) + blk = sbd1->sb_rindex_di.no_addr; + else + blk = masterblock("rindex"); + } else blk = block; if (termlines) { display_title_lines(); @@ -1534,6 +1642,8 @@ uint64_t goto_block(void) temp_blk = sbd1->sb_rindex_di.no_addr; else if (!strcmp(string, "quota")) temp_blk = gfs1_quota_di.no_addr; + else if (!strcmp(string, "rgs")) + temp_blk = RGLIST_DUMMY_BLOCK; } else { if (!strcmp(string, "rgs")) @@ -2183,6 +2293,7 @@ void usage(void) fprintf(stderr,"savemeta - save off your metadata for analysis and debugging.\n"); fprintf(stderr," (The intelligent way: assume bitmap is correct).\n"); fprintf(stderr,"savemetaslow - save off your metadata for analysis and debugging. The SLOW way (block by block).\n"); + fprintf(stderr,"savergs - save off only the resource group information (rindex and rgs).\n"); fprintf(stderr,"restoremeta - restore metadata for debugging (DANGEROUS).\n"); fprintf(stderr,"rgcount - print how many RGs in the file system.\n"); fprintf(stderr,"rgflags rgnum [new flags] - print or modify flags for rg #rgnum (0 - X)\n"); @@ -2261,6 +2372,8 @@ void process_parameters(int argc, char *argv[], int pass) termlines = 0; else if (!strcasecmp(argv[i], "savemetaslow")) termlines = 0; + else if (!strcasecmp(argv[i], "savergs")) + termlines = 0; else if (!strcasecmp(argv[i], "printsavedmeta")) restoremeta(argv[i+1], argv[i+2], TRUE); @@ -2318,8 +2431,7 @@ void process_parameters(int argc, char *argv[], int pass) push_block(masterblock("rindex")); } else if (!strcmp(argv[i], "rgs")) { - if (!gfs1) - push_block(RGLIST_DUMMY_BLOCK); + push_block(RGLIST_DUMMY_BLOCK); } else if (!strcmp(argv[i], "quota")) { if (gfs1) @@ -2379,9 +2491,11 @@ void process_parameters(int argc, char *argv[], int pass) exit(EXIT_SUCCESS); } else if (!strcasecmp(argv[i], "savemeta")) - savemeta(argv[i+2], FALSE); + savemeta(argv[i+2], 0); else if (!strcasecmp(argv[i], "savemetaslow")) - savemeta(argv[i+2], TRUE); + savemeta(argv[i+2], 1); + else if (!strcasecmp(argv[i], "savergs")) + savemeta(argv[i+2], 2); else if (argv[i][0]=='0' && argv[i][1]=='x') { /* hex addr */ sscanf(argv[i], "%"SCNx64, &temp_blk);/* retrieve in hex */ push_block(temp_blk); @@ -2457,6 +2571,8 @@ int main(int argc, char *argv[]) max_block = lseek(fd, 0, SEEK_END) / bufsize; read_superblock(fd); + max_block = lseek(fd, 0, SEEK_END) / bufsize; + blockstack[0].block = 0x10 * (4096 / bufsize); strcpy(sbd.device_name, device); if (!gfs1) read_master_dir(); diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h index 4778ab1..40cf47c 100644 --- a/gfs2/edit/hexedit.h +++ b/gfs2/edit/hexedit.h @@ -135,6 +135,38 @@ struct gfs_log_header { char lh_reserved[64]; }; +struct gfs_rindex { + uint64_t ri_addr; /* block # of 1st block (header) in rgrp */ + uint32_t ri_length; /* # fs blocks containing rgrp header & bitmap */ + uint32_t ri_pad; + + uint64_t ri_data1; /* block # of first data/meta block in rgrp */ + uint32_t ri_data; /* number (qty) of data/meta blocks in rgrp */ + + uint32_t ri_bitbytes; /* total # bytes used by block alloc bitmap */ + + char ri_reserved[64]; +}; + +struct gfs_rgrp { + struct gfs2_meta_header rg_header; + + uint32_t rg_flags; /* ?? */ + + uint32_t rg_free; /* Number (qty) of free data blocks */ + + /* Dinodes are USEDMETA, but are handled separately from other METAs */ + uint32_t rg_useddi; /* Number (qty) of dinodes (used or free) */ + uint32_t rg_freedi; /* Number (qty) of unused (free) dinodes */ + struct gfs2_inum rg_freedi_list; /* 1st block in chain of free dinodes */ + + /* These META statistics do not include dinodes (used or free) */ + uint32_t rg_usedmeta; /* Number (qty) of used metadata blocks */ + uint32_t rg_freemeta; /* Number (qty) of unused metadata blocks */ + + char rg_reserved[64]; +}; + EXTERN int block_is_jindex(void); EXTERN int block_is_rindex(void); EXTERN int block_is_inum_file(void); diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index c73dc09..d582304 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -631,7 +631,7 @@ void save_inode_data(int out_fd) /* Process directory exhash inodes */ if (S_ISDIR(inode->i_di.di_mode)) { if (inode->i_di.di_flags & GFS2_DIF_EXHASH) { - save_indirect_blocks(out_fd, cur_list, mybh, + save_indirect_blocks(out_fd, cur_list, metabh, height, 0); } } @@ -701,7 +701,9 @@ void get_journal_inode_blocks(void) struct gfs_jindex ji; char jbuf[sizeof(struct gfs_jindex)]; + bh = bread(&sbd, sbd1->sb_jindex_di.no_addr); j_inode = inode_get(&sbd, bh); + brelse(bh, not_updated); amt = gfs2_readi(j_inode, (void *)&jbuf, journal * sizeof(struct gfs_jindex), sizeof(struct gfs_jindex)); @@ -709,7 +711,6 @@ void get_journal_inode_blocks(void) break; gfs_jindex_in(&ji, jbuf); jblock = ji.ji_addr; - inode_put(j_inode, not_updated); } else { if (journal > indirect->ii[0].dirents - 3) break; @@ -723,15 +724,17 @@ void get_journal_inode_blocks(void) } } -void savemeta(const char *out_fn, int slow) +void savemeta(const char *out_fn, int saveoption) { int out_fd; + int slow; osi_list_t *tmp; uint64_t memreq; int rgcount; uint64_t jindex_block; struct gfs2_buffer_head *bh; + slow = (saveoption == 1); sbd.md.journals = 1; if (!out_fn) @@ -760,7 +763,7 @@ void savemeta(const char *out_fn, int slow) osi_list_init(&sbd.buf_hash[i]); sbd.sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE; compute_constants(&sbd); - if(read_sb(&sbd) < 0) + if(!gfs1 && read_sb(&sbd) < 0) slow = TRUE; else bufsize = sbd.bsize = sbd.sd_sb.sb_bsize; @@ -808,6 +811,13 @@ void savemeta(const char *out_fn, int slow) if (!slow) { /* Save off the superblock */ save_block(sbd.device_fd, out_fd, 0x10 * (4096 / bufsize)); + /* If this is gfs1, save off the rindex because it's not + part of the file system as it is in gfs2. */ + if (gfs1) { + block = sbd1->sb_rindex_di.no_addr; + save_block(sbd.device_fd, out_fd, block); + save_inode_data(out_fd); + } /* Walk through the resource groups saving everything within */ for (tmp = sbd.rglist.next; tmp != &sbd.rglist; tmp = tmp->next){ @@ -834,15 +844,17 @@ void savemeta(const char *out_fn, int slow) save_block(sbd.device_fd, out_fd, block); } /* Save off the other metadata: inodes, etc. */ - while (!gfs2_next_rg_meta(rgd, &block, first)) { - int blktype; - - warm_fuzzy_stuff(block, FALSE, TRUE); - blktype = save_block(sbd.device_fd, out_fd, - block); - if (blktype == GFS2_METATYPE_DI) - save_inode_data(out_fd); - first = 0; + if (saveoption != 2) { + while (!gfs2_next_rg_meta(rgd, &block, first)) { + int blktype; + + warm_fuzzy_stuff(block, FALSE, TRUE); + blktype = save_block(sbd.device_fd, + out_fd, block); + if (blktype == GFS2_METATYPE_DI) + save_inode_data(out_fd); + first = 0; + } } gfs2_rgrp_relse(rgd, not_updated); } hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Fri Apr 11 14:05:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 11 Apr 2008 14:05:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-62-g819fddb Message-ID: <20080411140507.22477.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=819fddbffaf73550a046f79e78d5147f0e8b9030 The branch, STABLE2 has been updated via 819fddbffaf73550a046f79e78d5147f0e8b9030 (commit) via acf6100f3e0f2eefe73019d5a1b2d18cd59ea093 (commit) via 755a9a68e99b29856aef856df8ab5a1af46b65ed (commit) via 40cd555c21891563f67411175854a00fbb704b25 (commit) from a3ff336f79cabcb020c750cb569de0872bf3e05d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 819fddbffaf73550a046f79e78d5147f0e8b9030 Author: Bob Peterson Date: Thu Apr 10 10:45:47 2008 -0500 Fix some compiler warnings in gfs2_edit commit acf6100f3e0f2eefe73019d5a1b2d18cd59ea093 Author: Bob Peterson Date: Thu Apr 10 10:45:47 2008 -0500 gfs2_edit was not recalculating the max block size after it figured that out. commit 755a9a68e99b29856aef856df8ab5a1af46b65ed Author: Bob Peterson Date: Tue Mar 18 15:44:24 2008 -0500 Fix gfs2_edit print options (-p) to work properly for gfs-1 rgs and rindex. Also fixed rgflags option for gfs1. commit 40cd555c21891563f67411175854a00fbb704b25 Author: Bob Peterson Date: Tue Mar 11 18:18:43 2008 -0500 Fix savemeta so it saves gfs-1 rg information properly Also add savergs option to facilitate rg-only repairs. ----------------------------------------------------------------------- Summary of changes: gfs2/edit/gfs2hex.c | 12 ++-- gfs2/edit/hexedit.c | 178 +++++++++++++++++++++++++++++++++++++++++--------- gfs2/edit/hexedit.h | 32 +++++++++ gfs2/edit/savemeta.c | 38 +++++++---- 4 files changed, 210 insertions(+), 50 deletions(-) diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c index dfd6c03..7262d78 100644 --- a/gfs2/edit/gfs2hex.c +++ b/gfs2/edit/gfs2hex.c @@ -70,9 +70,9 @@ void print_gfs2(const char *fmt, ...) va_start(args, fmt); vsprintf(string, fmt, args); if (termlines) - printw(string); + printw("%s", string); else - printf(string); + printf("%s", string); va_end(args); } @@ -127,9 +127,9 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) vsprintf(tmp_string, fmt, args); if (termlines) - printw(tmp_string); + printw("%s", tmp_string); else - printf(tmp_string); + printf("%s", tmp_string); check_highlight(FALSE); if (fmt2) { @@ -159,10 +159,10 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...) fmtstring="(decimal)"; if (termlines) { move(line, 50); - printw(fmtstring); + printw("%s", fmtstring); } else - printf(fmtstring); + printf("%s", fmtstring); } if (termlines) { refresh(); diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index bd4f917..07edf81 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -387,7 +387,7 @@ int display_block_type(const char *lpBuffer, int from_restore) } if (block == RGLIST_DUMMY_BLOCK) { ret_type = GFS2_METATYPE_RG; - struct_len = sizeof(struct gfs2_rgrp); + struct_len = gfs1 ? sizeof(struct gfs_rgrp) : sizeof(struct gfs2_rgrp); } else if ((ret_type = get_block_type(lpBuffer))) { switch (*(lpBuffer+7)) { @@ -618,6 +618,17 @@ uint64_t masterblock(const char *fn) } /* ------------------------------------------------------------------------ */ +/* risize - size of one rindex entry, whether gfs1 or gfs2 */ +/* ------------------------------------------------------------------------ */ +static int risize(void) +{ + if (gfs1) + return sizeof(struct gfs_rindex); + else + return sizeof(struct gfs2_rindex); +} + +/* ------------------------------------------------------------------------ */ /* rgcount - return how many rgrps there are. */ /* ------------------------------------------------------------------------ */ void rgcount(void) @@ -633,7 +644,7 @@ void rgcount(void) ribh = bread(&sbd, block); riinode = inode_get(&sbd, ribh); printf("%lld RGs in this file system.\n", - riinode->i_di.di_size / sizeof(struct gfs2_rindex)); + riinode->i_di.di_size / risize()); inode_put(riinode, not_updated); exit(EXIT_SUCCESS); } @@ -646,10 +657,18 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) char buf[sizeof(struct gfs2_rindex)]; int amt; struct gfs2_rindex ri; + uint64_t offset, gfs1_adj = 0; - amt = gfs2_readi(di, (void *)&buf, - rg * sizeof(struct gfs2_rindex), - sizeof(struct gfs2_rindex)); + offset = rg * risize(); + if (gfs1) { + uint64_t sd_jbsize = + (sbd.bsize - sizeof(struct gfs2_meta_header)); + + gfs1_adj = (offset / sd_jbsize) * + sizeof(struct gfs2_meta_header); + gfs1_adj += sizeof(struct gfs2_meta_header); + } + amt = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, risize()); if (!amt) /* end of file */ return 0; gfs2_rindex_in(&ri, buf); @@ -657,6 +676,55 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) } /* ------------------------------------------------------------------------ */ +/* gfs_rgrp_in - Read in a resource group header */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf) +{ + struct gfs_rgrp *str = (struct gfs_rgrp *)buf; + + gfs2_meta_header_in(&rgrp->rg_header, buf); + rgrp->rg_flags = be32_to_cpu(str->rg_flags); + rgrp->rg_free = be32_to_cpu(str->rg_free); + rgrp->rg_useddi = be32_to_cpu(str->rg_useddi); + rgrp->rg_freedi = be32_to_cpu(str->rg_freedi); + gfs2_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list); + rgrp->rg_usedmeta = be32_to_cpu(str->rg_usedmeta); + rgrp->rg_freemeta = be32_to_cpu(str->rg_freemeta); +} + +/* ------------------------------------------------------------------------ */ +/* gfs_rgrp_out */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf) +{ + struct gfs_rgrp *str = (struct gfs_rgrp *)buf; + + gfs2_meta_header_out(&rgrp->rg_header, buf); + str->rg_flags = cpu_to_be32(rgrp->rg_flags); + str->rg_free = cpu_to_be32(rgrp->rg_free); + str->rg_useddi = cpu_to_be32(rgrp->rg_useddi); + str->rg_freedi = cpu_to_be32(rgrp->rg_freedi); + gfs2_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list); + str->rg_usedmeta = cpu_to_be32(rgrp->rg_usedmeta); + str->rg_freemeta = cpu_to_be32(rgrp->rg_freemeta); +} + +/* ------------------------------------------------------------------------ */ +/* gfs_rgrp_print - print a gfs1 resource group */ +/* ------------------------------------------------------------------------ */ +void gfs_rgrp_print(struct gfs_rgrp *rg) +{ + gfs2_meta_header_print(&rg->rg_header); + pv(rg, rg_flags, "%u", "0x%x"); + pv(rg, rg_free, "%u", "0x%x"); + pv(rg, rg_useddi, "%u", "0x%x"); + pv(rg, rg_freedi, "%u", "0x%x"); + gfs2_inum_print(&rg->rg_freedi_list); + pv(rg, rg_usedmeta, "%u", "0x%x"); + pv(rg, rg_freemeta, "%u", "0x%x"); +} + +/* ------------------------------------------------------------------------ */ /* set_rgrp_flags - Set an rgrp's flags to a given value */ /* rgnum: which rg to print or modify flags for (0 - X) */ /* new_flags: value to set new rg_flags to (if modify == TRUE) */ @@ -665,7 +733,10 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg) /* ------------------------------------------------------------------------ */ void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full) { - struct gfs2_rgrp rg; + union { + struct gfs2_rgrp rg2; + struct gfs_rgrp rg1; + } rg; struct gfs2_buffer_head *bh, *ribh; uint64_t rgblk, block; struct gfs2_inode *riinode; @@ -676,34 +747,43 @@ void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full) block = masterblock("rindex"); ribh = bread(&sbd, block); riinode = inode_get(&sbd, ribh); - if (rgnum >= riinode->i_di.di_size / sizeof(struct gfs2_rindex)) { + if (rgnum >= riinode->i_di.di_size / risize()) { fprintf(stderr, "Error: File system only has %lld RGs.\n", - riinode->i_di.di_size / sizeof(struct gfs2_rindex)); + riinode->i_di.di_size / risize()); inode_put(riinode, not_updated); brelse(ribh, not_updated); return; } rgblk = find_rgrp_block(riinode, rgnum); bh = bread(&sbd, rgblk); - gfs2_rgrp_in(&rg, bh->b_data); + if (gfs1) + gfs_rgrp_in(&rg.rg1, bh->b_data); + else + gfs2_rgrp_in(&rg.rg2, bh->b_data); if (modify) { printf("RG #%d (block %llu / 0x%llx) rg_flags changed from 0x%08x to 0x%08x\n", rgnum, (unsigned long long)rgblk, - (unsigned long long)rgblk, rg.rg_flags, new_flags); - rg.rg_flags = new_flags; - gfs2_rgrp_out(&rg, bh->b_data); + (unsigned long long)rgblk, rg.rg2.rg_flags, new_flags); + rg.rg2.rg_flags = new_flags; + if (gfs1) + gfs_rgrp_out(&rg.rg1, bh->b_data); + else + gfs2_rgrp_out(&rg.rg2, bh->b_data); brelse(bh, updated); } else { if (full) { print_gfs2("RG #%d", rgnum); print_gfs2(" located at: %llu (0x%llx)", rgblk, rgblk); eol(0); - gfs2_rgrp_print(&rg); + if (gfs1) + gfs_rgrp_print(&rg.rg1); + else + gfs2_rgrp_print(&rg.rg2); } else printf("RG #%d (block %llu / 0x%llx) rg_flags = 0x%08x\n", rgnum, (unsigned long long)rgblk, - (unsigned long long)rgblk, rg.rg_flags); + (unsigned long long)rgblk, rg.rg2.rg_flags); brelse(bh, not_updated); } inode_put(riinode, not_updated); @@ -718,20 +798,36 @@ int parse_rindex(struct gfs2_inode *di, int print_rindex) { int error, start_line; struct gfs2_rindex ri; - char buf[sizeof(struct gfs2_rindex)]; + char buf[sizeof(struct gfs_rindex)]; char highlighted_addr[32]; start_line = line; error = 0; - print_gfs2("RG index entries found: %d.", - di->i_di.di_size / sizeof(struct gfs2_rindex)); + print_gfs2("RG index entries found: %d.", di->i_di.di_size / risize()); eol(0); lines_per_row[dmode] = 6; memset(highlighted_addr, 0, sizeof(highlighted_addr)); + if (gfs1) { + /* gfs1 rindex files have the meta_header which is not + accounted for in gfs2's dinode size. Therefore, adjust. */ + di->i_di.di_size += ((di->i_di.di_size / sbd.bsize) + 1) * + sizeof(struct gfs2_meta_header); + } for (print_entry_ndx=0; ; print_entry_ndx++) { - error = gfs2_readi(di, (void *)&buf, - print_entry_ndx * sizeof(struct gfs2_rindex), - sizeof(struct gfs2_rindex)); + uint64_t gfs1_adj = 0; + uint64_t offset = print_entry_ndx * risize(); + + if (gfs1) { + uint64_t sd_jbsize = + (sbd.bsize - sizeof(struct gfs2_meta_header)); + + gfs1_adj = (offset / sd_jbsize) * + sizeof(struct gfs2_meta_header); + gfs1_adj += sizeof(struct gfs2_meta_header); + } + + error = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, + risize()); if (!error) /* end of file */ break; gfs2_rindex_in(&ri, buf); @@ -753,12 +849,18 @@ int parse_rindex(struct gfs2_inode *di, int print_rindex) if(print_rindex) gfs2_rindex_print(&ri); else { - struct gfs2_rgrp rg; struct gfs2_buffer_head *tmp_bh; tmp_bh = bread(&sbd, ri.ri_addr); - gfs2_rgrp_in(&rg, tmp_bh->b_data); - gfs2_rgrp_print(&rg); + if (gfs1) { + struct gfs_rgrp rg1; + gfs_rgrp_in(&rg1, tmp_bh->b_data); + gfs_rgrp_print(&rg1); + } else { + struct gfs2_rgrp rg; + gfs2_rgrp_in(&rg, tmp_bh->b_data); + gfs2_rgrp_print(&rg); + } brelse(tmp_bh, not_updated); } last_entry_onscreen[dmode] = print_entry_ndx; @@ -1283,7 +1385,10 @@ int display_extended(void) else if (display_indirect(indirect, indirect_blocks, 0, 0) == 0) return -1; else if (block_is_rglist()) { - tmp_bh = bread(&sbd, masterblock("rindex")); + if (gfs1) + tmp_bh = bread(&sbd, sbd1->sb_rindex_di.no_addr); + else + tmp_bh = bread(&sbd, masterblock("rindex")); tmp_inode = inode_get(&sbd, tmp_bh); parse_rindex(tmp_inode, FALSE); brelse(tmp_bh, not_updated); @@ -1380,9 +1485,12 @@ int display(int identify_only) { uint64_t blk; - if (block == RGLIST_DUMMY_BLOCK) - blk = masterblock("rindex"); - else + if (block == RGLIST_DUMMY_BLOCK) { + if (gfs1) + blk = sbd1->sb_rindex_di.no_addr; + else + blk = masterblock("rindex"); + } else blk = block; if (termlines) { display_title_lines(); @@ -1534,6 +1642,8 @@ uint64_t goto_block(void) temp_blk = sbd1->sb_rindex_di.no_addr; else if (!strcmp(string, "quota")) temp_blk = gfs1_quota_di.no_addr; + else if (!strcmp(string, "rgs")) + temp_blk = RGLIST_DUMMY_BLOCK; } else { if (!strcmp(string, "rgs")) @@ -2183,6 +2293,7 @@ void usage(void) fprintf(stderr,"savemeta - save off your metadata for analysis and debugging.\n"); fprintf(stderr," (The intelligent way: assume bitmap is correct).\n"); fprintf(stderr,"savemetaslow - save off your metadata for analysis and debugging. The SLOW way (block by block).\n"); + fprintf(stderr,"savergs - save off only the resource group information (rindex and rgs).\n"); fprintf(stderr,"restoremeta - restore metadata for debugging (DANGEROUS).\n"); fprintf(stderr,"rgcount - print how many RGs in the file system.\n"); fprintf(stderr,"rgflags rgnum [new flags] - print or modify flags for rg #rgnum (0 - X)\n"); @@ -2261,6 +2372,8 @@ void process_parameters(int argc, char *argv[], int pass) termlines = 0; else if (!strcasecmp(argv[i], "savemetaslow")) termlines = 0; + else if (!strcasecmp(argv[i], "savergs")) + termlines = 0; else if (!strcasecmp(argv[i], "printsavedmeta")) restoremeta(argv[i+1], argv[i+2], TRUE); @@ -2318,8 +2431,7 @@ void process_parameters(int argc, char *argv[], int pass) push_block(masterblock("rindex")); } else if (!strcmp(argv[i], "rgs")) { - if (!gfs1) - push_block(RGLIST_DUMMY_BLOCK); + push_block(RGLIST_DUMMY_BLOCK); } else if (!strcmp(argv[i], "quota")) { if (gfs1) @@ -2379,9 +2491,11 @@ void process_parameters(int argc, char *argv[], int pass) exit(EXIT_SUCCESS); } else if (!strcasecmp(argv[i], "savemeta")) - savemeta(argv[i+2], FALSE); + savemeta(argv[i+2], 0); else if (!strcasecmp(argv[i], "savemetaslow")) - savemeta(argv[i+2], TRUE); + savemeta(argv[i+2], 1); + else if (!strcasecmp(argv[i], "savergs")) + savemeta(argv[i+2], 2); else if (argv[i][0]=='0' && argv[i][1]=='x') { /* hex addr */ sscanf(argv[i], "%"SCNx64, &temp_blk);/* retrieve in hex */ push_block(temp_blk); @@ -2457,6 +2571,8 @@ int main(int argc, char *argv[]) max_block = lseek(fd, 0, SEEK_END) / bufsize; read_superblock(fd); + max_block = lseek(fd, 0, SEEK_END) / bufsize; + blockstack[0].block = 0x10 * (4096 / bufsize); strcpy(sbd.device_name, device); if (!gfs1) read_master_dir(); diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h index 4778ab1..40cf47c 100644 --- a/gfs2/edit/hexedit.h +++ b/gfs2/edit/hexedit.h @@ -135,6 +135,38 @@ struct gfs_log_header { char lh_reserved[64]; }; +struct gfs_rindex { + uint64_t ri_addr; /* block # of 1st block (header) in rgrp */ + uint32_t ri_length; /* # fs blocks containing rgrp header & bitmap */ + uint32_t ri_pad; + + uint64_t ri_data1; /* block # of first data/meta block in rgrp */ + uint32_t ri_data; /* number (qty) of data/meta blocks in rgrp */ + + uint32_t ri_bitbytes; /* total # bytes used by block alloc bitmap */ + + char ri_reserved[64]; +}; + +struct gfs_rgrp { + struct gfs2_meta_header rg_header; + + uint32_t rg_flags; /* ?? */ + + uint32_t rg_free; /* Number (qty) of free data blocks */ + + /* Dinodes are USEDMETA, but are handled separately from other METAs */ + uint32_t rg_useddi; /* Number (qty) of dinodes (used or free) */ + uint32_t rg_freedi; /* Number (qty) of unused (free) dinodes */ + struct gfs2_inum rg_freedi_list; /* 1st block in chain of free dinodes */ + + /* These META statistics do not include dinodes (used or free) */ + uint32_t rg_usedmeta; /* Number (qty) of used metadata blocks */ + uint32_t rg_freemeta; /* Number (qty) of unused metadata blocks */ + + char rg_reserved[64]; +}; + EXTERN int block_is_jindex(void); EXTERN int block_is_rindex(void); EXTERN int block_is_inum_file(void); diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index c73dc09..d582304 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -631,7 +631,7 @@ void save_inode_data(int out_fd) /* Process directory exhash inodes */ if (S_ISDIR(inode->i_di.di_mode)) { if (inode->i_di.di_flags & GFS2_DIF_EXHASH) { - save_indirect_blocks(out_fd, cur_list, mybh, + save_indirect_blocks(out_fd, cur_list, metabh, height, 0); } } @@ -701,7 +701,9 @@ void get_journal_inode_blocks(void) struct gfs_jindex ji; char jbuf[sizeof(struct gfs_jindex)]; + bh = bread(&sbd, sbd1->sb_jindex_di.no_addr); j_inode = inode_get(&sbd, bh); + brelse(bh, not_updated); amt = gfs2_readi(j_inode, (void *)&jbuf, journal * sizeof(struct gfs_jindex), sizeof(struct gfs_jindex)); @@ -709,7 +711,6 @@ void get_journal_inode_blocks(void) break; gfs_jindex_in(&ji, jbuf); jblock = ji.ji_addr; - inode_put(j_inode, not_updated); } else { if (journal > indirect->ii[0].dirents - 3) break; @@ -723,15 +724,17 @@ void get_journal_inode_blocks(void) } } -void savemeta(const char *out_fn, int slow) +void savemeta(const char *out_fn, int saveoption) { int out_fd; + int slow; osi_list_t *tmp; uint64_t memreq; int rgcount; uint64_t jindex_block; struct gfs2_buffer_head *bh; + slow = (saveoption == 1); sbd.md.journals = 1; if (!out_fn) @@ -760,7 +763,7 @@ void savemeta(const char *out_fn, int slow) osi_list_init(&sbd.buf_hash[i]); sbd.sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE; compute_constants(&sbd); - if(read_sb(&sbd) < 0) + if(!gfs1 && read_sb(&sbd) < 0) slow = TRUE; else bufsize = sbd.bsize = sbd.sd_sb.sb_bsize; @@ -808,6 +811,13 @@ void savemeta(const char *out_fn, int slow) if (!slow) { /* Save off the superblock */ save_block(sbd.device_fd, out_fd, 0x10 * (4096 / bufsize)); + /* If this is gfs1, save off the rindex because it's not + part of the file system as it is in gfs2. */ + if (gfs1) { + block = sbd1->sb_rindex_di.no_addr; + save_block(sbd.device_fd, out_fd, block); + save_inode_data(out_fd); + } /* Walk through the resource groups saving everything within */ for (tmp = sbd.rglist.next; tmp != &sbd.rglist; tmp = tmp->next){ @@ -834,15 +844,17 @@ void savemeta(const char *out_fn, int slow) save_block(sbd.device_fd, out_fd, block); } /* Save off the other metadata: inodes, etc. */ - while (!gfs2_next_rg_meta(rgd, &block, first)) { - int blktype; - - warm_fuzzy_stuff(block, FALSE, TRUE); - blktype = save_block(sbd.device_fd, out_fd, - block); - if (blktype == GFS2_METATYPE_DI) - save_inode_data(out_fd); - first = 0; + if (saveoption != 2) { + while (!gfs2_next_rg_meta(rgd, &block, first)) { + int blktype; + + warm_fuzzy_stuff(block, FALSE, TRUE); + blktype = save_block(sbd.device_fd, + out_fd, block); + if (blktype == GFS2_METATYPE_DI) + save_inode_data(out_fd); + first = 0; + } } gfs2_rgrp_relse(rgd, not_updated); } hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:19:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:19:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-156-gd2a926d Message-ID: <20080411141859.9161.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d2a926d2122c23e6175a62326b5e2b421b842a93 The branch, master has been updated via d2a926d2122c23e6175a62326b5e2b421b842a93 (commit) from 56e13f474bc8abf02324e294462527755f8752f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d2a926d2122c23e6175a62326b5e2b421b842a93 Author: Abhijith Das Date: Fri Apr 11 09:10:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch uses linux/ext3_fs.h instead of /linux/fs.h and uses EXT3_XXX_FL inode flags instead of the respective FS_XXX_FL flags. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 1d46e1d..555976b 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,20 +224,18 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) - return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + if (strncmp(name, "jdata", 5) == 0) + return EXT3_JOURNAL_DATA_FL; + else if (strncmp(name, "exhash", 6) == 0) + return EXT3_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) - return FS_IMMUTABLE_FL; + return EXT3_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return FS_APPEND_FL; + return EXT3_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return FS_NOATIME_FL; + return EXT3_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return FS_SYNC_FL; + return EXT3_SYNC_FL; else return 0; } @@ -276,13 +270,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:21:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:21:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-63-ge392259 Message-ID: <20080411142107.10472.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e3922593271e97d91e69944a9675d2216e62a186 The branch, STABLE2 has been updated via e3922593271e97d91e69944a9675d2216e62a186 (commit) from 819fddbffaf73550a046f79e78d5147f0e8b9030 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e3922593271e97d91e69944a9675d2216e62a186 Author: Abhijith Das Date: Fri Apr 11 09:10:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch uses linux/ext3_fs.h instead of /linux/fs.h and uses EXT3_XXX_FL inode flags instead of the respective FS_XXX_FL flags. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 1d46e1d..555976b 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,20 +224,18 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) - return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + if (strncmp(name, "jdata", 5) == 0) + return EXT3_JOURNAL_DATA_FL; + else if (strncmp(name, "exhash", 6) == 0) + return EXT3_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) - return FS_IMMUTABLE_FL; + return EXT3_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return FS_APPEND_FL; + return EXT3_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return FS_NOATIME_FL; + return EXT3_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return FS_SYNC_FL; + return EXT3_SYNC_FL; else return 0; } @@ -276,13 +270,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:23:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:23:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-40-gb0d53e9 Message-ID: <20080411142329.12826.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b0d53e957419d279f5b1846d29160d150f1d02d2 The branch, RHEL5 has been updated via b0d53e957419d279f5b1846d29160d150f1d02d2 (commit) from 73916dd1f4ce1fa237a8e01e682e6380132edeeb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b0d53e957419d279f5b1846d29160d150f1d02d2 Author: Abhijith Das Date: Fri Apr 11 09:10:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch uses linux/ext3_fs.h instead of /linux/fs.h and uses EXT3_XXX_FL inode flags instead of the respective FS_XXX_FL flags. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 1d46e1d..555976b 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,20 +224,18 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) - return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + if (strncmp(name, "jdata", 5) == 0) + return EXT3_JOURNAL_DATA_FL; + else if (strncmp(name, "exhash", 6) == 0) + return EXT3_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) - return FS_IMMUTABLE_FL; + return EXT3_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return FS_APPEND_FL; + return EXT3_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return FS_NOATIME_FL; + return EXT3_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return FS_SYNC_FL; + return EXT3_SYNC_FL; else return 0; } @@ -276,13 +270,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); + error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:41:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:41:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-157-gd2d49ff Message-ID: <20080411144137.24290.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d2d49ff4c65cb6c7912c20a4a55b1d7e60cd3a85 The branch, master has been updated via d2d49ff4c65cb6c7912c20a4a55b1d7e60cd3a85 (commit) from d2a926d2122c23e6175a62326b5e2b421b842a93 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d2d49ff4c65cb6c7912c20a4a55b1d7e60cd3a85 Author: Abhijith Das Date: Fri Apr 11 09:40:41 2008 -0500 gfs2_tool manpage: Updates to the manpage for bz441636 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 36b90b7..503cddb 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -97,10 +97,9 @@ client when you do this. No one should have to use this. Print out the superblock. .TP \fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR -Set an attribute flag on a file. There are six currently -supported flags. They are jdata, directio, immutable, appendonly, -noatime, and sync. In most cases, the chattr command may be used -rather than gfs2_tool to set attributes. +Set an attribute flag on a file. The currently supported flags are +jdata, immutable, appendonly, noatime, and sync. In most cases, the +chattr command may be used rather than gfs2_tool to set attributes. The \fIjdata\fR flag causes all the data written to a file to be journaled. If the \fIjdata\fR flag is set for a directory, @@ -108,9 +107,6 @@ all files and directories subsequently created within that directory are also journaled. This behavior replaces the old \fIinherit_jdata\fR flag from gfs. Same as chattr +j. -The \fIdirectio\fR flag causes all I/O to a regular file to be Direct -I/O, even if the O_DIRECT flag isn't used on the open() command. - The \fIimmutable\fR flag marks the file immutable. The behavior is similar to the immutable flag in the ext2/3 filesystems. All write access is denied. Same as chattr +i. hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:43:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:43:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.02.00-64-g22663a8 Message-ID: <20080411144315.25510.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=22663a865681ebcc2f3c921a3ef3967d66d5663f The branch, STABLE2 has been updated via 22663a865681ebcc2f3c921a3ef3967d66d5663f (commit) from e3922593271e97d91e69944a9675d2216e62a186 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 22663a865681ebcc2f3c921a3ef3967d66d5663f Author: Abhijith Das Date: Fri Apr 11 09:40:41 2008 -0500 gfs2_tool manpage: Updates to the manpage for bz441636 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 36b90b7..503cddb 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -97,10 +97,9 @@ client when you do this. No one should have to use this. Print out the superblock. .TP \fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR -Set an attribute flag on a file. There are six currently -supported flags. They are jdata, directio, immutable, appendonly, -noatime, and sync. In most cases, the chattr command may be used -rather than gfs2_tool to set attributes. +Set an attribute flag on a file. The currently supported flags are +jdata, immutable, appendonly, noatime, and sync. In most cases, the +chattr command may be used rather than gfs2_tool to set attributes. The \fIjdata\fR flag causes all the data written to a file to be journaled. If the \fIjdata\fR flag is set for a directory, @@ -108,9 +107,6 @@ all files and directories subsequently created within that directory are also journaled. This behavior replaces the old \fIinherit_jdata\fR flag from gfs. Same as chattr +j. -The \fIdirectio\fR flag causes all I/O to a regular file to be Direct -I/O, even if the O_DIRECT flag isn't used on the open() command. - The \fIimmutable\fR flag marks the file immutable. The behavior is similar to the immutable flag in the ext2/3 filesystems. All write access is denied. Same as chattr +i. hooks/post-receive -- Cluster Project From adas@sourceware.org Fri Apr 11 14:43:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Fri, 11 Apr 2008 14:43:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-41-g9b83c17 Message-ID: <20080411144354.25804.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9b83c1750434f1065c63fe547303260da15a73b2 The branch, RHEL5 has been updated via 9b83c1750434f1065c63fe547303260da15a73b2 (commit) from b0d53e957419d279f5b1846d29160d150f1d02d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9b83c1750434f1065c63fe547303260da15a73b2 Author: Abhijith Das Date: Fri Apr 11 09:40:41 2008 -0500 gfs2_tool manpage: Updates to the manpage for bz441636 ----------------------------------------------------------------------- Summary of changes: gfs2/man/gfs2_tool.8 | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8 index 36b90b7..503cddb 100644 --- a/gfs2/man/gfs2_tool.8 +++ b/gfs2/man/gfs2_tool.8 @@ -97,10 +97,9 @@ client when you do this. No one should have to use this. Print out the superblock. .TP \fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR -Set an attribute flag on a file. There are six currently -supported flags. They are jdata, directio, immutable, appendonly, -noatime, and sync. In most cases, the chattr command may be used -rather than gfs2_tool to set attributes. +Set an attribute flag on a file. The currently supported flags are +jdata, immutable, appendonly, noatime, and sync. In most cases, the +chattr command may be used rather than gfs2_tool to set attributes. The \fIjdata\fR flag causes all the data written to a file to be journaled. If the \fIjdata\fR flag is set for a directory, @@ -108,9 +107,6 @@ all files and directories subsequently created within that directory are also journaled. This behavior replaces the old \fIinherit_jdata\fR flag from gfs. Same as chattr +j. -The \fIdirectio\fR flag causes all I/O to a regular file to be Direct -I/O, even if the O_DIRECT flag isn't used on the open() command. - The \fIimmutable\fR flag marks the file immutable. The behavior is similar to the immutable flag in the ext2/3 filesystems. All write access is denied. Same as chattr +i. hooks/post-receive -- Cluster Project From teigland@sourceware.org Fri Apr 11 14:53:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Fri, 11 Apr 2008 14:53:00 -0000 Subject: Cluster Project annotated tag, cluster-2.03.00, created. cluster-2.03.00 Message-ID: <20080411145345.19615.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e07faed464b8d808f1594c00854039a8d8b1baaa The annotated tag, cluster-2.03.00 has been created at e07faed464b8d808f1594c00854039a8d8b1baaa (tag) tagging 819fddbffaf73550a046f79e78d5147f0e8b9030 (commit) replaces cluster-2.02.00 tagged by David Teigland on Fri Apr 11 09:45:31 2008 -0500 - Log ----------------------------------------------------------------- cluster-2.03.00 release Abhijith Das (3): gfs2_tool: remove 'gfs2_tool counters' as they aren't implemented anymore gfs-kernel: fix for bz 429343 gfs_glock_is_locked_by_me assertion gfs2_tool manpage: gfs2_tool counters doesn't exist anymore. Andrew Price (1): [[BUILD] Warn and continue if CONFIG_KERNELVERSION is not found Bob Peterson (9): Resolves: bz 435917: GFS2: mkfs.gfs2 default lock protocol Resolves: bz 421761: 'gfs_tool lockdump' wrongly says 'unknown Resolves: bz 431945: GFS: gfs-kernel should use device major:minor Update to prior commit for bz431945: I forgot that STABLE2 Resolves: bz 436383: GFS filesystem size inconsistent Fix savemeta so it saves gfs-1 rg information properly Fix gfs2_edit print options (-p) to work properly for gfs-1 gfs2_edit was not recalculating the max block size after it figured Fix some compiler warnings in gfs2_edit Chris Feist (1): Added back in change to description line to make chkconfig work properly. Christine Caulfield (5): [DLM] Don't segfault if lvbptr is NULL [CMAN] Free up any queued messages when someone disconnects [CMAN] Limit outstanding replies [CMAN] valid port number & don't use it before validation Remove references to broadcast. David Teigland (4): doc: update usage.txt groupd: purge messages from dead nodes dlm_tool: print correct rq mode in lockdump libdlm: fix lvb copying Fabio M. Di Nitto (8): [BUILD] Fix configure script to handle releases [BUILD] Fix build system with openais whitetank [BUILD] Allow release version to contain padding 0's Add toplevel .gitignore [BUILD] Fix handling of version and libraries soname [BUILD] Fix man page install permission Revert "Fix help message to refer to script as 'fence_scsi_test'." Revert "fix bz277781 by accepting "nodename" as a synonym for "node"" Joel Becker (1): libdlm: Don't pass LKF_WAIT to the kernel Jonathan Brassow (4): rgmanager/lvm.sh: Fix bug 438816 rgmanager/lvm.sh: Fix bug bz242798 rgmanager/lvm.sh: change argument order of shell command rgmanager/lvm.sh: Minor comment updates Lon Hohberger (10): Add Sybase failover agent Update changelog Add / fix Oracle 10g failover agent [rgmanager] Make ip.sh check link states of non-ethernet devices [rgmanager] Set cloexec bit in msg_socket.c [rgmanager] Don't call quotaoff if quotas are not used [CMAN] Fix "Node X is undead" loop bug [rgmanager] Fix #432998 [cman] Apply missing fix for #315711 [CMAN] Make cman init script start qdiskd intelligently Ryan McCabe (1): fix bz277781 by accepting "nodename" as a synonym for "node" Ryan O'Hara (15): Variable should be quoted in conditional statement. Fix unregister code to report failure correctly. Remove "self" parameter. This was used to specify the name of the node Fix code to use get_key subroutine. Fix split calls to be consistent. Remove the optional LIMIT parameter. Replace /var/lock/subsys/${0##*/} with /var/lock/subsys/scsi_reserve. Fix success/failure reporting when registering devices at startup. Rewrite of get_scsi_devices function. Record devices that are successfully registered to /var/run/scsi_reserve. Allow 'stop' to release the reservation if and only if there are no other Attempt to register the node in the case where it must perform fence_scsi Fix help message to refer to script as 'fence_scsi_test'. BZ 248715 BZ: 373491, 373511, 373531, 373541, 373571, 429033 BZ 441323 : Redirect stderr to /dev/null when getting list of devices. ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From teigland@sourceware.org Fri Apr 11 16:29:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Fri, 11 Apr 2008 16:29:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-158-g77bce77 Message-ID: <20080411162952.6062.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=77bce77b5034adf8f00090b13dde7c7d481b0dd9 The branch, master has been updated via 77bce77b5034adf8f00090b13dde7c7d481b0dd9 (commit) from d2d49ff4c65cb6c7912c20a4a55b1d7e60cd3a85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 77bce77b5034adf8f00090b13dde7c7d481b0dd9 Author: David Teigland Date: Wed Mar 19 16:05:20 2008 -0500 dlm_controld: new version - uses libcpg directly without libgroup (use the -g0 option) - takes over plock handling from gfs_controld - interacts with fenced and fs_controld to coordinate recovery (todo) - runs in backward compat mode by default, using libgroup to interact with old groupd/dlm_controld (-g1 option) - plan to add a new default -g2 option that will detect old groupd's in the cluster and only run in old mode if any exist Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: group/dlm_controld/Makefile | 13 +- group/dlm_controld/action.c | 443 ++----- group/dlm_controld/config.c | 288 ++++ group/dlm_controld/config.h | 56 + group/dlm_controld/cpg.c | 1383 ++++++++++++++++++++ .../gfs2_disk_hash.h => group/dlm_controld/crc.c | 13 +- group/dlm_controld/deadlock.c | 326 +---- group/dlm_controld/dlm_daemon.h | 189 +++- group/dlm_controld/group.c | 45 +- group/dlm_controld/main.c | 597 +++++---- group/dlm_controld/member_cman.c | 9 +- group/dlm_controld/netlink.c | 237 ++++ group/{gfs_controld => dlm_controld}/plock.c | 807 ++++++------ group/include/list.h | 11 + 14 files changed, 3078 insertions(+), 1339 deletions(-) create mode 100644 group/dlm_controld/config.c create mode 100644 group/dlm_controld/config.h create mode 100644 group/dlm_controld/cpg.c copy gfs2/include/gfs2_disk_hash.h => group/dlm_controld/crc.c (96%) create mode 100644 group/dlm_controld/netlink.c copy group/{gfs_controld => dlm_controld}/plock.c (71%) diff --git a/group/dlm_controld/Makefile b/group/dlm_controld/Makefile index 9f26a14..8098bad 100644 --- a/group/dlm_controld/Makefile +++ b/group/dlm_controld/Makefile @@ -22,11 +22,16 @@ include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -OBJS= main.o \ +OBJS= action.o \ + config.o \ + cpg.o \ + crc.o \ + deadlock.o \ + main.o \ member_cman.o \ - group.o \ - action.o \ - deadlock.o + netlink.o \ + plock.o \ + group.o CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${openaisincdir} CFLAGS += -I${KERNEL_SRC}/include/ diff --git a/group/dlm_controld/action.c b/group/dlm_controld/action.c index 34e84fe..b7c422b 100644 --- a/group/dlm_controld/action.c +++ b/group/dlm_controld/action.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -10,79 +10,128 @@ ******************************************************************************* ******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "dlm_daemon.h" -#include "ccs.h" +#include "config.h" -static int dir_members[MAX_GROUP_MEMBERS]; +static int dir_members[MAX_NODES]; static int dir_members_count; static int comms_nodes[MAX_NODES]; static int comms_nodes_count; +static char mg_name[MAXNAME+1]; #define DLM_SYSFS_DIR "/sys/kernel/dlm" #define CLUSTER_DIR "/sys/kernel/config/dlm/cluster" #define SPACES_DIR "/sys/kernel/config/dlm/cluster/spaces" #define COMMS_DIR "/sys/kernel/config/dlm/cluster/comms" +/* look for an id that matches in e.g. /sys/fs/gfs/bull\:x/lock_module/id + and then extract the "x" as the name */ -int do_read(int fd, void *buf, size_t count) +static int get_mountgroup_name(uint32_t mg_id) { - int rv, off = 0; + char path[PATH_MAX]; + char *fsname, *fsdir; + DIR *d; + FILE *file; + struct dirent *de; + uint32_t id; + int retry_gfs2 = 1; + int rv, error; - while (off < count) { - rv = read(fd, buf + off, count - off); - if (rv == 0) - return -1; - if (rv == -1 && errno == EINTR) + fsdir = "/sys/fs/gfs"; + retry: + rv = -1; + + d = opendir(fsdir); + if (!d) { + log_debug("%s: opendir failed: %d", path, errno); + goto out; + } + + while ((de = readdir(d))) { + if (de->d_name[0] == '.') continue; - if (rv == -1) - return -1; - off += rv; + + id = 0; + memset(path, 0, PATH_MAX); + snprintf(path, PATH_MAX, "%s/%s/lock_module/id", + fsdir, de->d_name); + + file = fopen(path, "r"); + if (!file) { + log_error("can't open %s %d", path, errno); + continue; + } + + error = fscanf(file, "%u", &id); + fclose(file); + + if (error != 1) { + log_error("bad read %s %d", path, errno); + continue; + } + if (id != mg_id) { + log_debug("get_mountgroup_name skip %x %s", + id, de->d_name); + continue; + } + + /* take the fsname out of clustername:fsname */ + fsname = strstr(de->d_name, ":"); + if (!fsname) { + log_debug("get_mountgroup_name skip2 %x %s", + id, de->d_name); + continue; + } + fsname++; + + log_debug("get_mountgroup_name found %x %s %s", + id, de->d_name, fsname); + strncpy(mg_name, fsname, 256); + rv = 0; + break; } - return 0; + + closedir(d); + + out: + if (rv && retry_gfs2) { + retry_gfs2 = 0; + fsdir = "/sys/fs/gfs2"; + goto retry; + } + + return rv; } -int do_write(int fd, void *buf, size_t count) +/* find the mountgroup with "mg_id" in sysfs, get it's name, then look for + the ls with with the same name in lockspaces list, return its id */ + +void set_associated_id(uint32_t mg_id) { - int rv, off = 0; + struct lockspace *ls; + int rv; - retry: - rv = write(fd, buf + off, count); - if (rv == -1 && errno == EINTR) - goto retry; - if (rv < 0) { - log_error("write errno %d", errno); - return rv; + log_debug("set_associated_id mg_id %x %d", mg_id, mg_id); + + memset(&mg_name, 0, sizeof(mg_name)); + + rv = get_mountgroup_name(mg_id); + if (rv) { + log_error("no mountgroup found with id %x", mg_id); + return; } - if (rv != count) { - count -= rv; - off += rv; - goto retry; + ls = find_ls(mg_name); + if (!ls) { + log_error("no lockspace found with name %s for mg_id %x", + mg_name, mg_id); + return; } - return 0; + + log_debug("set_associated_id mg %x is ls %x", mg_id, ls->global_id); + + ls->associated_mg_id = mg_id; } static int do_sysfs(char *name, char *file, char *val) @@ -105,7 +154,7 @@ static int do_sysfs(char *name, char *file, char *val) return rv; } -int set_control(char *name, int val) +int set_sysfs_control(char *name, int val) { char buf[32]; @@ -115,7 +164,7 @@ int set_control(char *name, int val) return do_sysfs(name, "control", buf); } -int set_event_done(char *name, int val) +int set_sysfs_event_done(char *name, int val) { char buf[32]; @@ -125,7 +174,7 @@ int set_event_done(char *name, int val) return do_sysfs(name, "event_done", buf); } -int set_id(char *name, uint32_t id) +int set_sysfs_id(char *name, uint32_t id) { char buf[32]; @@ -207,122 +256,17 @@ static int path_exists(const char *path) return 1; } -static int open_ccs(void) -{ - int i, cd; - - while ((cd = ccs_connect()) < 0) { - sleep(1); - if (++i > 9 && !(i % 10)) - log_error("connect to ccs error %d, " - "check ccsd or cluster status", cd); - } - return cd; -} - -/* when not set in cluster.conf, a node's default weight is 1 */ - -#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master" -#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight" - -#define MASTER_NAME MASTER_PATH "/@name" -#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight" - -/* look for node's weight in the dlm/lockspace section */ - -static int get_weight_lockspace(int cd, char *node, char *lockspace) -{ - char path[PATH_MAX], *str; - int error, weight; - int master_count = 0, node_is_master = 0; - - memset(path, 0, PATH_MAX); - sprintf(path, MASTER_NAME, lockspace); - - while (1) { - error = ccs_get_list(cd, path, &str); - if (error || !str) - break; - master_count++; - if (strcmp(str, node) == 0) - node_is_master = 1; - free(str); - } - - /* if there are no masters, next check for a clusternode weight */ - - if (!master_count) - return -1; - - /* if there's a master and this node isn't it, it gets weight 0 */ - - if (!node_is_master) - return 0; - - /* master gets its specified weight or 1 if none is given */ - - memset(path, 0, PATH_MAX); - sprintf(path, MASTER_WEIGHT, lockspace, node); - - error = ccs_get(cd, path, &str); - if (error || !str) - return 1; - - weight = atoi(str); - free(str); - return weight; -} - -/* look for node's weight on its clusternode line */ - -static int get_weight_clusternode(int cd, char *node, char *lockspace) -{ - char path[PATH_MAX], *str; - int error, weight; - - memset(path, 0, PATH_MAX); - sprintf(path, WEIGHT_PATH, node); - - error = ccs_get(cd, path, &str); - if (error || !str) - return -1; - - weight = atoi(str); - free(str); - return weight; -} - -static int get_weight(int cd, int nodeid, char *lockspace) -{ - char *node; - int w; - - node = nodeid2name(nodeid); - if (!node) { - log_error("no name for nodeid %d", nodeid); - w = 1; - goto out; - } - - w = get_weight_lockspace(cd, node, lockspace); - if (w >= 0) - goto out; - - w = get_weight_clusternode(cd, node, lockspace); - if (w >= 0) - goto out; - - /* default weight is 1 */ - w = 1; - out: - return w; -} +/* The "renew" nodes are those that have left and rejoined since the last + call to set_members(). We rmdir/mkdir for these nodes so dlm-kernel + can notice they've left and rejoined. */ -int set_members(char *name, int new_count, int *new_members) +int set_configfs_members(char *name, int new_count, int *new_members, + int renew_count, int *renew_members) { char path[PATH_MAX]; char buf[32]; int i, w, fd, rv, id, cd = 0, old_count, *old_members; + int do_renew; /* * create lockspace dir if it doesn't exist yet @@ -383,7 +327,12 @@ int set_members(char *name, int new_count, int *new_members) for (i = 0; i < new_count; i++) { id = new_members[i]; - if (id_exists(id, old_count, old_members)) + + do_renew = 0; + + if (id_exists(id, renew_count, renew_members)) + do_renew = 1; + else if (id_exists(id, old_count, old_members)) continue; if (!is_cman_member(id)) @@ -396,6 +345,16 @@ int set_members(char *name, int new_count, int *new_members) snprintf(path, PATH_MAX, "%s/%s/nodes/%d", SPACES_DIR, name, id); + if (do_renew) { + log_debug("set_members renew rmdir \"%s\"", path); + rv = rmdir(path); + if (rv) { + log_error("%s: renew rmdir failed: %d", + path, errno); + goto out; + } + } + log_debug("set_members mkdir \"%s\"", path); rv = create_path(path); @@ -461,7 +420,7 @@ int set_members(char *name, int new_count, int *new_members) rv = 0; out: if (cd) - ccs_disconnect(cd); + close_ccs(cd); return rv; } @@ -476,7 +435,7 @@ char *str_ip(char *addr) } #endif -char *str_ip(char *addr) +static char *str_ip(char *addr) { static char str_ip_buf[INET6_ADDRSTRLEN]; struct sockaddr_storage *ss = (struct sockaddr_storage *)addr; @@ -528,7 +487,7 @@ static int update_comms_nodes(void) /* clear out everything under config/dlm/cluster/comms/ */ -void clear_configfs_comms(void) +static void clear_configfs_comms(void) { char path[PATH_MAX]; int i, rv; @@ -573,7 +532,7 @@ static void clear_configfs_space_nodes(char *name) /* clear out everything under config/dlm/cluster/spaces/ */ -void clear_configfs_spaces(void) +static void clear_configfs_spaces(void) { char path[PATH_MAX]; DIR *d; @@ -749,89 +708,7 @@ void del_configfs_node(int nodeid) log_error("%s: rmdir failed: %d", path, errno); } -#define PROTOCOL_PATH "/cluster/dlm/@protocol" -#define PROTO_TCP 1 -#define PROTO_SCTP 2 - -static int get_ccs_protocol(int cd) -{ - char path[PATH_MAX], *str; - int error, rv; - - memset(path, 0, PATH_MAX); - sprintf(path, PROTOCOL_PATH); - - error = ccs_get(cd, path, &str); - if (error || !str) - return -1; - - if (!strncasecmp(str, "tcp", 3)) - rv = PROTO_TCP; - else if (!strncasecmp(str, "sctp", 4)) - rv = PROTO_SCTP; - else { - log_error("read invalid dlm protocol from ccs"); - rv = 0; - } - - free(str); - log_debug("got ccs protocol %d", rv); - return rv; -} - -#define TIMEWARN_PATH "/cluster/dlm/@timewarn" - -static int get_ccs_timewarn(int cd) -{ - char path[PATH_MAX], *str; - int error, rv; - - memset(path, 0, PATH_MAX); - sprintf(path, TIMEWARN_PATH); - - error = ccs_get(cd, path, &str); - if (error || !str) - return -1; - - rv = atoi(str); - - if (rv <= 0) { - log_error("read invalid dlm timewarn from ccs"); - rv = -1; - } - - free(str); - log_debug("got ccs timewarn %d", rv); - return rv; -} - -#define DEBUG_PATH "/cluster/dlm/@log_debug" - -static int get_ccs_debug(int cd) -{ - char path[PATH_MAX], *str; - int error, rv; - - memset(path, 0, PATH_MAX); - sprintf(path, DEBUG_PATH); - - error = ccs_get(cd, path, &str); - if (error || !str) - return -1; - - rv = atoi(str); - - if (rv < 0) { - log_error("read invalid dlm log_debug from ccs"); - rv = -1; - } - - free(str); - log_debug("got ccs log_debug %d", rv); - return rv; -} - -static int set_configfs_protocol(int proto) +int set_configfs_protocol(int proto) { char path[PATH_MAX]; char buf[32]; @@ -863,7 +740,7 @@ static int set_configfs_protocol(int proto) return 0; } -static int set_configfs_timewarn(int cs) +int set_configfs_timewarn(int cs) { char path[PATH_MAX]; char buf[32]; @@ -895,7 +772,7 @@ static int set_configfs_timewarn(int cs) return 0; } -static int set_configfs_debug(int val) +int set_configfs_debug(int val) { char path[PATH_MAX]; char buf[32]; @@ -927,59 +804,3 @@ static int set_configfs_debug(int val) return 0; } -static void set_protocol(int cd) -{ - int rv, proto; - - rv = get_ccs_protocol(cd); - if (!rv || rv < 0) - return; - - /* for dlm kernel, TCP=0 and SCTP=1 */ - if (rv == PROTO_TCP) - proto = 0; - else if (rv == PROTO_SCTP) - proto = 1; - else - return; - - set_configfs_protocol(proto); -} - -static void set_timewarn(int cd) -{ - int rv; - - rv = get_ccs_timewarn(cd); - if (rv < 0) - return; - - set_configfs_timewarn(rv); -} - -static void set_debug(int cd) -{ - int rv; - - rv = get_ccs_debug(cd); - if (rv < 0) - return; - - set_configfs_debug(rv); -} - -void set_ccs_options(void) -{ - int cd; - - cd = open_ccs(); - - log_debug("set_ccs_options %d", cd); - - set_protocol(cd); - set_timewarn(cd); - set_debug(cd); - - ccs_disconnect(cd); -} - diff --git a/group/dlm_controld/config.c b/group/dlm_controld/config.c new file mode 100644 index 0000000..6a4fa73 --- /dev/null +++ b/group/dlm_controld/config.c @@ -0,0 +1,288 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dlm_daemon.h" +#include "config.h" +#include "ccs.h" + +#define PROTO_TCP 1 +#define PROTO_SCTP 2 + +/* was a config value set on command line?, 0 or 1. + optk is a kernel option, optd is a daemon option */ + +int optk_debug; +int optk_timewarn; +int optk_protocol; +int optd_groupd_compat; +int optd_enable_deadlk; +int optd_enable_plock; +int optd_plock_debug; +int optd_plock_rate_limit; +int optd_plock_ownership; +int optd_drop_resources_time; +int optd_drop_resources_count; +int optd_drop_resources_age; + +/* actual config value from command line, cluster.conf, or default. + cfgk is a kernel config value, cfgd is a daemon config value */ + +int cfgk_debug = -1; +int cfgk_timewarn = -1; +int cfgk_protocol = -1; +int cfgd_groupd_compat = DEFAULT_GROUPD_COMPAT; +int cfgd_enable_deadlk = DEFAULT_ENABLE_DEADLK; +int cfgd_enable_plock = DEFAULT_ENABLE_PLOCK; +int cfgd_plock_debug = DEFAULT_PLOCK_DEBUG; +int cfgd_plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT; +int cfgd_plock_ownership = DEFAULT_PLOCK_OWNERSHIP; +int cfgd_drop_resources_time = DEFAULT_DROP_RESOURCES_TIME; +int cfgd_drop_resources_count = DEFAULT_DROP_RESOURCES_COUNT; +int cfgd_drop_resources_age = DEFAULT_DROP_RESOURCES_AGE; + + +/* when not set in cluster.conf, a node's default weight is 1 */ + +#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master" +#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight" +#define MASTER_NAME MASTER_PATH "/@name" +#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight" + +/* look for node's weight in the dlm/lockspace section */ + +static int get_weight_lockspace(int cd, char *node, char *lockspace) +{ + char path[PATH_MAX], *str; + int error, weight; + int master_count = 0, node_is_master = 0; + + memset(path, 0, PATH_MAX); + sprintf(path, MASTER_NAME, lockspace); + + while (1) { + error = ccs_get_list(cd, path, &str); + if (error || !str) + break; + master_count++; + if (strcmp(str, node) == 0) + node_is_master = 1; + free(str); + } + + /* if there are no masters, next check for a clusternode weight */ + + if (!master_count) + return -1; + + /* if there's a master and this node isn't it, it gets weight 0 */ + + if (!node_is_master) + return 0; + + /* master gets its specified weight or 1 if none is given */ + + memset(path, 0, PATH_MAX); + sprintf(path, MASTER_WEIGHT, lockspace, node); + + error = ccs_get(cd, path, &str); + if (error || !str) + return 1; + + weight = atoi(str); + free(str); + return weight; +} + +/* look for node's weight on its clusternode line */ + +static int get_weight_clusternode(int cd, char *node, char *lockspace) +{ + char path[PATH_MAX], *str; + int error, weight; + + memset(path, 0, PATH_MAX); + sprintf(path, WEIGHT_PATH, node); + + error = ccs_get(cd, path, &str); + if (error || !str) + return -1; + + weight = atoi(str); + free(str); + return weight; +} + +int get_weight(int cd, int nodeid, char *lockspace) +{ + char *node; + int w; + + node = nodeid2name(nodeid); + if (!node) { + log_error("no name for nodeid %d", nodeid); + w = 1; + goto out; + } + + w = get_weight_lockspace(cd, node, lockspace); + if (w >= 0) + goto out; + + w = get_weight_clusternode(cd, node, lockspace); + if (w >= 0) + goto out; + + /* default weight is 1 */ + w = 1; + out: + return w; +} + +int open_ccs(void) +{ + int i = 0, cd; + + while ((cd = ccs_connect()) < 0) { + sleep(1); + if (++i > 9 && !(i % 10)) + log_error("connect to ccs error %d, " + "check ccsd or cluster status", cd); + } + return cd; +} + +void close_ccs(int cd) +{ + ccs_disconnect(cd); +} + +static void read_ccs_int(int cd, char *path, int *config_val) +{ + char *str; + int val; + int error; + + error = ccs_get(cd, path, &str); + if (error || !str) + return; + + val = atoi(str); + + if (val < 0) { + log_error("ignore invalid value %d for %s", val, path); + return; + } + + *config_val = val; + log_debug("%s is %u", path, val); + free(str); +} + +static void read_ccs_protocol(int cd, char *path, int *config_val) +{ + char *str; + int val; + int error; + + error = ccs_get(cd, path, &str); + if (error || !str) + return; + + if (!strncasecmp(str, "tcp", 3)) + val = PROTO_TCP; + else if (!strncasecmp(str, "sctp", 4)) + val = PROTO_SCTP; + else { + log_error("ignore invalid value %s for %s", str, path); + return; + } + + *config_val = val; + log_debug("%s is %u (%s)", path, val, str); + free(str); +} + +#define DEBUG_PATH "/cluster/dlm/@log_debug" +#define TIMEWARN_PATH "/cluster/dlm/@timewarn" +#define PROTOCOL_PATH "/cluster/dlm/@protocol" +#define GROUPD_COMPAT_PATH "/cluster/dlm/@groupd_compat" +#define ENABLE_DEADLK_PATH "/cluster/dlm/@enable_deadlk" +#define ENABLE_PLOCK_PATH "/cluster/dlm/@enable_plock" +#define PLOCK_DEBUG_PATH "/cluster/dlm/@plock_debug" +#define PLOCK_RATE_LIMIT_PATH "/cluster/dlm/@plock_rate_limit" +#define PLOCK_OWNERSHIP_PATH "/cluster/dlm/@plock_ownership" +#define DROP_RESOURCES_TIME_PATH "/cluster/dlm/@drop_resources_time" +#define DROP_RESOURCES_COUNT_PATH "/cluster/dlm/@drop_resources_count" +#define DROP_RESOURCES_AGE_PATH "/cluster/dlm/@drop_resources_age" + +/* These config values are set from cluster.conf only if they haven't already + been set on the command line. */ + +void read_ccs(void) +{ + int cd; + + cd = open_ccs(); + if (cd < 0) + return; + + if (!optk_debug) + read_ccs_int(cd, DEBUG_PATH, &cfgk_debug); + if (!optk_timewarn) + read_ccs_int(cd, TIMEWARN_PATH, &cfgk_timewarn); + if (!optk_protocol) + read_ccs_protocol(cd, PROTOCOL_PATH, &cfgk_protocol); + if (!optd_groupd_compat) + read_ccs_int(cd, GROUPD_COMPAT_PATH, &cfgd_groupd_compat); + if (!optd_enable_deadlk) + read_ccs_int(cd, ENABLE_DEADLK_PATH, &cfgd_enable_deadlk); + if (!optd_enable_plock) + read_ccs_int(cd, ENABLE_PLOCK_PATH, &cfgd_enable_plock); + if (!optd_plock_debug) + read_ccs_int(cd, PLOCK_DEBUG_PATH, &cfgd_plock_debug); + if (!optd_plock_rate_limit) + read_ccs_int(cd, PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit); + if (!optd_plock_ownership) + read_ccs_int(cd, PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership); + if (!optd_drop_resources_time) + read_ccs_int(cd, DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time); + if (!optd_drop_resources_count) + read_ccs_int(cd, DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count); + if (!optd_drop_resources_age) + read_ccs_int(cd, DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age); + + ccs_disconnect(cd); +} + diff --git a/group/dlm_controld/config.h b/group/dlm_controld/config.h new file mode 100644 index 0000000..0ae121d --- /dev/null +++ b/group/dlm_controld/config.h @@ -0,0 +1,56 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) 2008 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +/* the kernel has default values for debug, timewarn and protocol; + we only change them if new values are given on command line or in ccs */ + +#define DEFAULT_GROUPD_COMPAT 1 +#define DEFAULT_ENABLE_DEADLK 0 +#define DEFAULT_ENABLE_PLOCK 1 +#define DEFAULT_PLOCK_DEBUG 0 +#define DEFAULT_PLOCK_RATE_LIMIT 100 +#define DEFAULT_PLOCK_OWNERSHIP 1 +#define DEFAULT_DROP_RESOURCES_TIME 10000 /* 10 sec */ +#define DEFAULT_DROP_RESOURCES_COUNT 10 +#define DEFAULT_DROP_RESOURCES_AGE 10000 /* 10 sec */ + +extern int optk_debug; +extern int optk_timewarn; +extern int optk_protocol; +extern int optd_groupd_compat; +extern int optd_enable_deadlk; +extern int optd_enable_plock; +extern int optd_plock_debug; +extern int optd_plock_rate_limit; +extern int optd_plock_ownership; +extern int optd_drop_resources_time; +extern int optd_drop_resources_count; +extern int optd_drop_resources_age; + +extern int cfgk_debug; +extern int cfgk_timewarn; +extern int cfgk_protocol; +extern int cfgd_groupd_compat; +extern int cfgd_enable_deadlk; +extern int cfgd_enable_plock; +extern int cfgd_plock_debug; +extern int cfgd_plock_rate_limit; +extern int cfgd_plock_ownership; +extern int cfgd_drop_resources_time; +extern int cfgd_drop_resources_count; +extern int cfgd_drop_resources_age; + +void read_ccs(void); +int open_ccs(void); +void close_ccs(int cd); +int get_weight(int cd, int nodeid, char *lockspace); + diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c new file mode 100644 index 0000000..21c1a43 --- /dev/null +++ b/group/dlm_controld/cpg.c @@ -0,0 +1,1383 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#include "dlm_daemon.h" +#include "config.h" + +uint32_t cpgname_to_crc(const char *data, int len); + +int message_flow_control_on; +static cpg_handle_t daemon_handle; +static unsigned int protocol_active[3] = {1, 0, 0}; + +struct member { + struct list_head list; + int nodeid; + int start; /* 1 if we received a start message for this change */ + int added; /* 1 if added by this change */ + int failed; /* 1 if failed in this change */ + int disallowed; + uint32_t start_flags; +}; + +struct node { + struct list_head list; + int nodeid; + int needs_fencing; + struct timeval add_time; +}; + +/* One of these change structs is created for every confchg a cpg gets. */ + +#define CGST_WAIT_CONDITIONS 1 +#define CGST_WAIT_MESSAGES 2 + +struct change { + struct list_head list; + struct list_head members; + struct list_head removed; /* nodes removed by this change */ + int member_count; + int joined_count; + int remove_count; + int failed_count; + int state; + int we_joined; + uint32_t seq; /* just used as a reference when debugging */ +}; + +char *msg_name(int type) +{ + switch (type) { + case DLM_MSG_START: + return "start"; + case DLM_MSG_PLOCK: + return "plock"; + case DLM_MSG_PLOCK_OWN: + return "plock_own"; + case DLM_MSG_PLOCK_DROP: + return "plock_drop"; + case DLM_MSG_PLOCK_SYNC_LOCK: + return "plock_sync_lock"; + case DLM_MSG_PLOCK_SYNC_WAITER: + return "plock_sync_waiter"; + case DLM_MSG_PLOCKS_STORED: + return "plocks_stored"; + case DLM_MSG_DEADLK_CYCLE_START: + return "deadlk_cycle_start"; + case DLM_MSG_DEADLK_CYCLE_END: + return "deadlk_cycle_end"; + case DLM_MSG_DEADLK_CHECKPOINT_READY: + return "deadlk_checkpoint_ready"; + case DLM_MSG_DEADLK_CANCEL_LOCK: + return "deadlk_cancel_lock"; + default: + return "unknown"; + } +} + +static char *str_nums(int *nums, int n_ints) +{ + static char buf[128]; + int i, len, ret, pos = 0; + + len = sizeof(buf); + memset(buf, 0, len); + + for (i = 0; i < n_ints; i++) { + ret = snprintf(buf + pos, len - pos, "%d ", + le32_to_cpu(nums[i])); + if (ret >= len - pos) + break; + pos += ret; + } + + return buf; +} + +static int _send_message(cpg_handle_t h, void *buf, int len, int type) +{ + struct iovec iov; + cpg_error_t error; + int retries = 0; + + iov.iov_base = buf; + iov.iov_len = len; + + retry: + error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1); + if (error == CPG_ERR_TRY_AGAIN) { + retries++; + usleep(1000); + if (!(retries % 100)) + log_error("cpg_mcast_joined retry %d %s", + retries, msg_name(type)); + goto retry; + } + if (error != CPG_OK) { + log_error("cpg_mcast_joined error %d handle %llx %s", + error, (unsigned long long)h, msg_name(type)); + return -1; + } + + if (retries) + log_debug("cpg_mcast_joined retried %d %s", + retries, msg_name(type)); + + return 0; +} + +/* header fields caller needs to set: type, to_nodeid, flags, msgdata */ + +void dlm_send_message(struct lockspace *ls, char *buf, int len) +{ + struct dlm_header *hd = (struct dlm_header *) buf; + int type = hd->type; + + hd->version[0] = cpu_to_le16(protocol_active[0]); + hd->version[1] = cpu_to_le16(protocol_active[1]); + hd->version[2] = cpu_to_le16(protocol_active[2]); + hd->type = cpu_to_le16(hd->type); + hd->nodeid = cpu_to_le32(our_nodeid); + hd->to_nodeid = cpu_to_le32(hd->to_nodeid); + hd->global_id = cpu_to_le32(ls->global_id); + hd->flags = cpu_to_le32(hd->flags); + hd->msgdata = cpu_to_le32(hd->msgdata); + + _send_message(ls->cpg_handle, buf, len, type); +} + +static struct member *find_memb(struct change *cg, int nodeid) +{ + struct member *memb; + + list_for_each_entry(memb, &cg->members, list) { + if (memb->nodeid == nodeid) + return memb; + } + return NULL; +} + +static struct lockspace *find_ls_handle(cpg_handle_t h) +{ + struct lockspace *ls; + + list_for_each_entry(ls, &lockspaces, list) { + if (ls->cpg_handle == h) + return ls; + } + return NULL; +} + +static struct lockspace *find_ls_ci(int ci) +{ + struct lockspace *ls; + + list_for_each_entry(ls, &lockspaces, list) { + if (ls->cpg_client == ci) + return ls; + } + return NULL; +} + +static void free_cg(struct change *cg) +{ + struct member *memb, *safe; + + list_for_each_entry_safe(memb, safe, &cg->members, list) { + list_del(&memb->list); + free(memb); + } + list_for_each_entry_safe(memb, safe, &cg->removed, list) { + list_del(&memb->list); + free(memb); + } + free(cg); +} + +static void free_ls(struct lockspace *ls) +{ + struct change *cg, *cg_safe; + struct node *node, *node_safe; + + list_for_each_entry_safe(cg, cg_safe, &ls->changes, list) { + list_del(&cg->list); + free_cg(cg); + } + + if (ls->started_change) + free_cg(ls->started_change); + + list_for_each_entry_safe(node, node_safe, &ls->node_history, list) { + list_del(&node->list); + free(node); + } + + free(ls); +} + + +/* Problem scenario: + nodes A,B,C are in fence domain + node C has gfs foo mounted + node C fails + nodes A,B begin fencing C (slow, not completed) + node B mounts gfs foo + + We may end up having gfs foo mounted and being used on B before + C has been fenced. C could wake up corrupt fs. + + So, we need to prevent any new gfs mounts while there are any + outstanding, incomplete fencing operations. + + We also need to check that the specific failed nodes we know about have + been fenced (since fenced may not even have been notified that the node + has failed yet). + + So, check that: + 1. has fenced fenced the node after it joined this lockspace? + 2. fenced has no outstanding fencing ops + + For 1: + - record the time of the first good start message we see from node X + - node X fails + - wait for X to be removed from all dlm cpg's (probably not necessary) + - check that the fencing time is later than the recorded time above + + Tracking fencing state when there are spurious partitions/merges... + + from a spurious leave/join of node X, a lockspace will see: + - node X is a lockspace member + - node X fails, may be waiting for all cpgs to see failure or for fencing to + complete + - node X joins the lockspace - we want to process the change as usual, but + don't want to disrupt the code waiting for the fencing, and we want to + continue running properly once the remerged node is properly reset + + ls->node_history + when we see a node not in this list, add entry for it with zero add_time + record the time we get a good start message from the node, add_time + clear add_time if the node leaves + if node fails with non-zero add_time, set needs_fencing + when a node is fenced, clear add_time and clear needs_fencing + if a node remerges after this, no good start message, no new add_time set + if a node fails with zero add_time, it doesn't need fencing + if a node remerges before it's been fenced, no good start message, no new + add_time set +*/ + +static struct node *get_node_history(struct lockspace *ls, int nodeid) +{ + struct node *node; + + list_for_each_entry(node, &ls->node_history, list) { + if (node->nodeid == nodeid) + return node; + } + return NULL; +} + +static void node_history_init(struct lockspace *ls, int nodeid) +{ + struct node *node; + + node = get_node_history(ls, nodeid); + if (node) + return; + + node = malloc(sizeof(struct node)); + if (!node) + return; + memset(node, 0, sizeof(struct node)); + + node->nodeid = nodeid; + timerclear(&node->add_time); + list_add_tail(&node->list, &ls->node_history); +} + +static void node_history_start(struct lockspace *ls, int nodeid) +{ + struct node *node; + + node = get_node_history(ls, nodeid); + if (!node) { + log_error("node_history_start no nodeid %d", nodeid); + return; + } + + gettimeofday(&node->add_time, NULL); +} + +static void node_history_left(struct lockspace *ls, int nodeid) +{ + struct node *node; + + node = get_node_history(ls, nodeid); + if (!node) { + log_error("node_history_left no nodeid %d", nodeid); + return; + } + + timerclear(&node->add_time); +} + +static void node_history_fail(struct lockspace *ls, int nodeid) +{ + struct node *node; + + node = get_node_history(ls, nodeid); + if (!node) { + log_error("node_history_fail no nodeid %d", nodeid); + return; + } + + if (!timerisset(&node->add_time)) + node->needs_fencing = 1; +} + +static int failed_nodes_fenced(struct lockspace *ls) +{ +#if 0 + struct node *node; + struct timeval last_fenced; + int wait_count = 0; + + list_for_each_entry(node, &ls->node_history, list) { + if (!node->needs_fencing) + continue; + + /* check with fenced to see if the node has been + fenced since node->add_time */ + + fencedomain_last_success(node->nodeid, &last_fenced); + + if (last_fenced <= node->add_time) { + wait_count++; + continue; + } + + /* node has been fenced */ + node->needs_fencing = 0; + timerclear(&node->add_time); + } + + if (wait_count) { + return 0; + } + + /* now check if there are any outstanding fencing ops (for nodes + we may not have seen in any lockspace), and return 0 if there + are any */ + + fencedomain_pending_count(&pending); + if (pending) + return 0; +#endif + return 1; +} + +static int cluster_has_quorum(struct lockspace *ls) +{ + /* verify cman_last_failure_time() for this node is more recent + than when we last saw the node added; then we know that the + quorum result from cman is accounting for the given failure. */ + return 1; +} + +static int cluster_filesystem_stopped(struct lockspace *ls) +{ + /* communicate with fs daemon through the fscontrol:hostname + cpg to check if the fs has been notified of any node failures + in this change */ + return 1; +} + +static int member_ids[MAX_NODES]; +static int member_count; +static int renew_ids[MAX_NODES]; +static int renew_count; + +static void format_member_ids(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct member *memb; + + memset(member_ids, 0, sizeof(member_ids)); + member_count = 0; + + list_for_each_entry(memb, &cg->members, list) + member_ids[member_count++] = memb->nodeid; +} + +/* list of nodeids that have left and rejoined since last start_kernel; + is any member of startcg in the left list of any other cg's? + (if it is, then it presumably must be flagged added in another) */ + +static void format_renew_ids(struct lockspace *ls) +{ + struct change *cg, *startcg; + struct member *memb, *leftmemb; + + startcg = list_first_entry(&ls->changes, struct change, list); + + memset(renew_ids, 0, sizeof(renew_ids)); + renew_count = 0; + + list_for_each_entry(memb, &startcg->members, list) { + list_for_each_entry(cg, &ls->changes, list) { + if (cg == startcg) + continue; + list_for_each_entry(leftmemb, &cg->removed, list) { + if (memb->nodeid == leftmemb->nodeid) { + renew_ids[renew_count++] = memb->nodeid; + } + } + } + } + +} + +static void start_kernel(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + + if (!ls->kernel_stopped) { + log_error("start_kernel %u not stopped", cg->seq); + return; + } + + log_group(ls, "start_kernel %u member_count %d", + cg->seq, cg->member_count); + + format_member_ids(ls); + format_renew_ids(ls); + set_configfs_members(ls->name, member_count, member_ids, + renew_count, renew_ids); + set_sysfs_control(ls->name, 1); + ls->kernel_stopped = 0; + + if (ls->joining) { + set_sysfs_id(ls->name, ls->global_id); + set_sysfs_event_done(ls->name, 0); + ls->joining = 0; + } +} + +static void stop_kernel(struct lockspace *ls, uint32_t seq) +{ + if (!ls->kernel_stopped) { + log_group(ls, "stop_kernel %u", seq); + set_sysfs_control(ls->name, 0); + ls->kernel_stopped = 1; + } +} + +/* the first condition is that the local lockspace is stopped which we + don't need to check for because stop_kernel(), which is synchronous, + was done when the change was created */ + +static int wait_conditions_done(struct lockspace *ls) +{ + /* the fencing/quorum/fs conditions need to account for all the changes + that have occured since the last change applied to dlm-kernel, not + just the latest change */ + + if (!failed_nodes_fenced(ls)) { + poll_fencing = 1; + return 0; + } + poll_fencing = 0; + + /* even though fencing also waits for quorum, checking fencing isn't + sufficient because we don't want to start new lockspaces in an + inquorate cluster */ + + if (!cluster_has_quorum(ls)) { + poll_quorum = 1; + return 0; + } + poll_quorum = 0; + + if (!cluster_filesystem_stopped(ls)) { + poll_fs = 1; + return 0; + } + poll_fs = 0; + + return 1; +} + +static int wait_messages_done(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct member *memb; + int need = 0, total = 0; + + list_for_each_entry(memb, &cg->members, list) { + if (!memb->start) + need++; + total++; + } + + if (need) { + log_group(ls, "wait_messages_done need %d of %d", need, total); + return 0; + } + + log_group(ls, "wait_messages_done got all %d", total); + return 1; +} + +static void cleanup_changes(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct change *safe; + + list_del(&cg->list); + if (ls->started_change) + free_cg(ls->started_change); + ls->started_change = cg; + + list_for_each_entry_safe(cg, safe, &ls->changes, list) { + list_del(&cg->list); + free_cg(cg); + } +} + +/* There's a stream of confchg and messages. At one of these + messages, the low node needs to store plocks and new nodes + need to begin saving plock messages. A second message is + needed to say that the plocks are ready to be read. + + When the last start message is recvd for a change, the low node + stores plocks and the new nodes begin saving messages. When the + store is done, low node sends plocks_stored message. When + new nodes recv this, they read the plocks and their saved messages. + plocks_stored message should identify a specific change, like start + messages do; if it doesn't match ls->started_change, then it's ignored. + + If a confchg adding a new node arrives after plocks are stored but + before plocks_stored msg recvd, then the message is ignored. The low + node will send another plocks_stored message for the latest change + (although it may be able to reuse the ckpt if no plock state has changed). +*/ + +static void set_plock_ckpt_node(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct member *memb; + int low = 0; + + list_for_each_entry(memb, &cg->members, list) { + if (!(memb->start_flags & DLM_MFLG_HAVEPLOCK)) + continue; + + if (!low || memb->nodeid < low) + low = memb->nodeid; + } + + log_group(ls, "set_plock_ckpt_node from %d to %d", + ls->plock_ckpt_node, low); + + if (ls->plock_ckpt_node == our_nodeid && low != our_nodeid) { + /* Close ckpt so it will go away when the new ckpt_node + unlinks it prior to creating a new one; if we fail + our open ckpts are automatically closed. At this point + the ckpt has not been unlinked, but won't be held open by + anyone. We use the max "retentionDuration" to stop the + system from cleaning up ckpts that are open by no one. */ + close_plock_checkpoint(ls); + } + + ls->plock_ckpt_node = low; +} + +/* do the change details in the message match the details of the given change */ + +static int match_change(struct lockspace *ls, struct change *cg, + struct dlm_header *hd, int len) +{ + struct member *memb; + int member_count, joined_count, remove_count, failed_count; + int i, n_ints, *nums, nodeid, members_mismatch; + uint32_t seq = hd->msgdata; + + nums = (int *)((char *)hd + sizeof(struct dlm_header)); + + member_count = le32_to_cpu(nums[0]); + joined_count = le32_to_cpu(nums[1]); + remove_count = le32_to_cpu(nums[2]); + failed_count = le32_to_cpu(nums[3]); + + n_ints = 4 + member_count; + if (len != (sizeof(struct dlm_header) + (n_ints * sizeof(int)))) { + log_group(ls, "match_change fail %d:%u bad len %d nums %s", + hd->nodeid, seq, len, str_nums(nums, n_ints)); + return 0; + } + + /* We can ignore messages if we're not in the list of members. The one + known time this will happen is after we've joined the cpg, we can + get messages for changes prior to the change in which we're added. */ + + for (i = 0; i < member_count; i++) { + if (our_nodeid == le32_to_cpu(nums[4+i])) + break; + } + if (i == member_count) { + log_group(ls, "match_change fail %d:%u we are not in members", + hd->nodeid, seq); + return 0; + } + + memb = find_memb(cg, hd->nodeid); + if (!memb) { + log_group(ls, "match_change fail %d:%u sender not member", + hd->nodeid, seq); + return 0; + } + + /* verify this is the right change by matching the counts + and the nodeids of the current members */ + + if (member_count != cg->member_count || + joined_count != cg->joined_count || + remove_count != cg->remove_count || + failed_count != cg->failed_count) { + log_group(ls, "match_change fail %d:%u expect counts " + "%d %d %d %d nums %s", + hd->nodeid, seq, + cg->member_count, cg->joined_count, + cg->remove_count, cg->failed_count, + str_nums(nums, n_ints)); + return 0; + } + + members_mismatch = 0; + for (i = 0; i < member_count; i++) { + nodeid = le32_to_cpu(nums[4+i]); + memb = find_memb(cg, nodeid); + if (memb) + continue; + log_group(ls, "match_change fail %d:%u no memb %d", + hd->nodeid, seq, nodeid); + members_mismatch = 1; + } + if (members_mismatch) + return 0; + + return 1; +} + +static void send_plocks_stored(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct dlm_header *hd; + struct member *memb; + int n_ints, len, *p, i; + char *buf; + + n_ints = 4 + cg->member_count; + len = sizeof(struct dlm_header) + (n_ints * sizeof(uint32_t)); + + buf = malloc(len); + if (!buf) { + return; + } + memset(buf, 0, len); + + hd = (struct dlm_header *)buf; + hd->type = DLM_MSG_PLOCKS_STORED; + hd->msgdata = cg->seq; + + p = (int *)(buf + sizeof(struct dlm_header)); + + /* sending all this stuff is probably unnecessary, but gives + us more certainty in matching stopped messages to the correct + change that they are for */ + + p[0] = cpu_to_le32(cg->member_count); + p[1] = cpu_to_le32(cg->joined_count); + p[2] = cpu_to_le32(cg->remove_count); + p[3] = cpu_to_le32(cg->failed_count); + + i = 4; + list_for_each_entry(memb, &cg->members, list) + p[i++] = cpu_to_le32(memb->nodeid); + + dlm_send_message(ls, buf, len); + + free(buf); +} + +static void receive_plocks_stored(struct lockspace *ls, struct dlm_header *hd, + int len) +{ + log_group(ls, "receive_plocks_stored %d:%u need_plocks %d", + hd->nodeid, hd->msgdata, ls->need_plocks); + + if (!ls->need_plocks) + return; + + /* a confchg arrived between the last start and the plocks_stored msg, + so we ignore this plocks_stored msg and wait to read the ckpt until + the next plocks_stored msg following the current start */ + + if (!list_empty(&ls->changes) || !ls->started_change || + !match_change(ls, ls->started_change, hd, len)) { + log_group(ls, "receive_plocks_stored %d:%u ignore", + hd->nodeid, hd->msgdata); + return; + } + + retrieve_plocks(ls); + process_saved_plocks(ls); + ls->need_plocks = 0; + ls->save_plocks = 0; +} + +/* Unfortunately, there's no really simple way to match a message with the + specific change that it was sent for. We hope that by passing all the + details of the change in the message, we will be able to uniquely match the + it to the correct change. */ + +/* A start message will usually be for the first (current) change on our list. + In some cases it will be for a non-current change, and we can ignore it: + + 1. A,B,C get confchg1 adding C + 2. C sends start for confchg1 + 3. A,B,C get confchg2 adding D + 4. A,B,C,D recv start from C for confchg1 - ignored + 5. C,D send start for confchg2 + 6. A,B send start for confchg2 + 7. A,B,C,D recv all start messages for confchg2, and start kernel + + In step 4, how do the nodes know whether the start message from C is + for confchg1 or confchg2? Hopefully by comparing the counts and members. */ + +static struct change *find_change(struct lockspace *ls, struct dlm_header *hd, + int len) +{ + struct change *cg; + + list_for_each_entry_reverse(cg, &ls->changes, list) { + if (!match_change(ls, cg, hd, len)) + continue; + return cg; + } + + log_group(ls, "find_change %d:%u no match", hd->nodeid, hd->msgdata); + return NULL; +} + +/* We require new members (memb->added) to be joining the lockspace + (memb->joining). New members that are not joining the lockspace can happen + when the cpg partitions and is then merged back together (shouldn't happen + in general, but is possible). We label these new members that are not + joining as "disallowed", and ignore their start message. */ + +/* Handle spurious joins by ignoring this start message if the node says it's + not joining (i.e. it's already a member), but we see it being added (i.e. + it's not already a member) */ + +static void receive_start(struct lockspace *ls, struct dlm_header *hd, int len) +{ + struct change *cg; + struct member *memb; + int joining = 0; + uint32_t seq = hd->msgdata; + + log_group(ls, "receive_start %d:%u flags %x len %d", hd->nodeid, seq, + hd->flags, len); + + cg = find_change(ls, hd, len); + if (!cg) + return; + + memb = find_memb(cg, hd->nodeid); + if (!memb) { + /* this should never happen since match_change checks it */ + log_error("receive_start no member %d", hd->nodeid); + return; + } + + memb->start_flags = hd->flags; + + if (memb->start_flags & DLM_MFLG_JOINING) + joining = 1; + + if ((memb->added && !joining) || (!memb->added && joining)) { + log_error("receive_start %d:%u disallowed added %d joining %d", + hd->nodeid, seq, memb->added, joining); + memb->disallowed = 1; + } else { + node_history_start(ls, hd->nodeid); + memb->start = 1; + } +} + +static void send_start(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct dlm_header *hd; + struct member *memb; + int n_ints, len, *p, i; + char *buf; + + n_ints = 4 + cg->member_count; + len = sizeof(struct dlm_header) + (n_ints * sizeof(int)); + + buf = malloc(len); + if (!buf) { + return; + } + memset(buf, 0, len); + + hd = (struct dlm_header *)buf; + hd->type = DLM_MSG_START; + hd->msgdata = cg->seq; + + if (cg->we_joined) + hd->flags |= DLM_MFLG_JOINING; + + if (!ls->need_plocks) + hd->flags |= DLM_MFLG_HAVEPLOCK; + + p = (int *)(buf + sizeof(struct dlm_header)); + + /* sending all this stuff is probably unnecessary, but gives + us more certainty in matching stopped messages to the correct + change that they are for */ + + p[0] = cpu_to_le32(cg->member_count); + p[1] = cpu_to_le32(cg->joined_count); + p[2] = cpu_to_le32(cg->remove_count); + p[3] = cpu_to_le32(cg->failed_count); + + i = 4; + list_for_each_entry(memb, &cg->members, list) + p[i++] = cpu_to_le32(memb->nodeid); + + log_group(ls, "send_start %u flags %x counts %d %d %d %d", cg->seq, + hd->flags, cg->member_count, cg->joined_count, + cg->remove_count, cg->failed_count); + + dlm_send_message(ls, buf, len); + + free(buf); +} + +static int nodes_added(struct lockspace *ls) +{ + struct change *cg; + + list_for_each_entry(cg, &ls->changes, list) { + if (cg->joined_count) + return 1; + } + return 0; +} + +static void prepare_plocks(struct lockspace *ls) +{ + struct change *cg = list_first_entry(&ls->changes, struct change, list); + struct member *memb; + + if (!cfgd_enable_plock) + return; + + /* if we're the only node in the lockspace, then we are the ckpt_node + and we don't need plocks */ + + if (cg->member_count == 1) { + list_for_each_entry(memb, &cg->members, list) { + if (memb->nodeid != our_nodeid) { + log_error("prepare_plocks other member %d", + memb->nodeid); + } + } + ls->plock_ckpt_node = our_nodeid; + ls->need_plocks = 0; + return; + } + + /* the low node that indicated it had plock state in its last + start message is the ckpt_node */ + + set_plock_ckpt_node(ls); + + /* We save all plock messages from the time that the low node saves + existing plock state in the ckpt to the time that we read that state + from the ckpt. */ + + if (ls->need_plocks) { + ls->save_plocks = 1; + return; + } + + if (ls->plock_ckpt_node != our_nodeid) + return; + + /* At each start, a ckpt is written if there have been nodes added + since the last start/ckpt. If no nodes have been added, no one + does anything with ckpts. If the node that wrote the last ckpt + is no longer the ckpt_node, the new ckpt_node will unlink and + write a new one. If the node that wrote the last ckpt is still + the ckpt_node and no plock state has changed since the last ckpt, + it will just leave the old ckpt and not write a new one. + + A new ckpt_node will send a stored message even if it doesn't + write a ckpt because new nodes in the previous start may be + waiting to read the ckpt from the previous ckpt_node after ignoring + the previous stored message. They will read the ckpt from the + previous ckpt_node upon receiving the stored message from us. */ + + if (nodes_added(ls)) + store_plocks(ls); + send_plocks_stored(ls); +} + +static void apply_changes(struct lockspace *ls) +{ + struct change *cg; + + if (list_empty(&ls->changes)) + return; + cg = list_first_entry(&ls->changes, struct change, list); + + switch (cg->state) { + + case CGST_WAIT_CONDITIONS: + if (wait_conditions_done(ls)) { + send_start(ls); + cg->state = CGST_WAIT_MESSAGES; + } + break; + + case CGST_WAIT_MESSAGES: + if (wait_messages_done(ls)) { + start_kernel(ls); + prepare_plocks(ls); + cleanup_changes(ls); + } + break; + + default: + log_error("apply_changes invalid state %d", cg->state); + } +} + +void process_lockspace_changes(void) +{ + struct lockspace *ls, *safe; + + list_for_each_entry_safe(ls, safe, &lockspaces, list) { + if (!list_empty(&ls->changes)) + apply_changes(ls); + } +} + +static int add_change(struct lockspace *ls, + struct cpg_address *member_list, int member_list_entries, + struct cpg_address *left_list, int left_list_entries, + struct cpg_address *joined_list, int joined_list_entries, + struct change **cg_out) +{ + struct change *cg; + struct member *memb; + int i, error; + + cg = malloc(sizeof(struct change)); + if (!cg) + goto fail_nomem; + memset(cg, 0, sizeof(struct change)); + INIT_LIST_HEAD(&cg->members); + INIT_LIST_HEAD(&cg->removed); + cg->seq = ++ls->change_seq; + cg->state = CGST_WAIT_CONDITIONS; + + cg->member_count = member_list_entries; + cg->joined_count = joined_list_entries; + cg->remove_count = left_list_entries; + + for (i = 0; i < member_list_entries; i++) { + memb = malloc(sizeof(struct member)); + if (!memb) + goto fail_nomem; + memset(memb, 0, sizeof(struct member)); + memb->nodeid = member_list[i].nodeid; + list_add_tail(&memb->list, &cg->members); + } + + for (i = 0; i < left_list_entries; i++) { + memb = malloc(sizeof(struct member)); + if (!memb) + goto fail_nomem; + memset(memb, 0, sizeof(struct member)); + memb->nodeid = left_list[i].nodeid; + if (left_list[i].reason == CPG_REASON_NODEDOWN || + left_list[i].reason == CPG_REASON_PROCDOWN) { + memb->failed = 1; + cg->failed_count++; + } + list_add_tail(&memb->list, &cg->removed); + + if (memb->failed) + node_history_fail(ls, memb->nodeid); + else + node_history_left(ls, memb->nodeid); + + log_group(ls, "add_change %u nodeid %d remove reason %d", + cg->seq, memb->nodeid, left_list[i].reason); + } + + for (i = 0; i < joined_list_entries; i++) { + memb = find_memb(cg, joined_list[i].nodeid); + if (!memb) { + log_error("no member %d", joined_list[i].nodeid); + error = -ENOENT; + goto fail; + } + memb->added = 1; + + if (memb->nodeid == our_nodeid) + cg->we_joined = 1; + else + node_history_init(ls, memb->nodeid); + + log_group(ls, "add_change %u nodeid %d joined", cg->seq, + memb->nodeid); + } + + if (cg->we_joined) + list_for_each_entry(memb, &cg->members, list) + node_history_init(ls, memb->nodeid); + + log_group(ls, "add_change %u member %d joined %d remove %d failed %d", + cg->seq, cg->member_count, cg->joined_count, cg->remove_count, + cg->failed_count); + + list_add(&cg->list, &ls->changes); + *cg_out = cg; + return 0; + + fail_nomem: + log_error("no memory"); + error = -ENOMEM; + fail: + free_cg(cg); + return error; +} + +static int we_left(struct cpg_address *left_list, int left_list_entries) +{ + int i; + + for (i = 0; i < left_list_entries; i++) { + if (left_list[i].nodeid == our_nodeid) + return 1; + } + return 0; +} + +static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, + struct cpg_address *member_list, int member_list_entries, + struct cpg_address *left_list, int left_list_entries, + struct cpg_address *joined_list, int joined_list_entries) +{ + struct lockspace *ls; + struct change *cg; + struct member *memb; + int rv; + + ls = find_ls_handle(handle); + if (!ls) { + log_error("confchg_cb no lockspace for cpg %s", + group_name->value); + return; + } + + if (ls->leaving && we_left(left_list, left_list_entries)) { + /* we called cpg_leave(), and this should be the final + cpg callback we receive */ + log_group(ls, "confchg for our leave"); + stop_kernel(ls, 0); + set_configfs_members(ls->name, 0, NULL, 0, NULL); + set_sysfs_event_done(ls->name, 0); + cpg_finalize(ls->cpg_handle); + client_dead(ls->cpg_client); + purge_plocks(ls, our_nodeid, 1); + list_del(&ls->list); + free_ls(ls); + return; + } + + rv = add_change(ls, member_list, member_list_entries, + left_list, left_list_entries, + joined_list, joined_list_entries, &cg); + if (rv) + return; + + stop_kernel(ls, cg->seq); + + list_for_each_entry(memb, &cg->removed, list) + purge_plocks(ls, memb->nodeid, 0); + +#if 0 + /* deadlock code needs to adjust per a confchg, is this the right + way/place for this? */ + + deadlk_confchg(ls, member_list, member_list_entries, + left_list, left_list_entries, + joined_list, joined_list_entries); +#endif +} + +static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name, + uint32_t nodeid, uint32_t pid, void *data, int len) +{ + struct lockspace *ls; + struct dlm_header *hd; + + ls = find_ls_handle(handle); + if (!ls) { + log_error("deliver_cb no ls for cpg %s", group_name->value); + return; + } + + hd = (struct dlm_header *)data; + + hd->version[0] = le16_to_cpu(hd->version[0]); + hd->version[1] = le16_to_cpu(hd->version[1]); + hd->version[2] = le16_to_cpu(hd->version[2]); + hd->type = le16_to_cpu(hd->type); + hd->nodeid = le32_to_cpu(hd->nodeid); + hd->to_nodeid = le32_to_cpu(hd->to_nodeid); + hd->global_id = le32_to_cpu(hd->global_id); + hd->flags = le32_to_cpu(hd->flags); + hd->msgdata = le32_to_cpu(hd->msgdata); + + if (hd->version[0] != protocol_active[0]) { + log_error("reject message from %d version %u.%u.%u vs %u.%u.%u", + nodeid, hd->version[0], hd->version[1], + hd->version[2], protocol_active[0], + protocol_active[1], protocol_active[2]); + return; + } + + if (hd->nodeid != nodeid) { + log_error("bad msg nodeid %d %d", hd->nodeid, nodeid); + return; + } + + switch (hd->type) { + case DLM_MSG_START: + receive_start(ls, hd, len); + break; + + case DLM_MSG_PLOCK: + receive_plock(ls, hd, len); + break; + + case DLM_MSG_PLOCK_OWN: + receive_own(ls, hd, len); + break; + + case DLM_MSG_PLOCK_DROP: + receive_drop(ls, hd, len); + break; + + case DLM_MSG_PLOCK_SYNC_LOCK: + case DLM_MSG_PLOCK_SYNC_WAITER: + receive_sync(ls, hd, len); + break; + + case DLM_MSG_PLOCKS_STORED: + receive_plocks_stored(ls, hd, len); + break; + + case DLM_MSG_DEADLK_CYCLE_START: + receive_cycle_start(ls, hd, len); + break; + + case DLM_MSG_DEADLK_CYCLE_END: + receive_cycle_end(ls, hd, len); + break; + + case DLM_MSG_DEADLK_CHECKPOINT_READY: + receive_checkpoint_ready(ls, hd, len); + break; + + case DLM_MSG_DEADLK_CANCEL_LOCK: + receive_cancel_lock(ls, hd, len); + break; + + default: + log_error("unknown msg type %d", hd->type); + } +} + +static cpg_callbacks_t cpg_callbacks = { + .cpg_deliver_fn = deliver_cb, + .cpg_confchg_fn = confchg_cb, +}; + +void update_flow_control_status(void) +{ + cpg_flow_control_state_t flow_control_state; + cpg_error_t error; + + error = cpg_flow_control_state_get(daemon_handle, &flow_control_state); + if (error != CPG_OK) { + log_error("cpg_flow_control_state_get %d", error); + return; + } + + if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) { + if (message_flow_control_on == 0) { + log_debug("flow control on"); + } + message_flow_control_on = 1; + } else { + if (message_flow_control_on) { + log_debug("flow control off"); + } + message_flow_control_on = 0; + } +} + +static void process_lockspace_cpg(int ci) +{ + struct lockspace *ls; + cpg_error_t error; + + ls = find_ls_ci(ci); + if (!ls) { + log_error("process_lockspace_cpg no lockspace for ci %d", ci); + return; + } + + error = cpg_dispatch(ls->cpg_handle, CPG_DISPATCH_ALL); + if (error != CPG_OK) { + log_error("cpg_dispatch error %d", error); + return; + } + + apply_changes(ls); + + update_flow_control_status(); +} + +/* received an "online" uevent from dlm-kernel */ + +int dlm_join_lockspace(struct lockspace *ls) +{ + cpg_error_t error; + cpg_handle_t h; + struct cpg_name name; + int i = 0, fd, ci; + + error = cpg_initialize(&h, &cpg_callbacks); + if (error != CPG_OK) { + log_error("cpg_initialize error %d", error); + goto fail_free; + } + + cpg_fd_get(h, &fd); + + ci = client_add(fd, process_lockspace_cpg, NULL); + + list_add(&ls->list, &lockspaces); + + ls->cpg_handle = h; + ls->cpg_client = ci; + ls->cpg_fd = fd; + ls->kernel_stopped = 1; + ls->need_plocks = 1; + ls->joining = 1; + + memset(&name, 0, sizeof(name)); + sprintf(name.value, "dlm:%s", ls->name); + name.length = strlen(name.value) + 1; + + /* TODO: allow global_id to be set in cluster.conf? */ + ls->global_id = cpgname_to_crc(name.value, name.length); + + retry: + error = cpg_join(h, &name); + if (error == CPG_ERR_TRY_AGAIN) { + sleep(1); + if (!(++i % 10)) + log_error("cpg_join error retrying"); + goto retry; + } + if (error != CPG_OK) { + log_error("cpg_join error %d", error); + cpg_finalize(h); + goto fail; + } + + return 0; + + fail: + list_del(&ls->list); + client_dead(ci); + cpg_finalize(h); + fail_free: + free_ls(ls); + return error; +} + +/* received an "offline" uevent from dlm-kernel */ + +int dlm_leave_lockspace(struct lockspace *ls) +{ + cpg_error_t error; + struct cpg_name name; + int i = 0; + + ls->leaving = 1; + + memset(&name, 0, sizeof(name)); + sprintf(name.value, "dlm:%s", ls->name); + name.length = strlen(name.value) + 1; + + retry: + error = cpg_leave(ls->cpg_handle, &name); + if (error == CPG_ERR_TRY_AGAIN) { + sleep(1); + if (!(++i % 10)) + log_error("cpg_leave error retrying"); + goto retry; + } + if (error != CPG_OK) + log_error("cpg_leave error %d", error); + + return 0; +} + +int setup_cpg(void) +{ + cpg_error_t error; + + error = cpg_initialize(&daemon_handle, &cpg_callbacks); + if (error != CPG_OK) { + log_error("setup_cpg cpg_initialize error %d", error); + return -1; + } + + /* join "dlm_controld" cpg to interact with other daemons in + the cluster before we start processing uevents? Could this + also help in handling transient partitions? */ + + return 0; +} + diff --git a/gfs2/include/gfs2_disk_hash.h b/group/dlm_controld/crc.c similarity index 96% copy from gfs2/include/gfs2_disk_hash.h copy to group/dlm_controld/crc.c index 81e4196..cb486be 100644 --- a/gfs2/include/gfs2_disk_hash.h +++ b/group/dlm_controld/crc.c @@ -11,11 +11,9 @@ ******************************************************************************* ******************************************************************************/ -#ifndef __GFS2_DISK_HASH_DOT_H__ -#define __GFS2_DISK_HASH_DOT_H__ +#include "dlm_daemon.h" -static const uint32_t crc_32_tab[] = -{ +static const uint32_t crc_32_tab[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, @@ -51,6 +49,9 @@ static const uint32_t crc_32_tab[] = }; /** + * + * Copied from: + * * gfs2_disk_hash - hash an array of data * @data: the data to be hashed * @len: the length of data to be hashed @@ -70,7 +71,7 @@ static const uint32_t crc_32_tab[] = * Returns: the hash */ -uint32_t gfs2_disk_hash(const char *data, int len) +uint32_t cpgname_to_crc(const char *data, int len) { uint32_t hash = 0xFFFFFFFF; @@ -82,5 +83,3 @@ uint32_t gfs2_disk_hash(const char *data, int len) return hash; } -#endif - diff --git a/group/dlm_controld/deadlock.c b/group/dlm_controld/deadlock.c index f21beda..e9f7986 100644 --- a/group/dlm_controld/deadlock.c +++ b/group/dlm_controld/deadlock.c @@ -11,13 +11,9 @@ ******************************************************************************/ #include "dlm_daemon.h" +#include "config.h" #include "libdlm.h" -int deadlock_enabled = 0; - -extern struct list_head lockspaces; -extern int our_nodeid; - static SaCkptHandleT global_ckpt_h; static SaCkptCallbacksT callbacks = { 0, 0 }; static SaVersionT version = { 'B', 1, 1 }; @@ -96,26 +92,6 @@ struct trans { pointers */ }; -#define DLM_HEADER_MAJOR 1 -#define DLM_HEADER_MINOR 0 -#define DLM_HEADER_PATCH 0 - -#define DLM_MSG_CYCLE_START 1 -#define DLM_MSG_CYCLE_END 2 -#define DLM_MSG_CHECKPOINT_READY 3 -#define DLM_MSG_CANCEL_LOCK 4 - -struct dlm_header { - uint16_t version[3]; - uint16_t type; /* MSG_ */ - uint32_t nodeid; /* sender */ - uint32_t to_nodeid; /* 0 if to all */ - uint32_t global_id; - uint32_t lkid; - uint32_t pad; - char name[MAXNAME]; -}; - static const int __dlm_compat_matrix[8][8] = { /* UN NL CR CW PR PW EX PD */ {1, 1, 1, 1, 1, 1, 1, 0}, /* UN */ @@ -184,27 +160,11 @@ void setup_deadlock(void) { SaAisErrorT rv; - if (!deadlock_enabled) - return; - rv = saCkptInitialize(&global_ckpt_h, &callbacks, &version); if (rv != SA_AIS_OK) log_error("ckpt init error %d", rv); } -/* FIXME: use private data hooks into libcpg to save ls */ - -static struct lockspace *find_ls_by_handle(cpg_handle_t h) -{ - struct lockspace *ls; - - list_for_each_entry(ls, &lockspaces, list) { - if (ls->cpg_h == h) - return ls; - } - return NULL; -} - static struct dlm_rsb *get_resource(struct lockspace *ls, char *name, int len) { struct dlm_rsb *r; @@ -599,7 +559,7 @@ static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name) int ret = 0; int retries; - h = (SaCkptCheckpointHandleT) ls->lock_ckpt_handle; + h = (SaCkptCheckpointHandleT) ls->deadlk_ckpt_handle; log_group(ls, "unlink ckpt %llx", (unsigned long long)h); retries = 0; @@ -655,7 +615,7 @@ static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name) (unsigned long long)h, rv, ls->name); } out: - ls->lock_ckpt_handle = 0; + ls->deadlk_ckpt_handle = 0; return ret; } @@ -819,7 +779,7 @@ static void write_checkpoint(struct lockspace *ls) name.length = len; /* unlink an old checkpoint before we create a new one */ - if (ls->lock_ckpt_handle) { + if (ls->deadlk_ckpt_handle) { log_error("write_checkpoint: old ckpt"); if (_unlink_checkpoint(ls, &name)) return; @@ -880,7 +840,7 @@ static void write_checkpoint(struct lockspace *ls) log_group(ls, "write_checkpoint: open ckpt handle %llx", (unsigned long long)h); - ls->lock_ckpt_handle = (uint64_t) h; + ls->deadlk_ckpt_handle = (uint64_t) h; list_for_each_entry(r, &ls->resources, list) { memset(buf, 0, sizeof(buf)); @@ -918,34 +878,8 @@ static void write_checkpoint(struct lockspace *ls) } } -static int _send_message(cpg_handle_t h, void *buf, int len, int type) -{ - struct iovec iov; - cpg_error_t error; - int retries = 0; - - iov.iov_base = buf; - iov.iov_len = len; - retry: - error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1); - if (error == CPG_ERR_TRY_AGAIN) { - retries++; - usleep(1000); - if (!(retries % 100)) - log_error("cpg_mcast_joined retry %d", retries); - if (retries < 1000) - goto retry; - } - if (error != CPG_OK) { - log_error("cpg_mcast_joined error %d handle %llx", - (int)error, (unsigned long long)h); - disable_deadlock(); - return -1; - } - return 0; -} - -static void send_message(struct lockspace *ls, int type) +static void send_message(struct lockspace *ls, int type, + uint32_t to_nodeid, uint32_t msgdata) { struct dlm_header *hd; int len; @@ -961,16 +895,11 @@ static void send_message(struct lockspace *ls, int type) memset(buf, 0, len); hd = (struct dlm_header *)buf; - hd->version[0] = cpu_to_le16(DLM_HEADER_MAJOR); - hd->version[1] = cpu_to_le16(DLM_HEADER_MINOR); - hd->version[2] = cpu_to_le16(DLM_HEADER_PATCH); - hd->type = cpu_to_le16(type); - hd->nodeid = cpu_to_le32(our_nodeid); - hd->to_nodeid = 0; - hd->global_id = cpu_to_le32(ls->global_id); - memcpy(hd->name, ls->name, strlen(ls->name)); + hd->type = type; + hd->to_nodeid = to_nodeid; + hd->msgdata = msgdata; - _send_message(ls->cpg_h, buf, len, type); + dlm_send_message(ls, buf, len); free(buf); } @@ -978,43 +907,27 @@ static void send_message(struct lockspace *ls, int type) static void send_checkpoint_ready(struct lockspace *ls) { log_group(ls, "send_checkpoint_ready"); - send_message(ls, DLM_MSG_CHECKPOINT_READY); + send_message(ls, DLM_MSG_DEADLK_CHECKPOINT_READY, 0, 0); } void send_cycle_start(struct lockspace *ls) { - if (!deadlock_enabled) - return; log_group(ls, "send_cycle_start"); - send_message(ls, DLM_MSG_CYCLE_START); + send_message(ls, DLM_MSG_DEADLK_CYCLE_START, 0, 0); } -void send_cycle_end(struct lockspace *ls) +static void send_cycle_end(struct lockspace *ls) { - if (!deadlock_enabled) - return; log_group(ls, "send_cycle_end"); - send_message(ls, DLM_MSG_CYCLE_END); + send_message(ls, DLM_MSG_DEADLK_CYCLE_END, 0, 0); } static void send_cancel_lock(struct lockspace *ls, struct trans *tr, struct dlm_lkb *lkb) { - struct dlm_header *hd; - int len; - char *buf; int to_nodeid; uint32_t lkid; - len = sizeof(struct dlm_header); - buf = malloc(len); - if (!buf) { - log_error("send_message: no memory"); - disable_deadlock(); - return; - } - memset(buf, 0, len); - if (!lkb->lock.nodeid) lkid = lkb->lock.id; else @@ -1025,20 +938,7 @@ static void send_cancel_lock(struct lockspace *ls, struct trans *tr, to_nodeid, lkb->rsb->name, lkid, (unsigned long long)lkb->lock.xid); - hd = (struct dlm_header *)buf; - hd->version[0] = cpu_to_le16(DLM_HEADER_MAJOR); - hd->version[1] = cpu_to_le16(DLM_HEADER_MINOR); - hd->version[2] = cpu_to_le16(DLM_HEADER_PATCH); - hd->type = cpu_to_le16(DLM_MSG_CANCEL_LOCK); - hd->nodeid = cpu_to_le32(our_nodeid); - hd->to_nodeid = cpu_to_le32(to_nodeid); - hd->lkid = cpu_to_le32(lkid); - hd->global_id = cpu_to_le32(ls->global_id); - memcpy(hd->name, ls->name, strlen(ls->name)); - - _send_message(ls->cpg_h, buf, len, DLM_MSG_CANCEL_LOCK); - - free(buf); + send_message(ls, DLM_MSG_DEADLK_CANCEL_LOCK, to_nodeid, lkid); } static void dump_resources(struct lockspace *ls) @@ -1075,7 +975,7 @@ static void run_deadlock(struct lockspace *ls) if (ls->all_checkpoints_ready) log_group(ls, "WARNING: run_deadlock all_checkpoints_ready"); - list_for_each_entry(node, &ls->nodes, list) { + list_for_each_entry(node, &ls->deadlk_nodes, list) { if (!node->in_cycle) continue; if (!node->checkpoint_ready) @@ -1089,13 +989,13 @@ static void run_deadlock(struct lockspace *ls) ls->all_checkpoints_ready = 1; - list_for_each_entry(node, &ls->nodes, list) { + list_for_each_entry(node, &ls->deadlk_nodes, list) { if (!node->in_cycle) continue; if (node->nodeid < low || low == -1) low = node->nodeid; } - ls->low_nodeid = low; + ls->deadlk_low_nodeid = low; if (low == our_nodeid) find_deadlock(ls); @@ -1103,15 +1003,17 @@ static void run_deadlock(struct lockspace *ls) log_group(ls, "defer resolution to low nodeid %d", low); } -static void receive_checkpoint_ready(struct lockspace *ls, int nodeid) +void receive_checkpoint_ready(struct lockspace *ls, struct dlm_header *hd, + int len) { struct node *node; + int nodeid = hd->nodeid; log_group(ls, "receive_checkpoint_ready from %d", nodeid); read_checkpoint(ls, nodeid); - list_for_each_entry(node, &ls->nodes, list) { + list_for_each_entry(node, &ls->deadlk_nodes, list) { if (node->nodeid == nodeid) { node->checkpoint_ready = 1; break; @@ -1121,9 +1023,10 @@ static void receive_checkpoint_ready(struct lockspace *ls, int nodeid) run_deadlock(ls); } -static void receive_cycle_start(struct lockspace *ls, int nodeid) +void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len) { struct node *node; + int nodeid = hd->nodeid; int rv; log_group(ls, "receive_cycle_start from %d", nodeid); @@ -1135,7 +1038,7 @@ static void receive_cycle_start(struct lockspace *ls, int nodeid) ls->cycle_running = 1; gettimeofday(&ls->cycle_start_time, NULL); - list_for_each_entry(node, &ls->nodes, list) + list_for_each_entry(node, &ls->deadlk_nodes, list) node->in_cycle = 1; rv = read_debugfs_locks(ls); @@ -1166,9 +1069,10 @@ static uint64_t dt_usec(struct timeval *start, struct timeval *stop) /* TODO: nodes added during a cycle - what will they do with messages they recv from other nodes running the cycle? */ -static void receive_cycle_end(struct lockspace *ls, int nodeid) +void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len) { struct node *node; + int nodeid = hd->nodeid; uint64_t usec; if (!ls->cycle_running) { @@ -1185,7 +1089,7 @@ static void receive_cycle_end(struct lockspace *ls, int nodeid) ls->cycle_running = 0; ls->all_checkpoints_ready = 0; - list_for_each_entry(node, &ls->nodes, list) + list_for_each_entry(node, &ls->deadlk_nodes, list) node->checkpoint_ready = 0; free_resources(ls); @@ -1193,9 +1097,11 @@ static void receive_cycle_end(struct lockspace *ls, int nodeid) unlink_checkpoint(ls); } -static void receive_cancel_lock(struct lockspace *ls, int nodeid, uint32_t lkid) +void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len) { dlm_lshandle_t h; + int nodeid = hd->nodeid; + uint32_t lkid = hd->msgdata; int rv; if (nodeid != our_nodeid) @@ -1219,51 +1125,6 @@ static void receive_cancel_lock(struct lockspace *ls, int nodeid, uint32_t lkid) dlm_close_lockspace(h); } -static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name, - uint32_t nodeid, uint32_t pid, void *data, int data_len) -{ - struct lockspace *ls; - struct dlm_header *hd; - - ls = find_ls_by_handle(handle); - if (!ls) - return; - - hd = (struct dlm_header *) data; - - hd->version[0] = le16_to_cpu(hd->version[0]); - hd->version[1] = le16_to_cpu(hd->version[1]); - hd->version[2] = le16_to_cpu(hd->version[2]); - hd->type = le16_to_cpu(hd->type); - hd->nodeid = le32_to_cpu(hd->nodeid); - hd->to_nodeid = le32_to_cpu(hd->to_nodeid); - hd->global_id = le32_to_cpu(hd->global_id); - - if (hd->version[0] != DLM_HEADER_MAJOR) { - log_error("reject message version %u.%u.%u", - hd->version[0], hd->version[1], hd->version[2]); - return; - } - - switch (hd->type) { - case DLM_MSG_CYCLE_START: - receive_cycle_start(ls, hd->nodeid); - break; - case DLM_MSG_CYCLE_END: - receive_cycle_end(ls, hd->nodeid); - break; - case DLM_MSG_CHECKPOINT_READY: - receive_checkpoint_ready(ls, hd->nodeid); - break; - case DLM_MSG_CANCEL_LOCK: - receive_cancel_lock(ls, hd->nodeid, hd->lkid); - break; - default: - log_error("unknown message type %d from %d", - hd->type, hd->nodeid); - } -} - static void node_joined(struct lockspace *ls, int nodeid) { struct node *node; @@ -1276,7 +1137,7 @@ static void node_joined(struct lockspace *ls, int nodeid) } memset(node, 0, sizeof(struct node)); node->nodeid = nodeid; - list_add_tail(&node->list, &ls->nodes); + list_add_tail(&node->list, &ls->deadlk_nodes); log_group(ls, "node %d joined deadlock cpg", nodeid); } @@ -1284,7 +1145,7 @@ static void node_left(struct lockspace *ls, int nodeid, int reason) { struct node *node, *safe; - list_for_each_entry_safe(node, safe, &ls->nodes, list) { + list_for_each_entry_safe(node, safe, &ls->deadlk_nodes, list) { if (node->nodeid != nodeid) continue; @@ -1296,20 +1157,15 @@ static void node_left(struct lockspace *ls, int nodeid, int reason) static void purge_locks(struct lockspace *ls, int nodeid); -static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, +static void deadlk_confchg(struct lockspace *ls, struct cpg_address *member_list, int member_list_entries, struct cpg_address *left_list, int left_list_entries, struct cpg_address *joined_list, int joined_list_entries) { - struct lockspace *ls; int i; - ls = find_ls_by_handle(handle); - if (!ls) - return; - - if (!ls->got_first_confchg) { - ls->got_first_confchg = 1; + if (!ls->deadlk_confchg_init) { + ls->deadlk_confchg_init = 1; for (i = 0; i < member_list_entries; i++) node_joined(ls, member_list[i].nodeid); return; @@ -1339,7 +1195,7 @@ static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, purge_locks(ls, left_list[i].nodeid); for (i = 0; i < left_list_entries; i++) { - if (left_list[i].nodeid != ls->low_nodeid) + if (left_list[i].nodeid != ls->deadlk_low_nodeid) continue; /* this will set a new low node which will call find_deadlock */ run_deadlock(ls); @@ -1347,112 +1203,6 @@ static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, } } -static void process_deadlock_cpg(int ci) -{ - struct lockspace *ls; - cpg_error_t error; - - ls = get_client_lockspace(ci); - if (!ls) - return; - - error = cpg_dispatch(ls->cpg_h, CPG_DISPATCH_ONE); - if (error != CPG_OK) - log_error("cpg_dispatch error %d", error); -} - -cpg_callbacks_t ls_callbacks = { - .cpg_deliver_fn = deliver_cb, - .cpg_confchg_fn = confchg_cb, -}; - -static void make_cpgname(struct lockspace *ls, struct cpg_name *cn) -{ - char name[MAXNAME+8]; - - memset(name, 0, sizeof(name)); - strncpy(name, ls->name, sizeof(name)); - strncat(name, "_deadlk", 7); - memset(cn, 0, sizeof(struct cpg_name)); - strncpy(cn->value, name, strlen(name) + 1); - cn->length = strlen(name) + 1; -} - -void join_deadlock_cpg(struct lockspace *ls) -{ - cpg_handle_t h; - struct cpg_name cpgname; - cpg_error_t error; - int retries = 0; - int fd, ci; - - if (!deadlock_enabled) - return; - - unlink_checkpoint(ls); /* not sure about this */ - - error = cpg_initialize(&h, &ls_callbacks); - if (error != CPG_OK) { - log_error("cpg_initialize error %d", error); - return; - } - - cpg_fd_get(h, &fd); - if (fd < 0) { - log_error("cpg_fd_get error %d", error); - return; - } - - ci = client_add(fd, process_deadlock_cpg, NULL); - - make_cpgname(ls, &cpgname); - - retry: - error = cpg_join(h, &cpgname); - if (error == CPG_ERR_TRY_AGAIN) { - sleep(1); - if (retries++ < 10) - goto retry; - } - if (error != CPG_OK) { - log_error("deadlk cpg join error %d", error); - goto fail; - } - - ls->cpg_h = h; - ls->cpg_ci = ci; - set_client_lockspace(ci, ls); - log_group(ls, "deadlk cpg ci %d fd %d", ci, fd); - return; - fail: - cpg_finalize(h); - client_dead(ci); -} - -void leave_deadlock_cpg(struct lockspace *ls) -{ - struct cpg_name cpgname; - cpg_error_t error; - int retries = 0; - - if (!deadlock_enabled) - return; - - make_cpgname(ls, &cpgname); - retry: - error = cpg_leave(ls->cpg_h, &cpgname); - if (error == CPG_ERR_TRY_AGAIN) { - sleep(1); - if (retries++ < 10) - goto retry; - } - if (error != CPG_OK) - log_error("deadlk cpg leave error %d", error); - - cpg_finalize(ls->cpg_h); - client_dead(ls->cpg_ci); -} - /* would we ever call this after we've created the transaction lists? I don't think so; I think it can only be called between reading checkpoints */ diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index c164a81..d5657dd 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,6 @@ #include "dlm_controld.h" #include "list.h" #include "linux_endian.h" -#include "libgroup.h" #define MAXARGS 8 #define MAXLINE 256 @@ -57,16 +57,38 @@ #define MAXNAME 255 #define MAX_NODES 256 /* should be same as MAX_GROUP_MEMBERS */ #define MAX_NODE_ADDRESSES 4 +#define DUMP_SIZE (1024 * 1024) -extern char *prog_name; extern int daemon_debug_opt; -extern int kernel_debug_opt; +extern int daemon_quit; +extern int poll_fencing; +extern int poll_quorum; +extern int poll_fs; +extern int poll_ignore_plock; +extern int plock_fd; +extern int plock_ci; +extern struct list_head lockspaces; +extern int our_nodeid; extern char daemon_debug_buf[256]; +extern char dump_buf[DUMP_SIZE]; +extern int dump_point; +extern int dump_wrap; + +void daemon_dump_save(void); #define log_debug(fmt, args...) \ do { \ snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \ if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \ + daemon_dump_save(); \ +} while (0) + +#define log_group(ls, fmt, args...) \ +do { \ + snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \ + (ls)->name, ##args); \ + if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \ + daemon_dump_save(); \ } while (0) #define log_error(fmt, args...) \ @@ -75,73 +97,166 @@ do { \ syslog(LOG_ERR, fmt, ##args); \ } while (0) -#define log_group(ls, fmt, args...) \ +#define log_plock(ls, fmt, args...) \ do { \ snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \ (ls)->name, ##args); \ - if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \ + if (daemon_debug_opt && cfgd_plock_debug) fprintf(stderr, "%s", daemon_debug_buf); \ } while (0) +/* dlm_header types */ +enum { + DLM_MSG_START = 1, + DLM_MSG_PLOCK, + DLM_MSG_PLOCK_OWN, + DLM_MSG_PLOCK_DROP, + DLM_MSG_PLOCK_SYNC_LOCK, + DLM_MSG_PLOCK_SYNC_WAITER, + DLM_MSG_PLOCKS_STORED, + DLM_MSG_DEADLK_CYCLE_START, + DLM_MSG_DEADLK_CYCLE_END, + DLM_MSG_DEADLK_CHECKPOINT_READY, + DLM_MSG_DEADLK_CANCEL_LOCK +}; + +/* dlm_header flags */ +#define DLM_MFLG_JOINING 1 /* accompanies start, we are joining */ +#define DLM_MFLG_HAVEPLOCK 2 /* accompanies start, we have plock state */ + +struct dlm_header { + uint16_t version[3]; + uint16_t type; /* DLM_MSG_ */ + uint32_t nodeid; /* sender */ + uint32_t to_nodeid; /* recipient, 0 for all */ + uint32_t global_id; /* global unique id for this lockspace */ + uint32_t flags; /* DLM_MFLG_ */ + uint32_t msgdata; /* in-header payload depends on MSG type; lkid + for deadlock, seq for lockspace membership */ + uint32_t pad1; + uint64_t pad2; +}; struct lockspace { struct list_head list; char name[MAXNAME+1]; uint32_t global_id; - int low_nodeid; + + /* lockspace membership stuff */ + + cpg_handle_t cpg_handle; + int cpg_client; + int cpg_fd; int joining; - int cpg_ci; - cpg_handle_t cpg_h; - SaCkptCheckpointHandleT lock_ckpt_handle; + int leaving; + int kernel_stopped; + uint32_t change_seq; + struct change *started_change; + struct list_head changes; + struct list_head node_history; + + /* plock stuff */ + + int plock_ckpt_node; + int need_plocks; + int save_plocks; + uint32_t associated_mg_id; + struct list_head saved_messages; + struct list_head plock_resources; + time_t last_checkpoint_time; + time_t last_plock_time; + struct timeval drop_resources_last; + uint64_t plock_ckpt_handle; + + /* deadlock stuff */ + + int deadlk_low_nodeid; + struct list_head deadlk_nodes; + uint64_t deadlk_ckpt_handle; + int deadlk_confchg_init; struct list_head transactions; struct list_head resources; - struct list_head nodes; struct timeval cycle_start_time; struct timeval cycle_end_time; struct timeval last_send_cycle_start; - int got_first_confchg; int cycle_running; int all_checkpoints_ready; }; /* action.c */ -int set_control(char *name, int val); -int set_event_done(char *name, int val); +void set_associated_id(uint32_t mg_id); +int set_sysfs_control(char *name, int val); +int set_sysfs_event_done(char *name, int val); +int set_sysfs_id(char *name, uint32_t id); +int set_configfs_members(char *name, int new_count, int *new_members, + int renew_count, int *renew_members); +void clear_configfs(void); int add_configfs_node(int nodeid, char *addr, int addrlen, int local); void del_configfs_node(int nodeid); -void clear_configfs(void); -int set_members(char *name, int new_count, int *new_members); -int set_id(char *name, uint32_t id); -void set_ccs_options(void); -int do_read(int fd, void *buf, size_t count); -int do_write(int fd, void *buf, size_t count); +int set_configfs_protocol(int proto); +int set_configfs_timewarn(int cs); +int set_configfs_debug(int val); -/* member_xxx.c */ -int setup_member(void); -void process_member(int ci); -char *nodeid2name(int nodeid); +/* cpg.c */ +int setup_cpg(void); +void process_lockspace_changes(void); +void dlm_send_message(struct lockspace *ls, char *buf, int len); +int dlm_join_lockspace(struct lockspace *ls); +int dlm_leave_lockspace(struct lockspace *ls); +char *msg_name(int type); +void update_flow_control_status(void); -/* group.c */ -int setup_groupd(void); -void process_groupd(int ci); +/* deadlock.c */ +void setup_deadlock(void); +void send_cycle_start(struct lockspace *ls); +void receive_checkpoint_ready(struct lockspace *ls, struct dlm_header *hd, + int len); +void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len); +void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len); +void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len); /* main.c */ -int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci)); +int do_read(int fd, void *buf, size_t count); +int do_write(int fd, void *buf, size_t count); void client_dead(int ci); -void set_client_lockspace(int ci, struct lockspace *ls); -struct lockspace *get_client_lockspace(int ci); -struct lockspace *create_ls(char *name); +int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci)); +int client_fd(int ci); +void client_ignore(int ci, int fd); +void client_back(int ci, int fd); struct lockspace *find_ls(char *name); +struct lockspace *find_ls_id(uint32_t id); char *dlm_mode_str(int mode); /* member_cman.c */ -int is_cman_member(int nodeid); +int setup_cman(void); +void process_cman(int ci); void cman_statechange(void); +int is_cman_member(int nodeid); +char *nodeid2name(int nodeid); -/* deadlock.c */ -void setup_deadlock(void); -void join_deadlock_cpg(struct lockspace *ls); -void leave_deadlock_cpg(struct lockspace *ls); -void send_cycle_start(struct lockspace *ls); +/* netlink.c */ +int setup_netlink(void); +void process_netlink(int ci); + +/* plock.c */ +int setup_plocks(void); +void process_plocks(int ci); +int limit_plocks(void); +void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len); +void receive_own(struct lockspace *ls, struct dlm_header *hd, int len); +void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len); +void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len); +void process_saved_plocks(struct lockspace *ls); +void close_plock_checkpoint(struct lockspace *ls); +void store_plocks(struct lockspace *ls); +void retrieve_plocks(struct lockspace *ls); +void purge_plocks(struct lockspace *ls, int nodeid, int unmount); +int dump_plocks(char *name, int fd); + +/* group.c */ +int setup_groupd(void); +void process_groupd(int ci); +int dlm_join_lockspace_group(struct lockspace *ls); +int dlm_leave_lockspace_group(struct lockspace *ls); #endif diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c index 2e5b4e6..8dc68a1 100644 --- a/group/dlm_controld/group.c +++ b/group/dlm_controld/group.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -11,6 +11,7 @@ ******************************************************************************/ #include "dlm_daemon.h" +#include "libgroup.h" #define DO_STOP 1 #define DO_START 2 @@ -84,7 +85,7 @@ group_callbacks_t callbacks = { setid_cbfn }; -char *str_members(void) +static char *str_members(void) { static char str_members_buf[MAXLINE]; int i, ret, pos = 0, len = MAXLINE; @@ -127,7 +128,7 @@ void process_groupd(int ci) switch (cb_action) { case DO_STOP: log_debug("groupd callback: stop %s", cb_name); - set_control(cb_name, 0); + set_sysfs_control(cb_name, 0); group_stop_done(gh, cb_name); break; @@ -135,12 +136,13 @@ void process_groupd(int ci) log_debug("groupd callback: start %s count %d members %s", cb_name, cb_member_count, str_members()); - set_members(cb_name, cb_member_count, cb_members); + set_configfs_members(cb_name, cb_member_count, cb_members, + 0, NULL); /* this causes the dlm to do a "start" using the members we just set */ - set_control(cb_name, 1); + set_sysfs_control(cb_name, 1); /* the dlm doesn't need/use a "finish" stage following start, so we can just do start_done immediately */ @@ -155,14 +157,13 @@ void process_groupd(int ci) /* this causes the dlm_new_lockspace() call (typically from mount) to complete */ - set_event_done(cb_name, 0); + set_sysfs_event_done(cb_name, 0); - join_deadlock_cpg(ls); break; case DO_SETID: log_debug("groupd callback: set_id %s %x", cb_name, cb_id); - set_id(cb_name, cb_id); + set_sysfs_id(cb_name, cb_id); ls->global_id = cb_id; break; @@ -178,11 +179,10 @@ void process_groupd(int ci) log_debug("leave event done %s", cb_name); /* remove everything under configfs */ - set_members(cb_name, 0, NULL); + set_configfs_members(ls->name, 0, NULL, 0, NULL); } - set_event_done(cb_name, val); - leave_deadlock_cpg(ls); + set_sysfs_event_done(cb_name, val); list_del(&ls->list); free(ls); break; @@ -200,6 +200,29 @@ void process_groupd(int ci) return; } +int dlm_join_lockspace_group(struct lockspace *ls) +{ + int rv; + + ls->joining = 1; + list_add(&ls->list, &lockspaces); + + rv = group_join(gh, ls->name); + if (rv) { + list_del(&ls->list); + free(ls); + } + + return rv; +} + +int dlm_leave_lockspace_group(struct lockspace *ls) +{ + ls->leaving = 1; + group_leave(gh, ls->name); + return 0; +} + int setup_groupd(void) { int rv; diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index a83eea0..0e4bc15 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -11,29 +11,22 @@ ******************************************************************************/ #include "dlm_daemon.h" - +#include "config.h" +#include #include #include -#include #include -#define OPTION_STRING "KDhVd:" -#define LOCKFILE_NAME "/var/run/dlm_controld.pid" - -#define DEADLOCK_CHECK_SECS 10 - -#define NALLOC 16 - -struct list_head lockspaces; - -extern group_handle_t gh; -extern int deadlock_enabled; +#define LOCKFILE_NAME "/var/run/dlm_controld.pid" +#define CLIENT_NALLOC 32 +#define GROUP_LIBGROUP 2 +#define GROUP_LIBCPG 3 -static int daemon_quit; static int client_maxi; static int client_size = 0; static struct client *client = NULL; static struct pollfd *pollfd = NULL; +static int group_mode; struct client { int fd; @@ -42,17 +35,72 @@ struct client { struct lockspace *ls; }; +int do_read(int fd, void *buf, size_t count) +{ + int rv, off = 0; + + while (off < count) { + rv = read(fd, buf + off, count - off); + if (rv == 0) + return -1; + if (rv == -1 && errno == EINTR) + continue; + if (rv == -1) + return -1; + off += rv; + } + return 0; +} + +int do_write(int fd, void *buf, size_t count) +{ + int rv, off = 0; + + retry: + rv = write(fd, buf + off, count); + if (rv == -1 && errno == EINTR) + goto retry; + if (rv < 0) { + log_error("write errno %d", errno); + return rv; + } + + if (rv != count) { + count -= rv; + off += rv; + goto retry; + } + return 0; +} + +static void do_dump(int fd) +{ + int len; + + if (dump_wrap) { + len = DUMP_SIZE - dump_point; + do_write(fd, dump_buf + dump_point, len); + len = dump_point; + } else + len = dump_point; + + /* NUL terminate the debug string */ + dump_buf[dump_point] = '\0'; + + do_write(fd, dump_buf, len); +} + static void client_alloc(void) { int i; if (!client) { - client = malloc(NALLOC * sizeof(struct client)); - pollfd = malloc(NALLOC * sizeof(struct pollfd)); + client = malloc(CLIENT_NALLOC * sizeof(struct client)); + pollfd = malloc(CLIENT_NALLOC * sizeof(struct pollfd)); } else { - client = realloc(client, (client_size + NALLOC) * + client = realloc(client, (client_size + CLIENT_NALLOC) * sizeof(struct client)); - pollfd = realloc(pollfd, (client_size + NALLOC) * + pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) * sizeof(struct pollfd)); if (!pollfd) log_error("can't alloc for pollfd"); @@ -60,14 +108,14 @@ static void client_alloc(void) if (!client || !pollfd) log_error("can't alloc for client array"); - for (i = client_size; i < client_size + NALLOC; i++) { + for (i = client_size; i < client_size + CLIENT_NALLOC; i++) { client[i].workfn = NULL; client[i].deadfn = NULL; client[i].fd = -1; pollfd[i].fd = -1; pollfd[i].revents = 0; } - client_size += NALLOC; + client_size += CLIENT_NALLOC; } void client_dead(int ci) @@ -105,14 +153,21 @@ int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci)) goto again; } -void set_client_lockspace(int ci, struct lockspace *ls) +int client_fd(int ci) { - client[ci].ls = ls; + return client[ci].fd; } -struct lockspace *get_client_lockspace(int ci) +void client_ignore(int ci, int fd) { - return client[ci].ls; + pollfd[ci].fd = -1; + pollfd[ci].events = 0; +} + +void client_back(int ci, int fd) +{ + pollfd[ci].fd = fd; + pollfd[ci].events = POLLIN; } static void sigterm_handler(int sig) @@ -120,7 +175,7 @@ static void sigterm_handler(int sig) daemon_quit = 1; } -struct lockspace *create_ls(char *name) +static struct lockspace *create_ls(char *name) { struct lockspace *ls; @@ -129,9 +184,14 @@ struct lockspace *create_ls(char *name) goto out; memset(ls, 0, sizeof(*ls)); strncpy(ls->name, name, MAXNAME); + + INIT_LIST_HEAD(&ls->changes); + INIT_LIST_HEAD(&ls->node_history); + INIT_LIST_HEAD(&ls->saved_messages); + INIT_LIST_HEAD(&ls->plock_resources); + INIT_LIST_HEAD(&ls->deadlk_nodes); INIT_LIST_HEAD(&ls->transactions); INIT_LIST_HEAD(&ls->resources); - INIT_LIST_HEAD(&ls->nodes); out: return ls; } @@ -231,7 +291,7 @@ static void process_uevent(int ci) return; if (rv < 0) { log_error("uevent recv error %d errno %d", rv, errno); - goto out; + return; } if (!strstr(buf, "dlm")) @@ -250,6 +310,8 @@ static void process_uevent(int ci) log_debug("kernel: %s %s", act, argv[3]); + rv = 0; + if (!strcmp(act, "online@")) { ls = find_ls(argv[3]); if (ls) { @@ -263,10 +325,14 @@ static void process_uevent(int ci) goto out; } - ls->joining = 1; - list_add(&ls->list, &lockspaces); - - rv = group_join(gh, argv[3]); + if (group_mode == GROUP_LIBGROUP) + rv = dlm_join_lockspace_group(ls); + else + rv = dlm_join_lockspace(ls); + if (rv) { + /* ls already freed */ + goto out; + } } else if (!strcmp(act, "offline@")) { ls = find_ls(argv[3]); @@ -275,9 +341,11 @@ static void process_uevent(int ci) goto out; } - rv = group_leave(gh, argv[3]); - } else - rv = 0; + if (group_mode == GROUP_LIBGROUP) + dlm_leave_lockspace_group(ls); + else + dlm_leave_lockspace(ls); + } out: if (rv < 0) log_error("process_uevent %s error %d errno %d", @@ -310,216 +378,7 @@ static int setup_uevent(void) return s; } -/* FIXME: look into using libnl/libnetlink */ - -#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN)) -#define GENLMSG_PAYLOAD(glh) (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN) -#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN)) -#define NLA_PAYLOAD(len) (len - NLA_HDRLEN) - -/* Maximum size of response requested or message sent */ -#define MAX_MSG_SIZE 1024 - -struct msgtemplate { - struct nlmsghdr n; - struct genlmsghdr g; - char buf[MAX_MSG_SIZE]; -}; - -static int send_genetlink_cmd(int sd, uint16_t nlmsg_type, uint32_t nlmsg_pid, - uint8_t genl_cmd, uint16_t nla_type, - void *nla_data, int nla_len) -{ - struct nlattr *na; - struct sockaddr_nl nladdr; - int r, buflen; - char *buf; - - struct msgtemplate msg; - - msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); - msg.n.nlmsg_type = nlmsg_type; - msg.n.nlmsg_flags = NLM_F_REQUEST; - msg.n.nlmsg_seq = 0; - msg.n.nlmsg_pid = nlmsg_pid; - msg.g.cmd = genl_cmd; - msg.g.version = 0x1; - na = (struct nlattr *) GENLMSG_DATA(&msg); - na->nla_type = nla_type; - na->nla_len = nla_len + 1 + NLA_HDRLEN; - if (nla_data) - memcpy(NLA_DATA(na), nla_data, nla_len); - msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); - - buf = (char *) &msg; - buflen = msg.n.nlmsg_len ; - memset(&nladdr, 0, sizeof(nladdr)); - nladdr.nl_family = AF_NETLINK; - while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr, - sizeof(nladdr))) < buflen) { - if (r > 0) { - buf += r; - buflen -= r; - } else if (errno != EAGAIN) - return -1; - } - return 0; -} - -/* - * Probe the controller in genetlink to find the family id - * for the DLM family - */ -static int get_family_id(int sd) -{ - char genl_name[100]; - struct { - struct nlmsghdr n; - struct genlmsghdr g; - char buf[256]; - } ans; - - int id, rc; - struct nlattr *na; - int rep_len; - - strcpy(genl_name, DLM_GENL_NAME); - rc = send_genetlink_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY, - CTRL_ATTR_FAMILY_NAME, (void *)genl_name, - strlen(DLM_GENL_NAME)+1); - - rep_len = recv(sd, &ans, sizeof(ans), 0); - if (ans.n.nlmsg_type == NLMSG_ERROR || - (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len)) - return 0; - - na = (struct nlattr *) GENLMSG_DATA(&ans); - na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len)); - if (na->nla_type == CTRL_ATTR_FAMILY_ID) { - id = *(uint16_t *) NLA_DATA(na); - } - return id; -} - -/* genetlink messages are timewarnings used as part of deadlock detection */ - -static int setup_netlink(void) -{ - struct sockaddr_nl snl; - int s, rv; - uint16_t id; - - s = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); - if (s < 0) { - log_error("generic netlink socket"); - return s; - } - - memset(&snl, 0, sizeof(snl)); - snl.nl_family = AF_NETLINK; - - rv = bind(s, (struct sockaddr *) &snl, sizeof(snl)); - if (rv < 0) { - log_error("gen netlink bind error %d errno %d", rv, errno); - close(s); - return rv; - } - - id = get_family_id(s); - if (!id) { - log_error("Error getting family id, errno %d", errno); - close(s); - return -1; - } - - rv = send_genetlink_cmd(s, id, getpid(), DLM_CMD_HELLO, 0, NULL, 0); - if (rv < 0) { - log_error("error sending hello cmd, errno %d", errno); - close(s); - return -1; - } - - return s; -} - -static void process_timewarn(struct dlm_lock_data *data) -{ - struct lockspace *ls; - struct timeval now; - unsigned int sec; - - ls = find_ls_id(data->lockspace_id); - if (!ls) - return; - - data->resource_name[data->resource_namelen] = '\0'; - - log_group(ls, "timewarn: lkid %x pid %d name %s", - data->id, data->ownpid, data->resource_name); - - /* Problem: we don't want to get a timewarn, assume it's resolved - by the current cycle, but in fact it's from a deadlock that - formed after the checkpoints for the current cycle. Then we'd - have to hope for another warning (that may not come) to trigger - a new cycle to catch the deadlock. If our last cycle ckpt - was say N (~5?) sec before we receive the timewarn, then we - can be confident that the cycle included the lock in question. - Otherwise, we're not sure if the warning is for a new deadlock - that's formed since our last cycle ckpt (unless it's a long - enough time since the last cycle that we're confident it *is* - a new deadlock). When there is a deadlock, I suspect it will - be common to receive warnings before, during, and possibly - after the cycle that resolves it. Wonder if we should record - timewarns and match them with deadlock cycles so we can tell - which timewarns are addressed by a given cycle and which aren't. */ - - - gettimeofday(&now, NULL); - - /* don't send a new start until at least SECS after the last - we sent, and at least SECS after the last completed cycle */ - - sec = now.tv_sec - ls->last_send_cycle_start.tv_sec; - - if (sec < DEADLOCK_CHECK_SECS) { - log_group(ls, "skip send: recent send cycle %d sec", sec); - return; - } - - sec = now.tv_sec - ls->cycle_end_time.tv_sec; - - if (sec < DEADLOCK_CHECK_SECS) { - log_group(ls, "skip send: recent cycle end %d sec", sec); - return; - } - - gettimeofday(&ls->last_send_cycle_start, NULL); - send_cycle_start(ls); -} - -static void process_netlink(int ci) -{ - struct msgtemplate msg; - struct nlattr *na; - int len; - - len = recv(client[ci].fd, &msg, sizeof(msg), 0); - - if (len < 0) { - log_error("nonfatal netlink error: errno %d", errno); - return; - } - - if (msg.n.nlmsg_type == NLMSG_ERROR || !NLMSG_OK((&msg.n), len)) { - struct nlmsgerr *err = NLMSG_DATA(&msg); - log_error("fatal netlink error: errno %d", err->error); - return; - } - - na = (struct nlattr *) GENLMSG_DATA(&msg); - - process_timewarn((struct dlm_lock_data *) NLA_DATA(na)); -} +/* FIXME: use a library? Add ability to list lockspaces and their state. */ static void process_connection(int ci) { @@ -548,6 +407,12 @@ static void process_connection(int ci) send_cycle_start(ls); else log_debug("deadlock_check ls name not found"); + } else if (!strncmp(argv[0], "dump", 4)) { + do_dump(client[ci].fd); + client_dead(ci); + } else if (!strncmp(argv[0], "plocks", 6)) { + dump_plocks(argv[1], client[ci].fd); + client_dead(ci); } } @@ -601,7 +466,7 @@ static int setup_listener(void) return s; } -void cluster_dead(int ci) +static void cluster_dead(int ci) { log_error("cluster is down, exiting"); clear_configfs(); @@ -610,6 +475,7 @@ void cluster_dead(int ci) static int loop(void) { + int poll_timeout = -1; int rv, i; void (*workfn) (int ci); void (*deadfn) (int ci); @@ -619,34 +485,76 @@ static int loop(void) goto out; client_add(rv, process_listener, NULL); - rv = setup_groupd(); - if (rv < 0) - goto out; - client_add(rv, process_groupd, cluster_dead); - rv = setup_uevent(); if (rv < 0) goto out; client_add(rv, process_uevent, NULL); - rv = setup_member(); + rv = setup_cman(); if (rv < 0) goto out; - client_add(rv, process_member, cluster_dead); + client_add(rv, process_cman, cluster_dead); - /* netlink stuff is only used for deadlock detection */ - if (!deadlock_enabled) - goto for_loop; + group_mode = GROUP_LIBCPG; - rv = setup_netlink(); - if (rv < 0) - goto for_loop; - client_add(rv, process_netlink, NULL); + if (cfgd_groupd_compat) { + rv = setup_groupd(); + if (rv < 0) + goto out; + client_add(rv, process_groupd, cluster_dead); + + group_mode = GROUP_LIBGROUP; + + if (cfgd_groupd_compat == 2) { + /* cfgd_groupd_compat of 2 uses new groupd feature that + figures out whether all other groupd's in the cluster + are in LIGCPG mode, and if they are group_mode is + changed to LIBCPG. If any groupd in the cluster + is from cluster2/stable2/rhel5, or any groupd is + in LIBGROUP mode, then group_mode remains LIBGROUP. + + set_group_mode() figures this out by joining the + groupd cpg, sending a new "mode" message, and + waiting to see if it gets a mode reply from + all other groupd's. If it does, and all modes + are LIGCPG, then we set groupd_mode to LIBCPG. + Any previous generation groupd's won't recognize + the new mode message and won't reply; their lack + of reply (or seeing an old-style message from them) + indicates they are a cluster2 version. + + Not yet implemented. In the future, it may set + group_mode to GROUP_LIBCPG. */ + + /* set_group_mode(); */ + group_mode = GROUP_LIBGROUP; + } + } + + if (group_mode == GROUP_LIBCPG) { + rv = setup_cpg(); + if (rv < 0) + goto out; + /* client_add(rv, process_cpg, cluster_dead); */ - for_loop: + if (cfgd_enable_deadlk) { + rv = setup_netlink(); + if (rv < 0) + goto out; + client_add(rv, process_netlink, NULL); + + setup_deadlock(); + } + + rv = setup_plocks(); + if (rv < 0) + goto out; + plock_fd = rv; + plock_ci = client_add(rv, process_plocks, NULL); + } for (;;) { - rv = poll(pollfd, client_maxi + 1, -1); + rv = poll(pollfd, client_maxi + 1, poll_timeout); if (rv == -1 && errno == EINTR) { if (daemon_quit && list_empty(&lockspaces)) { clear_configfs(); @@ -672,6 +580,21 @@ static int loop(void) deadfn(i); } } + + poll_timeout = -1; + + if (poll_fencing || poll_quorum || poll_fs) { + process_lockspace_changes(); + poll_timeout = 1000; + } + + if (poll_ignore_plock) { + if (!limit_plocks()) { + poll_ignore_plock = 0; + client_back(plock_ci, plock_fd); + } + poll_timeout = 1000; + } } rv = 0; out: @@ -721,7 +644,7 @@ static void lockfile(void) } } -void daemonize(void) +static void daemonize(void) { pid_t pid = fork(); if (pid < 0) { @@ -745,22 +668,46 @@ static void print_usage(void) { printf("Usage:\n"); printf("\n"); - printf("%s [options]\n", prog_name); + printf("dlm_controld [options]\n"); printf("\n"); printf("Options:\n"); printf("\n"); - printf(" -d Enable (1) or disable (0, default) deadlock code\n"); - printf(" -D Enable debugging code and don't fork\n"); - printf(" -K Enable kernel dlm debugging messages\n"); - printf(" -h Print this help, then exit\n"); - printf(" -V Print program version information, then exit\n"); + printf(" -D Enable daemon debugging and don't fork\n"); + printf(" -K Enable kernel dlm debugging messages\n"); + printf(" -g groupd compatibility, 0 off, 1 on\n"); + printf(" on: use libgroup, compat with cluster2/stable2/rhel5\n"); + printf(" off: use libcpg, no backward compatability\n"); + printf(" Default is %d\n", DEFAULT_GROUPD_COMPAT); + printf(" -d Enable (1) or disable (0) deadlock code\n"); + printf(" Default is %d\n", DEFAULT_ENABLE_DEADLK); + printf(" -p Enable (1) or disable (0) plock code\n"); + printf(" Default is %d\n", DEFAULT_ENABLE_PLOCK); + printf(" -P Enable plock debugging\n"); + printf(" -l Limit the rate of plock operations\n"); + printf(" Default is %d, set to 0 for no limit\n", DEFAULT_PLOCK_RATE_LIMIT); + printf(" -o plock ownership, 1 enable, 0 disable\n"); + printf(" Default is %d\n", DEFAULT_PLOCK_OWNERSHIP); + printf(" -t plock drop resources time (milliseconds)\n"); + printf(" Default is %u\n", DEFAULT_DROP_RESOURCES_TIME); + printf(" -c plock drop resources count\n"); + printf(" Default is %u\n", DEFAULT_DROP_RESOURCES_COUNT); + printf(" -a plock drop resources age (milliseconds)\n"); + printf(" Default is %u\n", DEFAULT_DROP_RESOURCES_AGE); + printf(" -h Print this help, then exit\n"); + printf(" -V Print program version information, then exit\n"); } -static void decode_arguments(int argc, char **argv) +#define OPTION_STRING "DKg:d:p:Pl:o:t:c:a:hV" + +static void read_arguments(int argc, char **argv) { int cont = 1; int optchar; + /* we don't allow these to be set on command line, should we? */ + optk_timewarn = 0; + optk_timewarn = 0; + while (cont) { optchar = getopt(argc, argv, OPTION_STRING); @@ -770,8 +717,54 @@ static void decode_arguments(int argc, char **argv) daemon_debug_opt = 1; break; + case 'g': + optd_groupd_compat = 1; + cfgd_groupd_compat = atoi(optarg); + break; + case 'K': - kernel_debug_opt = 1; + optk_debug = 1; + cfgk_debug = 1; + break; + + case 'd': + optd_enable_deadlk = 1; + cfgd_enable_deadlk = atoi(optarg); + break; + + case 'p': + optd_enable_plock = 1; + cfgd_enable_plock = atoi(optarg); + break; + + case 'P': + optd_plock_debug = 1; + cfgd_plock_debug = 1; + break; + + case 'l': + optd_plock_rate_limit = 1; + cfgd_plock_rate_limit = atoi(optarg); + break; + + case 'o': + optd_plock_ownership = 1; + cfgd_plock_ownership = atoi(optarg); + break; + + case 't': + optd_drop_resources_time = 1; + cfgd_drop_resources_time = atoi(optarg); + break; + + case 'c': + optd_drop_resources_count = 1; + cfgd_drop_resources_count = atoi(optarg); + break; + + case 'a': + optd_drop_resources_age = 1; + cfgd_drop_resources_age = atoi(optarg); break; case 'h': @@ -779,10 +772,6 @@ static void decode_arguments(int argc, char **argv) exit(EXIT_SUCCESS); break; - case 'd': - deadlock_enabled = atoi(optarg); - break; - case 'V': printf("dlm_controld (built %s %s)\n", __DATE__, __TIME__); /* printf("%s\n", REDHAT_COPYRIGHT); */ @@ -807,7 +796,7 @@ static void decode_arguments(int argc, char **argv) } } -void set_oom_adj(int val) +static void set_oom_adj(int val) { FILE *fp; @@ -819,7 +808,7 @@ void set_oom_adj(int val) fclose(fp); } -void set_scheduler(void) +static void set_scheduler(void) { struct sched_param sched_param; int rv; @@ -839,34 +828,62 @@ void set_scheduler(void) int main(int argc, char **argv) { - prog_name = argv[0]; - INIT_LIST_HEAD(&lockspaces); - decode_arguments(argc, argv); + read_arguments(argc, argv); if (!daemon_debug_opt) daemonize(); + signal(SIGTERM, sigterm_handler); - setup_deadlock(); + read_ccs(); - signal(SIGTERM, sigterm_handler); + clear_configfs(); + + /* the kernel has its own defaults for these values which we + don't want to change unless these have been set; -1 means + they have not been set on command line or config file */ + if (cfgk_debug != -1) + set_configfs_debug(cfgk_debug); + if (cfgk_timewarn != -1) + set_configfs_timewarn(cfgk_timewarn); + if (cfgk_protocol != -1) + set_configfs_protocol(cfgk_protocol); set_scheduler(); set_oom_adj(-16); - /* if this daemon was killed and the cluster shut down, and - then the cluster brought back up and this daemon restarted, - there will be old configfs entries we need to clear out */ - clear_configfs(); + return loop(); +} - set_ccs_options(); +void daemon_dump_save(void) +{ + int len, i; - return loop(); + len = strlen(daemon_debug_buf); + + for (i = 0; i < len; i++) { + dump_buf[dump_point++] = daemon_debug_buf[i]; + + if (dump_point == DUMP_SIZE) { + dump_point = 0; + dump_wrap = 1; + } + } } -char *prog_name; int daemon_debug_opt; +int daemon_quit; +int poll_fencing; +int poll_quorum; +int poll_fs; +int poll_ignore_plock; +int plock_fd; +int plock_ci; +struct list_head lockspaces; +int our_nodeid; char daemon_debug_buf[256]; -int kernel_debug_opt; +char dump_buf[DUMP_SIZE]; +int dump_point; +int dump_wrap; diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c index 1ce180c..847351a 100644 --- a/group/dlm_controld/member_cman.c +++ b/group/dlm_controld/member_cman.c @@ -13,13 +13,11 @@ #include #include "dlm_daemon.h" -int our_nodeid; static cman_handle_t ch; static cman_node_t old_nodes[MAX_NODES]; static int old_node_count; static cman_node_t cman_nodes[MAX_NODES]; static int cman_node_count; -extern struct list_head lockspaces; static int is_member(cman_node_t *node_list, int count, int nodeid) { @@ -147,7 +145,7 @@ static void member_callback(cman_handle_t h, void *private, int reason, int arg) } } -void process_member(int ci) +void process_cman(int ci) { int rv; @@ -161,7 +159,7 @@ void process_member(int ci) } } -int setup_member(void) +int setup_cman(void) { cman_node_t node; int rv, fd; @@ -205,7 +203,8 @@ int setup_member(void) } /* Force re-read of cman nodes */ -void cman_statechange() +void cman_statechange(void) { statechange(); } + diff --git a/group/dlm_controld/netlink.c b/group/dlm_controld/netlink.c new file mode 100644 index 0000000..b61337e --- /dev/null +++ b/group/dlm_controld/netlink.c @@ -0,0 +1,237 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) 2008 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#include "dlm_daemon.h" +#include "config.h" +#include +#include +#include +#include + +#define DEADLOCK_CHECK_SECS 10 + +/* FIXME: look into using libnl/libnetlink */ + +#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN)) +#define GENLMSG_PAYLOAD(glh) (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN) +#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN)) +#define NLA_PAYLOAD(len) (len - NLA_HDRLEN) + +/* Maximum size of response requested or message sent */ +#define MAX_MSG_SIZE 1024 + +struct msgtemplate { + struct nlmsghdr n; + struct genlmsghdr g; + char buf[MAX_MSG_SIZE]; +}; + +static int send_genetlink_cmd(int sd, uint16_t nlmsg_type, uint32_t nlmsg_pid, + uint8_t genl_cmd, uint16_t nla_type, + void *nla_data, int nla_len) +{ + struct nlattr *na; + struct sockaddr_nl nladdr; + int r, buflen; + char *buf; + + struct msgtemplate msg; + + msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); + msg.n.nlmsg_type = nlmsg_type; + msg.n.nlmsg_flags = NLM_F_REQUEST; + msg.n.nlmsg_seq = 0; + msg.n.nlmsg_pid = nlmsg_pid; + msg.g.cmd = genl_cmd; + msg.g.version = 0x1; + na = (struct nlattr *) GENLMSG_DATA(&msg); + na->nla_type = nla_type; + na->nla_len = nla_len + 1 + NLA_HDRLEN; + if (nla_data) + memcpy(NLA_DATA(na), nla_data, nla_len); + msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); + + buf = (char *) &msg; + buflen = msg.n.nlmsg_len ; + memset(&nladdr, 0, sizeof(nladdr)); + nladdr.nl_family = AF_NETLINK; + while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr, + sizeof(nladdr))) < buflen) { + if (r > 0) { + buf += r; + buflen -= r; + } else if (errno != EAGAIN) + return -1; + } + return 0; +} + +/* + * Probe the controller in genetlink to find the family id + * for the DLM family + */ +static int get_family_id(int sd) +{ + char genl_name[100]; + struct { + struct nlmsghdr n; + struct genlmsghdr g; + char buf[256]; + } ans; + + int id = 0, rc; + struct nlattr *na; + int rep_len; + + strcpy(genl_name, DLM_GENL_NAME); + rc = send_genetlink_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY, + CTRL_ATTR_FAMILY_NAME, (void *)genl_name, + strlen(DLM_GENL_NAME)+1); + + rep_len = recv(sd, &ans, sizeof(ans), 0); + if (ans.n.nlmsg_type == NLMSG_ERROR || + (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len)) + return 0; + + na = (struct nlattr *) GENLMSG_DATA(&ans); + na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len)); + if (na->nla_type == CTRL_ATTR_FAMILY_ID) { + id = *(uint16_t *) NLA_DATA(na); + } + return id; +} + +/* genetlink messages are timewarnings used as part of deadlock detection */ + +int setup_netlink(void) +{ + struct sockaddr_nl snl; + int s, rv; + uint16_t id; + + s = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); + if (s < 0) { + log_error("generic netlink socket"); + return s; + } + + memset(&snl, 0, sizeof(snl)); + snl.nl_family = AF_NETLINK; + + rv = bind(s, (struct sockaddr *) &snl, sizeof(snl)); + if (rv < 0) { + log_error("gen netlink bind error %d errno %d", rv, errno); + close(s); + return rv; + } + + id = get_family_id(s); + if (!id) { + log_error("Error getting family id, errno %d", errno); + close(s); + return -1; + } + + rv = send_genetlink_cmd(s, id, getpid(), DLM_CMD_HELLO, 0, NULL, 0); + if (rv < 0) { + log_error("error sending hello cmd, errno %d", errno); + close(s); + return -1; + } + + return s; +} + +static void process_timewarn(struct dlm_lock_data *data) +{ + struct lockspace *ls; + struct timeval now; + unsigned int sec; + + ls = find_ls_id(data->lockspace_id); + if (!ls) + return; + + data->resource_name[data->resource_namelen] = '\0'; + + log_group(ls, "timewarn: lkid %x pid %d name %s", + data->id, data->ownpid, data->resource_name); + + /* Problem: we don't want to get a timewarn, assume it's resolved + by the current cycle, but in fact it's from a deadlock that + formed after the checkpoints for the current cycle. Then we'd + have to hope for another warning (that may not come) to trigger + a new cycle to catch the deadlock. If our last cycle ckpt + was say N (~5?) sec before we receive the timewarn, then we + can be confident that the cycle included the lock in question. + Otherwise, we're not sure if the warning is for a new deadlock + that's formed since our last cycle ckpt (unless it's a long + enough time since the last cycle that we're confident it *is* + a new deadlock). When there is a deadlock, I suspect it will + be common to receive warnings before, during, and possibly + after the cycle that resolves it. Wonder if we should record + timewarns and match them with deadlock cycles so we can tell + which timewarns are addressed by a given cycle and which aren't. */ + + + gettimeofday(&now, NULL); + + /* don't send a new start until at least SECS after the last + we sent, and at least SECS after the last completed cycle */ + + sec = now.tv_sec - ls->last_send_cycle_start.tv_sec; + + if (sec < DEADLOCK_CHECK_SECS) { + log_group(ls, "skip send: recent send cycle %d sec", sec); + return; + } + + sec = now.tv_sec - ls->cycle_end_time.tv_sec; + + if (sec < DEADLOCK_CHECK_SECS) { + log_group(ls, "skip send: recent cycle end %d sec", sec); + return; + } + + gettimeofday(&ls->last_send_cycle_start, NULL); + + if (cfgd_enable_deadlk) + send_cycle_start(ls); +} + +void process_netlink(int ci) +{ + struct msgtemplate msg; + struct nlattr *na; + int len; + int fd; + + fd = client_fd(ci); + + len = recv(fd, &msg, sizeof(msg), 0); + + if (len < 0) { + log_error("nonfatal netlink error: errno %d", errno); + return; + } + + if (msg.n.nlmsg_type == NLMSG_ERROR || !NLMSG_OK((&msg.n), len)) { + struct nlmsgerr *err = NLMSG_DATA(&msg); + log_error("fatal netlink error: errno %d", err->error); + return; + } + + na = (struct nlattr *) GENLMSG_DATA(&msg); + + process_timewarn((struct dlm_lock_data *) NLA_DATA(na)); +} + diff --git a/group/gfs_controld/plock.c b/group/dlm_controld/plock.c similarity index 71% copy from group/gfs_controld/plock.c copy to group/dlm_controld/plock.c index 42890df..a862356 100644 --- a/group/gfs_controld/plock.c +++ b/group/dlm_controld/plock.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -10,52 +10,16 @@ ******************************************************************************* ******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lock_dlm.h" +#include "dlm_daemon.h" +#include "config.h" +#include #define PROC_MISC "/proc/misc" #define PROC_DEVICES "/proc/devices" #define MISC_NAME "misc" #define CONTROL_DIR "/dev/misc" -#define CONTROL_NAME "lock_dlm_plock" +#define CONTROL_NAME "dlm_plock" -extern int our_nodeid; -extern int message_flow_control_on; - -/* user configurable */ -extern int config_no_plock; -extern uint32_t config_plock_rate_limit; -extern uint32_t config_plock_ownership; -extern uint32_t config_drop_resources_time; -extern uint32_t config_drop_resources_count; -extern uint32_t config_drop_resources_age; - -static int plocks_online = 0; static uint32_t plock_read_count; static uint32_t plock_recv_count; static uint32_t plock_rate_delays; @@ -64,11 +28,14 @@ static struct timeval plock_recv_time; static struct timeval plock_rate_last; static int control_fd = -1; -static SaCkptHandleT ckpt_handle; +static SaCkptHandleT system_ckpt_handle; static SaCkptCallbacksT callbacks = { 0, 0 }; static SaVersionT version = { 'B', 1, 1 }; static char section_buf[1024 * 1024]; static uint32_t section_len; +static int need_fsid_translation = 0; + +extern int message_flow_control_on; struct pack_plock { uint64_t start; @@ -112,13 +79,21 @@ struct posix_lock { struct lock_waiter { struct list_head list; uint32_t flags; - struct gdlm_plock_info info; + struct dlm_plock_info info; +}; + +struct save_msg { + struct list_head list; + int nodeid; + int len; + int type; + char buf[0]; }; -static void send_own(struct mountgroup *mg, struct resource *r, int owner); -static void save_pending_plock(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in); +static void send_own(struct lockspace *ls, struct resource *r, int owner); +static void save_pending_plock(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in); static int got_unown(struct resource *r) @@ -126,7 +101,7 @@ static int got_unown(struct resource *r) return !!(r->flags & R_GOT_UNOWN); } -static void info_bswap_out(struct gdlm_plock_info *i) +static void info_bswap_out(struct dlm_plock_info *i) { i->version[0] = cpu_to_le32(i->version[0]); i->version[1] = cpu_to_le32(i->version[1]); @@ -141,7 +116,7 @@ static void info_bswap_out(struct gdlm_plock_info *i) i->owner = cpu_to_le64(i->owner); } -static void info_bswap_in(struct gdlm_plock_info *i) +static void info_bswap_in(struct dlm_plock_info *i) { i->version[0] = le32_to_cpu(i->version[0]); i->version[1] = le32_to_cpu(i->version[1]); @@ -159,11 +134,11 @@ static void info_bswap_in(struct gdlm_plock_info *i) static char *op_str(int optype) { switch (optype) { - case GDLM_PLOCK_OP_LOCK: + case DLM_PLOCK_OP_LOCK: return "LK"; - case GDLM_PLOCK_OP_UNLOCK: + case DLM_PLOCK_OP_UNLOCK: return "UN"; - case GDLM_PLOCK_OP_GET: + case DLM_PLOCK_OP_GET: return "GET"; default: return "??"; @@ -172,7 +147,7 @@ static char *op_str(int optype) static char *ex_str(int optype, int ex) { - if (optype == GDLM_PLOCK_OP_UNLOCK || optype == GDLM_PLOCK_OP_GET) + if (optype == DLM_PLOCK_OP_UNLOCK || optype == DLM_PLOCK_OP_GET) return "-"; if (ex) return "WR"; @@ -207,10 +182,11 @@ static int get_proc_number(const char *file, const char *name, uint32_t *number) return 0; } -static int control_device_number(uint32_t *major, uint32_t *minor) +static int control_device_number(const char *plock_misc_name, + uint32_t *major, uint32_t *minor) { if (!get_proc_number(PROC_DEVICES, MISC_NAME, major) || - !get_proc_number(PROC_MISC, GDLM_PLOCK_MISC_NAME, minor)) { + !get_proc_number(PROC_MISC, plock_misc_name, minor)) { *major = 0; return 0; } @@ -277,7 +253,7 @@ static int create_control(const char *control, uint32_t major, uint32_t minor) return 1; } -static int open_control(void) +static int open_control(const char *control_name, const char *plock_misc_name) { char control[PATH_MAX]; uint32_t major = 0, minor = 0; @@ -285,22 +261,20 @@ static int open_control(void) if (control_fd != -1) return 0; - snprintf(control, sizeof(control), "%s/%s", CONTROL_DIR, CONTROL_NAME); + snprintf(control, sizeof(control), "%s/%s", CONTROL_DIR, control_name); - if (!control_device_number(&major, &minor)) { - log_error("Is dlm missing from kernel?"); + if (!control_device_number(plock_misc_name, &major, &minor)) return -1; - } if (!control_exists(control, major, minor) && !create_control(control, major, minor)) { - log_error("Failure to communicate with kernel lock_dlm"); + log_error("Failure to create device file %s", control); return -1; } control_fd = open(control, O_RDWR); if (control_fd < 0) { - log_error("Failure to communicate with kernel lock_dlm: %s", + log_error("Failure to open device %s: %s", control, strerror(errno)); return -1; } @@ -308,6 +282,16 @@ static int open_control(void) return 0; } +/* + * In kernels before 2.6.26, plocks came from gfs2's lock_dlm module. + * Reading plocks from there as well should allow us to use cluster3 + * on old (RHEL5) kernels. In this case, the fsid we read in plock_info + * structs is the mountgroup id, which we need to translate to the ls id. + */ + +#define OLD_CONTROL_NAME "lock_dlm_plock" +#define OLD_PLOCK_MISC_NAME "lock_dlm_plock" + int setup_plocks(void) { SaAisErrorT err; @@ -320,28 +304,55 @@ int setup_plocks(void) gettimeofday(&plock_recv_time, NULL); gettimeofday(&plock_rate_last, NULL); - if (config_no_plock) - goto control; + err = saCkptInitialize(&system_ckpt_handle, &callbacks, &version); + if (err != SA_AIS_OK) { + log_error("ckpt init error %d", err); + cfgd_enable_plock = 0; - err = saCkptInitialize(&ckpt_handle, &callbacks, &version); - if (err == SA_AIS_OK) - plocks_online = 1; - else - log_error("ckpt init error %d - plocks unavailable", err); + /* still try to open and read the control device so that we can + send ENOSYS back to the kernel if it tries to do a plock */ + } - control: - rv = open_control(); - if (rv) - return rv; + + rv = open_control(CONTROL_NAME, DLM_PLOCK_MISC_NAME); + if (rv) { + log_debug("setup_plocks trying old lock_dlm interface"); + rv = open_control(OLD_CONTROL_NAME, OLD_PLOCK_MISC_NAME); + if (rv) { + log_error("Is dlm missing from kernel? No control device."); + return rv; + } + need_fsid_translation = 1; + } log_debug("plocks %d", control_fd); log_debug("plock cpg message size: %u bytes", - (unsigned int) (sizeof(struct gdlm_header) + - sizeof(struct gdlm_plock_info))); + (unsigned int) (sizeof(struct dlm_header) + + sizeof(struct dlm_plock_info))); return control_fd; } +static uint32_t mg_to_ls_id(uint32_t fsid) +{ + struct lockspace *ls; + int do_set = 1; + + retry: + list_for_each_entry(ls, &lockspaces, list) { + if (ls->associated_mg_id == fsid) + return ls->global_id; + } + + if (do_set) { + do_set = 0; + set_associated_id(fsid); + goto retry; + } + + return fsid; +} + /* FIXME: unify these two */ static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end) @@ -361,24 +372,24 @@ static uint64_t dt_usec(struct timeval *start, struct timeval *stop) return dt; } -static struct resource *search_resource(struct mountgroup *mg, uint64_t number) +static struct resource *search_resource(struct lockspace *ls, uint64_t number) { struct resource *r; - list_for_each_entry(r, &mg->resources, list) { + list_for_each_entry(r, &ls->plock_resources, list) { if (r->number == number) return r; } return NULL; } -static int find_resource(struct mountgroup *mg, uint64_t number, int create, +static int find_resource(struct lockspace *ls, uint64_t number, int create, struct resource **r_out) { struct resource *r = NULL; int rv = 0; - r = search_resource(mg, number); + r = search_resource(ls, number); if (r) goto out; @@ -400,12 +411,12 @@ static int find_resource(struct mountgroup *mg, uint64_t number, int create, INIT_LIST_HEAD(&r->waiters); INIT_LIST_HEAD(&r->pending); - if (config_plock_ownership) + if (cfgd_plock_ownership) r->owner = -1; else r->owner = 0; - list_add_tail(&r->list, &mg->resources); + list_add_tail(&r->list, &ls->plock_resources); out: if (r) gettimeofday(&r->last_access, NULL); @@ -416,7 +427,7 @@ static int find_resource(struct mountgroup *mg, uint64_t number, int create, static void put_resource(struct resource *r) { /* with ownership, resources are only freed via drop messages */ - if (config_plock_ownership) + if (cfgd_plock_ownership) return; if (list_empty(&r->locks) && list_empty(&r->waiters)) { @@ -429,8 +440,8 @@ static inline int ranges_overlap(uint64_t start1, uint64_t end1, uint64_t start2, uint64_t end2) { if (end1 < start2 || start1 > end2) - return FALSE; - return TRUE; + return 0; + return 1; } /** @@ -529,7 +540,7 @@ static int shrink_range(struct posix_lock *po, uint64_t start, uint64_t end) return shrink_range2(&po->start, &po->end, start, end); } -static int is_conflict(struct resource *r, struct gdlm_plock_info *in, int get) +static int is_conflict(struct resource *r, struct dlm_plock_info *in, int get) { struct posix_lock *po; @@ -578,7 +589,7 @@ static int add_lock(struct resource *r, uint32_t nodeid, uint64_t owner, 2. convert RE to RN range and mode */ static int lock_case1(struct posix_lock *po, struct resource *r, - struct gdlm_plock_info *in) + struct dlm_plock_info *in) { uint64_t start2, end2; int rv; @@ -605,7 +616,7 @@ static int lock_case1(struct posix_lock *po, struct resource *r, 3. convert RE to RN range and mode */ static int lock_case2(struct posix_lock *po, struct resource *r, - struct gdlm_plock_info *in) + struct dlm_plock_info *in) { int rv; @@ -627,8 +638,8 @@ static int lock_case2(struct posix_lock *po, struct resource *r, return rv; } -static int lock_internal(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in) +static int lock_internal(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in) { struct posix_lock *po, *safe; int rv = 0; @@ -690,8 +701,8 @@ static int lock_internal(struct mountgroup *mg, struct resource *r, } -static int unlock_internal(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in) +static int unlock_internal(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in) { struct posix_lock *po, *safe; int rv = 0; @@ -754,8 +765,8 @@ static int unlock_internal(struct mountgroup *mg, struct resource *r, return rv; } -static int add_waiter(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in) +static int add_waiter(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in) { struct lock_waiter *w; @@ -763,26 +774,29 @@ static int add_waiter(struct mountgroup *mg, struct resource *r, w = malloc(sizeof(struct lock_waiter)); if (!w) return -ENOMEM; - memcpy(&w->info, in, sizeof(struct gdlm_plock_info)); + memcpy(&w->info, in, sizeof(struct dlm_plock_info)); list_add_tail(&w->list, &r->waiters); return 0; } -static void write_result(struct mountgroup *mg, struct gdlm_plock_info *in, +static void write_result(struct lockspace *ls, struct dlm_plock_info *in, int rv) { int err; + if (need_fsid_translation) + in->fsid = ls->associated_mg_id; + in->rv = rv; - err = write(control_fd, in, sizeof(struct gdlm_plock_info)); - if (err != sizeof(struct gdlm_plock_info)) + err = write(control_fd, in, sizeof(struct dlm_plock_info)); + if (err != sizeof(struct dlm_plock_info)) log_error("plock result write err %d errno %d", err, errno); } -static void do_waiters(struct mountgroup *mg, struct resource *r) +static void do_waiters(struct lockspace *ls, struct resource *r) { struct lock_waiter *w, *safe; - struct gdlm_plock_info *in; + struct dlm_plock_info *in; int rv; list_for_each_entry_safe(w, safe, &r->waiters, list) { @@ -794,21 +808,21 @@ static void do_waiters(struct mountgroup *mg, struct resource *r) list_del(&w->list); /* - log_group(mg, "take waiter %llx %llx-%llx %d/%u/%llx", + log_group(ls, "take waiter %llx %llx-%llx %d/%u/%llx", in->number, in->start, in->end, in->nodeid, in->pid, in->owner); */ - rv = lock_internal(mg, r, in); + rv = lock_internal(ls, r, in); if (in->nodeid == our_nodeid) - write_result(mg, in, rv); + write_result(ls, in, rv); free(w); } } -static void do_lock(struct mountgroup *mg, struct gdlm_plock_info *in, +static void do_lock(struct lockspace *ls, struct dlm_plock_info *in, struct resource *r) { int rv; @@ -817,39 +831,39 @@ static void do_lock(struct mountgroup *mg, struct gdlm_plock_info *in, if (!in->wait) rv = -EAGAIN; else { - rv = add_waiter(mg, r, in); + rv = add_waiter(ls, r, in); if (rv) goto out; rv = -EINPROGRESS; } } else - rv = lock_internal(mg, r, in); + rv = lock_internal(ls, r, in); out: if (in->nodeid == our_nodeid && rv != -EINPROGRESS) - write_result(mg, in, rv); + write_result(ls, in, rv); - do_waiters(mg, r); + do_waiters(ls, r); put_resource(r); } -static void do_unlock(struct mountgroup *mg, struct gdlm_plock_info *in, +static void do_unlock(struct lockspace *ls, struct dlm_plock_info *in, struct resource *r) { int rv; - rv = unlock_internal(mg, r, in); + rv = unlock_internal(ls, r, in); if (in->nodeid == our_nodeid) - write_result(mg, in, rv); + write_result(ls, in, rv); - do_waiters(mg, r); + do_waiters(ls, r); put_resource(r); } /* we don't even get to this function if the getlk isn't from us */ -static void do_get(struct mountgroup *mg, struct gdlm_plock_info *in, +static void do_get(struct lockspace *ls, struct dlm_plock_info *in, struct resource *r) { int rv; @@ -859,32 +873,52 @@ static void do_get(struct mountgroup *mg, struct gdlm_plock_info *in, else rv = 0; - write_result(mg, in, rv); + write_result(ls, in, rv); +} + +static void save_message(struct lockspace *ls, struct dlm_header *hd, int len, + int from, int type) +{ + struct save_msg *sm; + + sm = malloc(sizeof(struct save_msg) + len); + if (!sm) + return; + memset(sm, 0, sizeof(struct save_msg) + len); + + memcpy(&sm->buf, hd, len); + sm->type = type; + sm->len = len; + sm->nodeid = from; + + log_group(ls, "save %s from %d len %d", msg_name(type), from, len); + + list_add_tail(&sm->list, &ls->saved_messages); } -static void __receive_plock(struct mountgroup *mg, struct gdlm_plock_info *in, +static void __receive_plock(struct lockspace *ls, struct dlm_plock_info *in, int from, struct resource *r) { switch (in->optype) { - case GDLM_PLOCK_OP_LOCK: - mg->last_plock_time = time(NULL); - do_lock(mg, in, r); + case DLM_PLOCK_OP_LOCK: + ls->last_plock_time = time(NULL); + do_lock(ls, in, r); break; - case GDLM_PLOCK_OP_UNLOCK: - mg->last_plock_time = time(NULL); - do_unlock(mg, in, r); + case DLM_PLOCK_OP_UNLOCK: + ls->last_plock_time = time(NULL); + do_unlock(ls, in, r); break; - case GDLM_PLOCK_OP_GET: - do_get(mg, in, r); + case DLM_PLOCK_OP_GET: + do_get(ls, in, r); break; default: log_error("receive_plock from %d optype %d", from, in->optype); if (from == our_nodeid) - write_result(mg, in, -EINVAL); + write_result(ls, in, -EINVAL); } } -/* When mg members receive our options message (for our mount), one of them +/* When ls members receive our options message (for our mount), one of them saves all plock state received to that point in a checkpoint and then sends us our journals message. We know to retrieve the plock state from the checkpoint when we receive our journals message. Any plocks messages that @@ -894,19 +928,19 @@ static void __receive_plock(struct mountgroup *mg, struct gdlm_plock_info *in, set save_plocks (when we see our options message) can be ignored because it should be reflected in the checkpointed state. */ -static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) +static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len) { - struct gdlm_plock_info info; - struct gdlm_header *hd = (struct gdlm_header *) buf; + struct dlm_plock_info info; struct resource *r = NULL; struct timeval now; uint64_t usec; + int from = hd->nodeid; int rv, create; - memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info)); + memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info)); info_bswap_in(&info); - log_plock(mg, "receive plock %llx %s %s %llx-%llx %d/%u/%llx w %d", + log_plock(ls, "receive plock %llx %s %s %llx-%llx %d/%u/%llx w %d", (unsigned long long)info.number, op_str(info.optype), ex_str(info.optype, info.ex), @@ -918,12 +952,12 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) if (!(plock_recv_count % 1000)) { gettimeofday(&now, NULL); usec = dt_usec(&plock_recv_time, &now); - log_group(mg, "plock_recv_count %u time %.3f s", + log_group(ls, "plock_recv_count %u time %.3f s", plock_recv_count, usec * 1.e-6); plock_recv_time = now; } - if (info.optype == GDLM_PLOCK_OP_GET && from != our_nodeid) + if (info.optype == DLM_PLOCK_OP_GET && from != our_nodeid) return; if (from != hd->nodeid || from != info.nodeid) { @@ -932,11 +966,11 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) return; } - create = !config_plock_ownership; + create = !cfgd_plock_ownership; - rv = find_resource(mg, info.number, create, &r); + rv = find_resource(ls, info.number, create, &r); - if (rv && config_plock_ownership) { + if (rv && cfgd_plock_ownership) { /* There must have been a race with a drop, so we need to ignore this plock op which will be resent. If we're the one who sent the plock, we need to send_own() and put it on the @@ -948,11 +982,11 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) if (from != our_nodeid) return; - rv = find_resource(mg, info.number, 1, &r); + rv = find_resource(ls, info.number, 1, &r); if (rv) return; - send_own(mg, r, our_nodeid); - save_pending_plock(mg, r, &info); + send_own(ls, r, our_nodeid); + save_pending_plock(ls, r, &info); return; } if (rv) { @@ -987,14 +1021,14 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) we're the owner of r. */ if (!r->owner) { - __receive_plock(mg, &info, from, r); + __receive_plock(ls, &info, from, r); } else if (r->owner == -1) { log_debug("receive_plock from %d r %llx owner %d", from, (unsigned long long)info.number, r->owner); if (from == our_nodeid) - save_pending_plock(mg, r, &info); + save_pending_plock(ls, r, &info); } else if (r->owner != our_nodeid) { /* might happen, if frequent change to log_debug */ @@ -1002,7 +1036,7 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) (unsigned long long)info.number, r->owner); if (from == our_nodeid) - save_pending_plock(mg, r, &info); + save_pending_plock(ls, r, &info); } else if (r->owner == our_nodeid) { /* might happen, if frequent change to log_debug */ @@ -1010,33 +1044,28 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from) (unsigned long long)info.number, r->owner); if (from == our_nodeid) - __receive_plock(mg, &info, from, r); + __receive_plock(ls, &info, from, r); } } -void receive_plock(struct mountgroup *mg, char *buf, int len, int from) +void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len) { - if (mg->save_plocks) { - save_message(mg, buf, len, from, MSG_PLOCK); - return; - } - - if (!mg->got_our_journals) { - log_group(mg, "not saving plock messages yet"); + if (ls->save_plocks) { + save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK); return; } - _receive_plock(mg, buf, len, from); + _receive_plock(ls, hd, len); } -static int send_struct_info(struct mountgroup *mg, struct gdlm_plock_info *in, +static int send_struct_info(struct lockspace *ls, struct dlm_plock_info *in, int msg_type) { + struct dlm_header *hd; + int rv = 0, len; char *buf; - int rv, len; - struct gdlm_header *hd; - len = sizeof(struct gdlm_header) + sizeof(struct gdlm_plock_info); + len = sizeof(struct dlm_header) + sizeof(struct dlm_plock_info); buf = malloc(len); if (!buf) { rv = -ENOMEM; @@ -1046,31 +1075,29 @@ static int send_struct_info(struct mountgroup *mg, struct gdlm_plock_info *in, info_bswap_out(in); - hd = (struct gdlm_header *)buf; + hd = (struct dlm_header *)buf; hd->type = msg_type; - hd->nodeid = our_nodeid; - hd->to_nodeid = 0; - memcpy(buf + sizeof(struct gdlm_header), in, sizeof(*in)); + memcpy(buf + sizeof(struct dlm_header), in, sizeof(*in)); - rv = send_group_message(mg, len, buf); + dlm_send_message(ls, buf, len); free(buf); out: if (rv) - log_error("send plock message error %d", rv); + log_error("send_struct_info error %d", rv); return rv; } -static void send_plock(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in) +static void send_plock(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in) { - send_struct_info(mg, in, MSG_PLOCK); + send_struct_info(ls, in, DLM_MSG_PLOCK); } -static void send_own(struct mountgroup *mg, struct resource *r, int owner) +static void send_own(struct lockspace *ls, struct resource *r, int owner) { - struct gdlm_plock_info info; + struct dlm_plock_info info; /* if we've already sent an own message for this resource, (pending list is not empty), then we shouldn't send another */ @@ -1085,12 +1112,12 @@ static void send_own(struct mountgroup *mg, struct resource *r, int owner) info.number = r->number; info.nodeid = owner; - send_struct_info(mg, &info, MSG_PLOCK_OWN); + send_struct_info(ls, &info, DLM_MSG_PLOCK_OWN); } -static void send_syncs(struct mountgroup *mg, struct resource *r) +static void send_syncs(struct lockspace *ls, struct resource *r) { - struct gdlm_plock_info info; + struct dlm_plock_info info; struct posix_lock *po; struct lock_waiter *w; int rv; @@ -1105,7 +1132,7 @@ static void send_syncs(struct mountgroup *mg, struct resource *r) info.pid = po->pid; info.ex = po->ex; - rv = send_struct_info(mg, &info, MSG_PLOCK_SYNC_LOCK); + rv = send_struct_info(ls, &info, DLM_MSG_PLOCK_SYNC_LOCK); if (rv) goto out; @@ -1115,7 +1142,7 @@ static void send_syncs(struct mountgroup *mg, struct resource *r) list_for_each_entry(w, &r->waiters, list) { memcpy(&info, &w->info, sizeof(info)); - rv = send_struct_info(mg, &info, MSG_PLOCK_SYNC_WAITER); + rv = send_struct_info(ls, &info, DLM_MSG_PLOCK_SYNC_WAITER); if (rv) goto out; @@ -1125,21 +1152,21 @@ static void send_syncs(struct mountgroup *mg, struct resource *r) return; } -static void send_drop(struct mountgroup *mg, struct resource *r) +static void send_drop(struct lockspace *ls, struct resource *r) { - struct gdlm_plock_info info; + struct dlm_plock_info info; memset(&info, 0, sizeof(info)); info.number = r->number; - send_struct_info(mg, &info, MSG_PLOCK_DROP); + send_struct_info(ls, &info, DLM_MSG_PLOCK_DROP); } /* plock op can't be handled until we know the owner value of the resource, so the op is saved on the pending list until the r owner is established */ -static void save_pending_plock(struct mountgroup *mg, struct resource *r, - struct gdlm_plock_info *in) +static void save_pending_plock(struct lockspace *ls, struct resource *r, + struct dlm_plock_info *in) { struct lock_waiter *w; @@ -1148,19 +1175,19 @@ static void save_pending_plock(struct mountgroup *mg, struct resource *r, log_error("save_pending_plock no mem"); return; } - memcpy(&w->info, in, sizeof(struct gdlm_plock_info)); + memcpy(&w->info, in, sizeof(struct dlm_plock_info)); list_add_tail(&w->list, &r->pending); } /* plock ops are on pending list waiting for ownership to be established. owner has now become us, so add these plocks to r */ -static void add_pending_plocks(struct mountgroup *mg, struct resource *r) +static void add_pending_plocks(struct lockspace *ls, struct resource *r) { struct lock_waiter *w, *safe; list_for_each_entry_safe(w, safe, &r->pending, list) { - __receive_plock(mg, &w->info, our_nodeid, r); + __receive_plock(ls, &w->info, our_nodeid, r); list_del(&w->list); free(w); } @@ -1169,32 +1196,32 @@ static void add_pending_plocks(struct mountgroup *mg, struct resource *r) /* plock ops are on pending list waiting for ownership to be established. owner has now become 0, so send these plocks to everyone */ -static void send_pending_plocks(struct mountgroup *mg, struct resource *r) +static void send_pending_plocks(struct lockspace *ls, struct resource *r) { struct lock_waiter *w, *safe; list_for_each_entry_safe(w, safe, &r->pending, list) { - send_plock(mg, r, &w->info); + send_plock(ls, r, &w->info); list_del(&w->list); free(w); } } -static void _receive_own(struct mountgroup *mg, char *buf, int len, int from) +static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len) { - struct gdlm_header *hd = (struct gdlm_header *) buf; - struct gdlm_plock_info info; + struct dlm_plock_info info; struct resource *r; int should_not_happen = 0; + int from = hd->nodeid; int rv; - memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info)); + memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info)); info_bswap_in(&info); - log_plock(mg, "receive own %llx from %u owner %u", + log_plock(ls, "receive own %llx from %u owner %u", (unsigned long long)info.number, hd->nodeid, info.nodeid); - rv = find_resource(mg, info.number, 1, &r); + rv = find_resource(ls, info.number, 1, &r); if (rv) return; @@ -1223,11 +1250,11 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from) if (r->owner == -1) { /* we have gained ownership */ r->owner = our_nodeid; - add_pending_plocks(mg, r); + add_pending_plocks(ls, r); } else if (r->owner == our_nodeid) { should_not_happen = 1; } else if (r->owner == 0) { - send_pending_plocks(mg, r); + send_pending_plocks(ls, r); } else { /* resource is owned by other node; they should set owner to 0 shortly */ @@ -1257,7 +1284,7 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from) } else { r->owner = 0; r->flags |= R_GOT_UNOWN; - send_pending_plocks(mg, r); + send_pending_plocks(ls, r); } } else if (info.nodeid == from) { @@ -1269,8 +1296,8 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from) } else if (r->owner == our_nodeid) { /* we relinquish our ownership: sync our local plocks to everyone, then set owner to 0 */ - send_syncs(mg, r); - send_own(mg, r, 0); + send_syncs(ls, r); + send_own(ls, r, 0); /* we need to set owner to 0 here because local ops may arrive before we receive our send_own message and can't be added @@ -1300,17 +1327,17 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from) } } -void receive_own(struct mountgroup *mg, char *buf, int len, int from) +void receive_own(struct lockspace *ls, struct dlm_header *hd, int len) { - if (mg->save_plocks) { - save_message(mg, buf, len, from, MSG_PLOCK_OWN); + if (ls->save_plocks) { + save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK_OWN); return; } - _receive_own(mg, buf, len, from); + _receive_own(ls, hd, len); } -static void clear_syncing_flag(struct resource *r, struct gdlm_plock_info *in) +static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in) { struct posix_lock *po; struct lock_waiter *w; @@ -1347,22 +1374,22 @@ static void clear_syncing_flag(struct resource *r, struct gdlm_plock_info *in) in->nodeid, in->pid, (unsigned long long)in->owner); } -static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from) +static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len) { - struct gdlm_plock_info info; - struct gdlm_header *hd = (struct gdlm_header *) buf; + struct dlm_plock_info info; struct resource *r; + int from = hd->nodeid; int rv; - memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info)); + memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info)); info_bswap_in(&info); - log_plock(mg, "receive sync %llx from %u %s %llx-%llx %d/%u/%llx", + log_plock(ls, "receive sync %llx from %u %s %llx-%llx %d/%u/%llx", (unsigned long long)info.number, from, info.ex ? "WR" : "RD", (unsigned long long)info.start, (unsigned long long)info.end, info.nodeid, info.pid, (unsigned long long)info.owner); - rv = find_resource(mg, info.number, 0, &r); + rv = find_resource(ls, info.number, 0, &r); if (rv) { log_error("receive_sync no r %llx from %d", info.number, from); return; @@ -1374,38 +1401,37 @@ static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from) return; } - if (hd->type == MSG_PLOCK_SYNC_LOCK) + if (hd->type == DLM_MSG_PLOCK_SYNC_LOCK) add_lock(r, info.nodeid, info.owner, info.pid, !info.ex, info.start, info.end); - else if (hd->type == MSG_PLOCK_SYNC_WAITER) - add_waiter(mg, r, &info); + else if (hd->type == DLM_MSG_PLOCK_SYNC_WAITER) + add_waiter(ls, r, &info); } -void receive_sync(struct mountgroup *mg, char *buf, int len, int from) +void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len) { - struct gdlm_header *hd = (struct gdlm_header *) buf; - - if (mg->save_plocks) { - save_message(mg, buf, len, from, hd->type); + if (ls->save_plocks) { + save_message(ls, hd, len, hd->nodeid, hd->type); return; } - _receive_sync(mg, buf, len, from); + _receive_sync(ls, hd, len); } -static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from) +static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len) { - struct gdlm_plock_info info; + struct dlm_plock_info info; struct resource *r; + int from = hd->nodeid; int rv; - memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info)); + memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info)); info_bswap_in(&info); - log_plock(mg, "receive drop %llx from %u", + log_plock(ls, "receive drop %llx from %u", (unsigned long long)info.number, from); - rv = find_resource(mg, info.number, 0, &r); + rv = find_resource(ls, info.number, 0, &r); if (rv) { /* we'll find no r if two nodes sent drop at once */ log_debug("receive_drop from %d no r %llx", from, @@ -1444,14 +1470,14 @@ static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from) } } -void receive_drop(struct mountgroup *mg, char *buf, int len, int from) +void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len) { - if (mg->save_plocks) { - save_message(mg, buf, len, from, MSG_PLOCK_DROP); + if (ls->save_plocks) { + save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK_DROP); return; } - _receive_drop(mg, buf, len, from); + _receive_drop(ls, hd, len); } /* We only drop resources from the unowned state to simplify things. @@ -1460,7 +1486,7 @@ void receive_drop(struct mountgroup *mg, char *buf, int len, int from) /* FIXME: in the transition from owner = us, to owner = 0, to drop; we want the second period to be shorter than the first */ -static int drop_resources(struct mountgroup *mg) +static int drop_resources(struct lockspace *ls) { struct resource *r; struct timeval now; @@ -1470,21 +1496,21 @@ static int drop_resources(struct mountgroup *mg) /* try to drop the oldest, unused resources */ - list_for_each_entry_reverse(r, &mg->resources, list) { - if (count >= config_drop_resources_count) + list_for_each_entry_reverse(r, &ls->plock_resources, list) { + if (count >= cfgd_drop_resources_count) break; if (r->owner && r->owner != our_nodeid) continue; if (time_diff_ms(&r->last_access, &now) < - config_drop_resources_age) + cfgd_drop_resources_age) continue; if (list_empty(&r->locks) && list_empty(&r->waiters)) { if (r->owner == our_nodeid) { - send_own(mg, r, 0); + send_own(ls, r, 0); r->owner = 0; } else if (r->owner == 0 && got_unown(r)) { - send_drop(mg, r); + send_drop(ls, r); } count++; @@ -1494,36 +1520,53 @@ static int drop_resources(struct mountgroup *mg) return 0; } -int process_plocks(void) +int limit_plocks(void) { - struct mountgroup *mg; - struct resource *r; - struct gdlm_plock_info info; struct timeval now; - uint64_t usec; - int rv; /* Don't send more messages while the cpg message queue is backed up */ if (message_flow_control_on) { update_flow_control_status(); if (message_flow_control_on) - return -EBUSY; + return 1; } + if (!cfgd_plock_rate_limit || !plock_read_count) + return 0; + gettimeofday(&now, NULL); - /* Every N ops we check how long it's taken to do those N ops. - If it's less than 1000 ms, we don't take any more. */ + /* Every time a plock op is read from the kernel, we increment + plock_read_count. After every cfgd_plock_rate_limit (N) reads, + we check the time it's taken to do those N; if the time is less than + a second, then we delay reading any more until a second is up. + This way we read a max of N ops from the kernel every second. */ - if (config_plock_rate_limit && plock_read_count && - !(plock_read_count % config_plock_rate_limit)) { + if (!(plock_read_count % cfgd_plock_rate_limit)) { if (time_diff_ms(&plock_rate_last, &now) < 1000) { plock_rate_delays++; - return -EBUSY; + return 2; } plock_rate_last = now; } + return 0; +} + +void process_plocks(int ci) +{ + struct lockspace *ls; + struct resource *r; + struct dlm_plock_info info; + struct timeval now; + uint64_t usec; + int rv; + + if (limit_plocks()) { + poll_ignore_plock = 1; + client_ignore(plock_ci, plock_fd); + return; + } memset(&info, 0, sizeof(info)); @@ -1531,25 +1574,28 @@ int process_plocks(void) if (rv < 0) { log_debug("process_plocks: read error %d fd %d\n", errno, control_fd); - return 0; + return; } /* kernel doesn't set the nodeid field */ info.nodeid = our_nodeid; - if (!plocks_online) { + if (!cfgd_enable_plock) { rv = -ENOSYS; goto fail; } - mg = find_mg_id(info.fsid); - if (!mg) { - log_debug("process_plocks: no mg id %x", info.fsid); + if (need_fsid_translation) + info.fsid = mg_to_ls_id(info.fsid); + + ls = find_ls_id(info.fsid); + if (!ls) { + log_debug("process_plocks: no ls id %x", info.fsid); rv = -EEXIST; goto fail; } - log_plock(mg, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d", + log_plock(ls, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d", (unsigned long long)info.number, op_str(info.optype), ex_str(info.optype, info.ex), @@ -1561,71 +1607,72 @@ int process_plocks(void) plock_read_count++; if (!(plock_read_count % 1000)) { usec = dt_usec(&plock_read_time, &now) ; - log_group(mg, "plock_read_count %u time %.3f s delays %u", + log_group(ls, "plock_read_count %u time %.3f s delays %u", plock_read_count, usec * 1.e-6, plock_rate_delays); plock_read_time = now; plock_rate_delays = 0; } - rv = find_resource(mg, info.number, 1, &r); + rv = find_resource(ls, info.number, 1, &r); if (rv) goto fail; if (r->owner == 0) { /* plock state replicated on all nodes */ - send_plock(mg, r, &info); + send_plock(ls, r, &info); } else if (r->owner == our_nodeid) { /* we are the owner of r, so our plocks are local */ - __receive_plock(mg, &info, our_nodeid, r); + __receive_plock(ls, &info, our_nodeid, r); } else { /* r owner is -1: r is new, try to become the owner; r owner > 0: tell other owner to give up ownership; both done with a message trying to set owner to ourself */ - send_own(mg, r, our_nodeid); - save_pending_plock(mg, r, &info); + send_own(ls, r, our_nodeid); + save_pending_plock(ls, r, &info); } - if (config_plock_ownership && - time_diff_ms(&mg->drop_resources_last, &now) >= - config_drop_resources_time) { - mg->drop_resources_last = now; - drop_resources(mg); + if (cfgd_plock_ownership && + time_diff_ms(&ls->drop_resources_last, &now) >= + cfgd_drop_resources_time) { + ls->drop_resources_last = now; + drop_resources(ls); } - return 0; + return; fail: info.rv = rv; - rv = write(control_fd, &info, sizeof(info)); - - return 0; + write(control_fd, &info, sizeof(info)); } -void process_saved_plocks(struct mountgroup *mg) +void process_saved_plocks(struct lockspace *ls) { struct save_msg *sm, *sm2; + struct dlm_header *hd; - if (list_empty(&mg->saved_messages)) + if (list_empty(&ls->saved_messages)) return; - log_group(mg, "process_saved_plocks"); + log_group(ls, "process_saved_plocks"); + + list_for_each_entry_safe(sm, sm2, &ls->saved_messages, list) { + hd = (struct dlm_header *)sm->buf; - list_for_each_entry_safe(sm, sm2, &mg->saved_messages, list) { switch (sm->type) { - case MSG_PLOCK: - _receive_plock(mg, sm->buf, sm->len, sm->nodeid); + case DLM_MSG_PLOCK: + _receive_plock(ls, hd, sm->len); break; - case MSG_PLOCK_OWN: - _receive_own(mg, sm->buf, sm->len, sm->nodeid); + case DLM_MSG_PLOCK_OWN: + _receive_own(ls, hd, sm->len); break; - case MSG_PLOCK_DROP: - _receive_drop(mg, sm->buf, sm->len, sm->nodeid); + case DLM_MSG_PLOCK_DROP: + _receive_drop(ls, hd, sm->len); break; - case MSG_PLOCK_SYNC_LOCK: - case MSG_PLOCK_SYNC_WAITER: - _receive_sync(mg, sm->buf, sm->len, sm->nodeid); + case DLM_MSG_PLOCK_SYNC_LOCK: + case DLM_MSG_PLOCK_SYNC_WAITER: + _receive_sync(ls, hd, sm->len); break; default: continue; @@ -1638,14 +1685,13 @@ void process_saved_plocks(struct mountgroup *mg) void plock_exit(void) { - if (plocks_online) - saCkptFinalize(ckpt_handle); + saCkptFinalize(system_ckpt_handle); } /* locks still marked SYNCING should not go into the ckpt; the new node will get those locks by receiving PLOCK_SYNC messages */ -static void pack_section_buf(struct mountgroup *mg, struct resource *r) +static void pack_section_buf(struct lockspace *ls, struct resource *r) { struct pack_plock *pp; struct posix_lock *po; @@ -1689,7 +1735,7 @@ static void pack_section_buf(struct mountgroup *mg, struct resource *r) section_len = count * sizeof(struct pack_plock); } -static int unpack_section_buf(struct mountgroup *mg, char *numbuf, int buflen) +static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen) { struct pack_plock *pp; struct posix_lock *po; @@ -1710,10 +1756,7 @@ static int unpack_section_buf(struct mountgroup *mg, char *numbuf, int buflen) INIT_LIST_HEAD(&r->waiters); INIT_LIST_HEAD(&r->pending); - if (config_plock_ownership) - sscanf(numbuf, "r%llu.%d", &num, &owner); - else - sscanf(numbuf, "r%llu", &num); + sscanf(numbuf, "r%llu.%d", &num, &owner); r->number = num; r->owner = owner; @@ -1744,46 +1787,51 @@ static int unpack_section_buf(struct mountgroup *mg, char *numbuf, int buflen) pp++; } - list_add_tail(&r->list, &mg->resources); + list_add_tail(&r->list, &ls->plock_resources); return 0; } -int _unlink_checkpoint(struct mountgroup *mg, SaNameT *name) +/* If we are the new ckpt_node, we'll be unlinking a ckpt that we don't + have open, which was created by the previous ckpt_node. The previous + ckpt_node should have closed the ckpt in set_plock_ckpt_node() so it + will go away when we unlink it here. */ + +static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name) { SaCkptCheckpointHandleT h; SaCkptCheckpointDescriptorT s; SaAisErrorT rv; int ret = 0; - h = (SaCkptCheckpointHandleT) mg->cp_handle; - log_group(mg, "unlink ckpt %llx", (unsigned long long)h); + h = (SaCkptCheckpointHandleT) ls->plock_ckpt_handle; + log_group(ls, "unlink ckpt %llx", (unsigned long long)h); unlink_retry: - rv = saCkptCheckpointUnlink(ckpt_handle, name); + rv = saCkptCheckpointUnlink(system_ckpt_handle, name); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "unlink ckpt retry"); + log_group(ls, "unlink ckpt retry"); sleep(1); goto unlink_retry; } if (rv == SA_AIS_OK) goto out_close; - log_error("unlink ckpt error %d %s", rv, mg->name); + log_error("unlink ckpt error %d %s", rv, ls->name); ret = -1; status_retry: rv = saCkptCheckpointStatusGet(h, &s); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "unlink ckpt status retry"); + log_group(ls, "unlink ckpt status retry"); sleep(1); goto status_retry; } if (rv != SA_AIS_OK) { - log_error("unlink ckpt status error %d %s", rv, mg->name); + log_error("unlink ckpt status error %d %s", rv, ls->name); goto out_close; } - log_group(mg, "unlink ckpt status: size %llu, max sections %u, " + log_group(ls, "unlink ckpt status: size %llu, max sections %u, " "max section size %llu, section count %u, mem %u", (unsigned long long)s.checkpointCreationAttributes.checkpointSize, s.checkpointCreationAttributes.maxSections, @@ -1796,31 +1844,43 @@ int _unlink_checkpoint(struct mountgroup *mg, SaNameT *name) rv = saCkptCheckpointClose(h); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "unlink ckpt close retry"); + log_group(ls, "unlink ckpt close retry"); sleep(1); goto out_close; } if (rv != SA_AIS_OK) { log_error("unlink ckpt %llx close err %d %s", - (unsigned long long)h, rv, mg->name); + (unsigned long long)h, rv, ls->name); /* should we return an error here and possibly cause store_plocks() to fail on this? */ /* ret = -1; */ } out: - mg->cp_handle = 0; + ls->plock_ckpt_handle = 0; return ret; } -int unlink_checkpoint(struct mountgroup *mg) +void close_plock_checkpoint(struct lockspace *ls) { - SaNameT name; - int len; + SaCkptCheckpointHandleT h; + SaAisErrorT rv; - len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", - mg->name); - name.length = len; - return _unlink_checkpoint(mg, &name); + h = (SaCkptCheckpointHandleT) ls->plock_ckpt_handle; + if (!h) + return; + retry: + rv = saCkptCheckpointClose(h); + if (rv == SA_AIS_ERR_TRY_AGAIN) { + log_group(ls, "close_plock_checkpoint retry"); + sleep(1); + goto retry; + } + if (rv != SA_AIS_OK) { + log_error("close_plock_checkpoint %llx err %d %s", + (unsigned long long)h, rv, ls->name); + } + + ls->plock_ckpt_handle = 0; } /* @@ -1847,7 +1907,7 @@ int unlink_checkpoint(struct mountgroup *mg) it. The ckpt should then disappear and the new node can create a new ckpt for the next mounter. */ -void store_plocks(struct mountgroup *mg, int nodeid) +void store_plocks(struct lockspace *ls) { SaCkptCheckpointCreationAttributesT attr; SaCkptCheckpointHandleT h; @@ -1863,25 +1923,21 @@ void store_plocks(struct mountgroup *mg, int nodeid) int r_count, lock_count, total_size, section_size, max_section_size; int len, owner; - if (!plocks_online) + if (!cfgd_enable_plock) return; /* no change to plock state since we created the last checkpoint */ - if (mg->last_checkpoint_time > mg->last_plock_time) { - log_group(mg, "store_plocks: saved ckpt uptodate"); + if (ls->last_checkpoint_time > ls->last_plock_time) { + log_group(ls, "store_plocks: saved ckpt uptodate"); goto out; } - mg->last_checkpoint_time = time(NULL); + ls->last_checkpoint_time = time(NULL); - len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", - mg->name); + len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmplock.%s", + ls->name); name.length = len; - /* unlink an old checkpoint before we create a new one */ - if (mg->cp_handle) { - if (_unlink_checkpoint(mg, &name)) - return; - } + _unlink_checkpoint(ls, &name); /* loop through all plocks to figure out sizes to set in the attr fields */ @@ -1891,7 +1947,7 @@ void store_plocks(struct mountgroup *mg, int nodeid) total_size = 0; max_section_size = 0; - list_for_each_entry(r, &mg->resources, list) { + list_for_each_entry(r, &ls->plock_resources, list) { if (r->owner == -1) continue; @@ -1910,10 +1966,10 @@ void store_plocks(struct mountgroup *mg, int nodeid) max_section_size = section_size; } - log_group(mg, "store_plocks: r_count %d, lock_count %d, pp %u bytes", + log_group(ls, "store_plocks: r_count %d, lock_count %d, pp %u bytes", r_count, lock_count, (unsigned int)sizeof(struct pack_plock)); - log_group(mg, "store_plocks: total %d bytes, max_section %d bytes", + log_group(ls, "store_plocks: total %d bytes, max_section %d bytes", total_size, max_section_size); attr.creationFlags = SA_CKPT_WR_ALL_REPLICAS; @@ -1928,24 +1984,24 @@ void store_plocks(struct mountgroup *mg, int nodeid) SA_CKPT_CHECKPOINT_CREATE; open_retry: - rv = saCkptCheckpointOpen(ckpt_handle, &name, &attr, flags, 0, &h); + rv = saCkptCheckpointOpen(system_ckpt_handle, &name,&attr,flags,0,&h); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "store_plocks: ckpt open retry"); + log_group(ls, "store_plocks: ckpt open retry"); sleep(1); goto open_retry; } if (rv == SA_AIS_ERR_EXIST) { - log_group(mg, "store_plocks: ckpt already exists"); + log_group(ls, "store_plocks: ckpt already exists"); return; } if (rv != SA_AIS_OK) { - log_error("store_plocks: ckpt open error %d %s", rv, mg->name); + log_error("store_plocks: ckpt open error %d %s", rv, ls->name); return; } - log_group(mg, "store_plocks: open ckpt handle %llx", + log_group(ls, "store_plocks: open ckpt handle %llx", (unsigned long long)h); - mg->cp_handle = (uint64_t) h; + ls->plock_ckpt_handle = (uint64_t) h; /* - If r owner is -1, ckpt nothing. - If r owner is us, ckpt owner of us and no plocks. @@ -1957,7 +2013,7 @@ void store_plocks(struct mountgroup *mg, int nodeid) - If r owner is 0 and got_unown, then ckpt owner 0 and all plocks; (there should be no SYNCING plocks) */ - list_for_each_entry(r, &mg->resources, list) { + list_for_each_entry(r, &ls->plock_resources, list) { if (r->owner == -1) continue; else if (r->owner == our_nodeid) @@ -1975,12 +2031,8 @@ void store_plocks(struct mountgroup *mg, int nodeid) } memset(&buf, 0, sizeof(buf)); - if (config_plock_ownership) - len = snprintf(buf, SECTION_NAME_LEN, "r%llu.%d", - (unsigned long long)r->number, owner); - else - len = snprintf(buf, SECTION_NAME_LEN, "r%llu", - (unsigned long long)r->number); + len = snprintf(buf, SECTION_NAME_LEN, "r%llu.%d", + (unsigned long long)r->number, owner); section_id.id = (void *)buf; section_id.idLen = len + 1; @@ -1990,49 +2042,42 @@ void store_plocks(struct mountgroup *mg, int nodeid) memset(§ion_buf, 0, sizeof(section_buf)); section_len = 0; - pack_section_buf(mg, r); + pack_section_buf(ls, r); - log_group(mg, "store_plocks: section size %u id %u \"%s\"", + log_group(ls, "store_plocks: section size %u id %u \"%s\"", section_len, section_id.idLen, buf); create_retry: rv = saCkptSectionCreate(h, §ion_attr, §ion_buf, section_len); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "store_plocks: ckpt create retry"); + log_group(ls, "store_plocks: ckpt create retry"); sleep(1); goto create_retry; } if (rv == SA_AIS_ERR_EXIST) { /* this shouldn't happen in general */ - log_group(mg, "store_plocks: clearing old ckpt"); + log_group(ls, "store_plocks: clearing old ckpt"); + /* do we need this close or will the close in + the unlink function be ok? */ saCkptCheckpointClose(h); - _unlink_checkpoint(mg, &name); + _unlink_checkpoint(ls, &name); goto open_retry; } if (rv != SA_AIS_OK) { log_error("store_plocks: ckpt section create err %d %s", - rv, mg->name); + rv, ls->name); break; } } - out: - /* If the new nodeid is becoming the low nodeid it will now be in - charge of creating ckpt's for mounters instead of us. */ - - if (nodeid < our_nodeid) { - log_group(mg, "store_plocks: closing ckpt for new low node %d", - nodeid); - saCkptCheckpointClose(h); - mg->cp_handle = 0; - } + return; } /* called by a node that's just been added to the group to get existing plock state */ -void retrieve_plocks(struct mountgroup *mg) +void retrieve_plocks(struct lockspace *ls) { SaCkptCheckpointHandleT h; SaCkptSectionIterationHandleT itr; @@ -2043,39 +2088,39 @@ void retrieve_plocks(struct mountgroup *mg) char buf[SECTION_NAME_LEN]; int len; - if (!plocks_online) + if (!cfgd_enable_plock) return; - log_group(mg, "retrieve_plocks"); + log_group(ls, "retrieve_plocks"); - len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", - mg->name); + len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmplock.%s", + ls->name); name.length = len; open_retry: - rv = saCkptCheckpointOpen(ckpt_handle, &name, NULL, + rv = saCkptCheckpointOpen(system_ckpt_handle, &name, NULL, SA_CKPT_CHECKPOINT_READ, 0, &h); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "retrieve_plocks: ckpt open retry"); + log_group(ls, "retrieve_plocks: ckpt open retry"); sleep(1); goto open_retry; } if (rv != SA_AIS_OK) { log_error("retrieve_plocks: ckpt open error %d %s", - rv, mg->name); + rv, ls->name); return; } init_retry: rv = saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY, 0, &itr); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "retrieve_plocks: ckpt iterinit retry"); + log_group(ls, "retrieve_plocks: ckpt iterinit retry"); sleep(1); goto init_retry; } if (rv != SA_AIS_OK) { log_error("retrieve_plocks: ckpt iterinit error %d %s", - rv, mg->name); + rv, ls->name); goto out; } @@ -2085,13 +2130,13 @@ void retrieve_plocks(struct mountgroup *mg) if (rv == SA_AIS_ERR_NO_SECTIONS) break; if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "retrieve_plocks: ckpt iternext retry"); + log_group(ls, "retrieve_plocks: ckpt iternext retry"); sleep(1); goto next_retry; } if (rv != SA_AIS_OK) { log_error("retrieve_plocks: ckpt iternext error %d %s", - rv, mg->name); + rv, ls->name); goto out_it; } @@ -2105,24 +2150,24 @@ void retrieve_plocks(struct mountgroup *mg) memset(&buf, 0, sizeof(buf)); snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id); - log_group(mg, "retrieve_plocks: section size %llu id %u \"%s\"", + log_group(ls, "retrieve_plocks: section size %llu id %u \"%s\"", (unsigned long long)iov.dataSize, iov.sectionId.idLen, buf); read_retry: rv = saCkptCheckpointRead(h, &iov, 1, NULL); if (rv == SA_AIS_ERR_TRY_AGAIN) { - log_group(mg, "retrieve_plocks: ckpt read retry"); + log_group(ls, "retrieve_plocks: ckpt read retry"); sleep(1); goto read_retry; } if (rv != SA_AIS_OK) { log_error("retrieve_plocks: ckpt read error %d %s", - rv, mg->name); + rv, ls->name); goto out_it; } - log_group(mg, "retrieve_plocks: ckpt read %llu bytes", + log_group(ls, "retrieve_plocks: ckpt read %llu bytes", (unsigned long long)iov.readSize); section_len = iov.readSize; @@ -2131,38 +2176,35 @@ void retrieve_plocks(struct mountgroup *mg) if (section_len % sizeof(struct pack_plock)) { log_error("retrieve_plocks: bad section len %d %s", - section_len, mg->name); + section_len, ls->name); continue; } - unpack_section_buf(mg, (char *)desc.sectionId.id, + unpack_section_buf(ls, (char *)desc.sectionId.id, desc.sectionId.idLen); } out_it: saCkptSectionIterationFinalize(itr); out: - if (mg->low_nodeid == our_nodeid) { - /* we're the new low nodeid, will be master */ - log_group(mg, "retrieve_plocks: unlink ckpt from old master"); - mg->cp_handle = (uint64_t) h; - _unlink_checkpoint(mg, &name); - } else - saCkptCheckpointClose(h); + saCkptCheckpointClose(h); } /* Called when a node has failed, or we're unmounting. For a node failure, we need to call this when the cpg confchg arrives so that we're guaranteed all nodes do this in the same sequence wrt other messages. */ -void purge_plocks(struct mountgroup *mg, int nodeid, int unmount) +void purge_plocks(struct lockspace *ls, int nodeid, int unmount) { struct posix_lock *po, *po2; struct lock_waiter *w, *w2; struct resource *r, *r2; int purged = 0; - list_for_each_entry_safe(r, r2, &mg->resources, list) { + if (!cfgd_enable_plock) + return; + + list_for_each_entry_safe(r, r2, &ls->plock_resources, list) { list_for_each_entry_safe(po, po2, &r->locks, list) { if (po->nodeid == nodeid || unmount) { list_del(&po->list); @@ -2185,13 +2227,13 @@ void purge_plocks(struct mountgroup *mg, int nodeid, int unmount) if (r->owner == nodeid) { r->owner = 0; - send_pending_plocks(mg, r); + send_pending_plocks(ls, r); } if (!list_empty(&r->waiters)) - do_waiters(mg, r); + do_waiters(ls, r); - if (!config_plock_ownership && + if (!cfgd_plock_ownership && list_empty(&r->locks) && list_empty(&r->waiters)) { list_del(&r->list); free(r); @@ -2199,21 +2241,14 @@ void purge_plocks(struct mountgroup *mg, int nodeid, int unmount) } if (purged) - mg->last_plock_time = time(NULL); - - log_group(mg, "purged %d plocks for %d", purged, nodeid); - - /* we may have a saved ckpt that we created for the last mounter, - we need to unlink it so another node can create a new ckpt for - the next mounter after we leave */ + ls->last_plock_time = time(NULL); - if (unmount && mg->cp_handle) - unlink_checkpoint(mg); + log_group(ls, "purged %d plocks for %d", purged, nodeid); } int dump_plocks(char *name, int fd) { - struct mountgroup *mg; + struct lockspace *ls; struct posix_lock *po; struct lock_waiter *w; struct resource *r; @@ -2223,11 +2258,11 @@ int dump_plocks(char *name, int fd) if (!name) return -1; - mg = find_mg(name); - if (!mg) + ls = find_ls(name); + if (!ls) return -1; - list_for_each_entry(r, &mg->resources, list) { + list_for_each_entry(r, &ls->plock_resources, list) { list_for_each_entry(po, &r->locks, list) { snprintf(line, MAXLINE, "%llu %s %llu-%llu nodeid %d pid %u owner %llx\n", diff --git a/group/include/list.h b/group/include/list.h index 566b377..8100cbc 100644 --- a/group/include/list.h +++ b/group/include/list.h @@ -226,6 +226,17 @@ static inline void list_splice_init(struct list_head *list, container_of(ptr, type, member) /** + * list_first_entry - get the first element from a list + * @ptr: the list head to take the element from. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * Note, that list is expected to be not empty. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +/** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. hooks/post-receive -- Cluster Project From teigland@sourceware.org Fri Apr 11 19:50:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Fri, 11 Apr 2008 19:50:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-159-gb4c3351 Message-ID: <20080411195027.21030.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b4c3351a0850da056f879705a28aead767d78072 The branch, master has been updated via b4c3351a0850da056f879705a28aead767d78072 (commit) from 77bce77b5034adf8f00090b13dde7c7d481b0dd9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b4c3351a0850da056f879705a28aead767d78072 Author: David Teigland Date: Fri Apr 11 14:45:41 2008 -0500 dlm_controld: quorum checking Fill out the quorum dependency checking, and refine structure of the fencing and fs dependency checking which don't actually work yet. Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: group/dlm_controld/cpg.c | 107 +++++++++++++++++++++++++++---------- group/dlm_controld/dlm_daemon.h | 2 + group/dlm_controld/main.c | 1 + group/dlm_controld/member_cman.c | 2 + group/dlm_controld/plock.c | 2 +- 5 files changed, 84 insertions(+), 30 deletions(-) diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c index 21c1a43..afe12bd 100644 --- a/group/dlm_controld/cpg.c +++ b/group/dlm_controld/cpg.c @@ -32,7 +32,10 @@ struct member { struct node { struct list_head list; int nodeid; - int needs_fencing; + int check_fencing; + int check_quorum; + int check_fs; + int fs_notify; struct timeval add_time; }; @@ -266,8 +269,8 @@ static void free_ls(struct lockspace *ls) when we see a node not in this list, add entry for it with zero add_time record the time we get a good start message from the node, add_time clear add_time if the node leaves - if node fails with non-zero add_time, set needs_fencing - when a node is fenced, clear add_time and clear needs_fencing + if node fails with non-zero add_time, set check_fencing + when a node is fenced, clear add_time and clear check_fencing if a node remerges after this, no good start message, no new add_time set if a node fails with zero add_time, it doesn't need fencing if a node remerges before it's been fenced, no good start message, no new @@ -340,63 +343,109 @@ static void node_history_fail(struct lockspace *ls, int nodeid) } if (!timerisset(&node->add_time)) - node->needs_fencing = 1; + node->check_fencing = 1; + + node->check_quorum = 1; + node->check_fs = 1; } -static int failed_nodes_fenced(struct lockspace *ls) +static int check_fencing_done(struct lockspace *ls) { -#if 0 struct node *node; struct timeval last_fenced; int wait_count = 0; list_for_each_entry(node, &ls->node_history, list) { - if (!node->needs_fencing) + if (!node->check_fencing) continue; /* check with fenced to see if the node has been fenced since node->add_time */ - fencedomain_last_success(node->nodeid, &last_fenced); + /* fenced_last_success(node->nodeid, &last_fenced); */ + gettimeofday(&last_fenced, NULL); - if (last_fenced <= node->add_time) { + if (timercmp(&last_fenced, &node->add_time, >)) { + node->check_fencing = 0; + timerclear(&node->add_time); + } else { + log_group(ls, "check_fencing %d needs fencing", + node->nodeid); wait_count++; - continue; } - - /* node has been fenced */ - node->needs_fencing = 0; - timerclear(&node->add_time); } - if (wait_count) { + if (wait_count) return 0; - } /* now check if there are any outstanding fencing ops (for nodes we may not have seen in any lockspace), and return 0 if there are any */ - fencedomain_pending_count(&pending); + /* + fenced_pending_count(&pending); if (pending) return 0; -#endif + */ return 1; } -static int cluster_has_quorum(struct lockspace *ls) +static int check_quorum_done(struct lockspace *ls) { - /* verify cman_last_failure_time() for this node is more recent - than when we last saw the node added; then we know that the - quorum result from cman is accounting for the given failure. */ + struct node *node; + int wait_count = 0; + + if (!cman_quorate) { + log_group(ls, "check_quorum %d", cman_quorate); + return 0; + } + + list_for_each_entry(node, &ls->node_history, list) { + if (!node->check_quorum) + continue; + + if (!is_cman_member(node->nodeid)) { + node->check_quorum = 0; + } else { + log_group(ls, "check_quorum %d is_cman_member", + node->nodeid); + wait_count++; + } + } + + if (wait_count) + return 0; + + log_group(ls, "check_quorum done"); return 1; } -static int cluster_filesystem_stopped(struct lockspace *ls) +static int check_fs_done(struct lockspace *ls) { - /* communicate with fs daemon through the fscontrol:hostname - cpg to check if the fs has been notified of any node failures - in this change */ + struct node *node; + int wait_count = 0; + + /* no corresponding fs for this lockspace */ + if (!ls->fs_registered) + return 1; + + list_for_each_entry(node, &ls->node_history, list) { + if (!node->check_fs) + continue; + + if (node->fs_notify) { + node->check_fs = 0; + } else { + log_group(ls, "check_fs %d needs fs notify", + node->nodeid); + wait_count++; + } + } + + if (wait_count) + return 0; + + log_group(ls, "check_fs done"); return 1; } @@ -490,7 +539,7 @@ static int wait_conditions_done(struct lockspace *ls) that have occured since the last change applied to dlm-kernel, not just the latest change */ - if (!failed_nodes_fenced(ls)) { + if (!check_fencing_done(ls)) { poll_fencing = 1; return 0; } @@ -500,13 +549,13 @@ static int wait_conditions_done(struct lockspace *ls) sufficient because we don't want to start new lockspaces in an inquorate cluster */ - if (!cluster_has_quorum(ls)) { + if (!check_quorum_done(ls)) { poll_quorum = 1; return 0; } poll_quorum = 0; - if (!cluster_filesystem_stopped(ls)) { + if (!check_fs_done(ls)) { poll_fs = 1; return 0; } diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index d5657dd..b969bdc 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -68,6 +68,7 @@ extern int poll_ignore_plock; extern int plock_fd; extern int plock_ci; extern struct list_head lockspaces; +extern int cman_quorate; extern int our_nodeid; extern char daemon_debug_buf[256]; extern char dump_buf[DUMP_SIZE]; @@ -149,6 +150,7 @@ struct lockspace { int joining; int leaving; int kernel_stopped; + int fs_registered; uint32_t change_seq; struct change *started_change; struct list_head changes; diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index 0e4bc15..b954f53 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -881,6 +881,7 @@ int poll_ignore_plock; int plock_fd; int plock_ci; struct list_head lockspaces; +int cman_quorate; int our_nodeid; char daemon_debug_buf[256]; char dump_buf[DUMP_SIZE]; diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c index 847351a..c871097 100644 --- a/group/dlm_controld/member_cman.c +++ b/group/dlm_controld/member_cman.c @@ -71,6 +71,8 @@ static void statechange(void) int num_addrs; struct cman_node_address *addrptr = addrs; + cman_quorate = cman_is_quorate(ch); + old_node_count = cman_node_count; memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes)); diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c index a862356..4dc38ac 100644 --- a/group/dlm_controld/plock.c +++ b/group/dlm_controld/plock.c @@ -1816,7 +1816,7 @@ static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name) if (rv == SA_AIS_OK) goto out_close; - log_error("unlink ckpt error %d %s", rv, ls->name); + log_group(ls, "unlink ckpt error %d %s", rv, ls->name); ret = -1; status_retry: hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Fri Apr 11 22:43:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 22:43:00 -0000 Subject: conga/luci/cluster fence-macros Message-ID: <20080411224317.16450.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-11 22:43:17 Modified files: luci/cluster : fence-macros Log message: Fix typo Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.2&r2=1.2.4.3 From rmccabe@sourceware.org Fri Apr 11 22:43:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 11 Apr 2008 22:43:00 -0000 Subject: conga/luci/cluster fence-macros Message-ID: <20080411224330.16592.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-11 22:43:30 Modified files: luci/cluster : fence-macros Log message: Fix typo Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.2&r2=1.2.2.3 From rpeterso@sourceware.org Sun Apr 13 16:28:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Sun, 13 Apr 2008 16:28:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-42-ge835ef0 Message-ID: <20080413162825.28577.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e835ef061174e2ab6ecd663145121bc454c9790c The branch, RHEL5 has been updated via e835ef061174e2ab6ecd663145121bc454c9790c (commit) from 9b83c1750434f1065c63fe547303260da15a73b2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e835ef061174e2ab6ecd663145121bc454c9790c Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) ----------------------------------------------------------------------- Summary of changes: gfs/gfs_fsck/rgrp.c | 10 ++++++++++ gfs/gfs_fsck/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c index 601f292..6ef6f74 100644 --- a/gfs/gfs_fsck/rgrp.c +++ b/gfs/gfs_fsck/rgrp.c @@ -35,6 +35,16 @@ int fs_compute_bitstructs(struct fsck_rgrp *rgd) uint32 bytes_left, bytes; int x; + /* Max size of an rg is 2GB. A 2GB RG with (minimum) 512-byte blocks + has 4194304 blocks. We can represent 4 blocks in one bitmap byte. + Therefore, all 4194304 blocks can be represented in 1048576 bytes. + Subtract a metadata header for each 512-byte block and we get + 488 bytes of bitmap per block. Divide 1048576 by 488 and we can + be assured we should never have more than 2149 of them. */ + if (length > 2149 || length == 0) { + log_err("Invalid length %u found in rindex.\n", length); + return -1; + } if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) { log_err("Unable to allocate bitmap structure\n"); stack; diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c index 8bfb823..55ff997 100644 --- a/gfs/gfs_fsck/super.c +++ b/gfs/gfs_fsck/super.c @@ -1070,6 +1070,7 @@ int ri_update(struct fsck_sb *sdp) struct gfs_rindex buf; unsigned int rg, calc_rg_count; int error, count1 = 0, count2 = 0; + int fix_grow_problems = 0, grow_problems = 0; enum rgindex_trust_level { /* how far can we trust our RG index? */ blind_faith = 0, /* We'd like to trust the rgindex. We always used to before bz 179069. This should cover most cases. */ @@ -1170,12 +1171,41 @@ int ri_update(struct fsck_sb *sdp) osi_list_del(&expected_rgd->rd_list); free(expected_rgd); } /* if we can't trust the rg index */ + else { /* blind faith -- just check for the gfs_grow problem */ + if (rgd->rd_ri.ri_data == 4294967292) { + if (!fix_grow_problems) { + log_err("A problem with the rindex file caused by gfs_grow was detected.\n"); + if(query(sdp, "Fix the rindex problem? (y/n)")) + fix_grow_problems = 1; + } + /* Keep a counter in case we hit it more than once. */ + grow_problems++; + osi_list_del(&rgd->rd_list); /* take it out of the equation */ + free(rgd); + continue; + } else if (fix_grow_problems) { + /* Once we detect the gfs_grow rindex problem, we have to */ + /* rewrite the entire rest of the rindex file, starting */ + /* with the entry AFTER the one that has the problem. */ + gfs_rindex_out(&rgd->rd_ri, (char *)&buf); + error = writei(sdp->riinode, (char *)&buf, + (rg - grow_problems) * + sizeof(struct gfs_rindex), + sizeof(struct gfs_rindex)); + if (error != sizeof(struct gfs_rindex)) { + log_err("Unable to fix rindex entry %u.\n", + rg + 1); + goto fail; + } + } + } error = fs_compute_bitstructs(rgd); if (error) break; rgd->rd_open_count = 0; count1++; } /* for all RGs in the index */ + rg -= grow_problems; if (!error) { log_info("%u resource groups found.\n", rg); if (trust_lvl != blind_faith && rg != calc_rg_count) @@ -1204,6 +1234,16 @@ int ri_update(struct fsck_sb *sdp) } sdp->rgcount = count1; } + if (fix_grow_problems) { + osi_buf_t *dibh; + + get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0); + sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex); + gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh)); + write_buf(sdp, dibh, 0); + grow_problems = fix_grow_problems = 0; + relse_buf(sdp, dibh); + } if (!error) { /* if no problems encountered with the rgs */ log_info("(passed)\n"); break; /* no reason to distrust what we saw. Otherwise, we hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Sun Apr 13 16:31:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Sun, 13 Apr 2008 16:31:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-160-g5370723 Message-ID: <20080413163148.30252.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=53707236b407fee094f1135df445670cbed15f00 The branch, master has been updated via 53707236b407fee094f1135df445670cbed15f00 (commit) from b4c3351a0850da056f879705a28aead767d78072 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 53707236b407fee094f1135df445670cbed15f00 Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) ----------------------------------------------------------------------- Summary of changes: gfs/gfs_fsck/rgrp.c | 10 ++++++++++ gfs/gfs_fsck/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c index 601f292..6ef6f74 100644 --- a/gfs/gfs_fsck/rgrp.c +++ b/gfs/gfs_fsck/rgrp.c @@ -35,6 +35,16 @@ int fs_compute_bitstructs(struct fsck_rgrp *rgd) uint32 bytes_left, bytes; int x; + /* Max size of an rg is 2GB. A 2GB RG with (minimum) 512-byte blocks + has 4194304 blocks. We can represent 4 blocks in one bitmap byte. + Therefore, all 4194304 blocks can be represented in 1048576 bytes. + Subtract a metadata header for each 512-byte block and we get + 488 bytes of bitmap per block. Divide 1048576 by 488 and we can + be assured we should never have more than 2149 of them. */ + if (length > 2149 || length == 0) { + log_err("Invalid length %u found in rindex.\n", length); + return -1; + } if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) { log_err("Unable to allocate bitmap structure\n"); stack; diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c index 8bfb823..55ff997 100644 --- a/gfs/gfs_fsck/super.c +++ b/gfs/gfs_fsck/super.c @@ -1070,6 +1070,7 @@ int ri_update(struct fsck_sb *sdp) struct gfs_rindex buf; unsigned int rg, calc_rg_count; int error, count1 = 0, count2 = 0; + int fix_grow_problems = 0, grow_problems = 0; enum rgindex_trust_level { /* how far can we trust our RG index? */ blind_faith = 0, /* We'd like to trust the rgindex. We always used to before bz 179069. This should cover most cases. */ @@ -1170,12 +1171,41 @@ int ri_update(struct fsck_sb *sdp) osi_list_del(&expected_rgd->rd_list); free(expected_rgd); } /* if we can't trust the rg index */ + else { /* blind faith -- just check for the gfs_grow problem */ + if (rgd->rd_ri.ri_data == 4294967292) { + if (!fix_grow_problems) { + log_err("A problem with the rindex file caused by gfs_grow was detected.\n"); + if(query(sdp, "Fix the rindex problem? (y/n)")) + fix_grow_problems = 1; + } + /* Keep a counter in case we hit it more than once. */ + grow_problems++; + osi_list_del(&rgd->rd_list); /* take it out of the equation */ + free(rgd); + continue; + } else if (fix_grow_problems) { + /* Once we detect the gfs_grow rindex problem, we have to */ + /* rewrite the entire rest of the rindex file, starting */ + /* with the entry AFTER the one that has the problem. */ + gfs_rindex_out(&rgd->rd_ri, (char *)&buf); + error = writei(sdp->riinode, (char *)&buf, + (rg - grow_problems) * + sizeof(struct gfs_rindex), + sizeof(struct gfs_rindex)); + if (error != sizeof(struct gfs_rindex)) { + log_err("Unable to fix rindex entry %u.\n", + rg + 1); + goto fail; + } + } + } error = fs_compute_bitstructs(rgd); if (error) break; rgd->rd_open_count = 0; count1++; } /* for all RGs in the index */ + rg -= grow_problems; if (!error) { log_info("%u resource groups found.\n", rg); if (trust_lvl != blind_faith && rg != calc_rg_count) @@ -1204,6 +1234,16 @@ int ri_update(struct fsck_sb *sdp) } sdp->rgcount = count1; } + if (fix_grow_problems) { + osi_buf_t *dibh; + + get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0); + sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex); + gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh)); + write_buf(sdp, dibh, 0); + grow_problems = fix_grow_problems = 0; + relse_buf(sdp, dibh); + } if (!error) { /* if no problems encountered with the rgs */ log_info("(passed)\n"); break; /* no reason to distrust what we saw. Otherwise, we hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Sun Apr 13 16:33:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Sun, 13 Apr 2008 16:33:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-3-gb8a071f Message-ID: <20080413163321.30665.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b8a071f51986e3a3e9fa670259dd012ec0a23141 The branch, STABLE2 has been updated via b8a071f51986e3a3e9fa670259dd012ec0a23141 (commit) from 22663a865681ebcc2f3c921a3ef3967d66d5663f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b8a071f51986e3a3e9fa670259dd012ec0a23141 Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) ----------------------------------------------------------------------- Summary of changes: gfs/gfs_fsck/rgrp.c | 10 ++++++++++ gfs/gfs_fsck/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c index 601f292..6ef6f74 100644 --- a/gfs/gfs_fsck/rgrp.c +++ b/gfs/gfs_fsck/rgrp.c @@ -35,6 +35,16 @@ int fs_compute_bitstructs(struct fsck_rgrp *rgd) uint32 bytes_left, bytes; int x; + /* Max size of an rg is 2GB. A 2GB RG with (minimum) 512-byte blocks + has 4194304 blocks. We can represent 4 blocks in one bitmap byte. + Therefore, all 4194304 blocks can be represented in 1048576 bytes. + Subtract a metadata header for each 512-byte block and we get + 488 bytes of bitmap per block. Divide 1048576 by 488 and we can + be assured we should never have more than 2149 of them. */ + if (length > 2149 || length == 0) { + log_err("Invalid length %u found in rindex.\n", length); + return -1; + } if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) { log_err("Unable to allocate bitmap structure\n"); stack; diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c index 8bfb823..55ff997 100644 --- a/gfs/gfs_fsck/super.c +++ b/gfs/gfs_fsck/super.c @@ -1070,6 +1070,7 @@ int ri_update(struct fsck_sb *sdp) struct gfs_rindex buf; unsigned int rg, calc_rg_count; int error, count1 = 0, count2 = 0; + int fix_grow_problems = 0, grow_problems = 0; enum rgindex_trust_level { /* how far can we trust our RG index? */ blind_faith = 0, /* We'd like to trust the rgindex. We always used to before bz 179069. This should cover most cases. */ @@ -1170,12 +1171,41 @@ int ri_update(struct fsck_sb *sdp) osi_list_del(&expected_rgd->rd_list); free(expected_rgd); } /* if we can't trust the rg index */ + else { /* blind faith -- just check for the gfs_grow problem */ + if (rgd->rd_ri.ri_data == 4294967292) { + if (!fix_grow_problems) { + log_err("A problem with the rindex file caused by gfs_grow was detected.\n"); + if(query(sdp, "Fix the rindex problem? (y/n)")) + fix_grow_problems = 1; + } + /* Keep a counter in case we hit it more than once. */ + grow_problems++; + osi_list_del(&rgd->rd_list); /* take it out of the equation */ + free(rgd); + continue; + } else if (fix_grow_problems) { + /* Once we detect the gfs_grow rindex problem, we have to */ + /* rewrite the entire rest of the rindex file, starting */ + /* with the entry AFTER the one that has the problem. */ + gfs_rindex_out(&rgd->rd_ri, (char *)&buf); + error = writei(sdp->riinode, (char *)&buf, + (rg - grow_problems) * + sizeof(struct gfs_rindex), + sizeof(struct gfs_rindex)); + if (error != sizeof(struct gfs_rindex)) { + log_err("Unable to fix rindex entry %u.\n", + rg + 1); + goto fail; + } + } + } error = fs_compute_bitstructs(rgd); if (error) break; rgd->rd_open_count = 0; count1++; } /* for all RGs in the index */ + rg -= grow_problems; if (!error) { log_info("%u resource groups found.\n", rg); if (trust_lvl != blind_faith && rg != calc_rg_count) @@ -1204,6 +1234,16 @@ int ri_update(struct fsck_sb *sdp) } sdp->rgcount = count1; } + if (fix_grow_problems) { + osi_buf_t *dibh; + + get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0); + sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex); + gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh)); + write_buf(sdp, dibh, 0); + grow_problems = fix_grow_problems = 0; + relse_buf(sdp, dibh); + } if (!error) { /* if no problems encountered with the rgs */ log_info("(passed)\n"); break; /* no reason to distrust what we saw. Otherwise, we hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Mon Apr 14 12:33:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Mon, 14 Apr 2008 12:33:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-161-gb4d82fb Message-ID: <20080414123305.25342.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b4d82fbfeb6ce28ef68a3552e9cfc408df177af9 The branch, master has been updated via b4d82fbfeb6ce28ef68a3552e9cfc408df177af9 (commit) from 53707236b407fee094f1135df445670cbed15f00 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b4d82fbfeb6ce28ef68a3552e9cfc408df177af9 Author: Christine Caulfield Date: Mon Apr 14 13:28:59 2008 +0100 [CMAN] Save the new expected_votes when a node is removed When a node leaves the cluster using 'cman_tool leave remove' it reduces the quorum of the cluster to accomodate the loss of the node. Unfortunately the following transition messages raise quorum back to its original value again because of the bug fix for bz#308581, so it appears that the remove hasn't worked. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/daemon/commands.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index c15f1a7..27e6697 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -295,8 +295,10 @@ static int calculate_quorum(int allow_decrease, int max_expected, unsigned int * node = list_item(nodelist, struct cluster_node); if (node->state == NODESTATE_MEMBER) { - highest_expected = - max(highest_expected, node->expected_votes); + if (max_expected) + node->expected_votes = max_expected; + else + highest_expected = max(highest_expected, node->expected_votes); total_votes += node->votes; total_nodes++; } @@ -2089,7 +2091,8 @@ void del_ais_node(int nodeid) node->state = NODESTATE_DEAD; cluster_members--; - if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED) + P_MEMB("del_ais_node %s, leave_reason=%x\n", node->name, node->leave_reason); + if ((node->leave_reason & 0xF) == CLUSTER_LEAVEFLAG_REMOVED) recalculate_quorum(1, 1); else recalculate_quorum(0, 0); hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 14 12:43:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 14 Apr 2008 12:43:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-162-g85a7ff8 Message-ID: <20080414124320.30517.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=85a7ff8b2a1b0900cb8906d358ab9e4c3f87c6f4 The branch, master has been updated via 85a7ff8b2a1b0900cb8906d358ab9e4c3f87c6f4 (commit) from b4d82fbfeb6ce28ef68a3552e9cfc408df177af9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 85a7ff8b2a1b0900cb8906d358ab9e4c3f87c6f4 Author: Fabio M. Di Nitto Date: Mon Apr 14 14:42:57 2008 +0200 [GFS2] Fix build warning Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 555976b..10ad239 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -152,7 +152,7 @@ print_lockdump(int argc, char **argv) file = fopen(path, "rt"); if (file) { while (fgets(line, PATH_MAX, file)) { - printf(line); + printf("%s", line); } fclose(file); } else { hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 14 12:45:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 14 Apr 2008 12:45:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-4-g9e0e6f5 Message-ID: <20080414124530.851.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9e0e6f562c29cf284183c4ec8958ef0e33f6b4b0 The branch, STABLE2 has been updated via 9e0e6f562c29cf284183c4ec8958ef0e33f6b4b0 (commit) from b8a071f51986e3a3e9fa670259dd012ec0a23141 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9e0e6f562c29cf284183c4ec8958ef0e33f6b4b0 Author: Fabio M. Di Nitto Date: Mon Apr 14 14:42:57 2008 +0200 [GFS2] Fix build warning Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 555976b..10ad239 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -152,7 +152,7 @@ print_lockdump(int argc, char **argv) file = fopen(path, "rt"); if (file) { while (fgets(line, PATH_MAX, file)) { - printf(line); + printf("%s", line); } fclose(file); } else { hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Mon Apr 14 13:03:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Mon, 14 Apr 2008 13:03:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-5-g529c79e Message-ID: <20080414130312.8661.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=529c79ee350e06e14075dd2006b34920bacdb4bb The branch, STABLE2 has been updated via 529c79ee350e06e14075dd2006b34920bacdb4bb (commit) from 9e0e6f562c29cf284183c4ec8958ef0e33f6b4b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 529c79ee350e06e14075dd2006b34920bacdb4bb Author: Christine Caulfield Date: Mon Apr 14 14:01:13 2008 +0100 [CMAN] Save the new expected_votes when a node is removed When a node leaves the cluster using 'cman_tool leave remove' it reduces the quorum of the cluster to accomodate the loss of the node. Unfortunately the following transition messages raise quorum back to its original value again because of the bug fix for bz#308581, so it appears that the remove hasn't worked. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/daemon/commands.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index b6d796a..c96fe52 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -289,8 +289,10 @@ static int calculate_quorum(int allow_decrease, int max_expected, unsigned int * node = list_item(nodelist, struct cluster_node); if (node->state == NODESTATE_MEMBER) { - highest_expected = - max(highest_expected, node->expected_votes); + if (max_expected) + node->expected_votes = max_expected; + else + highest_expected = max(highest_expected, node->expected_votes); total_votes += node->votes; total_nodes++; } @@ -2009,7 +2011,8 @@ void del_ais_node(int nodeid) node->state = NODESTATE_DEAD; cluster_members--; - if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED) + P_MEMB("del_ais_node %s, leave_reason=%x\n", node->name, node->leave_reason); + if ((node->leave_reason & 0xF) == CLUSTER_LEAVEFLAG_REMOVED) recalculate_quorum(1, 1); else recalculate_quorum(0, 0); hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Mon Apr 14 15:43:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Mon, 14 Apr 2008 15:43:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-31-g5f03c06 Message-ID: <20080414154329.554.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5f03c06d964894819c182b5112af75e5ee44a256 The branch, RHEL4 has been updated via 5f03c06d964894819c182b5112af75e5ee44a256 (commit) from 625364c99277445b97bbb3120736c358b802fb0f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5f03c06d964894819c182b5112af75e5ee44a256 Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) ----------------------------------------------------------------------- Summary of changes: gfs/gfs_fsck/rgrp.c | 10 ++++++++++ gfs/gfs_fsck/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c index 3948106..cf8e3ed 100644 --- a/gfs/gfs_fsck/rgrp.c +++ b/gfs/gfs_fsck/rgrp.c @@ -35,6 +35,16 @@ int fs_compute_bitstructs(struct fsck_rgrp *rgd) uint32 bytes_left, bytes; int x; + /* Max size of an rg is 2GB. A 2GB RG with (minimum) 512-byte blocks + has 4194304 blocks. We can represent 4 blocks in one bitmap byte. + Therefore, all 4194304 blocks can be represented in 1048576 bytes. + Subtract a metadata header for each 512-byte block and we get + 488 bytes of bitmap per block. Divide 1048576 by 488 and we can + be assured we should never have more than 2149 of them. */ + if (length > 2149 || length == 0) { + log_err("Invalid length %u found in rindex.\n", length); + return -1; + } if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) { log_err("Unable to allocate bitmap structure\n"); stack; diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c index 8bfb823..55ff997 100644 --- a/gfs/gfs_fsck/super.c +++ b/gfs/gfs_fsck/super.c @@ -1070,6 +1070,7 @@ int ri_update(struct fsck_sb *sdp) struct gfs_rindex buf; unsigned int rg, calc_rg_count; int error, count1 = 0, count2 = 0; + int fix_grow_problems = 0, grow_problems = 0; enum rgindex_trust_level { /* how far can we trust our RG index? */ blind_faith = 0, /* We'd like to trust the rgindex. We always used to before bz 179069. This should cover most cases. */ @@ -1170,12 +1171,41 @@ int ri_update(struct fsck_sb *sdp) osi_list_del(&expected_rgd->rd_list); free(expected_rgd); } /* if we can't trust the rg index */ + else { /* blind faith -- just check for the gfs_grow problem */ + if (rgd->rd_ri.ri_data == 4294967292) { + if (!fix_grow_problems) { + log_err("A problem with the rindex file caused by gfs_grow was detected.\n"); + if(query(sdp, "Fix the rindex problem? (y/n)")) + fix_grow_problems = 1; + } + /* Keep a counter in case we hit it more than once. */ + grow_problems++; + osi_list_del(&rgd->rd_list); /* take it out of the equation */ + free(rgd); + continue; + } else if (fix_grow_problems) { + /* Once we detect the gfs_grow rindex problem, we have to */ + /* rewrite the entire rest of the rindex file, starting */ + /* with the entry AFTER the one that has the problem. */ + gfs_rindex_out(&rgd->rd_ri, (char *)&buf); + error = writei(sdp->riinode, (char *)&buf, + (rg - grow_problems) * + sizeof(struct gfs_rindex), + sizeof(struct gfs_rindex)); + if (error != sizeof(struct gfs_rindex)) { + log_err("Unable to fix rindex entry %u.\n", + rg + 1); + goto fail; + } + } + } error = fs_compute_bitstructs(rgd); if (error) break; rgd->rd_open_count = 0; count1++; } /* for all RGs in the index */ + rg -= grow_problems; if (!error) { log_info("%u resource groups found.\n", rg); if (trust_lvl != blind_faith && rg != calc_rg_count) @@ -1204,6 +1234,16 @@ int ri_update(struct fsck_sb *sdp) } sdp->rgcount = count1; } + if (fix_grow_problems) { + osi_buf_t *dibh; + + get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0); + sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex); + gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh)); + write_buf(sdp, dibh, 0); + grow_problems = fix_grow_problems = 0; + relse_buf(sdp, dibh); + } if (!error) { /* if no problems encountered with the rgs */ log_info("(passed)\n"); break; /* no reason to distrust what we saw. Otherwise, we hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Mon Apr 14 15:55:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 14 Apr 2008 15:55:00 -0000 Subject: conga ./conga.spec.in.in ricci/modules/cluster ... Message-ID: <20080414155509.5725.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-14 15:55:09 Modified files: . : conga.spec.in.in ricci/modules/cluster: ClusterStatus.cpp ricci/modules/rpm: PackageHandler.cpp ricci/modules/service: ServiceManager.cpp Log message: Fix bz442369: conga should install 'sg3_utils' and start service 'scsi_reserve' when scsi fencing is used Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.23&r2=1.67.2.24 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.16.2.4&r2=1.16.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.11.2.4&r2=1.11.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceManager.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.4&r2=1.7.2.5 From rmccabe@sourceware.org Mon Apr 14 15:58:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 14 Apr 2008 15:58:00 -0000 Subject: conga ./conga.spec.in.in luci/site/luci/Extens ... Message-ID: <20080414155835.7357.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-14 15:58:35 Modified files: . : conga.spec.in.in luci/site/luci/Extensions: StorageReport.py ricci/modules/cluster: ClusterStatus.cpp ricci/modules/rpm: PackageHandler.cpp ricci/modules/service: ServiceManager.cpp Log message: fix bz441580: conga should install 'sg3_utils' and start service 'scsi_reserve' when scsi fencing is used Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.77&r2=1.45.2.78 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.7&r2=1.20.2.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.6&r2=1.15.2.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.8&r2=1.9.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceManager.cpp.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5.2.6&r2=1.5.2.7 From ccaulfield@sourceware.org Mon Apr 14 16:29:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Mon, 14 Apr 2008 16:29:00 -0000 Subject: Cluster Project branch, RHEL52, updated. cmirror_1_1_15-20-g4f5e3c5 Message-ID: <20080414162929.6200.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4f5e3c542d1e08f3acfd61882437ec839e3658b0 The branch, RHEL52 has been updated via 4f5e3c542d1e08f3acfd61882437ec839e3658b0 (commit) from c53ff8ef75c67fb53955905db96c9f96c28da7bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f5e3c542d1e08f3acfd61882437ec839e3658b0 Author: Christine Caulfield Date: Mon Apr 14 17:28:33 2008 +0100 [CMAN] Save the new expected_votes when a node is removed When a node leaves the cluster using 'cman_tool leave remove' it reduces the quorum of the cluster to accomodate the loss of the node. Unfortunately the following transition messages raise quorum back to its original value again because of the bug fix for bz#308581, so it appears that the remove hasn't worked. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/daemon/commands.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index eb96fcd..d7076cd 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -288,8 +288,10 @@ static int calculate_quorum(int allow_decrease, int max_expected, unsigned int * node = list_item(nodelist, struct cluster_node); if (node->state == NODESTATE_MEMBER) { - highest_expected = - max(highest_expected, node->expected_votes); + if (max_expected) + node->expected_votes = max_expected; + else + highest_expected = max(highest_expected, node->expected_votes); total_votes += node->votes; total_nodes++; } @@ -2009,7 +2011,7 @@ void del_ais_node(int nodeid) memset(&node->port_bits, 0, sizeof(node->port_bits)); cluster_members--; - if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED) + if ((node->leave_reason & 0xF) == CLUSTER_LEAVEFLAG_REMOVED) recalculate_quorum(1, 1); else recalculate_quorum(0, 0); hooks/post-receive -- Cluster Project From lhh@sourceware.org Mon Apr 14 16:38:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Mon, 14 Apr 2008 16:38:00 -0000 Subject: Cluster Project branch, RHEL52, updated. cmirror_1_1_15-21-g0639b2d Message-ID: <20080414163805.19720.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0639b2dfac1c2591c5fb444548d3a013a3bc230c The branch, RHEL52 has been updated via 0639b2dfac1c2591c5fb444548d3a013a3bc230c (commit) from 4f5e3c542d1e08f3acfd61882437ec839e3658b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0639b2dfac1c2591c5fb444548d3a013a3bc230c Author: Lon Hohberger Date: Mon Apr 14 12:38:00 2008 -0400 [fence] Fix #441737 - fence_node broken due to internal API change ----------------------------------------------------------------------- Summary of changes: fence/fence_node/fence_node.c | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 deletions(-) diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c index 7ee2799..1a344b9 100644 --- a/fence/fence_node/fence_node.c +++ b/fence/fence_node/fence_node.c @@ -34,7 +34,7 @@ while (0) static char *prog_name; static int force; -int dispatch_fence_agent(int cd, char *victim); +int dispatch_fence_agent(char *victim, int force); static void print_usage(void) { @@ -52,7 +52,7 @@ static void print_usage(void) int main(int argc, char *argv[]) { - int cont = 1, optchar, error, cd; + int cont = 1, optchar, error; char *victim = NULL; prog_name = argv[0]; @@ -104,28 +104,15 @@ int main(int argc, char *argv[]) if (!victim) die("no node name specified"); - if (force) - cd = ccs_force_connect(NULL, 0); - else - cd = ccs_connect(); - openlog("fence_node", LOG_PID, LOG_USER); - if (cd < 0) { - syslog(LOG_ERR, "cannot connect to ccs %d\n", cd); - goto fail; - } - - error = dispatch_fence_agent(cd, victim); + error = dispatch_fence_agent(victim, force); if (error) - goto fail_ccs; + goto fail; syslog(LOG_NOTICE, "Fence of \"%s\" was successful\n", victim); - ccs_disconnect(cd); exit(EXIT_SUCCESS); - fail_ccs: - ccs_disconnect(cd); fail: syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); exit(EXIT_FAILURE); hooks/post-receive -- Cluster Project From lhh@sourceware.org Mon Apr 14 16:39:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Mon, 14 Apr 2008 16:39:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-44-g1d56fb4 Message-ID: <20080414163942.20496.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=1d56fb441d78faf375eb26a84e775cc8dde7e705 The branch, RHEL5 has been updated via 1d56fb441d78faf375eb26a84e775cc8dde7e705 (commit) via 9272ffea31005732c4f680e639828de1626f5a95 (commit) from e835ef061174e2ab6ecd663145121bc454c9790c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1d56fb441d78faf375eb26a84e775cc8dde7e705 Merge: 9272ffea31005732c4f680e639828de1626f5a95 e835ef061174e2ab6ecd663145121bc454c9790c Author: Lon Hohberger Date: Mon Apr 14 12:39:30 2008 -0400 Merge branch 'RHEL5' of ssh://sources.redhat.com/git/cluster into rhel5 commit 9272ffea31005732c4f680e639828de1626f5a95 Author: Lon Hohberger Date: Mon Apr 14 12:38:00 2008 -0400 [fence] Fix #441737 - fence_node broken due to internal API change ----------------------------------------------------------------------- Summary of changes: fence/fence_node/fence_node.c | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 deletions(-) diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c index 7ee2799..1a344b9 100644 --- a/fence/fence_node/fence_node.c +++ b/fence/fence_node/fence_node.c @@ -34,7 +34,7 @@ while (0) static char *prog_name; static int force; -int dispatch_fence_agent(int cd, char *victim); +int dispatch_fence_agent(char *victim, int force); static void print_usage(void) { @@ -52,7 +52,7 @@ static void print_usage(void) int main(int argc, char *argv[]) { - int cont = 1, optchar, error, cd; + int cont = 1, optchar, error; char *victim = NULL; prog_name = argv[0]; @@ -104,28 +104,15 @@ int main(int argc, char *argv[]) if (!victim) die("no node name specified"); - if (force) - cd = ccs_force_connect(NULL, 0); - else - cd = ccs_connect(); - openlog("fence_node", LOG_PID, LOG_USER); - if (cd < 0) { - syslog(LOG_ERR, "cannot connect to ccs %d\n", cd); - goto fail; - } - - error = dispatch_fence_agent(cd, victim); + error = dispatch_fence_agent(victim, force); if (error) - goto fail_ccs; + goto fail; syslog(LOG_NOTICE, "Fence of \"%s\" was successful\n", victim); - ccs_disconnect(cd); exit(EXIT_SUCCESS); - fail_ccs: - ccs_disconnect(cd); fail: syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); exit(EXIT_FAILURE); hooks/post-receive -- Cluster Project From lhh@sourceware.org Mon Apr 14 16:50:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Mon, 14 Apr 2008 16:50:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-6-g16a1d06 Message-ID: <20080414165050.2913.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=16a1d06a176e7e502704716beb10179320094767 The branch, STABLE2 has been updated via 16a1d06a176e7e502704716beb10179320094767 (commit) from 529c79ee350e06e14075dd2006b34920bacdb4bb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 16a1d06a176e7e502704716beb10179320094767 Author: Lon Hohberger Date: Mon Apr 14 12:38:00 2008 -0400 [fence] Fix #441737 - fence_node broken due to internal API change ----------------------------------------------------------------------- Summary of changes: fence/fence_node/fence_node.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c index 65d1e90..d26b14a 100644 --- a/fence/fence_node/fence_node.c +++ b/fence/fence_node/fence_node.c @@ -106,7 +106,6 @@ int main(int argc, char *argv[]) openlog("fence_node", LOG_PID, LOG_USER); error = dispatch_fence_agent(victim, force); - if (error) { syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); exit(EXIT_FAILURE); hooks/post-receive -- Cluster Project From lhh@sourceware.org Mon Apr 14 17:00:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Mon, 14 Apr 2008 17:00:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-7-g94cdda2 Message-ID: <20080414170049.6997.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=94cdda2b57182a21ca2760ad759255d6e4715b62 The branch, STABLE2 has been updated via 94cdda2b57182a21ca2760ad759255d6e4715b62 (commit) from 16a1d06a176e7e502704716beb10179320094767 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94cdda2b57182a21ca2760ad759255d6e4715b62 Author: Lon Hohberger Date: Mon Apr 14 12:59:10 2008 -0400 Revert "[fence] Fix #441737 - fence_node broken due to internal API change" This reverts commit 16a1d06a176e7e502704716beb10179320094767. This commit didn't actually change anything except whitespace. ----------------------------------------------------------------------- Summary of changes: fence/fence_node/fence_node.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c index d26b14a..65d1e90 100644 --- a/fence/fence_node/fence_node.c +++ b/fence/fence_node/fence_node.c @@ -106,6 +106,7 @@ int main(int argc, char *argv[]) openlog("fence_node", LOG_PID, LOG_USER); error = dispatch_fence_agent(victim, force); + if (error) { syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); exit(EXIT_FAILURE); hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Mon Apr 14 17:18:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 14 Apr 2008 17:18:00 -0000 Subject: conga ./clustermon.spec.in.in luci/site/luci/v ... Message-ID: <20080414171805.26967.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-14 17:18:05 Modified files: . : clustermon.spec.in.in luci/site/luci/var: Data.fs Log message: Update Zope DB for Conga Bump revision for clustermon Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.25.2.12&r2=1.25.2.13 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.21&r2=1.20.2.22 From rpeterso@sourceware.org Mon Apr 14 20:31:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Mon, 14 Apr 2008 20:31:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-45-gb5cc95a Message-ID: <20080414203134.22707.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b5cc95a48417758429752998be12c059b7ac2b95 The branch, RHEL5 has been updated via b5cc95a48417758429752998be12c059b7ac2b95 (commit) from 1d56fb441d78faf375eb26a84e775cc8dde7e705 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b5cc95a48417758429752998be12c059b7ac2b95 Author: Bob Peterson Date: Mon Apr 14 15:27:57 2008 -0500 bz425421: gfs mount attempt hangs if no more journals available ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/ops_fstype.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs-kernel/src/gfs/ops_fstype.c b/gfs-kernel/src/gfs/ops_fstype.c index 10b0838..e01ea32 100644 --- a/gfs-kernel/src/gfs/ops_fstype.c +++ b/gfs-kernel/src/gfs/ops_fstype.c @@ -388,6 +388,7 @@ out: return error; fail_dput: + gfs_inode_put(sdp->sd_linode); if (sb->s_root) { dput(sb->s_root); sb->s_root = NULL; hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Mon Apr 14 20:36:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Mon, 14 Apr 2008 20:36:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-163-g0ce60e8 Message-ID: <20080414203655.24924.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0ce60e8e2374789f2b0bc129f584f856dc7b604e The branch, master has been updated via 0ce60e8e2374789f2b0bc129f584f856dc7b604e (commit) from 85a7ff8b2a1b0900cb8906d358ab9e4c3f87c6f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0ce60e8e2374789f2b0bc129f584f856dc7b604e Author: Bob Peterson Date: Mon Apr 14 15:27:57 2008 -0500 bz425421: gfs mount attempt hangs if no more journals available ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/ops_fstype.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs-kernel/src/gfs/ops_fstype.c b/gfs-kernel/src/gfs/ops_fstype.c index 10b0838..e01ea32 100644 --- a/gfs-kernel/src/gfs/ops_fstype.c +++ b/gfs-kernel/src/gfs/ops_fstype.c @@ -388,6 +388,7 @@ out: return error; fail_dput: + gfs_inode_put(sdp->sd_linode); if (sb->s_root) { dput(sb->s_root); sb->s_root = NULL; hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Mon Apr 14 20:38:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Mon, 14 Apr 2008 20:38:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-8-g5866e09 Message-ID: <20080414203837.25527.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5866e09c192ee617a7e0a221fa7e871066950688 The branch, STABLE2 has been updated via 5866e09c192ee617a7e0a221fa7e871066950688 (commit) from 94cdda2b57182a21ca2760ad759255d6e4715b62 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5866e09c192ee617a7e0a221fa7e871066950688 Author: Bob Peterson Date: Mon Apr 14 15:27:57 2008 -0500 bz425421: gfs mount attempt hangs if no more journals available ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/ops_fstype.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs-kernel/src/gfs/ops_fstype.c b/gfs-kernel/src/gfs/ops_fstype.c index 10b0838..e01ea32 100644 --- a/gfs-kernel/src/gfs/ops_fstype.c +++ b/gfs-kernel/src/gfs/ops_fstype.c @@ -388,6 +388,7 @@ out: return error; fail_dput: + gfs_inode_put(sdp->sd_linode); if (sb->s_root) { dput(sb->s_root); sb->s_root = NULL; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 15 03:44:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 15 Apr 2008 03:44:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-167-gf3dea8c Message-ID: <20080415034423.30286.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f3dea8c306d68a8ae7a136374cdebb98b97bb06c The branch, master has been updated via f3dea8c306d68a8ae7a136374cdebb98b97bb06c (commit) via 70075fe6249823a33a59e5477b4c75db4e2a3e51 (commit) via 55cb88bb22079079d44be1a7d8f729fca1698d8d (commit) via 83c943f9024e0f790cb6e18cef8d1cf6ea321e14 (commit) from 0ce60e8e2374789f2b0bc129f584f856dc7b604e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f3dea8c306d68a8ae7a136374cdebb98b97bb06c Author: Fabio M. Di Nitto Date: Tue Apr 15 05:39:30 2008 +0200 [GROUP] Fix building with standard kernels > From: David Teigland > Subject: [Cluster-devel] kernel for building master > This commit assumes dlm kernel changes that are only available in > linux-next or linux-mm (linux/dlm_plock.h). This goes against our aim to > keep master building against -rc kernels by default, so the following > patch disables the relevant part for now. Fabio has said he may turn this > ifdef into something more sophisticated. Apply patch from David to allow dlm_controld to build again against vanilla kernels. Change the patch to use the EXPERIMENTAL_BUILD infrastructure. Cleanup a couple of typos from the patch. Signed-off-by: David Teigland Signed-off-by: Fabio M. Di Nitto commit 70075fe6249823a33a59e5477b4c75db4e2a3e51 Author: Fabio M. Di Nitto Date: Tue Apr 15 05:33:43 2008 +0200 [BUILD] Set automatically cflags when building experimental bits Signed-off-by: Fabio M. Di Nitto commit 55cb88bb22079079d44be1a7d8f729fca1698d8d Author: Fabio M. Di Nitto Date: Tue Apr 15 05:30:02 2008 +0200 [BUILD] Fix typo Signed-off-by: Fabio M. Di Nitto commit 83c943f9024e0f790cb6e18cef8d1cf6ea321e14 Author: Fabio M. Di Nitto Date: Tue Apr 15 05:22:46 2008 +0200 [BUILD] Add --enable_crack_of_the_day configure option This option should NEVER be used lightly and it's there as facility for developers that need/want to commit experimental code that, for one reason or another, is not ready for general use or it depends on other code that is not available mainline yet. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 16 +++++++++++++++- group/dlm_controld/main.c | 2 ++ group/dlm_controld/plock.c | 19 +++++++++++++++++++ make/defines.mk.input | 1 + 4 files changed, 37 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 1b65c70..82268c6 100755 --- a/configure +++ b/configure @@ -83,6 +83,7 @@ my %options = ( fence_agents => \$fence_agents, fencelibdir => \$fencelibdir, enable_experimental_fence_agents => \$enable_experimental_fence_agents, + enable_crack_of_the_day => \$enable_crack_of_the_day, enable_xen => \$enable_xen, somajor => \$somajor, sominor => \$sominor, @@ -155,6 +156,7 @@ my $err = &GetOptions (\%options, 'fence_agents=s', 'fencelibdir=s', 'enable_experimental_fence_agents', + 'enable_crack_of_the_day', 'enable_xen', 'without_ccs', 'without_cman', @@ -230,6 +232,7 @@ if ($help || !$err) { print "\t\tUse --fence_agents=help for a list\n"; print "--fencelibdir=\tspecify directory where to install common fence python lib. (Default: /usr/lib/fence)\n"; print "--enable_experimental_fence_agents\tEnable build and install of experimental fence agents. (Default: no)\n"; + print "--enable_crack_of_the_day\tEnable build of highly experimental features that rely on code that is not yet available for general use. (Default: no)\n"; print "--enable_xen\tEnable building of Xen-specific pieces\n"; print "--without_ccs\tDisable ccs building (Default: enabled)\n"; print "--without_cman\tDisable cman building (Default: enabled)\n"; @@ -240,7 +243,7 @@ if ($help || !$err) { print "--without_gfs2\tDisable gfs2 building (Default: enabled)\n"; print "--without_gnbd\tDisable gnbd building (Default: enabled)\n"; print "--without_rgmanager\tDisable rgmanager building (Default: enabled)\n"; - print "--disable_kernel_check\tDisable kernel version check (default: enabled)\n"; + print "--disable_kernel_check\tDisable kernel version check (Default: enabled)\n"; exit $ret; } @@ -523,6 +526,16 @@ if (!$fencelibdir) { if (!$enable_experimental_fence_agents) { $enable_experimental_fence_agents=""; } +if (!$enable_crack_of_the_day) { + $enable_crack_of_the_day=""; +} else { + print "\n********************************************************************************************\n"; + print "WARNING: *you* have explicitly enabled all possible experimental features under development!\n"; + print " This code will have no mercy for your data and your machines. You have been warned!\n"; + print "\n********************************************************************************************\n"; + $enable_experimental_fence_agents=1; + $cflags="${cflags} -DEXPERIMENTAL_BUILD"; +} if (!$enable_xen) { $enable_xen=""; } @@ -642,6 +655,7 @@ while () { $_ =~ s/\@FENCE_AGENTS\@/$fence_agents/; $_ =~ s/\@FENCELIBDIR\@/$fencelibdir/; $_ =~ s/\@ENABLE_EXPERIMENTAL_FENCE_AGENTS\@/$enable_experimental_fence_agents/; + $_ =~ s/\@ENABLE_CRACK_OF_THE_DAY\@/$enable_crack_of_the_day/; $_ =~ s/\@ENABLE_XEN\@/$enable_xen/; $_ =~ s/\@DISABLE_CCS\@/$without_ccs/; $_ =~ s/\@DISABLE_CMAN\@/$without_cman/; diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index b954f53..a3f3012 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -546,11 +546,13 @@ static int loop(void) setup_deadlock(); } +#ifdef EXPERIMENTAL_BUILD rv = setup_plocks(); if (rv < 0) goto out; plock_fd = rv; plock_ci = client_add(rv, process_plocks, NULL); +#endif /* EXPERIMENTAL_BUILD */ } for (;;) { diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c index 4dc38ac..5f8d4ce 100644 --- a/group/dlm_controld/plock.c +++ b/group/dlm_controld/plock.c @@ -12,6 +12,8 @@ #include "dlm_daemon.h" #include "config.h" + +#ifdef EXPERIMENTAL_BUILD #include #define PROC_MISC "/proc/misc" @@ -2293,3 +2295,20 @@ int dump_plocks(char *name, int fd) return 0; } +#else /* EXPERIMENTAL_BUILD */ + +int setup_plocks(void) { return 0; }; +void process_plocks(int ci) { }; +int limit_plocks(void) { return 0; }; +void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len) { }; +void receive_own(struct lockspace *ls, struct dlm_header *hd, int len) { }; +void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len) { }; +void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len) { }; +void process_saved_plocks(struct lockspace *ls) { }; +void close_plock_checkpoint(struct lockspace *ls) { }; +void store_plocks(struct lockspace *ls) { }; +void retrieve_plocks(struct lockspace *ls) { }; +void purge_plocks(struct lockspace *ls, int nodeid, int unmount) { }; +int dump_plocks(char *name, int fd) { return 0; }; + +#endif /* EXPERIMENTAL_BUILD */ diff --git a/make/defines.mk.input b/make/defines.mk.input index 1ea77f4..acbbe36 100644 --- a/make/defines.mk.input +++ b/make/defines.mk.input @@ -68,6 +68,7 @@ virtlibdir ?= @VIRTLIBDIR@ fence_agents ?= @FENCE_AGENTS@ fencelibdir ?= @FENCELIBDIR@ enable_experimental_fence_agents ?= @ENABLE_EXPERIMENTAL_FENCE_AGENTS@ +experimental_build ?= @ENABLE_CRACK_OF_THE_DAY@ enable_xen ?= @ENABLE_XEN@ without_gnbd-kernel/src ?= @DISABLE_GNBD@ without_gfs-kernel/src/gfs ?= @DISABLE_GFS@ hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 15 03:49:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 15 Apr 2008 03:49:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-168-g4aa023e Message-ID: <20080415034910.32741.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4aa023e390abb5b466ddeb0e55e2acd7b45aa6df The branch, master has been updated via 4aa023e390abb5b466ddeb0e55e2acd7b45aa6df (commit) from f3dea8c306d68a8ae7a136374cdebb98b97bb06c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4aa023e390abb5b466ddeb0e55e2acd7b45aa6df Author: Andrew Price Date: Tue Apr 15 05:48:12 2008 +0200 [GFS2] gfs2_fsck: Fix operation on 'ptr' may be undefined warnings Occurrences of *ptr++ in fs_recovery.c made gcc throw up "operation on 'ptr' may be undefined" warnings. This patch disambiguates those occurrences. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/fsck/fs_recovery.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index 3b25dc6..3e4094b 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -125,7 +125,8 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, sd_found_metablocks++; - blkno = be64_to_cpu(*ptr++); + blkno = be64_to_cpu(*ptr); + ptr++; if (gfs2_revoke_check(sdp, blkno, start)) continue; @@ -218,8 +219,10 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, gfs2_replay_incr_blk(ip, &start); for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) { - blkno = be64_to_cpu(*ptr++); - esc = be64_to_cpu(*ptr++); + blkno = be64_to_cpu(*ptr); + ptr++; + esc = be64_to_cpu(*ptr); + ptr++; sd_found_jblocks++; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 15 03:51:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 15 Apr 2008 03:51:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-10-ge1718ac Message-ID: <20080415035131.1517.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e1718ace02bf0c3f890676b246816fc184b9d07b The branch, STABLE2 has been updated via e1718ace02bf0c3f890676b246816fc184b9d07b (commit) via 35d0ea0c438d09622fbeadc2b93db1c0448434c0 (commit) from 5866e09c192ee617a7e0a221fa7e871066950688 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e1718ace02bf0c3f890676b246816fc184b9d07b Author: Andrew Price Date: Tue Apr 15 05:48:12 2008 +0200 [GFS2] gfs2_fsck: Fix operation on 'ptr' may be undefined warnings Occurrences of *ptr++ in fs_recovery.c made gcc throw up "operation on 'ptr' may be undefined" warnings. This patch disambiguates those occurrences. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto commit 35d0ea0c438d09622fbeadc2b93db1c0448434c0 Author: Fabio M. Di Nitto Date: Tue Apr 15 05:30:02 2008 +0200 [BUILD] Fix typo Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 2 +- gfs2/fsck/fs_recovery.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 817ca4f..13ed3e6 100755 --- a/configure +++ b/configure @@ -231,7 +231,7 @@ if ($help || !$err) { print "--without_gfs2\tDisable gfs2 building (Default: enabled)\n"; print "--without_gnbd\tDisable gnbd building (Default: enabled)\n"; print "--without_rgmanager\tDisable rgmanager building (Default: enabled)\n"; - print "--disable_kernel_check\tDisable kernel version check (default: enabled)\n"; + print "--disable_kernel_check\tDisable kernel version check (Default: enabled)\n"; exit $ret; } diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index 3b25dc6..3e4094b 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -125,7 +125,8 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, sd_found_metablocks++; - blkno = be64_to_cpu(*ptr++); + blkno = be64_to_cpu(*ptr); + ptr++; if (gfs2_revoke_check(sdp, blkno, start)) continue; @@ -218,8 +219,10 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start, gfs2_replay_incr_blk(ip, &start); for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) { - blkno = be64_to_cpu(*ptr++); - esc = be64_to_cpu(*ptr++); + blkno = be64_to_cpu(*ptr); + ptr++; + esc = be64_to_cpu(*ptr); + ptr++; sd_found_jblocks++; hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Tue Apr 15 14:38:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Tue, 15 Apr 2008 14:38:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-46-gd48a61c Message-ID: <20080415143810.16588.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d48a61c7d3fac5cae7528df29614216754ad5880 The branch, RHEL5 has been updated via d48a61c7d3fac5cae7528df29614216754ad5880 (commit) from b5cc95a48417758429752998be12c059b7ac2b95 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d48a61c7d3fac5cae7528df29614216754ad5880 Author: Bob Peterson Date: Tue Apr 15 09:33:26 2008 -0500 bz438762: gfs_tool: Cannot allocate memory ----------------------------------------------------------------------- Summary of changes: gfs/gfs_tool/df.c | 2 +- gfs/gfs_tool/tune.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gfs/gfs_tool/df.c b/gfs/gfs_tool/df.c index 8ddbd04..fcea608 100644 --- a/gfs/gfs_tool/df.c +++ b/gfs/gfs_tool/df.c @@ -30,7 +30,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * do_df_one - print out information about one filesystem diff --git a/gfs/gfs_tool/tune.c b/gfs/gfs_tool/tune.c index 93f35df..581c9eb 100644 --- a/gfs/gfs_tool/tune.c +++ b/gfs/gfs_tool/tune.c @@ -29,7 +29,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * get_tune - print out the current tuneable parameters for a filesystem hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Tue Apr 15 14:41:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Tue, 15 Apr 2008 14:41:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-169-gf5a705d Message-ID: <20080415144100.17643.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f5a705d3ed1843f403f0d03aeae447f0b6ca10a9 The branch, master has been updated via f5a705d3ed1843f403f0d03aeae447f0b6ca10a9 (commit) from 4aa023e390abb5b466ddeb0e55e2acd7b45aa6df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f5a705d3ed1843f403f0d03aeae447f0b6ca10a9 Author: Bob Peterson Date: Tue Apr 15 09:33:26 2008 -0500 bz438762: gfs_tool: Cannot allocate memory ----------------------------------------------------------------------- Summary of changes: gfs/gfs_tool/df.c | 2 +- gfs/gfs_tool/tune.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gfs/gfs_tool/df.c b/gfs/gfs_tool/df.c index 8ddbd04..fcea608 100644 --- a/gfs/gfs_tool/df.c +++ b/gfs/gfs_tool/df.c @@ -30,7 +30,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * do_df_one - print out information about one filesystem diff --git a/gfs/gfs_tool/tune.c b/gfs/gfs_tool/tune.c index 93f35df..581c9eb 100644 --- a/gfs/gfs_tool/tune.c +++ b/gfs/gfs_tool/tune.c @@ -29,7 +29,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * get_tune - print out the current tuneable parameters for a filesystem hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Tue Apr 15 14:42:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Tue, 15 Apr 2008 14:42:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-11-gc6bb755 Message-ID: <20080415144213.18137.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c6bb7557e85b3363ff0fd10f1411373f4b747366 The branch, STABLE2 has been updated via c6bb7557e85b3363ff0fd10f1411373f4b747366 (commit) from e1718ace02bf0c3f890676b246816fc184b9d07b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c6bb7557e85b3363ff0fd10f1411373f4b747366 Author: Bob Peterson Date: Tue Apr 15 09:33:26 2008 -0500 bz438762: gfs_tool: Cannot allocate memory ----------------------------------------------------------------------- Summary of changes: gfs/gfs_tool/df.c | 2 +- gfs/gfs_tool/tune.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gfs/gfs_tool/df.c b/gfs/gfs_tool/df.c index 8ddbd04..fcea608 100644 --- a/gfs/gfs_tool/df.c +++ b/gfs/gfs_tool/df.c @@ -30,7 +30,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * do_df_one - print out information about one filesystem diff --git a/gfs/gfs_tool/tune.c b/gfs/gfs_tool/tune.c index 93f35df..581c9eb 100644 --- a/gfs/gfs_tool/tune.c +++ b/gfs/gfs_tool/tune.c @@ -29,7 +29,7 @@ #include "gfs_tool.h" -#define SIZE (65536) +#define SIZE (4096) /** * get_tune - print out the current tuneable parameters for a filesystem hooks/post-receive -- Cluster Project From lhh@sourceware.org Tue Apr 15 15:03:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Tue, 15 Apr 2008 15:03:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-42-g69a3d82 Message-ID: <20080415150350.2441.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=69a3d82a661d0c67dadfc0c02a6839c94ab0cdfb The branch, RHEL4 has been updated via 69a3d82a661d0c67dadfc0c02a6839c94ab0cdfb (commit) via 24945860f4de6118437688aa3e4b7bb3e3edbbf0 (commit) via 070de9cc3db1a66d427a2aaaef0dbf71d4d404b9 (commit) via 179da28103b843845cad5eaec61a48855b5cf807 (commit) via 7c3f3ad887d460c2bd92a7a398048be58f1b4a07 (commit) via d35287124adf15a981703c3e0785fa7c644223c1 (commit) via fed6e7804f9b092b09a1d243abd03eb87747e566 (commit) via 71a51fb8ed4c91c5963665940afca5fc44f42559 (commit) via 652fe516bfa1efd5ceff9e1551e8dabc573e294d (commit) via 0d3a7a758217efbfec3a662269856a30d68fdd63 (commit) via 00a395dd63da4728c30b61a04a71224a4f05b82d (commit) from 5f03c06d964894819c182b5112af75e5ee44a256 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 69a3d82a661d0c67dadfc0c02a6839c94ab0cdfb Author: Lon Hohberger Date: Tue Apr 15 11:02:33 2008 -0400 [rgmanager] Fix several bugzillas (see below) - 245381 - restart counter/thresholds before switching to relocation during service recovery - 247772 - one service following another (event scripting ability). This isn't fixed in the usual way, as this feature has limited use. Instead, we allow an alternative method of operation for rgmanager in which administrators can define event triggers for whatever they would like. (Called "RIND") - 247945 - rgmanager restarting services when noncritical parameters are changed - 247980 - strong / weak service dependencies. These are trivial. Weak dependencies are only allowed with the event scripting as noted for 247772 - 250101 - RG event API (internals change). This was required for RIND to operate as well as 247980 - 439948 - clushutdown reference in clusvcadm man page - 440006 - rgmanager stuck on stop in some cases - 440645 - quotaoff causes hanges in some circumstances - 441577 - Symlinks in mount point path cause erroneous failures commit 24945860f4de6118437688aa3e4b7bb3e3edbbf0 Author: Lon Hohberger Date: Tue Apr 8 00:32:04 2008 -0400 [rgmanager] Fix minor crash bug commit 070de9cc3db1a66d427a2aaaef0dbf71d4d404b9 Author: Lon Hohberger Date: Fri Apr 4 13:54:28 2008 -0400 [rgmanager] Fixes for RIND commit 179da28103b843845cad5eaec61a48855b5cf807 Author: Lon Hohberger Date: Fri Apr 4 11:20:09 2008 -0400 [rgmanager] More RIND merges. commit 7c3f3ad887d460c2bd92a7a398048be58f1b4a07 Author: Lon Hohberger Date: Tue Apr 1 16:25:08 2008 -0400 [rgmanager] Fix clusvcadm build commit d35287124adf15a981703c3e0785fa7c644223c1 Author: Lon Hohberger Date: Tue Apr 1 16:23:17 2008 -0400 [rgmanager] Fix build commit fed6e7804f9b092b09a1d243abd03eb87747e566 Author: Lon Hohberger Date: Tue Apr 1 16:22:15 2008 -0400 [rgmanager] Remove extraneous copy of event_script.txt commit 71a51fb8ed4c91c5963665940afca5fc44f42559 Author: Lon Hohberger Date: Tue Apr 1 16:17:55 2008 -0400 [rgmanager] Misc fixes. Update auto testing commit 652fe516bfa1efd5ceff9e1551e8dabc573e294d Author: Lon Hohberger Date: Tue Apr 1 12:54:15 2008 -0400 [rgmanager] Make RIND build on RHEL4 branch commit 0d3a7a758217efbfec3a662269856a30d68fdd63 Author: Lon Hohberger Date: Mon Mar 10 09:58:08 2008 -0400 Merge, part 2 commit 00a395dd63da4728c30b61a04a71224a4f05b82d Author: Lon Hohberger Date: Mon Mar 10 09:56:40 2008 -0400 Commit phase 1 of update from rhel5 branch ----------------------------------------------------------------------- Summary of changes: rgmanager/event-script.txt | 311 +++++ rgmanager/include/clulog.h | 2 +- rgmanager/include/event.h | 147 +++ rgmanager/include/res-ocf.h | 20 + rgmanager/include/resgroup.h | 60 +- rgmanager/include/reslist.h | 64 +- rgmanager/include/restart_counter.h | 32 + rgmanager/include/rg_queue.h | 24 +- rgmanager/include/sets.h | 39 + rgmanager/man/clusvcadm.8 | 13 +- rgmanager/src/clulib/Makefile | 3 +- rgmanager/src/clulib/rg_strings.c | 208 +++- rgmanager/src/clulib/sets.c | 370 ++++++ rgmanager/src/clulib/signals.c | 18 + rgmanager/src/clulib/tmgr.c | 128 ++ rgmanager/src/clulib/vft.c | 87 +- rgmanager/src/daemons/Makefile | 11 +- rgmanager/src/daemons/event_config.c | 540 ++++++++ rgmanager/src/daemons/fo_domain.c | 117 ++- rgmanager/src/daemons/groups.c | 575 ++++++++-- rgmanager/src/daemons/main.c | 167 ++-- rgmanager/src/daemons/members.c | 41 + rgmanager/src/daemons/reslist.c | 94 ++- rgmanager/src/daemons/resrules.c | 143 ++- rgmanager/src/daemons/restart_counter.c | 205 ++++ rgmanager/src/daemons/restree.c | 542 ++++----- rgmanager/src/daemons/rg_event.c | 500 ++++++++ rgmanager/src/daemons/rg_forward.c | 110 ++ rgmanager/src/daemons/rg_state.c | 427 +++++--- rgmanager/src/daemons/rg_thread.c | 5 + rgmanager/src/daemons/service_op.c | 207 ++++ rgmanager/src/daemons/slang_event.c | 1286 ++++++++++++++++++++ rgmanager/src/daemons/test.c | 101 ++- .../daemons/tests/delta-test001-test002.expected | 34 + .../daemons/tests/delta-test002-test003.expected | 48 +- .../daemons/tests/delta-test003-test004.expected | 52 +- .../daemons/tests/delta-test004-test005.expected | 53 +- .../daemons/tests/delta-test005-test006.expected | 56 +- .../daemons/tests/delta-test006-test007.expected | 56 +- .../daemons/tests/delta-test007-test008.expected | 68 +- .../daemons/tests/delta-test008-test009.expected | 89 +- .../daemons/tests/delta-test009-test010.expected | 98 +- .../daemons/tests/delta-test010-test011.expected | 135 ++- .../daemons/tests/delta-test011-test012.expected | 157 ++- .../daemons/tests/delta-test012-test013.expected | 160 ++- .../daemons/tests/delta-test013-test014.expected | 224 +++-- .../daemons/tests/delta-test014-test015.expected | 264 +++-- .../daemons/tests/delta-test015-test016.expected | 256 +++-- .../daemons/tests/delta-test016-test017.expected | 309 ++++-- .../daemons/tests/delta-test017-test018.expected | 558 +++++++++ rgmanager/src/daemons/tests/runtests.sh | 6 +- rgmanager/src/daemons/tests/test001.expected | 21 + rgmanager/src/daemons/tests/test002.expected | 21 + rgmanager/src/daemons/tests/test003.expected | 33 +- rgmanager/src/daemons/tests/test004.expected | 33 +- rgmanager/src/daemons/tests/test005.expected | 36 +- rgmanager/src/daemons/tests/test006.expected | 36 +- rgmanager/src/daemons/tests/test007.expected | 36 +- rgmanager/src/daemons/tests/test008.expected | 52 +- rgmanager/src/daemons/tests/test009.expected | 53 +- rgmanager/src/daemons/tests/test010.expected | 63 +- rgmanager/src/daemons/tests/test011.expected | 88 +- rgmanager/src/daemons/tests/test012.expected | 89 +- rgmanager/src/daemons/tests/test013.expected | 89 +- rgmanager/src/daemons/tests/test014.expected | 147 ++- rgmanager/src/daemons/tests/test015.expected | 147 ++- rgmanager/src/daemons/tests/test016.expected | 147 ++- rgmanager/src/daemons/tests/test017.expected | 176 ++- rgmanager/src/daemons/tests/test018.expected | 291 +++++ rgmanager/src/resources/Makefile | 9 +- rgmanager/src/resources/clusterfs.sh | 61 +- rgmanager/src/resources/default_event_script.sl | 314 +++++ rgmanager/src/resources/fs.sh | 53 +- rgmanager/src/resources/netfs.sh | 2 +- rgmanager/src/resources/ocf-shellfuncs | 4 + rgmanager/src/resources/script.sh | 2 +- rgmanager/src/resources/service.sh | 104 ++- rgmanager/src/resources/svclib_nfslock | 28 + .../src/resources/utils/named-parse-config.pl | 26 + rgmanager/src/resources/utils/ra-skelet.sh | 2 +- rgmanager/src/utils/clusvcadm.c | 45 +- 81 files changed, 9563 insertions(+), 1865 deletions(-) create mode 100644 rgmanager/event-script.txt create mode 100644 rgmanager/include/event.h create mode 100644 rgmanager/include/restart_counter.h create mode 100644 rgmanager/include/sets.h create mode 100644 rgmanager/src/clulib/sets.c create mode 100644 rgmanager/src/clulib/tmgr.c create mode 100644 rgmanager/src/daemons/event_config.c create mode 100644 rgmanager/src/daemons/restart_counter.c create mode 100644 rgmanager/src/daemons/rg_event.c create mode 100644 rgmanager/src/daemons/service_op.c create mode 100644 rgmanager/src/daemons/slang_event.c create mode 100644 rgmanager/src/daemons/tests/delta-test017-test018.expected create mode 100644 rgmanager/src/daemons/tests/test018.expected create mode 100644 rgmanager/src/resources/default_event_script.sl create mode 100644 rgmanager/src/resources/utils/named-parse-config.pl diff --git a/rgmanager/event-script.txt b/rgmanager/event-script.txt new file mode 100644 index 0000000..00a8b4c --- /dev/null +++ b/rgmanager/event-script.txt @@ -0,0 +1,311 @@ +TODO: +* Return correct error codes to clusvcadm (currently it always returns + "Unknown") +* Write glue for 'migrate' operations and migrate-enabled services + +Basic configuration specification: + + + + + + + + + (note, all service ops and such deal with node ID, not + with node names) + + + + + + service_owner="3"/> + + + service_owner="3"/> + + + + ... + + +General globals available from all scripts: + + node_self - local node ID + event_type - event class, either: + EVENT_NONE - unspecified / unknown + EVENT_NODE - node transition + EVENT_SERVICE - service transition + EVENT_USER - a user-generated request + EVENT_CONFIG - [NOT CONFIGURABLE] + +Node event globals (i.e. when event_type == EVENT_NODE): + + node_id - node ID which is transitioning + node_name - name of node which is transitioning + node_state - new node state (NODE_ONLINE or NODE_OFFLINE, or if you prefer, + 1 or 0, respectively) + node_clean - 0 if the node has not been fenced, 1 if the node has been + fenced + +Service event globals (i.e. when event_type == EVENT_SERVICE): + + service_name - Name of service which transitioned + service_state - new state of service + service_owner - new owner of service (or <0 if service is no longer + running) + service_last_owner - Last owner of service if known. Used for when + service_state = "recovering" generally, in order to + apply restart/relocate/disable policy. + +User event globals (i.e. when event_type == EVENT_USER): + + service_name - service to perform request upon + user_request - request to perform (USER_ENABLE, USER_DISABLE, + USER_STOP, USER_RELOCATE, [TODO] USER_MIGRATE) + user_target - target node ID if applicable + + +Scripting functions - Informational: + + node_list = nodes_online(); + + Returns a list of all online nodes. + + service_list = service_list(); + + Returns a list of all configured services. + + (restarts, last_owner, owner, state) = service_status(service_name); + + Returns the state, owner, last_owner, and restarts. Note that + all return values are optional, but are right-justified per S-Lang + specification. This means if you only want the 'state', you can use: + + (state) = service_status(service_name); + + However, if you need the restart count, you must provide all four + return values as above. + + (nofailback, restricted, ordered, node_list) = + service_domain_info(service_name); + + Returns the failover domain specification, if it exists, for the + specified service name. The node list returned is an ordered list + according to priority levels. In the case of unordered domains, + the ordering of the returned list is pseudo-random. + +Scripting functions - Operational: + + err = service_start(service_name, node_list, [avoid_list]); + + Start a non-running, (but runnable, i.e. not failed) + service on the first node in node_list. Failing that, start it on + the second node in node_list and so forth. One may also specify + an avoid list, but it's better to just use the subtract() function + below. If the start is successful, the node ID running the service + is returned. If the start is unsuccessful, a value < 0 is returned. + + err = service_stop(service_name, [0 = stop, 1 = disable]); + + Stop a running service. The second parameter is optional, and if + non-zero is specified, the service will enter the disabled state. + + ... stuff that's not done but needs to be: + + err = service_relocate(service_name, node_list); + + Move a running service to the specified node_list in order of + preference. In the case of VMs, this is actually a migrate-or- + relocate operation. + +Utility functions - Node list manipulation + + node_list = union(left_node_list, right_node_list); + + Calculates the union between the two node list, removing duplicates + and preserving ordering according to left_node_list. Any added + values from right_node_list will appear in their order, but + after left_node_list in the returned list. + + node_list = intersection(left_node_list, right_node_list); + + Calculates the intersection (items in both lists) between the two + node lists, removing duplicates and preserving ordering according + to left_node_list. Any added values from right_node_list will + appear in their order, but after left_node_list in the returned list. + + node_list = delta(left_node_list, right_node_list); + + Calculates the delta (items not in both lists) between the two + node lists, removing duplicates and preserving ordering according + to left_node_list. Any added values from right_node_list will + appear in their order, but after left_node_list in the returned list. + + node_list = subtract(left_node_list, right_node_list); + + Removes any duplicates as well as items specified in right_node_list + from left_node_list. Example: + + all_nodes = nodes_online(); + allowed_nodes = subtract(nodes_online, node_to_avoid); + + node_list = shuffle(node_list_old); + + Rearranges the contents of node_list_old randomly and returns a + new node list. + +Utility functions - Logging: + + debug(item1, item2, ...); LOG_DEBUG level + info(...); LOG_INFO level + notice(...); LOG_NOTICE level + warning(...); LOG_WARNING level + err(...); LOG_ERR level + crit(...); LOG_CRIT level + alert(...); LOG_ALERT level + emerg(...); LOG_EMERG level + + items - These can be strings, integer lists, or integers. Logging + string lists is not supported. + + level - the level is consistent with syslog(8) + + stop_processing(); + + Calling this function will prevent further event scripts from being + executed on a particular event. Call this script if, for example, + you do not wish for the default event handler to process the event. + + Note: This does NOT terminate the caller script; that is, the + script being executed will run to completion. + +Event scripts are written in a language called S-Lang; documentation specifics +about the language are available at http://www.s-lang.org + +Example script (creating a follows-but-avoid-after-start behavior): +% +% If the main queue server and replication queue server are on the same +% node, relocate the replication server somewhere else if possible. +% +define my_sap_event_trigger() +{ + variable state, owner_rep, owner_main; + variable nodes, allowed; + + % + % If this was a service event, don't execute the default event + % script trigger after this script completes. + % + if (event_type == EVENT_SERVICE) { + stop_processing(); + } + + (owner_main, state) = service_status("service:main_queue"); + (owner_rep, state) = service_status("service:replication_server"); + + if ((event_type == EVENT_NODE) and (owner_main == node_id) and + (node_state == NODE_OFFLINE) and (owner_rep >= 0)) { + % + % uh oh, the owner of the main server died. Restart it + % on the node running the replication server + % + notice("Starting Main Queue Server on node ", owner_rep); + ()=service_start("service:main_queue", owner_rep); + return; + } + + % + % S-Lang doesn't short-circuit prior to 2.1.0 + % + if ((owner_main >= 0) and + ((owner_main == owner_rep) or (owner_rep < 0))) { + + % + % Get all online nodes + % + nodes = nodes_online(); + + % + % Drop out the owner of the main server + % + allowed = subtract(nodes, owner_main); + if ((owner_rep >= 0) and (length(allowed) == 0)) { + % + % Only one node is online and the rep server is + % already running. Don't do anything else. + % + return; + } + + if ((length(allowed) == 0) and (owner_rep < 0)) { + % + % Only node online is the owner ... go ahead + % and start it, even though it doesn't increase + % availability to do so. + % + allowed = owner_main; + } + + % + % Move the replication server off the node that is + % running the main server if a node's available. + % + if (owner_rep >= 0) { + ()=service_stop("service:replication_server"); + } + ()=service_start("service:replication_server", allowed); + } + + return; +} + +my_sap_event_trigger(); + + +Relevant section from cluster.conf: + + + + + + + + + + + + + + + + + + + + + diff --git a/rgmanager/include/clulog.h b/rgmanager/include/clulog.h index 856d83c..e6b7ff8 100644 --- a/rgmanager/include/clulog.h +++ b/rgmanager/include/clulog.h @@ -38,7 +38,7 @@ extern "C" { #include #include -#define LOGLEVEL_DFLT LOG_INFO +#define LOGLEVEL_DFLT LOG_NOTICE #define MAX_LOGMSG_LEN 512 /* diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h new file mode 100644 index 0000000..bd8bc0a --- /dev/null +++ b/rgmanager/include/event.h @@ -0,0 +1,147 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +#ifndef _EVENT_H +#define _EVENT_H + +/* 128 is a bit big, but it should be okay */ +typedef struct __rge_q { + char rg_name[128]; + uint32_t rg_state; + uint32_t pad1; + int rg_owner; + int rg_last_owner; +} group_event_t; + +typedef struct __ne_q { + uint64_t ne_nodeid; + int ne_local; + int ne_state; + int ne_clean; + int pad1; +} node_event_t; + +typedef struct __cfg_q { + int cfg_version; + int cfg_oldversion; +} config_event_t; + +typedef struct __user_q { + char u_name[128]; + uint64_t u_target; /* Node ID */ + int pad1; + int u_fd; + int u_request; + int u_arg1; + int u_arg2; +} user_event_t; + +typedef enum { + EVENT_NONE=0, + EVENT_CONFIG, + EVENT_NODE, + EVENT_RG, + EVENT_USER +} event_type_t; + +/* Data that's distributed which indicates which + node is the event master */ +typedef struct __rgm { + uint64_t m_nodeid; + uint64_t m_master_time; + uint32_t m_magic; + uint8_t m_reserved[108]; +} event_master_t; + +#define swab_event_master_t(ptr) \ +{\ + swab64((ptr)->m_nodeid);\ + swab64((ptr)->m_master_time);\ + swab32((ptr)->m_magic);\ +} + +/* Just a magic # to help us ensure we've got good + date from VF */ +#define EVENT_MASTER_MAGIC 0xfabab0de + +/* Event structure - internal to the event subsystem; use + the queueing functions below which allocate this struct + and pass it to the event handler */ +typedef struct _event { + /* Not used dynamically - part of config info */ + list_head(); + char *ev_name; + char *ev_script; + char *ev_script_file; + int ev_prio; + int ev_pad; + /* --- end config part */ + int ev_type; /* config & generated by rgmanager*/ + int ev_transaction; + union { + group_event_t group; + node_event_t node; + config_event_t config; + user_event_t user; + } ev; +} event_t; + +#define EVENT_PRIO_COUNT 100 + +typedef struct _event_table { + int max_prio; + int pad; + event_t *entries[0]; +} event_table_t; + + +int construct_events(int ccsfd, event_table_t **); +void deconstruct_events(event_table_t **); +void print_events(event_table_t *); + +/* Does the event match a configured event? */ +int event_match(event_t *pattern, event_t *actual); + +/* Event queueing functions. */ +void node_event_q(int local, uint64_t nodeID, int state, int clean); +void rg_event_q(char *name, uint32_t state, uint64_t owner, uint64_t last); +void user_event_q(char *svc, int request, int arg1, int arg2, + uint64_t target, int fd); +void config_event_q(int old_version, int new_version); + +/* Call this to see if there's a master. */ +int event_master_info_cached(event_master_t *); + +/* Call this to get the node ID of the current + master *or* become the master if none exists */ +uint64_t event_master(void); + +/* Setup */ +int central_events_enabled(void); +void set_central_events(int flag); +int slang_process_event(event_table_t *event_table, event_t *ev); + +/* For distributed events. */ +void set_transition_throttling(int nsecs); + +/* Simplified service start. */ +int service_op_start(char *svcName, uint64_t *target_list, int target_list_len, + uint64_t *new_owner); +int service_op_stop(char *svcName, int do_disable, int event_type); + + +#endif diff --git a/rgmanager/include/res-ocf.h b/rgmanager/include/res-ocf.h index 4459b67..b55bf44 100644 --- a/rgmanager/include/res-ocf.h +++ b/rgmanager/include/res-ocf.h @@ -31,6 +31,7 @@ #define OCF_RESOURCE_INSTANCE_STR "OCF_RESOURCE_INSTANCE" #define OCF_CHECK_LEVEL_STR "OCF_CHECK_LEVEL" #define OCF_RESOURCE_TYPE_STR "OCF_RESOURCE_TYPE" +#define OCF_REFCNT_STR "OCF_RESKEY_RGMANAGER_meta_refcnt" /* LSB return codes @@ -45,4 +46,23 @@ #define OCF_RA_NOT_RUNNING 7 #define OCF_RA_MAX 7 +/* + Resource operations - not ocf-specified + */ +#define RS_START (0) +#define RS_STOP (1) +#define RS_STATUS (2) +#define RS_RESINFO (3) +#define RS_RESTART (4) +#define RS_RELOAD (5) +#define RS_CONDRESTART (6) +#define RS_RECOVER (7) +#define RS_CONDSTART (8) /** Start if flagged with RF_NEEDSTART */ +#define RS_CONDSTOP (9) /** STOP if flagged with RF_NEEDSTOP */ +#define RS_MONITOR (10) +#define RS_META_DATA (11) +#define RS_VALIDATE (12) +#define RS_MIGRATE (13) +#define RS_RECONFIG (14) + #endif diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h index 56f7f3c..c52dcc0 100644 --- a/rgmanager/include/resgroup.h +++ b/rgmanager/include/resgroup.h @@ -54,6 +54,11 @@ typedef struct { #define RG_SERVICE_GROUP "usrm::manager" #define RG_ACTION_REQUEST /* Message header */ 0x138582 +/* Argument to RG_ACTION_REQUEST */ +#define RG_ACTION_MASTER 0xfe0db143 +#define RG_ACTION_USER 0x3f173bfd +/* */ +#define RG_EVENT 0x138583 #define RG_SUCCESS 0 #define RG_FAIL 1 @@ -67,7 +72,7 @@ typedef struct { #define RG_EXITING 9 #define RG_INIT 10 #define RG_ENABLE 11 -#define RG_STATUS_INQUIRY 12 +#define RG_STATUS_NODE 12 #define RG_RELOCATE 13 #define RG_CONDSTOP 14 #define RG_CONDSTART 15 @@ -77,11 +82,12 @@ typedef struct { #define RG_LOCK 19 #define RG_UNLOCK 20 #define RG_QUERY_LOCK 21 +/* #define RG_MIGRATE 22 */ +/* Compat: FREEZE = 23, UNFREEZE = 24 */ +/* #define RG_STATUS_INQUIRY 25 */ #define RG_NONE 999 -extern const char *rg_req_strings[]; - -#define rg_req_str(req) (rg_req_strings[req]) +const char *rg_req_str(int req); int handle_relocate_req(char *svcName, int request, uint64_t preferred_target, uint64_t *new_owner); @@ -101,23 +107,28 @@ int handle_start_remote_req(char *svcName, int req); #define RG_STATE_ERROR 117 /** Recoverable error */ #define RG_STATE_RECOVER 118 /** Pending recovery */ #define RG_STATE_DISABLED 119 /** Resource not allowd to run */ +/* #define RG_STATE_MIGRATE 120 */ #define DEFAULT_CHECK_INTERVAL 10 -extern const char *rg_state_strings[]; +const char *rg_state_str(int val); +int rg_state_str_to_id(const char *val); +const char *agent_op_str(int val); -#define rg_state_str(state) (rg_state_strings[state - RG_STATE_BASE]) +int eval_groups(int local, uint64_t nodeid, int nodeStatus); int rg_status(const char *resgroupname); int group_op(char *rgname, int op); void rg_init(void); -/* FOOM */ int svc_start(char *svcName, int req); int svc_stop(char *svcName, int error); int svc_status(char *svcName); int svc_disable(char *svcName); int svc_fail(char *svcName); +int check_restart(char *svcName); +int add_restart(char *svcName); + int rt_enqueue_request(const char *resgroupname, int request, int response_fd, int max, uint64_t target, int arg0, int arg1); @@ -135,6 +146,7 @@ int set_rg_state(char *name, rg_state_t *svcblk); int get_rg_state(char *servicename, rg_state_t *svcblk); uint64_t best_target_node(cluster_member_list_t *allowed, uint64_t owner, char *rg_name, int lock); +char *c_name(char *svcName); #ifdef DEBUG int _rg_lock_dbg(char *, void **, char *, int); @@ -155,6 +167,24 @@ int rg_unlock(char *name, void *p); void member_list_update(cluster_member_list_t *new_ml); cluster_member_list_t *member_list(void); uint64_t my_id(void); +int member_online(uint64_t nid); +void member_set_state(uint64_t nid, int state); + + +/* Return codes */ +#define RG_EDEPEND -17 /* Dependency rule would be violated */ +#define RG_EEXCL -16 /* Service not runnable due to + the fact that it is tagged + exclusive and there are no + empty nodes. */ +#define RG_EDOMAIN -15 /* Service not runnable given the + set of nodes and its failover + domain */ +#define RG_ESCRIPT -14 /* S/Lang script failed */ +#define RG_EFENCE -13 /* Fencing operation pending */ +#define RG_ENODE -12 /* Node is dead/nonexistent */ +#define RG_EINVAL -11 /* Invalid operation for resource */ +#define RG_EQUORUM -10 /* Operation requires quorum */ #define RG_ERELO -9 /* Operation cannot complete here */ #define RG_ENODEDEATH -8 /* Processing node died */ @@ -166,14 +196,12 @@ uint64_t my_id(void); #define RG_EABORT -2 /* Request cancelled */ #define RG_EFAIL -1 /* Generic error */ #define RG_ESUCCESS 0 +#define RG_YES 1 +#define RG_NO 2 + +const char *rg_strerror(int val); -#define FORWARD -3 -#define ABORT -2 -#define FAIL -1 -#define SUCCESS 0 -#define YES 1 -#define NO 2 /* * Fail-over domain states @@ -190,6 +218,12 @@ uint64_t my_id(void); #define FOD_RESTRICTED (1<<1) #define FOD_NOFAILBACK (1<<2) +/* + Status tree flags + */ +#define SFL_FAILURE (1<<0) +#define SFL_RECOVERABLE (1<<1) + //#define DEBUG #ifdef DEBUG diff --git a/rgmanager/include/reslist.h b/rgmanager/include/reslist.h index 7b98f23..23129ff 100644 --- a/rgmanager/include/reslist.h +++ b/rgmanager/include/reslist.h @@ -25,31 +25,34 @@ #include +#define RA_PRIMARY (1<<0) /** Primary key */ +#define RA_UNIQUE (1<<1) /** Unique for given type */ +#define RA_REQUIRED (1<<2) /** Required (or an error if not present */ +#define RA_INHERIT (1<<3) /** Inherit a parent resource's attr */ +#define RA_RECONFIG (1<<4) /** Allow inline reconfiguration */ + #define RF_INLINE (1<<0) #define RF_DEFINED (1<<1) #define RF_NEEDSTART (1<<2) /** Used when adding/changing resources */ #define RF_NEEDSTOP (1<<3) /** Used when deleting/changing resources */ #define RF_COMMON (1<<4) /** " */ +#define RF_INDEPENDENT (1<<5) /** Define this for a resource if it is + otherwise an independent subtree */ +#define RF_RECONFIG (1<<6) + +#define RF_INIT (1<<7) /** Resource rule: Initialize this resource + class on startup */ +#define RF_DESTROY (1<<8) /** Resource rule flag: Destroy this + resource class if you delete it from + the configuration */ +#define RF_ROOT (1<<9) + + #define RES_STOPPED (0) #define RES_STARTED (1) #define RES_FAILED (2) -/* - Resource operations - */ -#define RS_START (0) -#define RS_STOP (1) -#define RS_STATUS (2) -#define RS_RESINFO (3) -#define RS_RESTART (4) -#define RS_RELOAD (5) -#define RS_CONDRESTART (6) -#define RS_RECOVER (7) -#define RS_CONDSTART (8) /** Start if flagged with RF_NEEDSTART */ -#define RS_CONDSTOP (9) /** STOP if flagged with RF_NEEDSTOP */ - - #ifndef SHAREDIR #define SHAREDIR "/usr/share/rgmanager" #endif @@ -65,33 +68,20 @@ #include -typedef enum { -/* -#define RA_PRIMARY (1<<0) -#define RA_UNIQUE (1<<1) -#define RA_REQUIRED (1<<2) -#define RA_INHERIT (1<<3) - */ - RA_PRIMARY = (1<<0), - RA_UNIQUE = (1<<1), - RA_REQUIRED= (1<<2), - RA_INHERIT = (1<<3), - RA_SPEC = (1<<4) -} ra_flag_t; - typedef struct _resource_attribute { char *ra_name; char *ra_value; - ra_flag_t ra_flags; + int ra_flags; + int _pad_; } resource_attr_t; typedef struct _resource_child { + char *rc_name; int rc_startlevel; int rc_stoplevel; int rc_forbid; int rc_flags; - char *rc_name; } resource_child_t; @@ -110,7 +100,7 @@ typedef struct _resource_rule { char * rr_type; char * rr_agent; char * rr_version; /** agent XML spec version; OCF-ism */ - int rr_root; + int rr_flags; int rr_maxrefs; resource_attr_t * rr_attrs; resource_child_t * rr_childtypes; @@ -137,6 +127,7 @@ typedef struct _rg_node { struct _rg_node *rn_child, *rn_parent; resource_t *rn_resource; resource_act_t *rn_actions; + restart_counter_t rn_restart_counter; int rn_state; /* State of this instance of rn_resource */ int rn_flags; int rn_last_status; @@ -149,7 +140,7 @@ typedef struct _fod_node { list_head(); char *fdn_name; int fdn_prio; - int _pad_; /* align */ + uint64_t fdn_nodeid; /* on rhel4 this will be 64-bit int */ } fod_node_t; typedef struct _fod { @@ -169,7 +160,11 @@ int res_stop(resource_node_t **tree, resource_t *res, void *ret); int res_status(resource_node_t **tree, resource_t *res, void *ret); int res_condstart(resource_node_t **tree, resource_t *res, void *ret); int res_condstop(resource_node_t **tree, resource_t *res, void *ret); +int res_exec(resource_node_t *node, int op, const char *arg, int depth); /*int res_resinfo(resource_node_t **tree, resource_t *res, void *ret);*/ +int expand_time(char *val); +int store_action(resource_act_t **actsp, char *name, int depth, int timeout, int interval); + /* Calculate differences @@ -208,6 +203,8 @@ void deconstruct_domains(fod_t **domains); void print_domains(fod_t **domains); int node_should_start(uint64_t nodeid, cluster_member_list_t *membership, char *rg_name, fod_t **domains); +int node_domain_set(fod_t *domain, uint64_t **ret, int *retlen); +int node_domain_set_safe(char *domainname, uint64_t **ret, int *retlen, int *flags); /* @@ -216,6 +213,7 @@ int node_should_start(uint64_t nodeid, cluster_member_list_t *membership, resource_t *find_resource_by_ref(resource_t **reslist, char *type, char *ref); resource_t *find_root_by_ref(resource_t **reslist, char *ref); resource_rule_t *find_rule_by_type(resource_rule_t **rulelist, char *type); +void res_build_name(char *, size_t, resource_t *); /* Internal functions; shouldn't be needed. diff --git a/rgmanager/include/restart_counter.h b/rgmanager/include/restart_counter.h new file mode 100644 index 0000000..2f158ad --- /dev/null +++ b/rgmanager/include/restart_counter.h @@ -0,0 +1,32 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* Time-based restart counters for rgmanager */ + +#ifndef _RESTART_COUNTER_H +#define _RESTART_COUNTER_H + +typedef void *restart_counter_t; + +int restart_add(restart_counter_t arg); +int restart_clear(restart_counter_t arg); +int restart_count(restart_counter_t arg); +int restart_treshold_exceeded(restart_counter_t arg); +restart_counter_t restart_init(time_t expire_timeout, int max_restarts); +int restart_cleanup(restart_counter_t arg); + +#endif diff --git a/rgmanager/include/rg_queue.h b/rgmanager/include/rg_queue.h index ac26ce8..d40793e 100644 --- a/rgmanager/include/rg_queue.h +++ b/rgmanager/include/rg_queue.h @@ -1,9 +1,27 @@ +/* + Copyright Red Hat, Inc. 2004-2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ #ifndef _RG_QUEUE_H #define _RG_QUEUE_H #include #include #include #include +#include /** @@ -15,12 +33,12 @@ typedef struct _request { uint32_t rr_request; /** Request */ uint32_t rr_errorcode; /** Error condition */ uint32_t rr_orig_request; /** Original request */ - uint32_t rr_resp_fd; /** FD to send response */ uint64_t rr_target; /** Target node */ uint32_t rr_arg0; /** Integer argument */ uint32_t rr_arg1; /** Integer argument */ + uint32_t rr_arg2; /** Integer argument */ uint32_t rr_line; /** Line no */ - uint32_t _pad_; /** pad */ + uint32_t rr_resp_fd; /** FD to send response */ char *rr_file; /** Who made req */ time_t rr_when; /** time to execute */ } request_t; @@ -41,5 +59,7 @@ int rq_queue_empty(request_t **q); void rq_free(request_t *foo); void forward_request(request_t *req); +void forward_message(int fd, void *msg, uint64_t nodeid); + #endif diff --git a/rgmanager/include/sets.h b/rgmanager/include/sets.h new file mode 100644 index 0000000..8cc271b --- /dev/null +++ b/rgmanager/include/sets.h @@ -0,0 +1,39 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/** + @file sets.h - Header file for sets.c + @author Lon Hohberger + */ +#ifndef _SETS_H +#define _SETS_H + +#include +typedef uint64_t set_type_t; + +int s_add(set_type_t *, int *, set_type_t); +int s_union(set_type_t *, int, set_type_t *, + int, set_type_t **, int *); + +int s_intersection(set_type_t *, int, set_type_t *, + int, set_type_t **, int *); +int s_delta(set_type_t *, int, set_type_t *, + int, set_type_t **, int *); +int s_subtract(set_type_t *, int, set_type_t *, int, set_type_t **, int *); +int s_shuffle(set_type_t *, int); + +#endif diff --git a/rgmanager/man/clusvcadm.8 b/rgmanager/man/clusvcadm.8 index dcc5691..20ae823 100644 --- a/rgmanager/man/clusvcadm.8 +++ b/rgmanager/man/clusvcadm.8 @@ -49,12 +49,8 @@ service Lock the local resource group manager. This should only be used if the administrator intends to perform a global, cluster-wide shutdown. This prevents starting resource groups on the local node, allowing -services will not fail over during the shutdown of the cluster. Generally, -administrators should use the -.B -clushutdown(8) -command to accomplish this. Once the cluster quorum is dissolved, this -state is reset. +services will not fail over during the shutdown of the cluster. +Once the cluster quorum is dissolved, this state is reset. .IP "\-m " When used in conjunction with either the .B @@ -88,11 +84,10 @@ service until a member transition or until it is enabled again. .IP \-u Unlock the cluster's service managers. This allows services to transition -again. It will be necessary to re-enable all services in the stopped state -if this is run after \fB clushutdown(8)\fR. +again. .IP \-v Display version information and exit. .SH "SEE ALSO" -clustat(8), clushutdown(8) +clustat(8) diff --git a/rgmanager/src/clulib/Makefile b/rgmanager/src/clulib/Makefile index 343c2e9..5531e82 100644 --- a/rgmanager/src/clulib/Makefile +++ b/rgmanager/src/clulib/Makefile @@ -30,7 +30,8 @@ install: all uninstall: libclulib.a: clulog.o daemon_init.o signals.o msgsimple.o \ - vft.o gettid.o rg_strings.o wrap_lock.o + vft.o gettid.o rg_strings.o wrap_lock.o \ + sets.o ${AR} cru $@ $^ ranlib $@ diff --git a/rgmanager/src/clulib/rg_strings.c b/rgmanager/src/clulib/rg_strings.c index 4728789..5d561b7 100644 --- a/rgmanager/src/clulib/rg_strings.c +++ b/rgmanager/src/clulib/rg_strings.c @@ -1,35 +1,179 @@ -const char *rg_state_strings[] = { - "stopped", - "starting", - "started", - "stopping", - "failed", - "uninitialized", - "checking", - "recoverable", - "recovering", - "disabled", - "" +/* + Copyright Red Hat, Inc. 2004-2006 + + 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, or (at your option) any + later version. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +#include +#include + +struct string_val { + int val; + char *str; +}; + + +const struct string_val rg_error_strings[] = { + { RG_EEXCL, "Service not runnable: cannot run exclusive" }, + { RG_EDOMAIN, "Service not runnable: restricted failover domain offline" }, + { RG_ESCRIPT, "S/Lang Script Error" }, + { RG_EFENCE, "Fencing operation pending; try again later" }, + { RG_ENODE, "Target node dead / nonexistent" }, + { RG_ERUN, "Service is already running" }, + { RG_EQUORUM, "Operation requires quorum" }, + { RG_EINVAL, "Invalid operation for resource" }, + { RG_EDEPEND, "Operation violates dependency rule" }, + { RG_EAGAIN, "Temporary failure; try again" }, + { RG_EDEADLCK, "Operation would cause a deadlock" }, + { RG_ENOSERVICE,"Service does not exist" }, + { RG_EFORWARD, "Service not mastered locally" }, + { RG_EABORT, "Aborted; service failed" }, + { RG_EFAIL, "Failure" }, + { RG_ESUCCESS, "Success" }, + { RG_YES, "Yes" }, + { RG_NO, "No" }, + { 0, NULL } +}; + + +const struct string_val rg_req_strings[] = { + {RG_SUCCESS, "success" }, + {RG_FAIL, "fail"}, + {RG_START, "start"}, + {RG_STOP, "stop"}, + {RG_STATUS, "status"}, + {RG_DISABLE, "disable"}, + {RG_STOP_RECOVER, "stop (recovery)"}, + {RG_START_RECOVER, "start (recovery)"}, + {RG_RESTART, "restart"}, + {RG_EXITING, "exiting"}, + {RG_INIT, "initialize"}, + {RG_ENABLE, "enable"}, + {RG_STATUS_NODE, "status inquiry"}, + {RG_RELOCATE, "relocate"}, + {RG_CONDSTOP, "conditional stop"}, + {RG_CONDSTART, "conditional start"}, + {RG_START_REMOTE,"remote start"}, + {RG_STOP_USER, "user stop"}, + {RG_STOP_EXITING, "stop (shutdown)"}, + {RG_LOCK, "locking"}, + {RG_UNLOCK, "unlocking"}, + {RG_QUERY_LOCK, "lock status inquiry"}, + //{RG_MIGRATE, "migrate"}, + //{RG_STATUS_INQUIRY, "out of band service status inquiry"}, + {RG_NONE, "none"}, + {0, NULL} +}; + + +const struct string_val rg_state_strings[] = { + {RG_STATE_STOPPED, "stopped"}, + {RG_STATE_STARTING, "starting"}, + {RG_STATE_STARTED, "started"}, + {RG_STATE_STOPPING, "stopping"}, + {RG_STATE_FAILED, "failed"}, + {RG_STATE_UNINITIALIZED, "uninitialized"}, + {RG_STATE_CHECK, "checking"}, + {RG_STATE_ERROR, "recoverable"}, + {RG_STATE_RECOVER, "recovering"}, + {RG_STATE_DISABLED, "disabled"}, + //{RG_STATE_MIGRATE, "migrating"}, + {0, NULL} }; -const char *rg_req_strings[] = { - "success", - "fail", - "start", - "stop", - "status", - "disable", - "stop (recovery)", - "start (recovery)", - "restart", - "exiting", - "initialize", - "enable", - "status inquiry", - "relocate", - "conditional stop", - "conditional start", - "remote start", - "user stop", - "" + +const struct string_val agent_ops[] = { + {RS_START, "start"}, + {RS_STOP, "stop"}, + {RS_STATUS, "status"}, + {RS_RESINFO, "resinfo"}, + {RS_RESTART, "restart"}, + {RS_RELOAD, "reload"}, + {RS_CONDRESTART, "condrestart"}, /* Unused */ + {RS_RECOVER, "recover"}, + {RS_CONDSTART, "condstart"}, + {RS_CONDSTOP, "condstop"}, + {RS_MONITOR, "monitor"}, + {RS_META_DATA, "meta-data"}, /* printenv */ + {RS_VALIDATE, "validate-all"}, + //{RS_MIGRATE, "migrate"}, + {RS_RECONFIG, "reconfig"}, + {0 , NULL} }; + + +static inline const char * +rg_search_table(const struct string_val *table, int val) +{ + int x; + + for (x = 0; table[x].str != NULL; x++) { + if (table[x].val == val) { + return table[x].str; + } + } + + return "Unknown"; +} + + +static inline int +rg_search_table_by_str(const struct string_val *table, const char *val) +{ + int x; + + for (x = 0; table[x].str != NULL; x++) { + if (!strcasecmp(table[x].str, val)) + return table[x].val; + } + + return -1; +} + + + +const char * +rg_strerror(int val) +{ + return rg_search_table(rg_error_strings, val); +} + +const char * +rg_state_str(int val) +{ + return rg_search_table(rg_state_strings, val); +} + + +int +rg_state_str_to_id(const char *val) +{ + return rg_search_table_by_str(rg_state_strings, val); +} + + + +const char * +rg_req_str(int val) +{ + return rg_search_table(rg_req_strings, val); +} + + +const char * +agent_op_str(int val) +{ + return rg_search_table(agent_ops, val); +} diff --git a/rgmanager/src/clulib/sets.c b/rgmanager/src/clulib/sets.c new file mode 100644 index 0000000..f734064 --- /dev/null +++ b/rgmanager/src/clulib/sets.c @@ -0,0 +1,370 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/** + @file sets.c - Order-preserving set functions (union / intersection / delta) + (designed for integer types; a la int, uint64_t, etc...) + @author Lon Hohberger + */ +#include +#include +#include +#include +#include +#include + + +/** + Add a value to a set. This function disregards an add if the value is already + in the set. Note that the maximum length of set s must be preallocated; this + function doesn't do error or bounds checking. + + @param s Set to modify + @param curlen Current length (modified if added) + @param val Value to add + @return 0 if not added, 1 if added + */ +int +s_add(set_type_t *s, int *curlen, set_type_t val) +{ + int idx=0; + + for (; idx < *curlen; idx++) + if (s[idx] == val) + return 0; + s[*curlen] = val; + ++(*curlen); + return 1; +} + + +/** + Union-set function. Allocates and returns a new set which is the union of + the two given sets 'left' and 'right'. Also returns the new set length. + + @param left Left set - order is preserved on this set; that is, + this is the set where the caller cares about ordering. + @param ll Length of left set. + @param right Right set - order is not preserved on this set during + the union operation + @param rl Length of right set + @param ret Return set. Should * not * be preallocated. + @param retl Return set length. Should be ready to accept 1 integer + upon calling this function + @return 0 on success, -1 on error + */ +int +s_union(set_type_t *left, int ll, set_type_t *right, int rl, + set_type_t **ret, int *retl) +{ + int l, r, cnt = 0, total; + + total = ll + rl; /* Union will never exceed both sets */ + + *ret = malloc(sizeof(set_type_t)*total); + if (!*ret) { + return -1; + } + memset((void *)(*ret), 0, sizeof(set_type_t)*total); + + cnt = 0; + + /* Add all the ones on the left */ + for (l = 0; l < ll; l++) + s_add(*ret, &cnt, left[l]); + + /* Add the ones on the left */ + for (r = 0; r < rl; r++) + s_add(*ret, &cnt, right[r]); + + *retl = cnt; + + return 0; +} + + +/** + Intersection-set function. Allocates and returns a new set which is the + intersection of the two given sets 'left' and 'right'. Also returns the new + set length. + + @param left Left set - order is preserved on this set; that is, + this is the set where the caller cares about ordering. + @param ll Length of left set. + @param right Right set - order is not preserved on this set during + the union operation + @param rl Length of right set + @param ret Return set. Should * not * be preallocated. + @param retl Return set length. Should be ready to accept 1 integer + upon calling this function + @return 0 on success, -1 on error + */ +int +s_intersection(set_type_t *left, int ll, set_type_t *right, int rl, + set_type_t **ret, int *retl) +{ + int l, r, cnt = 0, total; + + total = ll; /* Intersection will never exceed one of the two set + sizes */ + + *ret = malloc(sizeof(set_type_t)*total); + if (!*ret) { + return -1; + } + memset((void *)(*ret), 0, sizeof(set_type_t)*total); + + cnt = 0; + /* Find duplicates */ + for (l = 0; l < ll; l++) { + for (r = 0; r < rl; r++) { + if (left[l] != right[r]) + continue; + if (s_add(*ret, &cnt, right[r])) + break; + } + } + + *retl = cnt; + return 0; +} + + +/** + Delta-set function. Allocates and returns a new set which is the delta (i.e. + numbers not in both sets) of the two given sets 'left' and 'right'. Also + returns the new set length. + + @param left Left set - order is preserved on this set; that is, + this is the set where the caller cares about ordering. + @param ll Length of left set. + @param right Right set - order is not preserved on this set during + the union operation + @param rl Length of right set + @param ret Return set. Should * not * be preallocated. + @param retl Return set length. Should be ready to accept 1 integer + upon calling this function + @return 0 on success, -1 on error + */ +int +s_delta(set_type_t *left, int ll, set_type_t *right, int rl, + set_type_t **ret, int *retl) +{ + int l, r, cnt = 0, total, found; + + total = ll + rl; /* Union will never exceed both sets */ + + *ret = malloc(sizeof(set_type_t)*total); + if (!*ret) { + return -1; + } + memset((void *)(*ret), 0, sizeof(set_type_t)*total); + + cnt = 0; + + /* not efficient, but it works */ + /* Add all the ones on the left */ + for (l = 0; l < ll; l++) { + found = 0; + for (r = 0; r < rl; r++) { + if (right[r] == left[l]) { + found = 1; + break; + } + } + + if (found) + continue; + s_add(*ret, &cnt, left[l]); + } + + + /* Add all the ones on the right*/ + for (r = 0; r < rl; r++) { + found = 0; + for (l = 0; l < ll; l++) { + if (right[r] == left[l]) { + found = 1; + break; + } + } + + if (found) + continue; + s_add(*ret, &cnt, right[r]); + } + + *retl = cnt; + + return 0; +} + + +/** + Subtract-set function. Allocates and returns a new set which is the + subtraction of the right set from the left set. + Also returns the new set length. + + @param left Left set - order is preserved on this set; that is, + this is the set where the caller cares about ordering. + @param ll Length of left set. + @param right Right set - order is not preserved on this set during + the union operation + @param rl Length of right set + @param ret Return set. Should * not * be preallocated. + @param retl Return set length. Should be ready to accept 1 integer + upon calling this function + @return 0 on success, -1 on error + */ +int +s_subtract(set_type_t *left, int ll, set_type_t *right, int rl, + set_type_t **ret, int *retl) +{ + int l, r, cnt = 0, total, found; + + total = ll; /* Union will never exceed left set length*/ + + *ret = malloc(sizeof(set_type_t)*total); + if (!*ret) { + return -1; + } + memset((void *)(*ret), 0, sizeof(set_type_t)*total); + + cnt = 0; + + /* not efficient, but it works */ + for (l = 0; l < ll; l++) { + found = 0; + for (r = 0; r < rl; r++) { + if (right[r] == left[l]) { + found = 1; + break; + } + } + + if (found) + continue; + s_add(*ret, &cnt, left[l]); + } + + *retl = cnt; + + return 0; +} + + +/** + Shuffle-set function. Weakly randomizes ordering of a set in-place. + + @param set Set to randomize + @param sl Length of set + @return 0 + */ +int +s_shuffle(set_type_t *set, int sl) +{ + int x, newidx; + unsigned r_state = 0; + set_type_t t; + struct timeval tv; + + gettimeofday(&tv, NULL); + r_state = (int)(tv.tv_usec); + + for (x = 0; x < sl; x++) { + newidx = (rand_r(&r_state) % sl); + if (newidx == x) + continue; + t = set[x]; + set[x] = set[newidx]; + set[newidx] = t; + } + + return 0; +} + + +#ifdef STANDALONE +/* Testbed */ +/* + gcc -o sets sets.c -DSTANDALONE -ggdb -I../../include \ + -Wall -Werror -Wstrict-prototypes -Wextra + */ +int +main(int __attribute__ ((unused)) argc, char __attribute__ ((unused)) **argv) +{ + set_type_t a[] = { 1, 2, 3, 3, 3, 2, 2, 3 }; + set_type_t b[] = { 2, 3, 4 }; + set_type_t *i; + int ilen = 0, x; + + s_union(a, 8, b, 3, &i, &ilen); + + /* Should return length of 4 - { 1 2 3 4 } */ + printf("set_union [%d] = ", ilen); + for ( x = 0; x < ilen; x++) { + printf("%d ", (int)i[x]); + } + printf("\n"); + + s_shuffle(i, ilen); + printf("shuffled [%d] = ", ilen); + for ( x = 0; x < ilen; x++) { + printf("%d ", (int)i[x]); + } + printf("\n"); + + + free(i); + + /* Should return length of 2 - { 2 3 } */ + s_intersection(a, 8, b, 3, &i, &ilen); + + printf("set_intersection [%d] = ", ilen); + for ( x = 0; x < ilen; x++) { + printf("%d ", (int)i[x]); + } + printf("\n"); + + free(i); + + /* Should return length of 2 - { 1 4 } */ + s_delta(a, 8, b, 3, &i, &ilen); + + printf("set_delta [%d] = ", ilen); + for ( x = 0; x < ilen; x++) { + printf("%d ", (int)i[x]); + } + printf("\n"); + + free(i); + + /* Should return length of 1 - { 1 } */ + s_subtract(a, 8, b, 3, &i, &ilen); + + printf("set_subtract [%d] = ", ilen); + for ( x = 0; x < ilen; x++) { + printf("%d ", (int)i[x]); + } + printf("\n"); + + free(i); + + + return 0; +} +#endif diff --git a/rgmanager/src/clulib/signals.c b/rgmanager/src/clulib/signals.c index 1d49ee5..fa9f4a6 100644 --- a/rgmanager/src/clulib/signals.c +++ b/rgmanager/src/clulib/signals.c @@ -1,3 +1,21 @@ +/* + Copyright Red Hat, Inc. 2003-2006 + + 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, or (at your option) any + later version. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ #include #include #include diff --git a/rgmanager/src/clulib/tmgr.c b/rgmanager/src/clulib/tmgr.c new file mode 100644 index 0000000..2565f26 --- /dev/null +++ b/rgmanager/src/clulib/tmgr.c @@ -0,0 +1,128 @@ +/* + Copyright Red Hat, Inc. 2007 + Copyright Crosswalk 2006-2007 + + 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, or (at your option) any + later version. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +#ifdef WRAP_THREADS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct _thr { + list_head(); + void *(*fn)(void *arg); + char **name; + pthread_t th; +} mthread_t; + +static mthread_t *_tlist = NULL; +static int _tcount = 0; +static pthread_rwlock_t _tlock = PTHREAD_RWLOCK_INITIALIZER; + +void +dump_thread_states(FILE *fp) +{ + int x; + mthread_t *curr; + fprintf(fp, "Thread Information\n"); + pthread_rwlock_rdlock(&_tlock); + list_for(&_tlist, curr, x) { + fprintf(fp, " Thread #%d id: %d function: %s\n", + x, (unsigned)curr->th, curr->name[0]); + } + pthread_rwlock_unlock(&_tlock); + fprintf(fp, "\n\n"); +} + + +int __real_pthread_create(pthread_t *, const pthread_attr_t *, + void *(*)(void*), void *); +int +__wrap_pthread_create(pthread_t *th, const pthread_attr_t *attr, + void *(*start_routine)(void*), + void *arg) +{ + void *fn = start_routine; + mthread_t *new; + int ret; + + new = malloc(sizeof (*new)); + + ret = __real_pthread_create(th, attr, start_routine, arg); + if (ret) { + if (new) + free(new); + return ret; + } + + if (new) { + new->th = *th; + new->fn = start_routine; + new->name = backtrace_symbols(&fn, 1); + pthread_rwlock_wrlock(&_tlock); + list_insert(&_tlist, new); + ++_tcount; + pthread_rwlock_unlock(&_tlock); + } + + return ret; +} + + +void __real_pthread_exit(void *); +void +__wrap_pthread_exit(void *exitval) +{ + mthread_t *old; + int ret = 0, found = 0; + pthread_t me = pthread_self(); + + pthread_rwlock_rdlock(&_tlock); + list_for(&_tlist, old, ret) { + if (old->th == me) { + found = 1; + break; + } + } + if (!found) + old = NULL; + pthread_rwlock_unlock(&_tlock); + + if (!old) + __real_pthread_exit(exitval); + + pthread_rwlock_wrlock(&_tlock); + list_remove(&_tlist, old); + --_tcount; + pthread_rwlock_unlock(&_tlock); + + if (old->name) + free(old->name); + free(old); + __real_pthread_exit(exitval); +} +#endif diff --git a/rgmanager/src/clulib/vft.c b/rgmanager/src/clulib/vft.c index 859fc3e..29e51bc 100644 --- a/rgmanager/src/clulib/vft.c +++ b/rgmanager/src/clulib/vft.c @@ -187,6 +187,9 @@ static void close_all(int *fds) { int x; + + if (!fds) + return; for (x = 0; fds[x] != -1; x++) { msg_close(fds[x]); } @@ -1246,10 +1249,10 @@ vf_write(cluster_member_list_t *membership, uint32_t flags, char *keyid, void *data, uint32_t datalen) { uint64_t nodeid; - int *peer_fds; + int *peer_fds = NULL; int count; - key_node_t *key_node; - vf_msg_t *join_view; + key_node_t *key_node = NULL; + vf_msg_t *join_view = NULL; int remain = 0, x, y, rv = 1; uint32_t totallen; struct timeval start, end, dif; @@ -1263,19 +1266,11 @@ vf_write(cluster_member_list_t *membership, uint32_t flags, char *keyid, return -1; pthread_mutex_lock(&vf_mutex); - /* Obtain cluster lock on it. */ - snprintf(lock_name, sizeof(lock_name), "usrm::vf"); - l = clu_lock(lock_name, CLK_EX, &lockp); - if (l < 0) { - pthread_mutex_unlock(&vf_mutex); - return l; - } /* set to -1 */ count = sizeof(int) * (membership->cml_count + 1); peer_fds = malloc(count); if(!peer_fds) { - clu_unlock(lock_name, lockp); pthread_mutex_unlock(&vf_mutex); return -1; } @@ -1285,6 +1280,14 @@ vf_write(cluster_member_list_t *membership, uint32_t flags, char *keyid, getuptime(&start); retry_top: + /* Obtain cluster lock on it. */ + snprintf(lock_name, sizeof(lock_name), "usrm::vf"); + l = clu_lock(lock_name, CLK_EX, &lockp); + if (l < 0) { + pthread_mutex_unlock(&vf_mutex); + return l; + } + /* * Connect to everyone, except ourself. We separate this from the * initial send cycle because the connect cycle can cause timeouts @@ -1316,29 +1319,40 @@ retry_top: printf("VF: Connect to %d failed: %s\n", (int)nodeid, strerror(errno)); #endif - if (flags & VFF_RETRY) - goto retry_top; if (flags & VFF_IGN_CONN_ERRORS) continue; - close_all(peer_fds); - free(peer_fds); - clu_unlock(lock_name, lockp); - pthread_mutex_unlock(&vf_mutex); - return -1; + if (flags & VFF_RETRY) { + clu_unlock(lock_name, lockp); + lockp = NULL; + usleep(20000); /* XXX */ + goto retry_top; + } + + /* No retry and no connection ignoring */ + rv = -1; + goto out_cleanup; } ++y; } + if (y == 0) { + /* No hosts online / all refused connection (including + ourself) - guess we're good */ + rv = 1; + goto out_cleanup; + } + pthread_mutex_lock(&key_list_mutex); key_node = kn_find_key(keyid); if (!key_node) { if ((vf_key_init_nt(keyid, 10, NULL, NULL) < 0)) { pthread_mutex_unlock(&key_list_mutex); - clu_unlock(lock_name, lockp); - pthread_mutex_unlock(&vf_mutex); - return -1; + /* key_list_mutex is only held here; so we do + not put it in the cleanup section */ + rv = -1; + goto out_cleanup; } key_node = kn_find_key(keyid); assert(key_node); @@ -1350,9 +1364,8 @@ retry_top: pthread_mutex_unlock(&key_list_mutex); if (!join_view) { - clu_unlock(lock_name, lockp); - pthread_mutex_unlock(&vf_mutex); - return -1; + rv = -1; + goto out_cleanup; } #ifdef DEBUG @@ -1386,11 +1399,8 @@ retry_top: */ if (ret_status == -1) { vf_send_abort(peer_fds); - close_all(peer_fds); - free(join_view); - clu_unlock(lock_name, lockp); - pthread_mutex_unlock(&vf_mutex); - return -1; + rv = -1; + goto out_cleanup; } #ifdef DEBUG @@ -1408,21 +1418,28 @@ retry_top: #endif } + +out_cleanup: /* * Clean up */ - close_all(peer_fds); + if (peer_fds) { + close_all(peer_fds); + free(peer_fds); + } /* * unanimous returns 1 for true; 0 for false, so negate it and * return our value... */ - free(join_view); - free(peer_fds); - clu_unlock(lock_name, lockp); + if (join_view) + free(join_view); + if (lockp) + clu_unlock(lock_name, lockp); + pthread_mutex_unlock(&vf_mutex); - if (rv) { + if (rv >= 0) { getuptime(&end); dif.tv_usec = end.tv_usec - start.tv_usec; @@ -1439,7 +1456,7 @@ retry_top: #endif } - return (rv?0:-1); + return ((rv>=0)?0:-1); } diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile index f4413b7..55b37d5 100644 --- a/rgmanager/src/daemons/Makefile +++ b/rgmanager/src/daemons/Makefile @@ -17,12 +17,13 @@ include ${top_srcdir}/make/defines.mk INCLUDE += -I $(top_srcdir)/include CFLAGS+= -g -I${incdir} -I/usr/include/libxml2 -L${libdir} +CFLAGS+= -I/usr/include/slang CFLAGS+= -g -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE CFLAGS+= -L ../clulib -LDFLAGS+= -lclulib -lxml2 -lmagmamsg -lmagma -lpthread -ldl +LDFLAGS+= -lclulib -lxml2 -lmagmamsg -lmagma -lpthread -ldl -lslang TARGETS=clurgmgrd clurmtabd rg_test all: ${TARGETS} @@ -40,8 +41,9 @@ uninstall: clurgmgrd: rg_thread.o rg_locks.o main.o groups.o rg_state.o \ rg_queue.o members.o rg_forward.o reslist.o \ - resrules.o restree.o fo_domain.o nodeevent.o \ - watchdog.o + resrules.o restree.o fo_domain.o \ + watchdog.o restart_counter.o event_config.o \ + slang_event.o rg_event.o service_op.o $(CC) -o $@ $^ $(INCLUDE) $(CFLAGS) $(LDFLAGS) -lccs # @@ -59,7 +61,8 @@ clurgmgrd: rg_thread.o rg_locks.o main.o groups.o rg_state.o \ # packages should run 'make check' as part of the build process. # rg_test: rg_locks-noccs.o test-noccs.o reslist-noccs.o \ - resrules-noccs.o restree-noccs.o fo_domain-noccs.o + resrules-noccs.o restree-noccs.o fo_domain-noccs.o \ + event_config-noccs.o restart_counter.o $(CC) -o $@ $^ $(INCLUDE) $(CFLAGS) -llalloc $(LDFLAGS) clurmtabd: clurmtabd.o clurmtabd_lib.o diff --git a/rgmanager/src/daemons/event_config.c b/rgmanager/src/daemons/event_config.c new file mode 100644 index 0000000..c679866 --- /dev/null +++ b/rgmanager/src/daemons/event_config.c @@ -0,0 +1,540 @@ +/** + Copyright Red Hat, Inc. 2002-2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/** @file + * CCS event parsing, based on failover domain parsing + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CONFIG_NODE_ID_TO_NAME \ + "/cluster/clusternodes/clusternode[@nodeid=\"%d\"]/@name" +#define CONFIG_NODE_NAME_TO_ID \ + "/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid" + +void deconstruct_events(event_table_t **); +void print_event(event_t *ev); + +//#define DEBUG + +#ifdef DEBUG +#define ENTER() clulog(LOG_DEBUG, "ENTER: %s\n", __FUNCTION__) +#define RETURN(val) {\ + clulog(LOG_DEBUG, "RETURN: %s line=%d value=%d\n", __FUNCTION__, \ + __LINE__, (val));\ + return(val);\ +} +#else +#define ENTER() +#define RETURN(val) return(val) +#endif + +#ifdef NO_CCS +#define ccs_get(fd, query, ret) conf_get(query, ret) +#endif + +/* + + + slang_script_stuff(); + start_service(); + + + */ +int +event_match(event_t *pattern, event_t *actual) +{ + if (pattern->ev_type != EVENT_NONE && + actual->ev_type != pattern->ev_type) + return 0; + + /* If there's no event class specified, the rest is + irrelevant */ + if (pattern->ev_type == EVENT_NONE) + return 1; + + switch(pattern->ev_type) { + case EVENT_NODE: + if (pattern->ev.node.ne_nodeid >= 0 && + actual->ev.node.ne_nodeid != + pattern->ev.node.ne_nodeid) { + return 0; + } + if (pattern->ev.node.ne_local >= 0 && + actual->ev.node.ne_local != + pattern->ev.node.ne_local) { + return 0; + } + if (pattern->ev.node.ne_state >= 0 && + actual->ev.node.ne_state != + pattern->ev.node.ne_state) { + return 0; + } + if (pattern->ev.node.ne_clean >= 0 && + actual->ev.node.ne_clean != + pattern->ev.node.ne_clean) { + return 0; + } + return 1; /* All specified params match */ + case EVENT_RG: + if (pattern->ev.group.rg_name[0] && + strcasecmp(actual->ev.group.rg_name, + pattern->ev.group.rg_name)) { + return 0; + } + if (pattern->ev.group.rg_state != (uint32_t)-1 && + actual->ev.group.rg_state != + pattern->ev.group.rg_state) { + return 0; + } + if (pattern->ev.group.rg_owner >= 0 && + actual->ev.group.rg_owner != + pattern->ev.group.rg_owner) { + return 0; + } + return 1; + case EVENT_CONFIG: + if (pattern->ev.config.cfg_version >= 0 && + actual->ev.config.cfg_version != + pattern->ev.config.cfg_version) { + return 0; + } + if (pattern->ev.config.cfg_oldversion >= 0 && + actual->ev.config.cfg_oldversion != + pattern->ev.config.cfg_oldversion) { + return 0; + } + return 1; + case EVENT_USER: + if (pattern->ev.user.u_name[0] && + strcasecmp(actual->ev.user.u_name, + pattern->ev.user.u_name)) { + return 0; + } + if (pattern->ev.user.u_request != 0 && + actual->ev.user.u_request != + pattern->ev.user.u_request) { + return 0; + } + if (pattern->ev.user.u_target != 0 && + actual->ev.user.u_target != + pattern->ev.user.u_target) { + return 0; + } + return 1; + default: + break; + } + + return 0; +} + + +char * +ccs_node_id_to_name(int ccsfd, int nodeid) +{ + char xpath[256], *ret = 0; + + snprintf(xpath, sizeof(xpath), CONFIG_NODE_ID_TO_NAME, + nodeid); + if (ccs_get(ccsfd, xpath, &ret) == 0) + return ret; + return NULL; +} + + +int +ccs_node_name_to_id(int ccsfd, char *name) +{ + char xpath[256], *ret = 0; + int rv = 0; + + snprintf(xpath, sizeof(xpath), CONFIG_NODE_NAME_TO_ID, + name); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + rv = atoi(ret); + free(ret); + return rv; + } + return 0; +} + + +static void +deconstruct_event(event_t *ev) +{ + if (ev->ev_script) + free(ev->ev_script); + if (ev->ev_name) + free(ev->ev_name); + free(ev); +} + + +static int +get_node_event(int ccsfd, char *base, event_t *ev) +{ + char xpath[256], *ret = NULL; + + /* Clear out the possibilitiies */ + ev->ev.node.ne_nodeid = -1; + ev->ev.node.ne_local = -1; + ev->ev.node.ne_state = -1; + ev->ev.node.ne_clean = -1; + + snprintf(xpath, sizeof(xpath), "%s/@node_id", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev.node.ne_nodeid = atoi(ret); + free(ret); + if (ev->ev.node.ne_nodeid <= 0) + return -1; + } else { + /* See if there's a node name */ + snprintf(xpath, sizeof(xpath), "%s/@node", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev.node.ne_nodeid = + ccs_node_name_to_id(ccsfd, ret); + free(ret); + if (ev->ev.node.ne_nodeid <= 0) + return -1; + } + } + + snprintf(xpath, sizeof(xpath), "%s/@node_state", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + if (!strcasecmp(ret, "up")) { + ev->ev.node.ne_state = 1; + } else if (!strcasecmp(ret, "down")) { + ev->ev.node.ne_state = 0; + } else { + ev->ev.node.ne_state = !!atoi(ret); + } + free(ret); + } + + snprintf(xpath, sizeof(xpath), "%s/@node_clean", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev.node.ne_clean = !!atoi(ret); + free(ret); + } + + snprintf(xpath, sizeof(xpath), "%s/@node_local", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev.node.ne_local = !!atoi(ret); + free(ret); + } + + return 0; +} + + +static int +get_rg_event(int ccsfd, char *base, event_t *ev) +{ + char xpath[256], *ret = NULL; + + /* Clear out the possibilitiies */ + ev->ev.group.rg_name[0] = 0; + ev->ev.group.rg_state = (uint32_t)-1; + ev->ev.group.rg_owner = -1; + + snprintf(xpath, sizeof(xpath), "%s/@service", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + strncpy(ev->ev.group.rg_name, ret, + sizeof(ev->ev.group.rg_name)); + free(ret); + if (!strlen(ev->ev.group.rg_name)) { + return -1; + } + } + + snprintf(xpath, sizeof(xpath), "%s/@service_state", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + if (!isdigit(ret[0])) { + ev->ev.group.rg_state = + rg_state_str_to_id(ret); + } else { + ev->ev.group.rg_state = atoi(ret); + } + free(ret); + } + + snprintf(xpath, sizeof(xpath), "%s/@service_owner", base); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + if (!isdigit(ret[0])) { + ev->ev.group.rg_owner = + ccs_node_name_to_id(ccsfd, ret); + } else { + ev->ev.group.rg_owner = !!atoi(ret); + } + free(ret); + } + + return 0; +} + + +static int +get_config_event(int __attribute__((unused)) ccsfd, + char __attribute__((unused)) *base, + event_t __attribute__((unused)) *ev) +{ + errno = ENOSYS; + return -1; +} + + +static event_t * +get_event(int ccsfd, char *base, int idx, int *_done) +{ + event_t *ev; + char xpath[256]; + char *ret = NULL; + + *_done = 0; + snprintf(xpath, sizeof(xpath), "%s/event[%d]/@name", + base, idx); + if (ccs_get(ccsfd, xpath, &ret) != 0) { + *_done = 1; + return NULL; + } + + ev = malloc(sizeof(*ev)); + if (!ev) + return NULL; + memset(ev, 0, sizeof(*ev)); + ev->ev_name = ret; + + /* Get the script file / inline from config */ + ret = NULL; + snprintf(xpath, sizeof(xpath), "%s/event[%d]/@file", + base, idx); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev_script_file = ret; + } else { + snprintf(xpath, sizeof(xpath), "%s/event[%d]", + base, idx); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev_script = ret; + } else { + goto out_fail; + } + } + + /* Get the priority ordering (must be nonzero) */ + ev->ev_prio = 99; + ret = NULL; + snprintf(xpath, sizeof(xpath), "%s/event[%d]/@priority", + base, idx); + if (ccs_get(ccsfd, xpath, &ret) == 0) { + ev->ev_prio = atoi(ret); + if (ev->ev_prio <= 0 || ev->ev_prio > EVENT_PRIO_COUNT) { + clulog(LOG_ERR, + "event %s: priority %s invalid\n", + ev->ev_name, ret); + goto out_fail; + } + free(ret); + } + + /* Get the event class */ + snprintf(xpath, sizeof(xpath), "%s/event[%d]/@class", + base, idx); + ret = NULL; + if (ccs_get(ccsfd, xpath, &ret) == 0) { + snprintf(xpath, sizeof(xpath), "%s/event[%d]", + base, idx); + if (!strcasecmp(ret, "node")) { + ev->ev_type = EVENT_NODE; + if (get_node_event(ccsfd, xpath, ev) < 0) + goto out_fail; + } else if (!strcasecmp(ret, "service") || + !strcasecmp(ret, "resource") || + !strcasecmp(ret, "rg") ) { + ev->ev_type = EVENT_RG; + if (get_rg_event(ccsfd, xpath, ev) < 0) + goto out_fail; + } else if (!strcasecmp(ret, "config") || + !strcasecmp(ret, "reconfig")) { + ev->ev_type = EVENT_CONFIG; + if (get_config_event(ccsfd, xpath, ev) < 0) + goto out_fail; + } else { + clulog(LOG_ERR, + "event %s: class %s unrecognized\n", + ev->ev_name, ret); + goto out_fail; + } + + free(ret); + ret = NULL; + } + + return ev; +out_fail: + if (ret) + free(ret); + deconstruct_event(ev); + return NULL; +} + + +static event_t * +get_default_event(void) +{ + event_t *ev; + char xpath[1024]; + + ev = malloc(sizeof(*ev)); + if (!ev) + return NULL; + memset(ev, 0, sizeof(*ev)); + ev->ev_name = strdup("Default"); + + /* Get the script file / inline from config */ + snprintf(xpath, sizeof(xpath), "%s/default_event_script.sl", + RESOURCE_ROOTDIR); + + ev->ev_prio = 100; + ev->ev_type = EVENT_NONE; + ev->ev_script_file = strdup(xpath); + if (!ev->ev_script_file || ! ev->ev_name) { + deconstruct_event(ev); + return NULL; + } + + return ev; +} + + +/** + * similar API to failover domain + */ +int +construct_events(int ccsfd, event_table_t **events) +{ + char xpath[256]; + event_t *ev; + int x = 1, done = 0; + + /* Allocate the event list table */ + *events = malloc(sizeof(event_table_t) + + sizeof(event_t) * (EVENT_PRIO_COUNT+1)); + if (!*events) + return -1; + memset(*events, 0, sizeof(event_table_t) + + sizeof(event_t) * (EVENT_PRIO_COUNT+1)); + (*events)->max_prio = EVENT_PRIO_COUNT; + + snprintf(xpath, sizeof(xpath), + RESOURCE_TREE_ROOT "/events"); + + do { + ev = get_event(ccsfd, xpath, x++, &done); + if (ev) + list_insert(&((*events)->entries[ev->ev_prio]), ev); + } while (!done); + + ev = get_default_event(); + if (ev) + list_insert(&((*events)->entries[ev->ev_prio]), ev); + + return 0; +} + + +void +print_event(event_t *ev) +{ + printf(" Name: %s\n", ev->ev_name); + + switch(ev->ev_type) { + case EVENT_NODE: + printf(" Node %d State %d\n", (int)ev->ev.node.ne_nodeid, + ev->ev.node.ne_state); + break; + case EVENT_RG: + printf(" RG %s State %s\n", ev->ev.group.rg_name, + rg_state_str(ev->ev.group.rg_state)); + break; + case EVENT_CONFIG: + printf(" Config change - unsupported\n"); + break; + default: + printf(" (Any event)\n"); + break; + } + + if (ev->ev_script) { + printf(" Inline script.\n"); + } else { + printf(" File: %s\n", ev->ev_script_file); + } +} + + +void +print_events(event_table_t *events) +{ + int x, y; + event_t *ev; + + for (x = 0; x <= events->max_prio; x++) { + if (!events->entries[x]) + continue; + printf("Event Priority Level %d:\n", x); + list_for(&(events->entries[x]), ev, y) { + print_event(ev); + } + } +} + + +void +deconstruct_events(event_table_t **eventsp) +{ + int x; + event_table_t *events = *eventsp; + event_t *ev = NULL; + + if (!events) + return; + + for (x = 0; x <= events->max_prio; x++) { + while ((ev = (events->entries[x]))) { + list_remove(&(events->entries[x]), ev); + deconstruct_event(ev); + } + } + + free(events); + *eventsp = NULL; +} + + diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c index 5dedbd5..9019a10 100644 --- a/rgmanager/src/daemons/fo_domain.c +++ b/rgmanager/src/daemons/fo_domain.c @@ -27,11 +27,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include //#define DEBUG @@ -61,7 +64,7 @@ */ -int group_property(char *, char *, char *, size_t); +int group_property_unlocked(char *, char *, char *, size_t); fod_node_t * get_node(int ccsfd, char *base, int idx, fod_t *domain) @@ -94,6 +97,23 @@ get_node(int ccsfd, char *base, int idx, fod_t *domain) fodn->fdn_name = ret; fodn->fdn_prio = 0; + snprintf(xpath, sizeof(xpath), + "/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid", + ret); + if (ccs_get(ccsfd, xpath, &ret) != 0) { + clulog(LOG_WARNING, "Node %s has no nodeid attribute\n", + fodn->fdn_name); + fodn->fdn_nodeid = -1; + } else { + /* 64-bit-ism on rhel4? */ + fodn->fdn_nodeid = atoi(ret); + } + + /* Don't even bother getting priority if we're not ordered (it's set + to 0 above */ + if (!(domain->fd_flags & FOD_ORDERED)) + return fodn; + snprintf(xpath, sizeof(xpath), "%s/failoverdomainnode[%d]/@priority", base, idx); if (ccs_get(ccsfd, xpath, &ret) != 0) @@ -226,6 +246,11 @@ print_domains(fod_t **domains) { fod_t *fod; fod_node_t *fodn = NULL; + /* + int x; + int *node_set = NULL; + int node_set_len = 0; + */ list_do(domains, fod) { printf("Failover domain: %s\n", fod->fd_name); @@ -243,9 +268,21 @@ print_domains(fod_t **domains) } list_do(&fod->fd_nodes, fodn) { - printf(" Node %s (priority %d)\n", - fodn->fdn_name, fodn->fdn_prio); + printf(" Node %s (id %d, priority %d)\n", + fodn->fdn_name, (int)fodn->fdn_nodeid, + fodn->fdn_prio); } while (!list_done(&fod->fd_nodes, fodn)); + + /* + node_domain_set(fod, &node_set, &node_set_len); + printf(" Failover Order = {"); + for (x = 0; x < node_set_len; x++) { + printf(" %d ", node_set[x]); + } + free(node_set); + printf("}\n"); + */ + } while (!list_done(domains, fod)); } @@ -265,7 +302,7 @@ int node_in_domain(char *nodename, fod_t *domain, cluster_member_list_t *membership) { - int member_online = 0, member_match = 0, preferred = 100, myprio = -1; + int online = 0, member_match = 0, preferred = 100, myprio = -1; fod_node_t *fodn; list_do(&domain->fd_nodes, fodn) { @@ -282,7 +319,7 @@ node_in_domain(char *nodename, fod_t *domain, * If we get here, we know: * A member of the domain is online somewhere */ - member_online = 1; + online = 1; if (!strcmp(nodename, fodn->fdn_name)) { /* * If we get here, we know: @@ -296,7 +333,7 @@ node_in_domain(char *nodename, fod_t *domain, preferred = fodn->fdn_prio; } while (!list_done(&domain->fd_nodes, fodn)); - if (!member_online) + if (!online) return 0; if (!member_match) @@ -311,6 +348,70 @@ node_in_domain(char *nodename, fod_t *domain, } +int +node_domain_set(fod_t *domain, uint64_t **ret, int *retlen) +{ + int x, i, j; + set_type_t *tmpset; + int ts_count; + + fod_node_t *fodn; + + /* Count domain length */ + list_for(&domain->fd_nodes, fodn, x) { } + + *retlen = 0; + *ret = malloc(sizeof(uint64_t) * x); + if (!(*ret)) + return -1; + tmpset = malloc(sizeof(uint64_t) * x); + if (!(*tmpset)) + return -1; + + if (domain->fd_flags & FOD_ORDERED) { + for (i = 1; i <= 100; i++) { + + ts_count = 0; + list_for(&domain->fd_nodes, fodn, x) { + if (fodn->fdn_prio == i) { + s_add(tmpset, &ts_count, + fodn->fdn_nodeid); + } + } + + if (!ts_count) + continue; + + /* Shuffle stuff at this prio level */ + if (ts_count > 1) + s_shuffle(tmpset, ts_count); + for (j = 0; j < ts_count; j++) + s_add(*ret, retlen, tmpset[j]); + } + } + + /* Add unprioritized nodes */ + ts_count = 0; + list_for(&domain->fd_nodes, fodn, x) { + if (!fodn->fdn_prio) { + s_add(tmpset, &ts_count, + fodn->fdn_nodeid); + } + } + + if (!ts_count) + return 0; + + /* Shuffle stuff at this prio level */ + if (ts_count > 1) + s_shuffle(tmpset, ts_count); + for (j = 0; j < ts_count; j++) + s_add(*ret, retlen, tmpset[j]); + + return 0; +} + + /** * See if a given nodeid should start a specified service svcid. * @@ -352,7 +453,7 @@ node_should_start(uint64_t nodeid, cluster_member_list_t *membership, nodename = memb_id_to_name(membership, nodeid); #ifndef NO_CCS /* XXX Testing only */ - if (group_property(rg_name, "domain", + if (group_property_unlocked(rg_name, "domain", domainname, sizeof(domainname))) { /* * If no domain is present, then the node in question should @@ -411,7 +512,7 @@ node_should_start(uint64_t nodeid, cluster_member_list_t *membership, RETURN(FOD_BEST); } - if (get_rg_state(rg_name, &svc_state) == FAIL) { + if (get_rg_state(rg_name, &svc_state) == RG_EFAIL) { /* * Couldn't get the service state, thats odd */ diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c index ebd37dc..5df7ed7 100644 --- a/rgmanager/src/daemons/groups.c +++ b/rgmanager/src/daemons/groups.c @@ -1,5 +1,5 @@ /* - Copyright Red Hat, Inc. 2002-2003 + Copyright Red Hat, Inc. 2002-2006 Copyright Mission Critical Linux, Inc. 2000 This program is free software; you can redistribute it and/or modify it @@ -19,21 +19,29 @@ */ //#define DEBUG #include -#include -#include #include +#include #include #include #include #include #include +#include #include #include #include +#include + +int get_rg_state_local(char *name, rg_state_t *svcblk); + +/* Use address field in this because we never use it internally, + and there is no extra space in the cman_node_t type. + */ #define cm_svccount cm_pad[0] /* Theses are uint8_t size */ #define cm_svcexcl cm_pad[1] +extern event_table_t *master_event_table; static int config_version = 0; static resource_t *_resources = NULL; @@ -41,9 +49,17 @@ static resource_rule_t *_rules = NULL; static resource_node_t *_tree = NULL; static fod_t *_domains = NULL; +#ifdef WRAP_LOCKS +pthread_mutex_t config_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +pthread_mutex_t status_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +#else pthread_mutex_t config_mutex = PTHREAD_MUTEX_INITIALIZER; -pthread_rwlock_t resource_lock = PTHREAD_RWLOCK_INITIALIZER; pthread_mutex_t status_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif +pthread_rwlock_t resource_lock = PTHREAD_RWLOCK_INITIALIZER; + +void res_build_name(char *, size_t, resource_t *); +int group_migratory(char *groupname, int lock); struct status_arg { @@ -72,10 +88,37 @@ node_should_start_safe(uint64_t nodeid, cluster_member_list_t *membership, int +node_domain_set_safe(char *domainname, uint64_t **ret, int *retlen, int *flags) +{ + fod_t *fod; + int rv = -1, found = 0, x = 0; + + pthread_rwlock_rdlock(&resource_lock); + + list_for(&_domains, fod, x) { + if (!strcasecmp(fod->fd_name, domainname)) { + found = 1; + break; + } + } // while (!list_done(&_domains, fod)); + + if (found) { + rv = node_domain_set(fod, ret, retlen); + *flags = fod->fd_flags; + } + + pthread_rwlock_unlock(&resource_lock); + + return rv; +} + + +int count_resource_groups(cluster_member_list_t *ml) { resource_t *res; - char *rgname, *val; + resource_node_t *node; + char rgname[64], *val; int x; rg_state_t st; void *lockp; @@ -88,11 +131,11 @@ count_resource_groups(cluster_member_list_t *ml) pthread_rwlock_rdlock(&resource_lock); - list_do(&_resources, res) { - if (res->r_rule->rr_root == 0) - continue; + list_do(&_tree, node) { + + res = node->rn_resource; - rgname = res->r_attrs[0].ra_value; + res_build_name(rgname, sizeof(rgname), res); if (rg_lock(rgname, &lockp) < 0) { clulog(LOG_ERR, "#XX: Unable to obtain cluster " @@ -103,7 +146,7 @@ count_resource_groups(cluster_member_list_t *ml) if (get_rg_state(rgname, &st) < 0) { clulog(LOG_ERR, "#34: Cannot get status " - "for service %s\n", rgname); + "for service %s\n", c_name(rgname)); rg_unlock(rgname, lockp); continue; } @@ -126,10 +169,9 @@ count_resource_groups(cluster_member_list_t *ml) ++mp->cm_svcexcl; } - } while (!list_done(&_resources, res)); + } while (!list_done(&_tree, node)); pthread_rwlock_unlock(&resource_lock); - return 0; } @@ -168,12 +210,35 @@ is_exclusive(char *svcName) } -int get_rg_state_local(char *, rg_state_t *); +resource_node_t * +node_by_ref(resource_node_t **tree, char *name) +{ + resource_t *res; + resource_node_t *node, *ret = NULL; + char rgname[64]; + int x; + + list_for(tree, node, x) { + + res = node->rn_resource; + res_build_name(rgname, sizeof(rgname), res); + + if (!strcasecmp(name, rgname)) { + ret = node; + break; + } + } + + return ret; +} + + int count_resource_groups_local(cluster_member_t *mp) { resource_t *res; - char *rgname, *val; + resource_node_t *node; + char rgname[64]; rg_state_t st; mp->cm_svccount = 0; @@ -181,20 +246,18 @@ count_resource_groups_local(cluster_member_t *mp) pthread_rwlock_rdlock(&resource_lock); - list_do(&_resources, res) { + list_do(&_tree, node) { - if (res->r_rule->rr_root == 0) - continue; + res = node->rn_resource; - rgname = res->r_attrs[0].ra_value; + res_build_name(rgname, sizeof(rgname), res); if (get_rg_state_local(rgname, &st) < 0) { continue; } if (st.rs_state != RG_STATE_STARTED && - st.rs_state != RG_STATE_STARTING && - st.rs_state != RG_STATE_STOPPING) + st.rs_state != RG_STATE_STARTING) continue; if (mp->cm_id != st.rs_owner) @@ -202,13 +265,12 @@ count_resource_groups_local(cluster_member_t *mp) ++mp->cm_svccount; - if (is_exclusive_res(res)) + if (is_exclusive_res(res)) ++mp->cm_svcexcl; - } while (!list_done(&_resources, res)); + } while (!list_done(&_tree, node)); pthread_rwlock_unlock(&resource_lock); - return 0; } @@ -225,6 +287,7 @@ have_exclusive_resources(void) pthread_rwlock_unlock(&resource_lock); return 1; } + } while (!list_done(&_resources, res)); pthread_rwlock_unlock(&resource_lock); @@ -237,9 +300,8 @@ int check_exclusive_resources(cluster_member_list_t *membership, char *svcName) { cluster_member_t *mp; - int exclusive, count; + int exclusive, count, excl; resource_t *res; - char *val; mp = memb_id_to_p(membership, my_id()); assert(mp); @@ -250,14 +312,13 @@ check_exclusive_resources(cluster_member_list_t *membership, char *svcName) res = find_root_by_ref(&_resources, svcName); if (!res) { pthread_rwlock_unlock(&resource_lock); - return FAIL; + return RG_ENOSERVICE; } - val = res_attr_value(res, "exclusive"); + + excl = is_exclusive_res(res); pthread_rwlock_unlock(&resource_lock); - if (exclusive || (count && val && - (!strcmp(val, "yes") || (atoi(val)>0)))) { - return 1; - } + if (exclusive || (count && excl)) + return RG_YES; return 0; } @@ -343,6 +404,42 @@ best_target_node(cluster_member_list_t *allowed, uint64_t owner, } +int +check_depend(resource_t *res) +{ + char *val; + rg_state_t rs; + + val = res_attr_value(res, "depend"); + if (!val) + /* No dependency */ + return -1; + + if (get_rg_state_local(val, &rs) == 0) + return (rs.rs_state == RG_STATE_STARTED); + + return 1; +} + + +int +check_depend_safe(char *rg_name) +{ + resource_t *res; + int ret; + + pthread_rwlock_rdlock(&resource_lock); + res = find_root_by_ref(&_resources, rg_name); + if (!res) + return -1; + + ret = check_depend(res); + pthread_rwlock_unlock(&resource_lock); + + return ret; +} + + /** Start or failback a resource group: if it's not running, start it. If it is running and we're a better member to run it, then ask for @@ -355,7 +452,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus, char *val; cluster_member_t *mp; int autostart, exclusive; - void *lockp; + void *lockp = NULL; mp = memb_id_to_p(membership, my_id()); assert(mp); @@ -382,7 +479,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus, /* clulog(LOG_DEBUG, "Skipping RG %s: Autostart disabled\n", - svcName); + logname); */ /* Mark non-autostart services as disabled to avoid @@ -397,7 +494,8 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus, if (get_rg_state(svcName, svcStatus) != 0) { clulog(LOG_ERR, "#34: Cannot get status " - "for service %s\n", svcName); + "for service %s\n", + c_name(svcName)); rg_unlock(svcName, lockp); return; } @@ -414,12 +512,20 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus, } } + /* See if service this one depends on is running. If not, + don't start it */ + if (check_depend(node->rn_resource) == 0) { + clulog(LOG_DEBUG, + "Skipping %s: Dependency missing\n", svcName); + return; + } + val = res_attr_value(node->rn_resource, "exclusive"); exclusive = val && ((!strcmp(val, "yes") || (atoi(val)>0))); if (exclusive && mp->cm_svccount) { clulog(LOG_DEBUG, - "Skipping RG %s: Exclusive and I am running services\n", + "Skipping %s: Exclusive and I am running services\n", svcName); return; } @@ -430,7 +536,7 @@ consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus, */ if (mp->cm_svcexcl) { clulog(LOG_DEBUG, - "Skipping RG %s: I am running an exclusive service\n", + "Skipping %s: I am running an exclusive service\n", svcName); return; } @@ -450,13 +556,14 @@ void consider_relocate(char *svcName, rg_state_t *svcStatus, uint64_t nodeid, cluster_member_list_t *membership) { - int a, b; + int a, b, req = RG_RELOCATE; /* Service must be running locally in order to consider for a relocate */ - if (svcStatus->rs_state != RG_STATE_STARTED || + if ((svcStatus->rs_state != RG_STATE_STARTING && + svcStatus->rs_state != RG_STATE_STARTED) || svcStatus->rs_owner != my_id()) return; @@ -476,14 +583,68 @@ consider_relocate(char *svcName, rg_state_t *svcStatus, uint64_t nodeid, if (a <= b) return; - clulog(LOG_DEBUG, "Relocating group %s to better node %s\n", + clulog(LOG_NOTICE, "Relocating %s to better node %s\n", svcName, memb_id_to_name(membership, nodeid)); - rt_enqueue_request(svcName, RG_RELOCATE, -1, 0, nodeid, 0, 0); + rt_enqueue_request(svcName, req, -1, 0, nodeid, 0, 0); +} + + +char ** +get_service_names(int *len) +{ + resource_node_t *node = NULL; + int nservices, ncopied = 0, x; + char **ret = NULL; + char rg_name[64]; + + pthread_rwlock_rdlock(&resource_lock); + + nservices = 0; + list_do(&_tree, node) { + ++nservices; + } while (!list_done(&_tree, node)); + + ret = malloc(sizeof(char *) * (nservices + 1)); + if (!ret) + goto out_fail; + + memset(ret, 0, sizeof(char *) * (nservices + 1)); + nservices = 0; + list_for(&_tree, node, nservices) { + res_build_name(rg_name, sizeof(rg_name), + node->rn_resource); + + if (!strlen(rg_name)) + continue; + + ret[ncopied] = strdup(rg_name); + if (ret[ncopied]) { + ncopied++; + } else { + goto out_fail; + } + } + + if (len) + *len = ncopied; + pthread_rwlock_unlock(&resource_lock); + return ret; + +out_fail: + pthread_rwlock_unlock(&resource_lock); + for (x = 0; x < ncopied; x++) + free(ret[x]); + if (ret) + free(ret); + return NULL; } + + + /** * Called to decide what services to start locally during a node_event. * Originally a part of node_event, it is now its own function to cut down @@ -495,7 +656,7 @@ int eval_groups(int local, uint64_t nodeid, int nodeStatus) { void *lockp = NULL; - char *svcName, *nodeName; + char svcName[96], *nodeName; resource_node_t *node; rg_state_t svcStatus; cluster_member_list_t *membership; @@ -516,10 +677,10 @@ eval_groups(int local, uint64_t nodeid, int nodeStatus) list_do(&_tree, node) { - if (node->rn_resource->r_rule->rr_root == 0) + if ((node->rn_resource->r_rule->rr_flags & RF_ROOT)== 0) continue; - svcName = node->rn_resource->r_attrs->ra_value; + res_build_name(svcName, sizeof(svcName), node->rn_resource); /* * Lock the service information and get the current service @@ -537,7 +698,7 @@ eval_groups(int local, uint64_t nodeid, int nodeStatus) if (get_rg_state(svcName, &svcStatus) != 0) { clulog(LOG_ERR, "#34: Cannot get status for service %s\n", - svcName); + c_name(svcName)); rg_unlock(svcName, lockp); continue; } @@ -557,7 +718,7 @@ eval_groups(int local, uint64_t nodeid, int nodeStatus) continue; } - clulog(LOG_DEBUG, "Evaluating RG %s, state %s, owner " + clulog(LOG_DEBUG, "Evaluating %s, state %s, owner " "%s\n", svcName, rg_state_str(svcStatus.rs_state), nodeName); @@ -600,6 +761,106 @@ eval_groups(int local, uint64_t nodeid, int nodeStatus) /** + * Called to decide what services to start locally after a service event. + * + * @see eval_groups + */ +int +group_event(char *rg_name, uint32_t state, int owner) +{ + char svcName[64], *nodeName; + resource_node_t *node; + rg_state_t svcStatus; + cluster_member_list_t *membership; + int depend; + + if (rg_locked()) { + clulog(LOG_DEBUG, + "Resource groups locked; not evaluating\n"); + return -EAGAIN; + } + + membership = member_list(); + if (!membership) + return -1; + + pthread_rwlock_rdlock(&resource_lock); + + /* Requires read lock */ + count_resource_groups(membership); + + list_do(&_tree, node) { + + res_build_name(svcName, sizeof(svcName), node->rn_resource); + + if (get_rg_state_local(svcName, &svcStatus) != 0) + continue; + + if (svcStatus.rs_owner == 0) + nodeName = "none"; + else + nodeName = memb_id_to_name(membership, + svcStatus.rs_owner); + + /* Disabled/failed/in recovery? Do nothing */ + if ((svcStatus.rs_state == RG_STATE_DISABLED) || + (svcStatus.rs_state == RG_STATE_FAILED) || + (svcStatus.rs_state == RG_STATE_RECOVER)) { + continue; + } + + depend = check_depend(node->rn_resource); + + /* Skip if we have no dependency */ + if (depend == -1) + continue; + + /* + If we have: + (a) a met dependency + (b) we're in the STOPPED state, and + (c) our new service event is a started service + + Then see if we should start this other service as well. + */ + if (depend == 1 && + svcStatus.rs_state == RG_STATE_STOPPED && + state == RG_STATE_STARTED) { + + clulog(LOG_DEBUG, "Evaluating %s, state %s, owner " + "%s\n", svcName, + rg_state_str(svcStatus.rs_state), + nodeName); + consider_start(node, svcName, &svcStatus, membership); + continue; + } + + /* + If we lost a dependency for this service and it's running + locally, stop it. + */ + if (depend == 0 && + svcStatus.rs_state == RG_STATE_STARTED && + svcStatus.rs_owner == my_id()) { + + clulog(LOG_WARNING, + "Stopping %s: Dependency missing\n", + svcName); + rt_enqueue_request(svcName, RG_STOP, -1, 0, my_id(), + 0, 0); + } + + } while (!list_done(&_tree, node)); + + pthread_rwlock_unlock(&resource_lock); + cml_free(membership); + + return 0; +} + + + +/** Perform an operation on a resource group. That is, walk down the tree for that resource group, performing the given operation on all children in the necessary order. @@ -675,31 +936,50 @@ group_op(char *groupname, int op) @return 0 on success, -1 on failure. */ int -group_property(char *groupname, char *property, char *ret, size_t len) +_group_property(char *groupname, char *property, char *ret, + size_t len, int lock) { resource_t *res = NULL; - int x = 0; + int x = 0, rv=-1; + + if (lock) + pthread_rwlock_rdlock(&resource_lock); - pthread_rwlock_rdlock(&resource_lock); res = find_root_by_ref(&_resources, groupname); - if (!res) { - pthread_rwlock_unlock(&resource_lock); - return -1; - } + if (!res) + goto out; for (; res->r_attrs[x].ra_name; x++) { if (strcasecmp(res->r_attrs[x].ra_name, property)) continue; strncpy(ret, res->r_attrs[x].ra_value, len); - pthread_rwlock_unlock(&resource_lock); - return 0; + rv = 0; + break; } - pthread_rwlock_unlock(&resource_lock); +out: + if (lock) + pthread_rwlock_unlock(&resource_lock); + return rv; +} - return -1; + +int +group_property(char *groupname, char *property, char *ret, + size_t len) +{ + return _group_property(groupname, property, ret, len, 1); } +int +group_property_unlocked(char *groupname, char *property, char *ret, + size_t len) +{ + return _group_property(groupname, property, ret, len, 0); +} + + + /** Send the state of a resource group to a given file descriptor. @@ -746,11 +1026,20 @@ status_check_thread(void *arg) { int fd = ((struct status_arg *)arg)->fd; int fast = ((struct status_arg *)arg)->fast; + char name[96]; resource_t *res; generic_msg_hdr hdr; free(arg); + if (central_events_enabled()) { + /* Never call get_rg_state() (distributed) if + central events are enabled, otherwise we + might overwrite the rg state with 'stopped' + when it should be 'disabled' (e.g. autostart="0") */ + fast = 1; + } + /* See if we have a slot... */ if (rg_inc_status() < 0) { /* Too many outstanding status checks. try again later. */ @@ -762,10 +1051,11 @@ status_check_thread(void *arg) pthread_rwlock_rdlock(&resource_lock); list_do(&_resources, res) { - if (res->r_rule->rr_root == 0) + if ((res->r_rule->rr_flags & RF_ROOT) == 0) continue; - send_rg_state(fd, res->r_attrs[0].ra_value, fast); + res_build_name(name, sizeof(name), res); + send_rg_state(fd, name, fast); } while (!list_done(&_resources, res)); pthread_rwlock_unlock(&resource_lock); @@ -819,19 +1109,25 @@ send_rg_states(int fd, int fast) int -svc_exists(char *svcname) +svc_exists(char *name) { resource_t *res; int ret = 0; + char rgname[64]; pthread_rwlock_rdlock(&resource_lock); list_do(&_resources, res) { - if (res->r_rule->rr_root == 0) + if ((res->r_rule->rr_flags & RF_ROOT) == 0) continue; - if (strcmp(res->r_attrs[0].ra_value, - svcname) == 0) { + res_build_name(rgname, sizeof(rgname), res); + + if (!strcmp(name, rgname)) { + ret = 1; + break; + } + if (!strcmp(name, c_name(rgname))) { ret = 1; break; } @@ -847,20 +1143,20 @@ void rg_doall(int request, int block, char *debugfmt) { resource_node_t *curr; - char *name; + char name[96]; rg_state_t svcblk; pthread_rwlock_rdlock(&resource_lock); list_do(&_tree, curr) { - if (curr->rn_resource->r_rule->rr_root == 0) + if ((curr->rn_resource->r_rule->rr_flags & RF_ROOT) == 0) continue; /* Group name */ - name = curr->rn_resource->r_attrs->ra_value; + res_build_name(name, sizeof(name), curr->rn_resource); if (debugfmt) - clulog(LOG_DEBUG, debugfmt, name); + clulog(LOG_DEBUG, debugfmt, c_name(name)); /* Optimization: Don't bother even queueing the request during the exit case if we don't own it */ @@ -895,7 +1191,7 @@ void * q_status_checks(void *arg) { resource_node_t *curr; - char *name; + char name[96]; rg_state_t svcblk; /* Only one status thread at a time, please! */ @@ -905,11 +1201,11 @@ q_status_checks(void *arg) pthread_rwlock_rdlock(&resource_lock); list_do(&_tree, curr) { - if (curr->rn_resource->r_rule->rr_root == 0) + if ((curr->rn_resource->r_rule->rr_flags & RF_ROOT) == 0) continue; /* Group name */ - name = curr->rn_resource->r_attrs->ra_value; + res_build_name(name, sizeof(name), curr->rn_resource); /* Local check - no one will make us take a service */ if (get_rg_state_local(name, &svcblk) < 0) { @@ -955,7 +1251,7 @@ void do_condstops(void) { resource_node_t *curr; - char *name; + char name[96]; rg_state_t svcblk; int need_kill; @@ -964,11 +1260,11 @@ do_condstops(void) pthread_rwlock_rdlock(&resource_lock); list_do(&_tree, curr) { - if (curr->rn_resource->r_rule->rr_root == 0) + if ((curr->rn_resource->r_rule->rr_flags & RF_ROOT) == 0) continue; /* Group name */ - name = curr->rn_resource->r_attrs->ra_value; + res_build_name(name, sizeof(name), curr->rn_resource); /* If we're not running it, no need to CONDSTOP */ if (get_rg_state_local(name, &svcblk) < 0) { @@ -1002,7 +1298,7 @@ void do_condstarts(void) { resource_node_t *curr; - char *name, *val; + char name[96], *val; rg_state_t svcblk; int need_init, new_groups = 0, autostart; void *lockp; @@ -1013,11 +1309,11 @@ do_condstarts(void) pthread_rwlock_rdlock(&resource_lock); list_do(&_tree, curr) { - if (curr->rn_resource->r_rule->rr_root == 0) + if ((curr->rn_resource->r_rule->rr_flags & RF_ROOT) == 0) continue; /* Group name */ - name = curr->rn_resource->r_attrs->ra_value; + res_build_name(name, sizeof(name), curr->rn_resource); /* New RG. We'll need to initialize it. */ need_init = 0; @@ -1063,11 +1359,11 @@ do_condstarts(void) pthread_rwlock_rdlock(&resource_lock); list_do(&_tree, curr) { - if (curr->rn_resource->r_rule->rr_root == 0) + if ((curr->rn_resource->r_rule->rr_flags & RF_ROOT) == 0) continue; /* Group name */ - name = curr->rn_resource->r_attrs->ra_value; + res_build_name(name, sizeof(name), curr->rn_resource); /* New RG. We'll need to initialize it. */ if (!(curr->rn_resource->r_flags & RF_NEEDSTART)) @@ -1140,6 +1436,13 @@ check_config_update(void) } +void +dump_config_version(FILE *fp) +{ + fprintf(fp, "Cluster configuration version %d\n\n", config_version); +} + + /** Initialize resource groups. This reads all the resource groups from CCS, builds the tree, etc. Ideally, we'll have a similar function @@ -1149,12 +1452,14 @@ check_config_update(void) int init_resource_groups(int reconfigure) { - int fd, x; + int fd, x, y, cnt; + event_table_t *evt = NULL; resource_t *reslist = NULL, *res; resource_rule_t *rulelist = NULL, *rule; resource_node_t *tree = NULL; fod_t *domains = NULL, *fod; + event_t *evp; char *val; if (reconfigure) @@ -1178,10 +1483,11 @@ init_resource_groups(int reconfigure) pthread_mutex_lock(&config_mutex); config_version = atoi(val); pthread_mutex_unlock(&config_mutex); + free(val); } - + if (ccs_get(fd, "/cluster/rm/@statusmax", &val) == 0) { - if (strlen(val)) + if (strlen(val)) rg_set_statusmax(atoi(val)); free(val); } @@ -1214,6 +1520,24 @@ init_resource_groups(int reconfigure) x = 0; list_do(&domains, fod) { ++x; } while (!list_done(&domains, fod)); clulog(LOG_DEBUG, "%d domains defined\n", x); + construct_events(fd, &evt); + cnt = 0; + if (evt) { + for (x=0; x <= evt->max_prio; x++) { + if (!evt->entries[x]) + continue; + + y = 0; + + list_do(&evt->entries[x], evp) { + ++y; + } while (!list_done(&evt->entries[x], evp)); + + cnt += y; + } + } + clulog(LOG_DEBUG, "%d events defined\n", cnt); + /* Reconfiguration done */ ccs_unlock(fd); @@ -1242,6 +1566,9 @@ init_resource_groups(int reconfigure) if (_domains) deconstruct_domains(&_domains); _domains = domains; + if (master_event_table) + deconstruct_events(&master_event_table); + master_event_table = evt; pthread_rwlock_unlock(&resource_lock); if (reconfigure) { @@ -1282,6 +1609,94 @@ get_recovery_policy(char *rg_name, char *buf, size_t buflen) } +int +get_service_property(char *rg_name, char *prop, char *buf, size_t buflen) +{ + int ret = 0; + resource_t *res; + char *val; + + memset(buf, 0, buflen); + +#if 0 + if (!strcmp(prop, "domain")) { + /* not needed */ + strncpy(buf, "", buflen); + } else if (!strcmp(prop, "autostart")) { + strncpy(buf, "1", buflen); + } else if (!strcmp(prop, "hardrecovery")) { + strncpy(buf, "0", buflen); + } else if (!strcmp(prop, "exclusive")) { + strncpy(buf, "0", buflen); + } else if (!strcmp(prop, "nfslock")) { + strncpy(buf, "0", buflen); + } else if (!strcmp(prop, "recovery")) { + strncpy(buf, "restart", buflen); + } else if (!strcmp(prop, "depend")) { + /* not needed */ + strncpy(buf, "", buflen); + } else { + /* not found / no defaults */ + ret = -1; + } +#endif + + pthread_rwlock_rdlock(&resource_lock); + res = find_root_by_ref(&_resources, rg_name); + if (res) { + val = res_attr_value(res, prop); + if (val) { + ret = 0; + strncpy(buf, val, buflen); + } + } + pthread_rwlock_unlock(&resource_lock); + +#if 0 + if (ret == 0) + printf("%s(%s, %s) = %s\n", __FUNCTION__, rg_name, prop, buf); + else + printf("%s(%s, %s) = NOT FOUND\n", __FUNCTION__, rg_name, prop); +#endif + + return ret; +} + + +int +add_restart(char *rg_name) +{ + resource_node_t *node; + int ret = 1; + + pthread_rwlock_rdlock(&resource_lock); + node = node_by_ref(&_tree, rg_name); + if (node) { + ret = restart_add(node->rn_restart_counter); + } + pthread_rwlock_unlock(&resource_lock); + + return ret; +} + + +int +check_restart(char *rg_name) +{ + resource_node_t *node; + int ret = 0; + + pthread_rwlock_rdlock(&resource_lock); + node = node_by_ref(&_tree, rg_name); + if (node) { + ret = restart_threshold_exceeded(node->rn_restart_counter); + } + pthread_rwlock_unlock(&resource_lock); + + return ret; +} + + void kill_resource_groups(void) { diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c index 1f0db93..527c5d7 100644 --- a/rgmanager/src/daemons/main.c +++ b/rgmanager/src/daemons/main.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #define L_SYS (1<<1) @@ -39,7 +40,6 @@ int configure_logging(int ccsfd); -void node_event_q(int, uint64_t, int); int daemon_init(char *); int init_resource_groups(int); void kill_resource_groups(void); @@ -52,8 +52,11 @@ int send_rg_states(int, int); int check_config_update(void); int svc_exists(char *); int watchdog_init(void); +int32_t master_event_callback(char *key, uint64_t viewno, void *data, uint32_t datalen); -int shutdown_pending = 0, running = 1, need_reconfigure = 0; + +int running = 1, need_reconfigure = 0; +int shutdown_pending = 0; char debug = 0; /* XXX* */ static int signalled = 0; @@ -127,60 +130,6 @@ flag_reconfigure(int sig) /** - Called to handle the transition of a cluster member from up->down or - down->up. This handles initializing services (in the local node-up case), - exiting due to loss of quorum (local node-down), and service fail-over - (remote node down). - - @param nodeID ID of the member which has come up/gone down. - @param nodeStatus New state of the member in question. - @see eval_groups - */ -void -node_event(int local, uint64_t nodeID, int nodeStatus) -{ - if (!running) - return; - - if (local) { - - /* Local Node Event */ - if (nodeStatus == STATE_DOWN) - hard_exit(); - - if (!rg_initialized()) { - if (init_resource_groups(0) != 0) { - clulog(LOG_ERR, - "#36: Cannot initialize services\n"); - hard_exit(); - } - } - - if (shutdown_pending) { - clulog(LOG_NOTICE, "Processing delayed exit signal\n"); - graceful_exit(SIGINT); - } - setup_signal(SIGINT, graceful_exit); - setup_signal(SIGTERM, graceful_exit); - setup_signal(SIGHUP, flag_reconfigure); - - eval_groups(1, nodeID, STATE_UP); - return; - } - - /* - * Nothing to do for events from other nodes if we are not ready. - */ - if (!rg_initialized()) { - clulog(LOG_DEBUG, "Services not initialized.\n"); - return; - } - - eval_groups(0, nodeID, nodeStatus); -} - - -/** This updates our local membership view and handles whether or not we should exit, as well as determines node transitions (thus, calling node_event()). @@ -216,7 +165,7 @@ membership_update(void) /* Should not happen */ clulog(LOG_INFO, "State change: LOCAL OFFLINE\n"); cml_free(node_delta); - node_event(1, my_id(), STATE_DOWN); + node_event_q(1, my_id(), STATE_DOWN, 1); /* NOTREACHED */ } @@ -228,7 +177,7 @@ membership_update(void) locked. This is just a performance thing */ if (!rg_locked()) { node_event_q(0, node_delta->cml_members[x].cm_id, - STATE_DOWN); + STATE_DOWN, 1); } else { clulog(LOG_NOTICE, "Not taking action - services" " locked\n"); @@ -246,7 +195,7 @@ membership_update(void) me = memb_online(node_delta, my_id()); if (me) { clulog(LOG_INFO, "State change: Local UP\n"); - node_event_q(1, my_id(), STATE_UP); + node_event_q(1, my_id(), STATE_UP, 1); } for (x=0; node_delta && x < node_delta->cml_count; x++) { @@ -261,7 +210,7 @@ membership_update(void) clulog(LOG_INFO, "State change: %s UP\n", node_delta->cml_members[x].cm_name); node_event_q(0, node_delta->cml_members[x].cm_id, - STATE_UP); + STATE_UP, 1); } cml_free(node_delta); @@ -340,8 +289,10 @@ int dispatch_msg(int fd, uint64_t nodeid) { int ret; + uint64_t nid; generic_msg_hdr msg_hdr; SmMessageSt msg_sm; + rg_state_msg_t msg_rsm; fd_set rfds; struct timeval tv = { 0, 500000 }; @@ -429,6 +380,30 @@ dispatch_msg(int fd, uint64_t nodeid) break; } + if (central_events_enabled() && + msg_sm.sm_hdr.gh_arg1 != RG_ACTION_MASTER) { + + /* Centralized processing or request is from + clusvcadm */ + nid = event_master(); + if (nid != my_id()) { + /* Forward the message to the event master */ + forward_message(fd, &msg_sm, nid); + } else { + /* for us: queue it */ + /* return below is intentional; the + event engine will close the fd for us */ + user_event_q(msg_sm.sm_data.d_svcName, + msg_sm.sm_data.d_action, + msg_sm.sm_hdr.gh_arg1, + msg_sm.sm_hdr.gh_arg2, + msg_sm.sm_data.d_svcOwner, + fd); + } + + return 0; + } + /* Queue request */ rt_enqueue_request(msg_sm.sm_data.d_svcName, msg_sm.sm_data.d_action, @@ -437,6 +412,28 @@ dispatch_msg(int fd, uint64_t nodeid) msg_sm.sm_hdr.gh_arg2); break; + case RG_EVENT: + ret = msg_receive_timeout(fd, &msg_rsm, sizeof(msg_rsm), 1); + + /* Service event. Run a dependency check */ + if (ret < (int)sizeof(rg_state_msg_t)) { + clulog(LOG_ERR, + "#39: Error receiving entire request (%d/%d)\n", + ret, (int)sizeof(rg_state_msg_t)); + ret = -1; + break; + } + + /* Decode SmMessageSt message */ + swab_rg_state_msg_t(&msg_rsm); + + /* Send to our rg event handler */ + rg_event_q(msg_rsm.rsm_state.rs_name, + msg_rsm.rsm_state.rs_state, + msg_rsm.rsm_state.rs_owner, + msg_rsm.rsm_state.rs_last_owner); + break; + case RG_EXITING: clulog(LOG_NOTICE, "Member %d is now offline\n", (int)nodeid); @@ -446,7 +443,8 @@ dispatch_msg(int fd, uint64_t nodeid) swab_generic_msg_hdr(&msg_hdr); msg_close(fd); - node_event(0, nodeid, STATE_DOWN); + member_set_state(nodeid, STATE_DOWN); + node_event_q(0, nodeid, STATE_DOWN, 1); break; default: @@ -586,7 +584,7 @@ event_loop(int clusterfd) return 0; /* No new messages. Drop in the status check requests. */ - if (n == 0) { + if (n == 0 && rg_quorate()) { do_status_checks(); return 0; } @@ -603,13 +601,6 @@ flag_shutdown(int sig) void -graceful_exit(int sig) -{ - running = 0; -} - - -void hard_exit(void) { rg_lockall(L_SYS); @@ -670,6 +661,14 @@ configure_logging(int ccsfd) free(v); } + if (ccs_get(ccsfd, "/cluster/rm/@central_processing", &v) == 0) { + set_central_events(atoi(v)); + if (atoi(v)) + clulog(LOG_NOTICE, + "Centralized Event Processing enabled\n"); + free(v); + } + if (internal) ccs_disconnect(ccsfd); @@ -719,6 +718,17 @@ set_nonblock(int fd) } +void * +shutdown_thread(void __attribute__ ((unused)) *arg) +{ + rg_lockall(L_SYS); + rg_doall(RG_STOP_EXITING, 1, NULL); + running = 0; + + pthread_exit(NULL); +} + + void wait_for_status(int pid, int fd, int timeout) { @@ -761,6 +771,7 @@ main(int argc, char **argv) int listen_fds[2], listeners, waittime = 0, waitpipe[2]; int waiter; uint64_t myNodeID; + pthread_t th; while ((rv = getopt(argc, argv, "fdt:")) != EOF) { switch (rv) { @@ -861,10 +872,8 @@ main(int argc, char **argv) if (quorate) { rg_set_quorate(); - } else { - setup_signal(SIGINT, graceful_exit); - setup_signal(SIGTERM, graceful_exit); } + clulog(LOG_DEBUG, "Cluster Status: %s\n", quorate?"Quorate":"Inquorate"); @@ -882,6 +891,7 @@ main(int argc, char **argv) } vf_key_init("rg_lockdown", 10, NULL, lock_commit_cb); + vf_key_init("Transition-Master", 10, NULL, master_event_callback); if (clu_login(cluster_fd, RG_SERVICE_GROUP) == -1) { if (errno != ENOSYS) { @@ -909,9 +919,20 @@ main(int argc, char **argv) */ notify_status(0); - while (running) + while (running) { event_loop(cluster_fd); + if (shutdown_pending) { + /* Kill local socket; local requests need to + be ignored here */ + for (rv = 0; rv < listeners; rv++) + msg_close(listen_fds[rv]); + ++shutdown_pending; + clulog(LOG_NOTICE, "Shutting down\n"); + pthread_create(&th, NULL, shutdown_thread, NULL); + } + } + clulog(LOG_NOTICE, "Shutting down\n"); cleanup(cluster_fd); clulog(LOG_NOTICE, "Shutdown complete, exiting\n"); diff --git a/rgmanager/src/daemons/members.c b/rgmanager/src/daemons/members.c index 839e2c7..910d174 100644 --- a/rgmanager/src/daemons/members.c +++ b/rgmanager/src/daemons/members.c @@ -41,6 +41,47 @@ member_list_update(cluster_member_list_t *new_ml) } +void +member_set_state(uint64_t nid, int state) +{ + int x; + + pthread_rwlock_wrlock(&memblock); + if (membership) { + for (x = 0; x < membership->cml_count; x++) { + if (membership->cml_members[x].cm_id == nid) { + membership->cml_members[x].cm_state = state; + goto out; + } + } + } + +out: + pthread_rwlock_unlock(&memblock); +} + + +int +member_online(uint64_t nid) +{ + int x, ret = 0; + + pthread_rwlock_wrlock(&memblock); + if (membership) { + for (x = 0; x < membership->cml_count; x++) { + if (membership->cml_members[x].cm_id == nid) { + ret = membership->cml_members[x].cm_state; + goto out; + } + } + } + +out: + pthread_rwlock_unlock(&memblock); + return ret; +} + + cluster_member_list_t * member_list(void) { diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c index dbf685a..11c5122 100644 --- a/rgmanager/src/daemons/reslist.c +++ b/rgmanager/src/daemons/reslist.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include #include #include #ifndef NO_CCS @@ -37,6 +37,13 @@ char *attr_value(resource_node_t *node, char *attrname); char *rg_attr_value(resource_node_t *node, char *attrname); +void +res_build_name(char *buf, size_t buflen, resource_t *res) +{ + snprintf(buf, buflen, "%s:%s", res->r_rule->rr_type, + res->r_attrs[0].ra_value); +} + /** Find and determine an attribute's value. @@ -170,18 +177,29 @@ primary_attr_value(resource_t *res) /** Compare two resources. + @param left Left resource + @param right Right resource + @return -1 on different resource, 0 if the same, 1 if different, + 2 if different, but only safe resources are different + */ int rescmp(resource_t *left, resource_t *right) { - int x, y = 0, found; + int x, y = 0, found = 0, ret = 0; + /* Completely different resource class... */ if (strcmp(left->r_rule->rr_type, right->r_rule->rr_type)) { - //printf("Er, wildly different resource type! "); return -1; } + /* + printf("Comparing %s:%s to %s:%s\n", + left->r_rule->rr_type, left->r_attrs[0].ra_value, + right->r_rule->rr_type, right->r_attrs[0].ra_value) + */ + for (x = 0; left->r_attrs && left->r_attrs[x].ra_name; x++) { found = 0; @@ -197,35 +215,52 @@ rescmp(resource_t *left, resource_t *right) left->r_attrs[x].ra_flags) { /* Flags are different. Change in resource agents? */ - //printf("flags differ "); + /* + printf("* flags differ %08x vs %08x\n", + left->r_attrs[x].ra_flags, + right->r_attrs[y].ra_flags); + */ return 1; } if (strcmp(right->r_attrs[y].ra_value, left->r_attrs[x].ra_value)) { /* Different attribute value. */ - //printf("different value for attr '%s' ", - //right->r_attrs[y].ra_name); - return 1; + /* + printf("* different value for attr '%s':" + " '%s' vs '%s'", + right->r_attrs[y].ra_name, + left->r_attrs[x].ra_value, + right->r_attrs[y].ra_value); + */ + if (left->r_attrs[x].ra_flags & RA_RECONFIG) { + /* printf(" [SAFE]\n"); */ + ret = 2; + } else { + /* printf("\n"); */ + return 1; + } } } /* Attribute missing -> different attribute value. */ if (!found) { - //printf("Attribute %s deleted ", - //left->r_attrs[x].ra_name); + /* + printf("* Attribute '%s' deleted\n", + left->r_attrs[x].ra_name); + */ return 1; } } /* Different attribute count */ if (x != y) { - //printf("Attribute count differ (attributes added!) "); + /* printf("* Attribute count differ (attributes added!) "); */ return 1; } /* All the same */ - return 0; + return ret; } @@ -280,11 +315,24 @@ resource_t * find_root_by_ref(resource_t **reslist, char *ref) { resource_t *curr; + char ref_buf[128]; + char *type; + char *name = ref; int x; + snprintf(ref_buf, sizeof(ref_buf), "%s", ref); + + type = ref_buf; + if ((name = strchr(ref_buf, ':'))) { + *name = 0; + name++; + } else { + /* Default type */ + type = "service"; + name = ref; + } + list_do(reslist, curr) { - if (curr->r_rule->rr_root == 0) - continue; /* This should be one operation - the primary attr @@ -292,15 +340,18 @@ find_root_by_ref(resource_t **reslist, char *ref) */ for (x = 0; curr->r_attrs && curr->r_attrs[x].ra_name; x++) { + if (strcmp(type, curr->r_rule->rr_type)) + continue; if (!(curr->r_attrs[x].ra_flags & RA_PRIMARY)) continue; - if (strcmp(ref, curr->r_attrs[x].ra_value)) + if (strcmp(name, curr->r_attrs[x].ra_value)) continue; return curr; } } while (!list_done(reslist, curr)); + return NULL; } @@ -421,14 +472,14 @@ xpath_get_one(xmlDocPtr doc, xmlXPathContextPtr ctx, char *query) if (((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*")) || ((node->type == XML_ELEMENT_NODE) && strstr(query, "child::*"))){ if (node->children && node->children->content) - size = strlen(node->children->content)+ - strlen(node->name)+2; + size = strlen((char *)node->children->content)+ + strlen((char *)node->name)+2; else - size = strlen(node->name)+2; + size = strlen((char *)node->name)+2; nnv = 1; } else { if (node->children && node->children->content) { - size = strlen(node->children->content)+1; + size = strlen((char *)node->children->content)+1; } else { goto out; } @@ -514,7 +565,7 @@ print_resource(resource_t *res) int x; printf("Resource type: %s", res->r_rule->rr_type); - if (res->r_rule->rr_root) + if (res->r_rule->rr_flags & RF_ROOT) printf(" [ROOT]"); if (res->r_flags & RF_INLINE) printf(" [INLINE]"); @@ -524,6 +575,8 @@ print_resource(resource_t *res) printf(" [NEEDSTOP]"); if (res->r_flags & RF_COMMON) printf(" [COMMON]"); + if (res->r_flags & RF_RECONFIG) + printf(" [RECONFIG]"); printf("\n"); if (res->r_rule->rr_maxrefs) @@ -559,6 +612,8 @@ print_resource(resource_t *res) printf(" unique"); if (res->r_attrs[x].ra_flags & RA_REQUIRED) printf(" required"); + if (res->r_attrs[x].ra_flags & RA_RECONFIG) + printf(" reconfig"); if (res->r_attrs[x].ra_flags & RA_INHERIT) printf(" inherit(\"%s\")", res->r_attrs[x].ra_value); printf(" ]\n"); @@ -817,6 +872,7 @@ load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist) "Error storing %s resource\n", newres->r_rule->rr_type); #endif + destroy_resource(newres); } diff --git a/rgmanager/src/daemons/resrules.c b/rgmanager/src/daemons/resrules.c index 282eb5a..6102a6b 100644 --- a/rgmanager/src/daemons/resrules.c +++ b/rgmanager/src/daemons/resrules.c @@ -19,14 +19,16 @@ #include #include #include -#include #include #include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -60,7 +62,8 @@ store_rule(resource_rule_t **rulelist, resource_rule_t *newrule) #endif return -1; } - if (newrule->rr_root && curr->rr_root) { + if ((newrule->rr_flags & RF_ROOT) && + (curr->rr_flags & RF_ROOT)) { #ifdef NO_CCS fprintf(stderr, "Error storing %s: root " "resource type %s exists already\n", @@ -175,32 +178,37 @@ _get_maxparents(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, /** - Get and store the version + Get and store a bit field. - @param doc Pre-parsed XML document pointer. - @param ctx Pre-allocated XML XPath context pointer. - @param base XPath prefix to search - @param rr Resource rule to store new information in. + @param doc Pre-parsed XML document pointer. + @param ctx Pre-allocated XML XPath context pointer. + @param base XPath prefix to search + @param rr Resource rule to store new information in. */ void -_get_version(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, - resource_rule_t *rr) +_get_rule_flag(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, + resource_rule_t *rr, char *flag, int bit) { char xpath[256]; char *ret = NULL; - snprintf(xpath, sizeof(xpath), "%s/@version", base); + snprintf(xpath, sizeof(xpath), + "%s/attributes/@%s", + base, flag); ret = xpath_get_one(doc, ctx, xpath); if (ret) { - rr->rr_version = ret; + if (atoi(ret)) { + rr->rr_flags |= bit; + } else { + rr->rr_flags &= ~bit; + } free(ret); } - rr->rr_version = NULL; } /** - Get and store the root attribute. + Get and store the version @param doc Pre-parsed XML document pointer. @param ctx Pre-allocated XML XPath context pointer. @@ -208,18 +216,19 @@ _get_version(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, @param rr Resource rule to store new information in. */ void -_get_root(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, - resource_rule_t *rr) +_get_version(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, + resource_rule_t *rr) { char xpath[256]; char *ret = NULL; - snprintf(xpath, sizeof(xpath), "%s/attributes/@root", base); + snprintf(xpath, sizeof(xpath), "%s/@version", base); ret = xpath_get_one(doc, ctx, xpath); if (ret) { - rr->rr_root = 1; + rr->rr_version = ret; free(ret); } + rr->rr_version = NULL; } @@ -588,7 +597,7 @@ print_resource_rule(resource_rule_t *rr) int x; printf("Resource Rules for \"%s\"", rr->rr_type); - if (rr->rr_root) + if (rr->rr_flags & RF_ROOT) printf(" [ROOT]"); printf("\n"); @@ -599,6 +608,17 @@ print_resource_rule(resource_rule_t *rr) printf("Max instances: %d\n", rr->rr_maxrefs); if (rr->rr_agent) printf("Agent: %s\n", basename(rr->rr_agent)); + + printf("Flags: "); + if (rr->rr_flags) { + if (rr->rr_flags & RF_INIT) + printf("init_on_add "); + if (rr->rr_flags & RF_DESTROY) + printf("destroy_on_delete "); + } else { + printf("(none)"); + } + printf("\n"); printf("Attributes:\n"); if (!rr->rr_attrs) { @@ -614,18 +634,25 @@ print_resource_rule(resource_rule_t *rr) continue; } - printf(" ["); - if (rr->rr_attrs[x].ra_flags & RA_PRIMARY) - printf(" primary"); - if (rr->rr_attrs[x].ra_flags & RA_UNIQUE) - printf(" unique"); - if (rr->rr_attrs[x].ra_flags & RA_REQUIRED) - printf(" required"); - if (rr->rr_attrs[x].ra_flags & RA_INHERIT) - printf(" inherit"); - else if (rr->rr_attrs[x].ra_value) - printf(" default=\"%s\"", rr->rr_attrs[x].ra_value); - printf(" ]\n"); + if (rr->rr_attrs[x].ra_flags) { + printf(" ["); + if (rr->rr_attrs[x].ra_flags & RA_PRIMARY) + printf(" primary"); + if (rr->rr_attrs[x].ra_flags & RA_UNIQUE) + printf(" unique"); + if (rr->rr_attrs[x].ra_flags & RA_REQUIRED) + printf(" required"); + if (rr->rr_attrs[x].ra_flags & RA_INHERIT) + printf(" inherit"); + if (rr->rr_attrs[x].ra_flags & RA_RECONFIG) + printf(" reconfig"); + printf(" ]"); + } + + if (rr->rr_attrs[x].ra_value) + printf(" default=\"%s\"\n", rr->rr_attrs[x].ra_value); + else + printf("\n"); } actions: @@ -761,6 +788,18 @@ _get_rule_attrs(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base, } /* + See if this can be reconfigured on the fly without a + stop/start + */ + snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@reconfig", + base, x); + if ((ret = xpath_get_one(doc,ctx,xpath))) { + if ((atoi(ret) != 0) || (ret[0] == 'y')) + flags |= RA_RECONFIG; + free(ret); + } + + /* See if this is supposed to be inherited */ snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@inherit", @@ -891,6 +930,10 @@ read_pipe(int fd, char **file, size_t *length) n = read(fd, buf, sizeof(buf)); if (n < 0) { + + if (errno == EINTR) + continue; + if (*file) free(*file); return -1; @@ -899,7 +942,7 @@ read_pipe(int fd, char **file, size_t *length) if (n == 0 && (!*length)) return 0; - if (n != sizeof(buf)) { + if (n == 0) { done = 1; } @@ -1024,6 +1067,7 @@ load_resource_rulefile(char *filename, resource_rule_t **rules) break; memset(rr,0,sizeof(*rr)); + rr->rr_flags = RF_INIT | RF_DESTROY; rr->rr_type = type; snprintf(base, sizeof(base), "/resource-agent[%d]", ruleid); @@ -1035,12 +1079,14 @@ load_resource_rulefile(char *filename, resource_rule_t **rules) snprintf(base, sizeof(base), "/resource-agent[%d]/special[@tag=\"rgmanager\"]", ruleid); - _get_root(doc, ctx, base, rr); _get_maxparents(doc, ctx, base, rr); + _get_rule_flag(doc, ctx, base, rr, "root", RF_ROOT); + _get_rule_flag(doc, ctx, base, rr, "init_on_add", RF_INIT); + _get_rule_flag(doc, ctx, base, rr, "destroy_on_delete", RF_DESTROY); rr->rr_agent = strdup(filename); /* - Second, add the allowable-children fields + Second, add the children fields */ _get_childtypes(doc, ctx, base, rr); @@ -1095,8 +1141,9 @@ load_resource_rules(const char *rpath, resource_rule_t **rules) { DIR *dir; struct dirent *de; - char *fn;//, *dot; + char *fn, *dot; char path[2048]; + struct stat st_buf; dir = opendir(rpath); if (!dir) @@ -1109,14 +1156,40 @@ load_resource_rules(const char *rpath, resource_rule_t **rules) if (!fn) continue; + /* Ignore files with common backup extension */ if ((fn != NULL) && (strlen(fn) > 0) && (fn[strlen(fn)-1] == '~')) continue; + /* Ignore hidden files */ + if (*fn == '.') + continue; + + dot = strrchr(fn, '.'); + if (dot) { + /* Ignore RPM installed save files, patches, + diffs, etc. */ + if (!strncasecmp(dot, ".rpm", 4)) { + fprintf(stderr, "Warning: " + "Ignoring %s/%s: Bad extension %s\n", + rpath, de->d_name, dot); + continue; + } + } + snprintf(path, sizeof(path), "%s/%s", rpath, de->d_name); - load_resource_rulefile(path, rules); + if (stat(path, &st_buf) < 0) + continue; + + if (S_ISDIR(st_buf.st_mode)) + continue; + + if (st_buf.st_mode & (S_IXUSR|S_IXOTH|S_IXGRP)) { + //printf("Loading resource rule from %s\n", path); + load_resource_rulefile(path, rules); + } } xmlCleanupParser(); diff --git a/rgmanager/src/daemons/restart_counter.c b/rgmanager/src/daemons/restart_counter.c new file mode 100644 index 0000000..c889c6d --- /dev/null +++ b/rgmanager/src/daemons/restart_counter.c @@ -0,0 +1,205 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* Time-based restart counters for rgmanager */ + +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define RESTART_INFO_MAGIC 0x184820ab + +typedef struct { + list_head(); + time_t restart_time; +} restart_item_t; + +typedef struct { + int magic; + time_t expire_timeout; + int max_restarts; + int restart_count; + restart_item_t *restart_nodes; +} restart_info_t; + + +#define VALIDATE(arg, ret) \ +do { \ + if (!arg) {\ + errno = EINVAL; \ + return ret; \ + } \ + if (((restart_info_t *)arg)->magic != RESTART_INFO_MAGIC) {\ + errno = EINVAL; \ + return ret; \ + } \ +} while(0) + + +/* Remove expired restarts */ +static int +restart_timer_purge(restart_counter_t arg, time_t now) +{ + restart_info_t *restarts = (restart_info_t *)arg; + restart_item_t *i; + int x, done = 0; + + VALIDATE(arg, -1); + + /* No timeout */ + if (restarts->expire_timeout == 0) + return 0; + + do { + done = 1; + list_for(&restarts->restart_nodes, i, x) { + if ((now - i->restart_time) >= + restarts->expire_timeout) { + restarts->restart_count--; + list_remove(&restarts->restart_nodes, i); + done = 0; + break; + } + } + } while(!done); + + return 0; +} + + +int +restart_count(restart_counter_t arg) +{ + restart_info_t *restarts = (restart_info_t *)arg; + time_t now; + + VALIDATE(arg, -1); + now = time(NULL); + restart_timer_purge(arg, now); + return restarts->restart_count; +} + + +int +restart_threshold_exceeded(restart_counter_t arg) +{ + restart_info_t *restarts = (restart_info_t *)arg; + time_t now; + + VALIDATE(arg, -1); + now = time(NULL); + restart_timer_purge(arg, now); + if (restarts->restart_count >= restarts->max_restarts) + return 1; + return 0; +} + + +/* Add a restart entry to the list. Returns 1 if restart + count is exceeded */ +int +restart_add(restart_counter_t arg) +{ + restart_info_t *restarts = (restart_info_t *)arg; + restart_item_t *i; + time_t t; + + if (!arg) + /* No max restarts / threshold = always + ok to restart! */ + return 0; + + VALIDATE(arg, -1); + + i = malloc(sizeof(*i)); + if (!i) { + return -1; + } + + t = time(NULL); + i->restart_time = t; + + list_insert(&restarts->restart_nodes, i); + restarts->restart_count++; + + /* Check and remove old entries */ + restart_timer_purge(restarts, t); + + if (restarts->restart_count >= restarts->max_restarts) + return 1; + + return 0; +} + + +int +restart_clear(restart_counter_t arg) +{ + restart_info_t *restarts = (restart_info_t *)arg; + restart_item_t *i; + + VALIDATE(arg, -1); + while ((i = restarts->restart_nodes)) { + list_remove(&restarts->restart_nodes, i); + free(i); + } + + restarts->restart_count = 0; + + return 0; +} + + +restart_counter_t +restart_init(time_t expire_timeout, int max_restarts) +{ + restart_info_t *info; + + if (max_restarts < 0) { + errno = EINVAL; + return NULL; + } + + info = malloc(sizeof(*info)); + if (info == NULL) + return NULL; + + info->magic = RESTART_INFO_MAGIC; + info->expire_timeout = expire_timeout; + info->max_restarts = max_restarts; + info->restart_count = 0; + info->restart_nodes = NULL; + + return (void *)info; +} + + +int +restart_cleanup(restart_counter_t arg) +{ + VALIDATE(arg, -1); + restart_clear(arg); + free(arg); + return 0; +} diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c index 95b2450..3d7b0ab 100644 --- a/rgmanager/src/daemons/restree.c +++ b/rgmanager/src/daemons/restree.c @@ -1,5 +1,5 @@ /* - Copyright Red Hat, Inc. 2004 + Copyright Red Hat, Inc. 2004-2006 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 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -39,12 +40,15 @@ void malloc_zap_mutex(void); #endif - /* XXX from resrules.c */ int store_childtype(resource_child_t **childp, char *name, int start, int stop, int forbid, int flags); int _res_op(resource_node_t **tree, resource_t *first, char *type, void * __attribute__((unused))ret, int op); +static inline int +_res_op_internal(resource_node_t **tree, resource_t *first, + char *type, void *__attribute__((unused))ret, int realop, + resource_node_t *node); void print_env(char **env); static inline int _res_op_internal(resource_node_t **tree, resource_t *first, char *type, void *__attribute__((unused))ret, int realop, @@ -63,22 +67,6 @@ void * act_dup(resource_act_t *acts); time_t get_time(char *action, int depth, resource_node_t *node); -const char *res_ops[] = { - "start", - "stop", - "status", - "resinfo", - "restart", - "reload", - "condrestart", /* Unused */ - "recover", - "condstart", - "condstop", - "monitor", - "meta-data", /* printenv */ - "validate-all" -}; - const char *ocf_errors[] = { "success", // 0 @@ -110,14 +98,13 @@ _no_op_mode(int arg) const char * ocf_strerror(int ret) { - if (ret < OCF_RA_MAX) + if (ret >= 0 && ret < OCF_RA_MAX) return ocf_errors[ret]; return "unspecified"; } - /** Destroys an environment variable array. @@ -143,7 +130,7 @@ kill_env(char **env) @see build_env */ static void -add_ocf_stuff(resource_t *res, char **env, int depth) +add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt) { char ver[10]; char *minor, *val; @@ -227,6 +214,17 @@ add_ocf_stuff(resource_t *res, char **env, int depth) return; snprintf(val, n, "%s=%s", OCF_CHECK_LEVEL_STR, ver); *env = val; env++; + + /* + Store the resource local refcnt (0 for now) + */ + snprintf(ver, sizeof(ver), "%d", refcnt); + n = strlen(OCF_REFCNT_STR) + strlen(ver) + 2; + val = malloc(n); + if (!val) + return; + snprintf(val, n, "%s=%s", OCF_REFCNT_STR, ver); + *env = val; env++; } @@ -234,14 +232,13 @@ add_ocf_stuff(resource_t *res, char **env, int depth) Allocate and fill an environment variable array. @param node Node in resource tree to use for parameters - @param op Operation (start/stop/status/monitor/etc.) @param depth Depth (status/monitor/etc.) @return Newly allocated environment array or NULL if one could not be formed. @see kill_env res_exec add_ocf_stuff */ static char ** -build_env(resource_node_t *node, int op, int depth) +build_env(resource_node_t *node, int depth, int refcnt) { resource_t *res = node->rn_resource; char **env; @@ -249,7 +246,7 @@ build_env(resource_node_t *node, int op, int depth) int x, attrs, n; for (attrs = 0; res->r_attrs && res->r_attrs[attrs].ra_name; attrs++); - attrs += 7; /* + attrs += 8; /* Leave space for: OCF_RA_VERSION_MAJOR OCF_RA_VERSION_MINOR @@ -257,6 +254,7 @@ build_env(resource_node_t *node, int op, int depth) OCF_RESOURCE_INSTANCE OCF_RESOURCE_TYPE OCF_CHECK_LEVEL + OCF_RESKEY_RGMANAGER_meta_refcnt (null terminator) */ @@ -296,7 +294,7 @@ build_env(resource_node_t *node, int op, int depth) ++attrs; } - add_ocf_stuff(res, &env[attrs], depth); + add_ocf_stuff(res, &env[attrs], depth, refcnt); return env; } @@ -346,46 +344,35 @@ restore_signals(void) @see build_env */ int -res_exec(resource_node_t *node, int op, int depth) +res_exec(resource_node_t *node, int op, const char *arg, int depth) { int childpid, pid; int ret = 0; char **env = NULL; resource_t *res = node->rn_resource; + const char *op_str = agent_op_str(op); char fullpath[2048]; - if (!res->r_rule->rr_agent) { - clulog(LOG_DEBUG, - "%s on %s \"%s\" no rr_agent\n", - res_ops[op], res->r_rule->rr_type, - res->r_attrs->ra_value); + if (!res->r_rule->rr_agent) return 0; - } #ifdef DEBUG - env = build_env(node, op); - if (!env) { - clulog(LOG_DEBUG, - "%s on %s \"%s\" build_env failed %d\n", - res_ops[op], res->r_rule->rr_type, - res->r_attrs->ra_value, errno); + env = build_env(node, depth, node->rn_resource->r_incarnations); + if (!env) return -errno; - } #endif #ifdef NO_CCS if (_no_op_mode_) { - printf("[%s] %s:%s\n", res_ops[op], - res->r_rule->rr_type, res->r_attrs->ra_value); + printf("[%s] %s:%s\n", op_str, res->r_rule->rr_type, + res->r_attrs->ra_value); return 0; } #endif childpid = fork(); - if (childpid < 0) { - clulog(LOG_ERR, "%s: fork failed (%d)!\n", __func__, errno); + if (childpid < 0) return -errno; - } if (!childpid) { /* Child */ @@ -394,21 +381,16 @@ res_exec(resource_node_t *node, int op, int depth) #endif #if 0 printf("Exec of script %s, action %s type %s\n", - res->r_rule->rr_agent, res_ops[op], + res->r_rule->rr_agent, agent_op_str(op), res->r_rule->rr_type); #endif #ifndef DEBUG - env = build_env(node, op, depth); + env = build_env(node, depth, node->rn_resource->r_incarnations); #endif - if (!env) { - clulog(LOG_DEBUG, - "%s on %s \"%s\" build_env failed (ENOMEM)\n", - res_ops[op], res->r_rule->rr_type, - res->r_attrs->ra_value); + if (!env) exit(-ENOMEM); - } if (res->r_rule->rr_agent[0] != '/') snprintf(fullpath, sizeof(fullpath), "%s/%s", @@ -419,7 +401,10 @@ res_exec(resource_node_t *node, int op, int depth) restore_signals(); - execle(fullpath, fullpath, res_ops[op], NULL, env); + if (arg) + execle(fullpath, fullpath, op_str, arg, NULL, env); + else + execle(fullpath, fullpath, op_str, NULL, env); } #ifdef DEBUG @@ -436,16 +421,16 @@ res_exec(resource_node_t *node, int op, int depth) ret = WEXITSTATUS(ret); +#ifndef NO_CCS + if ((op == RS_STATUS && + node->rn_state == RES_STARTED && ret) || + (op != RS_STATUS && ret)) { +#else if (ret) { +#endif clulog(LOG_NOTICE, - "%s on %s:%s returned %d (%s)\n", - res_ops[op], res->r_rule->rr_type, - res->r_attrs->ra_value, ret, - ocf_strerror(ret)); - } else { - clulog(LOG_DEBUG, - "%s on %s:%s returned %d (%s)\n", - res_ops[op], res->r_rule->rr_type, + "%s on %s \"%s\" returned %d (%s)\n", + op_str, res->r_rule->rr_type, res->r_attrs->ra_value, ret, ocf_strerror(ret)); } @@ -456,15 +441,43 @@ res_exec(resource_node_t *node, int op, int depth) if (!WIFSIGNALED(ret)) assert(0); - clulog(LOG_ERR, - "%s on %s:%s caught signal %d\n", - res_ops[op], res->r_rule->rr_type, - res->r_attrs->ra_value, WTERMSIG(ret)); - return -EFAULT; } +static inline void +assign_restart_policy(resource_t *curres, resource_node_t *parent, + resource_node_t *node) +{ + char *val; + int max_restarts = 0; + time_t restart_expire_time = 0; + + node->rn_restart_counter = NULL; + + if (!curres || !node) + return; + if (parent) /* Non-parents don't get one for now */ + return; + + val = res_attr_value(curres, "max_restarts"); + if (!val) + return; + max_restarts = atoi(val); + if (max_restarts <= 0) + return; + val = res_attr_value(curres, "restart_expire_time"); + if (val) { + restart_expire_time = (time_t)expand_time(val); + if (!restart_expire_time) + return; + } + + node->rn_restart_counter = restart_init(restart_expire_time, + max_restarts); +} + + static inline int do_load_resource(int ccsfd, char *base, resource_rule_t *rule, @@ -545,7 +558,21 @@ do_load_resource(int ccsfd, char *base, node->rn_parent = parent; node->rn_resource = curres; node->rn_state = RES_STOPPED; + node->rn_flags = 0; node->rn_actions = (resource_act_t *)act_dup(curres->r_actions); + assign_restart_policy(curres, parent, node); + + snprintf(tok, sizeof(tok), "%s/@__independent_subtree", base); +#ifndef NO_CCS + if (ccs_get(ccsfd, tok, &ref) == 0) { +#else + if (conf_get(tok, &ref) == 0) { +#endif + if (atoi(ref) > 0 || strcasecmp(ref, "yes") == 0) + node->rn_flags |= RF_INDEPENDENT; + free(ref); + } + curres->r_refs++; *newnode = node; @@ -685,8 +712,10 @@ build_tree(int ccsfd, resource_node_t **tree, } } /* No resource rule matching the child? Press on... */ - if (!flags) + if (!flags) { + free(ref); continue; + } flags = 0; /* Don't descend on anything we should have already picked @@ -706,12 +735,9 @@ build_tree(int ccsfd, resource_node_t **tree, break; } - if (flags == 2) { - free(ref); - continue; - } - free(ref); + if (flags == 2) + continue; x = 1; switch(do_load_resource(ccsfd, tok, childrule, tree, @@ -758,21 +784,13 @@ build_resource_tree(int ccsfd, resource_node_t **tree, resource_rule_t **rulelist, resource_t **reslist) { - resource_rule_t *curr; resource_node_t *root = NULL; char tok[512]; snprintf(tok, sizeof(tok), "%s", RESOURCE_TREE_ROOT); /* Find and build the list of root nodes */ - list_do(rulelist, curr) { - - if (!curr->rr_root) - continue; - - build_tree(ccsfd, &root, NULL, NULL/*curr*/, rulelist, reslist, tok); - - } while (!list_done(rulelist, curr)); + build_tree(ccsfd, &root, NULL, NULL/*curr*/, rulelist, reslist, tok); if (root) *tree = root; @@ -797,6 +815,11 @@ destroy_resource_tree(resource_node_t **tree) destroy_resource_tree(&(*tree)->rn_child); list_remove(tree, node); + + if (node->rn_restart_counter) { + restart_cleanup(node->rn_restart_counter); + } + if(node->rn_actions){ free(node->rn_actions); } @@ -810,6 +833,7 @@ _print_resource_tree(resource_node_t **tree, int level) { resource_node_t *node; int x, y; + char *val; list_do(tree, node) { for (x = 0; x < level; x++) @@ -824,19 +848,24 @@ _print_resource_tree(resource_node_t **tree, int level) printf("NEEDSTART "); if (node->rn_flags & RF_COMMON) printf("COMMON "); + if (node->rn_flags & RF_INDEPENDENT) + printf("INDEPENDENT "); printf("]"); } printf(" {\n"); for (x = 0; node->rn_resource->r_attrs && node->rn_resource->r_attrs[x].ra_value; x++) { + val = attr_value(node, + node->rn_resource->r_attrs[x].ra_name); + if (!val) + continue; + for (y = 0; y < level+1; y++) printf(" "); printf("%s = \"%s\";\n", node->rn_resource->r_attrs[x].ra_name, - attr_value(node, - node->rn_resource->r_attrs[x].ra_name) - ); + val); } _print_resource_tree(&node->rn_child, level + 1); @@ -879,16 +908,17 @@ _do_child_levels(resource_node_t **tree, resource_t *first, void *ret, #if 0 printf("%s children of %s type %s (level %d)\n", - res_ops[op], + agent_op_str(op), node->rn_resource->r_rule->rr_type, rule->rr_childtypes[x].rc_name, l); #endif /* Do op on all children at our level */ - rv += _res_op(&node->rn_child, first, + rv |= _res_op(&node->rn_child, first, rule->rr_childtypes[x].rc_name, ret, op); - if (rv != 0 && op != RS_STOP) + + if (rv & SFL_FAILURE && op != RS_STOP) return rv; } @@ -900,46 +930,6 @@ _do_child_levels(resource_node_t **tree, resource_t *first, void *ret, } -#if 0 -static inline int -_do_child_default_level(resource_node_t **tree, resource_t *first, - void *ret, int op) -{ - resource_node_t *node = *tree; - resource_t *res = node->rn_resource; - resource_rule_t *rule = res->r_rule; - int x, rv = 0, lev; - - for (x = 0; rule->rr_childtypes && - rule->rr_childtypes[x].rc_name; x++) { - - if(op == RS_STOP) - lev = rule->rr_childtypes[x].rc_stoplevel; - else - lev = rule->rr_childtypes[x].rc_startlevel; - - if (lev) - continue; - - /* - printf("%s children of %s type %s (default level)\n", - res_ops[op], - node->rn_resource->r_rule->rr_type, - rule->rr_childtypes[x].rc_name); - */ - - rv = _res_op(&node->rn_child, first, - rule->rr_childtypes[x].rc_name, - ret, op); - if (rv != 0) - return rv; - } - - return 0; -} -#endif - - static inline int _xx_child_internal(resource_node_t *node, resource_t *first, resource_node_t *child, void *ret, int op) @@ -973,13 +963,14 @@ _do_child_default_level(resource_node_t **tree, resource_t *first, if (op == RS_START || op == RS_STATUS) { list_for(&node->rn_child, child, y) { - rv = _xx_child_internal(node, first, child, ret, op); - if (rv) + rv |= _xx_child_internal(node, first, child, ret, op); + + if (rv & SFL_FAILURE) return rv; } } else { list_for_rev(&node->rn_child, child, y) { - rv += _xx_child_internal(node, first, child, ret, op); + rv |= _xx_child_internal(node, first, child, ret, op); } } @@ -1019,26 +1010,39 @@ _res_op_by_level(resource_node_t **tree, resource_t *first, void *ret, return _res_op(&node->rn_child, first, NULL, ret, op); if (op == RS_START || op == RS_STATUS) { - rv = _do_child_levels(tree, first, ret, op); - if (rv != 0) + rv |= _do_child_levels(tree, first, ret, op); + if (rv & SFL_FAILURE) return rv; /* Start default level after specified ones */ - rv = _do_child_default_level(tree, first, ret, op); + rv |= _do_child_default_level(tree, first, ret, op); } /* stop */ else { - rv = _do_child_default_level(tree, first, ret, op); - if (rv != 0) - return rv; - - rv = _do_child_levels(tree, first, ret, op); + rv |= _do_child_default_level(tree, first, ret, op); + rv |= _do_child_levels(tree, first, ret, op); } return rv; } +void +mark_nodes(resource_node_t *node, int state, int flags) +{ + int x; + resource_node_t *child; + + list_for(&node->rn_child, child, x) { + if (child->rn_child) + mark_nodes(child->rn_child, state, flags); + } + + node->rn_state = state; + node->rn_flags |= (RF_NEEDSTART | RF_NEEDSTOP); +} + + /** Do a status on a resource node. This takes into account the last time the status operation was run and selects the highest possible resource depth @@ -1075,7 +1079,8 @@ do_status(resource_node_t *node) /* Ok, it's a 'status' action. See if enough time has elapsed for a given type of status action */ - if (delta < node->rn_actions[x].ra_interval) + if (delta < node->rn_actions[x].ra_interval || + !node->rn_actions[x].ra_interval) continue; if (idx == -1 || @@ -1090,29 +1095,22 @@ do_status(resource_node_t *node) return 0; } + node->rn_actions[idx].ra_last = now; - x = res_exec(node, RS_STATUS, node->rn_actions[idx].ra_depth); + x = res_exec(node, RS_STATUS, NULL, node->rn_actions[idx].ra_depth); node->rn_last_status = x; node->rn_last_depth = node->rn_actions[idx].ra_depth; node->rn_checked = 1; - /* Clear check levels below ours. */ - for (x=0; node->rn_actions[x].ra_name; x++) { - if (strcmp(node->rn_actions[x].ra_name, "status")) - continue; - if (node->rn_actions[x].ra_depth <= node->rn_last_depth) - node->rn_actions[x].ra_last = now; - } - - if (node->rn_last_status == 0) + if (x == 0) return 0; if (!has_recover) - return node->rn_last_status; + return x; /* Strange/failed status. Try to recover inline. */ - if ((x = res_exec(node, RS_RECOVER, 0)) == 0) + if ((x = res_exec(node, RS_RECOVER, NULL, 0)) == 0) return 0; return x; @@ -1162,8 +1160,9 @@ clear_checks(resource_node_t *node) { time_t now; int x = 0; + resource_t *res = node->rn_resource; - now = time(NULL); + now = res->r_started; for (; node->rn_actions[x].ra_name; x++) { @@ -1197,136 +1196,12 @@ clear_checks(resource_node_t *node) in the subtree). @see _res_op_by_level res_exec */ -#if 0 -int -_res_op(resource_node_t **tree, resource_t *first, - char *type, void * __attribute__((unused))ret, int realop) -{ - int rv, me; - resource_node_t *node; - int op; - - list_do(tree, node) { - - /* Restore default operation. */ - op = realop; - - /* If we're starting by type, do that funky thing. */ - if (type && strlen(type) && - strcmp(node->rn_resource->r_rule->rr_type, type)) - continue; - - /* If the resource is found, all nodes in the subtree must - have the operation performed as well. */ - me = !first || (node->rn_resource == first); - - /* - printf("begin %s: %s %s [0x%x]\n", res_ops[op], - node->rn_resource->r_rule->rr_type, - primary_attr_value(node->rn_resource), - node->rn_flags); - */ - - if (me) { - /* - If we've been marked as a node which - needs to be started or stopped, clear - that flag and start/stop this resource - and all resource babies. - - Otherwise, don't do anything; look for - children with RF_NEEDSTART and - RF_NEEDSTOP flags. - - CONDSTART and CONDSTOP are no-ops if - the appropriate flag is not set. - */ - if ((op == RS_CONDSTART) && - (node->rn_flags & RF_NEEDSTART)) { - /* - printf("Node %s:%s - CONDSTART\n", - node->rn_resource->r_rule->rr_type, - primary_attr_value(node->rn_resource)); - */ - op = RS_START; - } - - if ((op == RS_CONDSTOP) && - (node->rn_flags & RF_NEEDSTOP)) { - /* - printf("Node %s:%s - CONDSTOP\n", - node->rn_resource->r_rule->rr_type, - primary_attr_value(node->rn_resource)); - */ - op = RS_STOP; - } - } - - /* Start starts before children */ - if (me && (op == RS_START)) { - node->rn_flags &= ~RF_NEEDSTART; - - rv = res_exec(node, op, 0); - if (rv != 0) { - node->rn_state = RES_FAILED; - return rv; - } - - set_time("start", 0, node); - clear_checks(node); - - if (node->rn_state != RES_STARTED) { - ++node->rn_resource->r_incarnations; - node->rn_state = RES_STARTED; - } - } - - if (node->rn_child) { - rv = _res_op_by_level(&node, me?NULL:first, ret, op); - if (rv != 0) - return rv; - } - - /* Stop/status/etc stops after children have stopped */ - if (me && (op == RS_STOP)) { - node->rn_flags &= ~RF_NEEDSTOP; - rv = res_exec(node, op, 0); - - if (rv != 0) { - node->rn_state = RES_FAILED; - return rv; - } - - if (node->rn_state != RES_STOPPED) { - --node->rn_resource->r_incarnations; - node->rn_state = RES_STOPPED; - } - - } else if (me && (op == RS_STATUS)) { - - rv = do_status(node); - if (rv != 0) - return rv; - } - - /* - printf("end %s: %s %s\n", res_ops[op], - node->rn_resource->r_rule->rr_type, - primary_attr_value(node->rn_resource)); - */ - } while (!list_done(tree, node)); - - return 0; -} -#endif - - static inline int _res_op_internal(resource_node_t **tree, resource_t *first, char *type, void *__attribute__((unused))ret, int realop, resource_node_t *node) { - int rv, me, op; + int rv = 0, me, op; /* Restore default operation. */ op = realop; @@ -1378,12 +1253,18 @@ _res_op_internal(resource_node_t **tree, resource_t *first, /* Start starts before children */ if (me && (op == RS_START)) { - node->rn_flags &= ~RF_NEEDSTART; - rv = res_exec(node, op, 0); + if (node->rn_flags & RF_RECONFIG && + realop == RS_CONDSTART) { + rv = res_exec(node, RS_RECONFIG, NULL, 0); + op = realop; /* reset to CONDSTART */ + } else { + rv = res_exec(node, op, NULL, 0); + } + node->rn_flags &= ~(RF_NEEDSTART | RF_RECONFIG); if (rv != 0) { node->rn_state = RES_FAILED; - return rv; + return SFL_FAILURE; } set_time("start", 0, node); @@ -1396,24 +1277,53 @@ _res_op_internal(resource_node_t **tree, resource_t *first, } else if (me && (op == RS_STATUS)) { /* Check status before children*/ rv = do_status(node); - if (rv != 0) - return rv; - } + if (rv != 0) { + /* + If this node's status has failed, all of its + dependent children are failed, whether or not this + node is independent or not. + */ + mark_nodes(node, RES_FAILED, + RF_NEEDSTART | RF_NEEDSTOP); + + /* If we're an independent subtree, return a flag + stating that this section is recoverable apart + from siblings in the resource tree. All child + resources of this node must be restarted, + but siblings of this node are not affected. */ + if (node->rn_flags & RF_INDEPENDENT) + return SFL_RECOVERABLE; + + return SFL_FAILURE; + } - if (node->rn_child) { - rv = _res_op_by_level(&node, me?NULL:first, ret, op); - if (rv != 0) - return rv; } + if (node->rn_child) { + rv |= _res_op_by_level(&node, me?NULL:first, ret, op); + + /* If one or more child resources are failed and at least one + of them is not an independent subtree then let's check if + if we are an independent subtree. If so, mark ourself + and all our children as failed and return a flag stating + that this section is recoverable apart from siblings in + the resource tree. */ + if (op == RS_STATUS && (rv & SFL_FAILURE) && + (node->rn_flags & RF_INDEPENDENT)) { + mark_nodes(node, RES_FAILED, + RF_NEEDSTART | RF_NEEDSTOP); + rv = SFL_RECOVERABLE; + } + } + /* Stop should occur after children have stopped */ if (me && (op == RS_STOP)) { node->rn_flags &= ~RF_NEEDSTOP; - rv = res_exec(node, op, 0); + rv |= res_exec(node, op, NULL, 0); if (rv != 0) { node->rn_state = RES_FAILED; - return rv; + return SFL_FAILURE; } if (node->rn_state != RES_STOPPED) { @@ -1426,7 +1336,7 @@ _res_op_internal(resource_node_t **tree, resource_t *first, //node->rn_resource->r_rule->rr_type, //primary_attr_value(node->rn_resource)); - return 0; + return rv; } @@ -1452,24 +1362,31 @@ _res_op(resource_node_t **tree, resource_t *first, char *type, void * __attribute__((unused))ret, int realop) { resource_node_t *node; - int count = 0, rv; + int count = 0, rv = 0; if (realop == RS_STOP) { list_for_rev(tree, node, count) { - rv = _res_op_internal(tree, first, type, ret, realop, - node); - if (rv != 0) - return rv; + rv |= _res_op_internal(tree, first, type, ret, realop, + node); } } else { list_for(tree, node, count) { - rv = _res_op_internal(tree, first, type, ret, realop, - node); - if (rv != 0) + rv |= _res_op_internal(tree, first, type, ret, realop, + node); + + /* If we hit a problem during a 'status' op in an + independent subtree, rv will have the + SFL_RECOVERABLE bit set, but not SFL_FAILURE. + If we ever hit SFL_FAILURE during a status + operation, we're *DONE* - even if the subtree + is flagged w/ indy-subtree */ + + if (rv & SFL_FAILURE) return rv; } } - return 0; + + return rv; } /** @@ -1564,6 +1481,7 @@ int resource_delta(resource_t **leftres, resource_t **rightres) { resource_t *lc, *rc; + int ret; list_do(leftres, lc) { rc = find_resource_by_ref(rightres, lc->r_rule->rr_type, @@ -1576,10 +1494,25 @@ resource_delta(resource_t **leftres, resource_t **rightres) } /* Ok, see if the resource is the same */ - if (rescmp(lc, rc) == 0) { + ret = rescmp(lc, rc); + if (ret == 0) { + rc->r_flags |= RF_COMMON; + continue; + } + + if (ret == 2) { + /* return of 2 from rescmp means + the two resources differ only + by reconfigurable bits */ + /* Do nothing on condstop phase; + do a "reconfig" instead of + "start" on conststart phase */ rc->r_flags |= RF_COMMON; + rc->r_flags |= RF_NEEDSTART; + rc->r_flags |= RF_RECONFIG; continue; } + rc->r_flags |= RF_COMMON; /* Resource has changed. Flag it. */ @@ -1641,12 +1574,17 @@ resource_tree_delta(resource_node_t **ltree, resource_node_t **rtree) or is new), then we don't really care about its children. */ + if (rn->rn_resource->r_flags & RF_NEEDSTART) { rn->rn_flags |= RF_NEEDSTART; - continue; + if ((rn->rn_resource->r_flags & RF_RECONFIG) == 0) + continue; } - if (rc == 0) { + if (rc == 0 || rc == 2) { + if (rc == 2) + rn->rn_flags |= RF_NEEDSTART | RF_RECONFIG; + /* Ok, same resource. Recurse. */ ln->rn_flags |= RF_COMMON; rn->rn_flags |= RF_COMMON; diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c new file mode 100644 index 0000000..48d0fca --- /dev/null +++ b/rgmanager/src/daemons/rg_event.c @@ -0,0 +1,500 @@ +/* + Copyright Red Hat, Inc. 2006-2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * resource group event queue. + */ +static event_t *event_queue = NULL; +#ifdef WRAP_LOCKS +static pthread_mutex_t event_queue_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +static pthread_mutex_t mi_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +#else +static pthread_mutex_t event_queue_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mi_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif +static pthread_t event_thread = 0; +static int transition_throttling = 5; +static int central_events = 0; + +extern int running; +static int _master = 0; +static void *_master_lock = NULL; +static int _xid = 0; +static event_master_t *mi = NULL; + +void hard_exit(void); +int init_resource_groups(int); +void flag_shutdown(int sig); +void flag_reconfigure(int sig); + +event_table_t *master_event_table = NULL; + + +void +set_transition_throttling(int nsecs) +{ + if (nsecs < 0) + nsecs = 0; + transition_throttling = nsecs; +} + + +void +set_central_events(int flag) +{ + central_events = flag; +} + + +int +central_events_enabled(void) +{ + return central_events; +} + + +/** + Called to handle the transition of a cluster member from up->down or + down->up. This handles initializing services (in the local node-up case), + exiting due to loss of quorum (local node-down), and service fail-over + (remote node down). This is the distributed node event processor; + for the local-only node event processor, see slang_event.c + + @param nodeID ID of the member which has come up/gone down. + @param nodeStatus New state of the member in question. + @see eval_groups + */ +void +node_event(int local, uint64_t nodeID, int nodeStatus, int clean) +{ + if (!running) + return; + + if (local) { + + /* Local Node Event */ + if (nodeStatus == 0) { + clulog(LOG_ERR, "Exiting uncleanly\n"); + hard_exit(); + } + + if (!rg_initialized()) { + if (init_resource_groups(0) != 0) { + clulog(LOG_ERR, + "#36: Cannot initialize services\n"); + hard_exit(); + } + } + + if (!running) { + clulog(LOG_NOTICE, "Processing delayed exit signal\n"); + return; + } + setup_signal(SIGINT, flag_shutdown); + setup_signal(SIGTERM, flag_shutdown); + setup_signal(SIGHUP, flag_reconfigure); + + eval_groups(1, nodeID, 1); + return; + } + + /* + * Nothing to do for events from other nodes if we are not ready. + */ + if (!rg_initialized()) { + clulog(LOG_DEBUG, "Services not initialized.\n"); + return; + } + + eval_groups(0, nodeID, nodeStatus); +} + + +/** + Callback from view-formation when a commit occurs for the Transition- + Master key. + */ +int32_t +master_event_callback(char *key, uint64_t viewno, + void *data, uint32_t datalen) +{ + event_master_t *m; + + m = data; + if (datalen != (uint32_t)sizeof(*m)) { + clulog(LOG_ERR, "%s: wrong size\n", __FUNCTION__); + return 1; + } + + swab_event_master_t(m); + if (m->m_magic != EVENT_MASTER_MAGIC) { + clulog(LOG_ERR, "%s: wrong size\n", __FUNCTION__); + return 1; + } + + if (m->m_nodeid == my_id()) + clulog(LOG_DEBUG, "Master Commit: I am master\n"); + else + clulog(LOG_DEBUG, "Master Commit: %d is master\n", m->m_nodeid); + + pthread_mutex_lock(&mi_mutex); + if (mi) + free(mi); + mi = m; + pthread_mutex_unlock(&mi_mutex); + + return 0; +} + + +/** + Read the Transition-Master key from vf if it exists. If it doesn't, + attempt to become the transition-master. + */ +static int +find_master(void) +{ + event_master_t *masterinfo = NULL; + void *data; + uint32_t sz; + cluster_member_list_t *m = NULL; + uint64_t vn; + int master_id = -1; + + m = member_list(); + if (vf_read(m, "Transition-Master", &vn, + (void **)(&data), &sz) < 0) { + clulog(LOG_ERR, "Unable to discover master" + " status\n"); + masterinfo = NULL; + } else { + masterinfo = (event_master_t *)data; + } + cml_free(m); + + if (masterinfo && (sz >= sizeof(*masterinfo))) { + swab_event_master_t(masterinfo); + if (masterinfo->m_magic == EVENT_MASTER_MAGIC) { + clulog(LOG_DEBUG, "Master Locate: %d is master\n", + masterinfo->m_nodeid); + pthread_mutex_lock(&mi_mutex); + if (mi) + free(mi); + mi = masterinfo; + pthread_mutex_unlock(&mi_mutex); + master_id = masterinfo->m_nodeid; + } + } + + return master_id; +} + + +/** + Return a copy of the cached event_master_t structure to the + caller. + */ +int +event_master_info_cached(event_master_t *mi_out) +{ + if (!central_events || !mi_out) { + errno = -EINVAL; + return -1; + } + + pthread_mutex_lock(&mi_mutex); + if (!mi) { + pthread_mutex_unlock(&mi_mutex); + errno = -ENOENT; + return -1; + } + + memcpy(mi_out, mi, sizeof(*mi)); + pthread_mutex_unlock(&mi_mutex); + return 0; +} + + +/** + Return the node ID of the master. If none exists, become + the master and return our own node ID. + */ +uint64_t +event_master(void) +{ + cluster_member_list_t *m = NULL; + event_master_t masterinfo; + uint64_t master_id = NODE_ID_NONE; + + /* We hold this forever. */ + if (_master) + return my_id(); + + m = member_list(); + pthread_mutex_lock(&mi_mutex); + + if (mi) { + master_id = mi->m_nodeid; + pthread_mutex_unlock(&mi_mutex); + if (memb_online(m, master_id)) { + //clulog(LOG_DEBUG, "%d is master\n", mi->m_nodeid); + goto out; + } + } + + pthread_mutex_unlock(&mi_mutex); + + memset(&_master_lock, 0, sizeof(_master_lock)); + if (clu_lock("Transition-Master", CLK_EX|CLK_NOWAIT, + &_master_lock) < 0) { + /* not us, find out who is master */ + master_id = find_master(); + goto out; + } + +#if 0 /* XXX */ + if (_master_lock.sb_status != 0) { + master_id = -1; + goto out; + } +#endif + + _master = 1; + + memset(&masterinfo, 0, sizeof(masterinfo)); + masterinfo.m_magic = EVENT_MASTER_MAGIC; + masterinfo.m_nodeid = my_id(); + masterinfo.m_master_time = (uint64_t)time(NULL); + swab_event_master_t(&masterinfo); + + if (vf_write(m, VFF_IGN_CONN_ERRORS | VFF_RETRY, + "Transition-Master", &masterinfo, + sizeof(masterinfo)) < 0) { + clulog(LOG_ERR, "Unable to advertise master" + " status to all nodes\n"); + } + + master_id = my_id(); +out: + if(m) + cml_free(m); + return master_id; +} + + + +void group_event(char *name, uint32_t state, int owner); + +/** + Event handling function. This only stays around as long as + events are on the queue. + */ +void * +_event_thread_f(void *arg) +{ + event_t *ev; + int count = 0; + + while (1) { + pthread_mutex_lock(&event_queue_mutex); + ev = event_queue; + if (ev) + list_remove(&event_queue, ev); + else + break; /* We're outta here */ + + ++count; + /* Event thread usually doesn't hang around. When it's + spawned, sleep for this many seconds in order to let + some events queue up */ + if ((count==1) && transition_throttling && !central_events) + sleep(transition_throttling); + + pthread_mutex_unlock(&event_queue_mutex); + + if (ev->ev_type == EVENT_CONFIG) { + /* + clulog(LOG_NOTICE, "Config Event: %d -> %d\n", + ev->ev.config.cfg_oldversion, + ev->ev.config.cfg_version); + */ + init_resource_groups(1); + free(ev); + continue; + } + + if (central_events) { + /* If the master node died or there isn't + one yet, take the master lock. */ + if (event_master() == my_id()) { + slang_process_event(master_event_table, + ev); + } + free(ev); + continue; + /* ALL OF THE CODE BELOW IS DISABLED + when using central_events */ + } + + if (ev->ev_type == EVENT_RG) { + /* + clulog(LOG_NOTICE, "RG Event: %s %s %d\n", + ev->ev.group.rg_name, + rg_state_str(ev->ev.group.rg_state), + ev->ev.group.rg_owner); + */ + group_event(ev->ev.group.rg_name, + ev->ev.group.rg_state, + ev->ev.group.rg_owner); + } else if (ev->ev_type == EVENT_NODE) { + /* + clulog(LOG_NOTICE, "Node Event: %s %d %s %s\n", + ev->ev.node.ne_local?"Local":"Remote", + ev->ev.node.ne_nodeid, + ev->ev.node.ne_state?"UP":"DOWN", + ev->ev.node.ne_clean?"Clean":"Dirty") + */ + + node_event(ev->ev.node.ne_local, + ev->ev.node.ne_nodeid, + ev->ev.node.ne_state, + ev->ev.node.ne_clean); + } + + free(ev); + } + + if (!central_events || _master) { + clulog(LOG_DEBUG, "%d events processed\n", count); + } + /* Mutex held */ + event_thread = 0; + pthread_mutex_unlock(&event_queue_mutex); + pthread_exit(NULL); +} + + +static void +insert_event(event_t *ev) +{ + pthread_attr_t attrs; + pthread_mutex_lock (&event_queue_mutex); + ev->ev_transaction = ++_xid; + list_insert(&event_queue, ev); + if (event_thread == 0) { + pthread_attr_init(&attrs); + pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED); + pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attrs, 262144); + + pthread_create(&event_thread, &attrs, _event_thread_f, NULL); + pthread_attr_destroy(&attrs); + } + pthread_mutex_unlock (&event_queue_mutex); +} + + +static event_t * +new_event(void) +{ + event_t *ev; + + while (1) { + ev = malloc(sizeof(*ev)); + if (ev) { + break; + } + sleep(1); + } + memset(ev,0,sizeof(*ev)); + ev->ev_type = EVENT_NONE; + + return ev; +} + + +void +rg_event_q(char *name, uint32_t state, uint64_t owner, uint64_t last) +{ + event_t *ev = new_event(); + + ev->ev_type = EVENT_RG; + + strncpy(ev->ev.group.rg_name, name, 128); + ev->ev.group.rg_state = state; + ev->ev.group.rg_owner = owner; + ev->ev.group.rg_last_owner = last; + + insert_event(ev); +} + + +void +node_event_q(int local, uint64_t nodeID, int state, int clean) +{ + event_t *ev = new_event(); + + ev->ev_type = EVENT_NODE; + ev->ev.node.ne_state = state; + ev->ev.node.ne_local = local; + ev->ev.node.ne_nodeid = nodeID; + ev->ev.node.ne_clean = clean; + insert_event(ev); +} + + +void +config_event_q(int old_version, int new_version) +{ + event_t *ev = new_event(); + + ev->ev_type = EVENT_CONFIG; + ev->ev.config.cfg_version = new_version; + ev->ev.config.cfg_oldversion = old_version; + insert_event(ev); +} + +void +user_event_q(char *svc, int request, + int arg1, int arg2, uint64_t target, int fd) +{ + event_t *ev = new_event(); + + ev->ev_type = EVENT_USER; + strncpy(ev->ev.user.u_name, svc, sizeof(ev->ev.user.u_name)); + ev->ev.user.u_request = request; + ev->ev.user.u_arg1 = arg1; + ev->ev.user.u_arg2 = arg2; + ev->ev.user.u_target = target; + ev->ev.user.u_fd = fd; + insert_event(ev); +} + diff --git a/rgmanager/src/daemons/rg_forward.c b/rgmanager/src/daemons/rg_forward.c index 081abb5..0d7df55 100644 --- a/rgmanager/src/daemons/rg_forward.c +++ b/rgmanager/src/daemons/rg_forward.c @@ -26,6 +26,14 @@ #include +struct fw_message { + SmMessageSt msg; + uint64_t nodeid; + int fd; + int unused; +}; + + void build_message(SmMessageSt *msgp, int action, char *svcName, uint64_t target) { @@ -145,3 +153,105 @@ forward_request(request_t *req) pthread_attr_destroy(&attrs); } + +void * +forwarding_thread_v2(void *arg) +{ + int fd = -1, resp_fd = -1; + cluster_member_list_t *m = NULL; + SmMessageSt *msgp = NULL, msg; + int response_code = RG_EAGAIN, ret, target = -1; + int retries = 0; + struct fw_message *fwmsg = (struct fw_message *)arg; + + msgp = &fwmsg->msg; + resp_fd = fwmsg->fd; + target = fwmsg->nodeid; + + clulog(LOG_DEBUG, "FW: Forwarding SM request to %d\n", + target); + + if ((fd = msg_open(target, RG_PORT, RG_PURPOSE, 10)) < 0) { + clulog(LOG_DEBUG, "FW: Failed to open channel to %d: %s\n", + target, strerror(errno)); + goto out_fail; + } + + /* swap + send */ + swab_SmMessageSt(msgp); + if (msg_send(fd, msgp, sizeof(*msgp)) < sizeof(*msgp)) { + clulog(LOG_DEBUG, "FW: Failed to send message to %d fd %d: %s\n", + target, fd, strerror(errno)); + goto out_fail; + } + + + /* + * Ok, we're forwarding a message to another node. Keep tabs on + * the node to make sure it doesn't die. Basically, wake up every + * now and again to make sure it's still online. If it isn't, send + * a response back to the caller. + */ + do { + ret = msg_receive_timeout(fd, &msg, sizeof(msg), 10); + if (ret < (int)sizeof(msg)) { + if (ret < 0 && errno == ETIMEDOUT) { + if (!member_online(target)) { + response_code = RG_ENODE; + goto out_fail; + } + continue; + } + + if (ret == 0) + continue; + } + break; + } while(++retries < 60); /* old 600 second rule */ + + swab_SmMessageSt(&msg); + + response_code = msg.sm_data.d_ret; + target = msg.sm_data.d_svcOwner; + +out_fail: + free(fwmsg); + + if (resp_fd >= 0) { + send_ret(resp_fd, msgp->sm_data.d_svcName, response_code, + msgp->sm_data.d_action, target); + msg_close(resp_fd); + } + + if (fd >= 0) + msg_close(fd); + + pthread_exit(NULL); +} + + +void +forward_message(int fd, void *msgp, uint64_t nodeid) +{ + pthread_t newthread; + pthread_attr_t attrs; + struct fw_message *fwmsg; + + fwmsg = malloc(sizeof(struct fw_message)); + if (!fwmsg) { + msg_close(fd); + return; + } + + memcpy(&fwmsg->msg, msgp, sizeof(fwmsg->msg)); + fwmsg->fd = fd; + fwmsg->nodeid = nodeid; + + pthread_attr_init(&attrs); + pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED); + pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attrs, 262144); + + pthread_create(&newthread, &attrs, forwarding_thread_v2, fwmsg); + pthread_attr_destroy(&attrs); +} diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c index a81a9ae..4509e6a 100644 --- a/rgmanager/src/daemons/rg_state.c +++ b/rgmanager/src/daemons/rg_state.c @@ -31,6 +31,9 @@ #include #include +#define cm_svccount cm_pad[0] /* Theses are uint8_t size */ +#define cm_svcexcl cm_pad[1] + int node_should_start_safe(uint64_t, cluster_member_list_t *, char *); uint64_t next_node_id(cluster_member_list_t *membership, uint64_t me); @@ -72,6 +75,65 @@ next_node_id(cluster_member_list_t *membership, uint64_t me) } +char * +c_name(char *svcName) +{ + char *ptr, *ret = svcName; + + ptr = strchr(svcName,':'); + if (!ptr) + return ret; + if ((int)(ptr - svcName) == 7 && + !memcmp(svcName, "service", 7)) /* strlen("service") */ + ret = ptr + 1; + + return ret; +} + + +void +broadcast_event(char *svcName, uint32_t state, uint64_t owner, uint64_t last) +{ + rg_state_msg_t msgp; + cluster_member_list_t *membership = NULL; + int fd, x, target; + + msgp.rsm_hdr.gh_magic = GENERIC_HDR_MAGIC; + msgp.rsm_hdr.gh_command = RG_EVENT; + msgp.rsm_hdr.gh_length = sizeof(msgp); + + msgp.rsm_state.rs_state = state; + strncpy(msgp.rsm_state.rs_name, svcName, + sizeof(msgp.rsm_state.rs_name)); + msgp.rsm_state.rs_owner = owner; + msgp.rsm_state.rs_last_owner = last; + + swab_rg_state_msg_t(&msgp); + + membership = member_list(); + if (!membership) { + clulog(LOG_ERR, "Cannot send event: %s\n", strerror(errno)); + return; + } + + for (x = 0; x < membership->cml_count; x++) { + if (!membership->cml_members[x].cm_state) + continue; + + target = membership->cml_members[x].cm_id; + + fd = msg_open(target, RG_PORT, RG_PURPOSE, 2); + if (fd < 0) + continue; + + msg_send(fd, &msgp, sizeof(msgp)); + msg_close(fd); + } + + cml_free(membership); +} + + int svc_report_failure(char *svcName) { @@ -81,13 +143,13 @@ svc_report_failure(char *svcName) cluster_member_list_t *membership; if (rg_lock(svcName, &lockp) == -1) { - clulog(LOG_ERR, "#41: Couldn't obtain lock for RG %s: %s\n", + clulog(LOG_ERR, "#41: Couldn't obtain lock for %s: %s\n", svcName, strerror(errno)); return -1; } if (get_rg_state(svcName, &svcStatus) != 0) { - clulog(LOG_ERR, "#42: Couldn't obtain status for RG %s\n", + clulog(LOG_ERR, "#42: Couldn't obtain status for %s\n", svcName); clu_unlock(svcName, lockp); return -1; @@ -98,11 +160,12 @@ svc_report_failure(char *svcName) nodeName = memb_id_to_name(membership, svcStatus.rs_last_owner); if (nodeName) { clulog(LOG_ALERT, "#2: Service %s returned failure " - "code. Last Owner: %s\n", svcName, nodeName); + "code. Last Owner: %s\n", + c_name(svcName), nodeName); } else { clulog(LOG_ALERT, "#3: Service %s returned failure " "code. Last Owner: %d\n", - svcName, (int)svcStatus.rs_last_owner); + c_name(svcName), (int)svcStatus.rs_last_owner); } cml_free(membership); @@ -223,11 +286,14 @@ send_response(int ret, uint64_t newowner, request_t *req) int -set_rg_state(char *name, rg_state_t *svcblk) +set_rg_state(char *rgname, rg_state_t *svcblk) { cluster_member_list_t *membership; char res[256]; int ret; + char *name; + + name = c_name(rgname); if (name) strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name)); @@ -256,7 +322,7 @@ init_rg(char *name, rg_state_t *svcblk) int -get_rg_state(char *name, rg_state_t *svcblk) +get_rg_state(char *rgname, rg_state_t *svcblk) { char res[256]; int ret; @@ -264,6 +330,9 @@ get_rg_state(char *name, rg_state_t *svcblk) uint32_t datalen = 0; uint64_t viewno; cluster_member_list_t *membership; + char *name; + + name = c_name(rgname); /* ... */ if (name) @@ -282,7 +351,7 @@ get_rg_state(char *name, rg_state_t *svcblk) if (ret != VFR_OK) { cml_free(membership); printf("Couldn't initialize rg %s!\n", name); - return FAIL; + return RG_EFAIL; } ret = vf_read(membership, res, &viewno, &data, &datalen); @@ -291,7 +360,7 @@ get_rg_state(char *name, rg_state_t *svcblk) free(data); cml_free(membership); printf("Couldn't reread rg %s! (%d)\n", name, ret); - return FAIL; + return RG_EFAIL; } } @@ -301,7 +370,7 @@ get_rg_state(char *name, rg_state_t *svcblk) if (data) free(data); cml_free(membership); - return FAIL; + return RG_EFAIL; } /* Copy out the data. */ @@ -315,15 +384,17 @@ get_rg_state(char *name, rg_state_t *svcblk) int vf_read_local(char *, uint64_t *, void *, uint32_t *); int -get_rg_state_local(char *name, rg_state_t *svcblk) +get_rg_state_local(char *rgname, rg_state_t *svcblk) { char res[256]; int ret; void *data = NULL; + char *name; uint32_t datalen = 0; uint64_t viewno; /* ... */ + name = c_name(rgname); if (name) strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name)); @@ -342,7 +413,7 @@ get_rg_state_local(char *name, rg_state_t *svcblk) svcblk->rs_transition = 0; strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name)); - return FAIL; + return RG_EFAIL; } /* Copy out the data. */ @@ -360,11 +431,11 @@ get_rg_state_local(char *name, rg_state_t *svcblk) * @param svcStatus Current service status. * @param svcName Service name * @param req Specify request to perform - * @return 0 = DO NOT stop service, return FAIL + * @return 0 = DO RG_NOT stop service, return RG_EFAIL * 1 = STOP service - return whatever it returns. - * 2 = DO NOT stop service, return 0 (success) - * 3 = DO NOT stop service, return RG_EFORWARD - * 4 = DO NOT stop service, return RG_EAGAIN + * 2 = DO RG_NOT stop service, return 0 (success) + * 3 = DO RG_NOT stop service, return RG_EFORWARD + * 4 = DO RG_NOT stop service, return RG_EAGAIN */ int svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req) @@ -436,7 +507,7 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req) } clulog(LOG_DEBUG, "Not stopping %s: service is failed\n", - svcName); + c_name(svcName)); ret = 0; break; @@ -449,23 +520,23 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req) break; case RG_STATE_DISABLED: - ret = 2; case RG_STATE_UNINITIALIZED: if (req == RG_DISABLE) { clulog(LOG_NOTICE, "Disabling disabled service %s\n", - svcName); + c_name(svcName)); ret = 1; break; } + ret = 2; clulog(LOG_DEBUG, "Not stopping disabled service %s\n", - svcName); + c_name(svcName)); break; default: clulog(LOG_ERR, - "#42: Cannot stop RG %s: Invalid State %d\n", + "#42: Cannot stop %s: Invalid State %d\n", svcName, svcStatus->rs_state); break; } @@ -483,11 +554,11 @@ svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req) * @param svcName Service name * @param flags Specify whether or not it's legal to start a * disabled service, etc. - * @return 0 = DO NOT start service, return FAIL + * @return 0 = DO RG_NOT start service, return RG_EFAIL * 1 = START service - return whatever it returns. - * 2 = DO NOT start service, return 0 - * 3 = DO NOT start service, return RG_EAGAIN - * 4 = DO NOT start servuce, return RG_ERUN + * 2 = DO RG_NOT start service, return 0 + * 3 = DO RG_NOT start service, return RG_EAGAIN + * 4 = DO RG_NOT start servuce, return RG_ERUN */ int svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) @@ -502,7 +573,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) case RG_STATE_FAILED: clulog(LOG_ERR, "#43: Service %s has failed; can not start.\n", - svcName); + c_name(svcName)); break; case RG_STATE_STOPPING: @@ -513,7 +584,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) /* * Service is already running locally clulog(LOG_DEBUG, - "RG %s is already running locally\n", svcName); + "%s is already running locally\n", svcName); */ ret = 4; break; @@ -523,7 +594,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) memb_online(membership, svcStatus->rs_owner)) { /* * Service is running and the owner is online! - clulog(LOG_DEBUG, "RG %s is running on member %s.\n", + clulog(LOG_DEBUG, "%s is running on member %s.\n", svcName, memb_id_to_name(membership,svcStatus->rs_owner)); */ @@ -541,7 +612,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) clulog(LOG_NOTICE, "Starting stopped service %s\n", - svcName); + c_name(svcName)); ret = 1; break; } @@ -554,7 +625,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) } /* - * Service is running but owner is down -> FAILOVER + * Service is running but owner is down -> RG_EFAILOVER */ fd = ccs_connect(); if (fd > 0) { @@ -568,7 +639,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) clulog(LOG_NOTICE, "Taking over service %s from down member %s\n", - svcName, nodename); + c_name(svcName), nodename); ret = 1; break; @@ -576,10 +647,10 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) /* * Starting failed service... */ - if (req == RG_START_RECOVER) { + if (req == RG_START_RECOVER || central_events_enabled()) { clulog(LOG_NOTICE, "Recovering failed service %s\n", - svcName); + c_name(svcName)); svcStatus->rs_state = RG_STATE_STOPPED; /* Start! */ ret = 1; @@ -589,7 +660,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) /* Don't start, but return success. */ clulog(LOG_DEBUG, "Not starting %s: recovery state\n", - svcName); + c_name(svcName)); ret = 2; break; @@ -602,13 +673,13 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) } clulog(LOG_NOTICE, "Starting stopped service %s\n", - svcName); + c_name(svcName)); ret = 1; break; case RG_STATE_DISABLED: case RG_STATE_UNINITIALIZED: - if (req == RG_ENABLE) { + if (req == RG_ENABLE || req == RG_START_REMOTE) { /* Don't actually enable if the RG is locked! */ if (rg_locked()) { ret = 3; @@ -617,7 +688,7 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) clulog(LOG_NOTICE, "Starting disabled service %s\n", - svcName); + c_name(svcName)); ret = 1; break; } @@ -626,13 +697,13 @@ svc_advise_start(rg_state_t *svcStatus, char *svcName, int req) break; } - clulog(LOG_DEBUG, "Not starting disabled RG %s\n", + clulog(LOG_DEBUG, "Not starting disabled %s\n", svcName); break; default: clulog(LOG_ERR, - "#44: Cannot start RG %s: Invalid State %d\n", + "#44: Cannot start %s: Invalid State %d\n", svcName, svcStatus->rs_state); break; } @@ -671,7 +742,7 @@ svc_start(char *svcName, int req) } if (get_rg_state(svcName, &svcStatus) != 0) { - clulog(LOG_ERR, "#46: Failed getting status for RG %s\n", + clulog(LOG_ERR, "#46: Failed getting status for %s\n", svcName); goto out_unlock; } @@ -693,7 +764,7 @@ svc_start(char *svcName, int req) /* LOCK HELD */ switch (svc_advise_start(&svcStatus, svcName, req)) { - case 0: /* Don't start service, return FAIL */ + case 0: /* Don't start service, return RG_EFAIL */ goto out_unlock; case 2: /* Don't start service, return 0 */ ret = 0; @@ -709,15 +780,19 @@ svc_start(char *svcName, int req) } /* LOCK HELD if we get here */ + if (req == RG_START_RECOVER || + svcStatus.rs_state == RG_STATE_RECOVER) { + if (!central_events_enabled()) + add_restart(svcName); + svcStatus.rs_restarts++; + } else { + svcStatus.rs_restarts = 0; + } + svcStatus.rs_owner = my_id(); svcStatus.rs_state = RG_STATE_STARTING; svcStatus.rs_transition = (uint64_t)time(NULL); - if (req == RG_START_RECOVER) - svcStatus.rs_restarts++; - else - svcStatus.rs_restarts = 0; - if (set_rg_state(svcName, &svcStatus) != 0) { clulog(LOG_ERR, "#47: Failed changing service status\n"); @@ -753,14 +828,18 @@ svc_start(char *svcName, int req) goto out_unlock; } - if (ret == 0) + if (ret == 0) { clulog(LOG_NOTICE, "Service %s started\n", - svcName); - else + c_name(svcName)); + + broadcast_event(svcName, RG_STATE_STARTED, svcStatus.rs_owner, + svcStatus.rs_last_owner); + } else { clulog(LOG_WARNING, "#68: Failed to start %s; return value: %d\n", svcName, ret); + } out_unlock: rg_unlock(svcName, lockp); @@ -775,7 +854,7 @@ out_nolock: * Check status of a cluster service * * @param svcName Service name to check. - * @return RG_EFORWARD, FAIL, 0 + * @return RG_EFORWARD, RG_EFAIL, 0 */ int svc_status(char *svcName) @@ -786,24 +865,24 @@ svc_status(char *svcName) if (rg_lock(svcName, &lockp) < 0) { clulog(LOG_ERR, "#48: Unable to obtain cluster lock: %s\n", strerror(errno)); - return FAIL; + return RG_EFAIL; } if (get_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); - clulog(LOG_ERR, "#49: Failed getting status for RG %s\n", + clulog(LOG_ERR, "#49: Failed getting status for %s\n", svcName); - return FAIL; + return RG_EFAIL; } rg_unlock(svcName, lockp); if (svcStatus.rs_owner != my_id()) /* Don't check status for anything not owned */ - return SUCCESS; + return RG_ESUCCESS; if (svcStatus.rs_state != RG_STATE_STARTED) /* Not-running RGs should not be checked either. */ - return SUCCESS; + return RG_ESUCCESS; return group_op(svcName, RG_STATUS); } @@ -831,28 +910,28 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate) return group_op(svcName, RG_STOP); } - if (rg_lock(svcName, &lockp) == FAIL) { + if (rg_lock(svcName, &lockp) == RG_EFAIL) { clulog(LOG_ERR, "#50: Unable to obtain cluster lock: %s\n", strerror(errno)); - return FAIL; + return RG_EFAIL; } if (get_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); - clulog(LOG_ERR, "#51: Failed getting status for RG %s\n", + clulog(LOG_ERR, "#51: Failed getting status for %s\n", svcName); - return FAIL; + return RG_EFAIL; } switch (svc_advise_stop(&svcStatus, svcName, req)) { case 0: rg_unlock(svcName, lockp); - clulog(LOG_DEBUG, "Unable to stop RG %s in %s state\n", + clulog(LOG_DEBUG, "Unable to stop %s in %s state\n", svcName, rg_state_str(svcStatus.rs_state)); - return FAIL; + return RG_EFAIL; case 2: rg_unlock(svcName, lockp); - return SUCCESS; + return RG_ESUCCESS; case 3: rg_unlock(svcName, lockp); return RG_EFORWARD; @@ -865,7 +944,20 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate) old_state = svcStatus.rs_state; - clulog(LOG_NOTICE, "Stopping service %s\n", svcName); + if (old_state == RG_STATE_RECOVER) { + clulog(LOG_DEBUG, "%s is clean; skipping double-stop\n", + svcName); + svcStatus.rs_state = newstate; + + if (set_rg_state(svcName, &svcStatus) != 0) { + clulog(LOG_ERR, "#52: Failed changing RG status\n"); + return RG_EFAIL; + } + rg_unlock(svcName, lockp); + return 0; + } + + clulog(LOG_NOTICE, "Stopping service %s\n", c_name(svcName)); if (recover) svcStatus.rs_state = RG_STATE_ERROR; @@ -878,7 +970,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate) if (set_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); clulog(LOG_ERR, "#52: Failed changing RG status\n"); - return FAIL; + return RG_EFAIL; } rg_unlock(svcName, lockp); @@ -890,6 +982,7 @@ _svc_stop(char *svcName, int req, int recover, uint32_t newstate) "but some resources may still be allocated!\n", svcName); _svc_stop_finish(svcName, 0, newstate); + ret = 0; } else { _svc_stop_finish(svcName, ret, newstate); } @@ -904,17 +997,17 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate) rg_state_t svcStatus; void *lockp; - if (rg_lock(svcName, &lockp) == FAIL) { + if (rg_lock(svcName, &lockp) == RG_EFAIL) { clulog(LOG_ERR, "#53: Unable to obtain cluster lock: %s\n", strerror(errno)); - return FAIL; + return RG_EFAIL; } if (get_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); - clulog(LOG_ERR, "#54: Failed getting status for RG %s\n", + clulog(LOG_ERR, "#54: Failed getting status for %s\n", svcName); - return FAIL; + return RG_EFAIL; } if ((svcStatus.rs_state != RG_STATE_STOPPING) && @@ -927,7 +1020,7 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate) svcStatus.rs_owner = NODE_ID_NONE; if (failed) { - clulog(LOG_CRIT, "#12: RG %s failed to stop; intervention " + clulog(LOG_CRIT, "#12: %s failed to stop; intervention " "required\n", svcName); svcStatus.rs_state = RG_STATE_FAILED; } else if (svcStatus.rs_state == RG_STATE_ERROR) @@ -935,7 +1028,7 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate) else svcStatus.rs_state = newstate; - clulog(LOG_NOTICE, "Service %s is %s\n", svcName, + clulog(LOG_NOTICE, "Service %s is %s\n", c_name(svcName), rg_state_str(svcStatus.rs_state)); //printf("rg state = %s\n", rg_state_str(svcStatus.rs_state)); @@ -943,10 +1036,12 @@ _svc_stop_finish(char *svcName, int failed, uint32_t newstate) if (set_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); clulog(LOG_ERR, "#55: Failed changing RG status\n"); - return FAIL; + return RG_EFAIL; } rg_unlock(svcName, lockp); + broadcast_event(svcName, svcStatus.rs_state, NODE_ID_NONE, svcStatus.rs_last_owner); + return 0; } @@ -986,27 +1081,27 @@ svc_fail(char *svcName) void *lockp = NULL; rg_state_t svcStatus; - if (rg_lock(svcName, &lockp) == FAIL) { + if (rg_lock(svcName, &lockp) == RG_EFAIL) { clulog(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n", strerror(errno)); - return FAIL; + return RG_EFAIL; } - clulog(LOG_DEBUG, "Handling failure request for RG %s\n", svcName); + clulog(LOG_DEBUG, "Handling failure request for %s\n", svcName); if (get_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); - clulog(LOG_ERR, "#56: Failed getting status for RG %s\n", + clulog(LOG_ERR, "#56: Failed getting status for %s\n", svcName); - return FAIL; + return RG_EFAIL; } if ((svcStatus.rs_state == RG_STATE_STARTED) && (svcStatus.rs_owner != my_id())) { rg_unlock(svcName, lockp); - clulog(LOG_DEBUG, "Unable to disable RG %s in %s state\n", + clulog(LOG_DEBUG, "Unable to disable %s in %s state\n", svcName, rg_state_str(svcStatus.rs_state)); - return FAIL; + return RG_EFAIL; } /* @@ -1022,10 +1117,13 @@ svc_fail(char *svcName) if (set_rg_state(svcName, &svcStatus) != 0) { rg_unlock(svcName, lockp); clulog(LOG_ERR, "#57: Failed changing RG status\n"); - return FAIL; + return RG_EFAIL; } rg_unlock(svcName, lockp); + broadcast_event(svcName, RG_STATE_FAILED, NODE_ID_NONE, + svcStatus.rs_last_owner); + return 0; } @@ -1033,8 +1131,8 @@ svc_fail(char *svcName) /* * Send a message to the target node to start the service. */ -static int -relocate_service(char *svcName, int request, uint64_t target) +int +svc_start_remote(char *svcName, int request, uint64_t target) { SmMessageSt msg_relo; int fd_relo, msg_ret; @@ -1043,6 +1141,7 @@ relocate_service(char *svcName, int request, uint64_t target) /* Build the message header */ msg_relo.sm_hdr.gh_magic = GENERIC_HDR_MAGIC; msg_relo.sm_hdr.gh_command = RG_ACTION_REQUEST; + msg_relo.sm_hdr.gh_arg1 = RG_ACTION_MASTER; msg_relo.sm_hdr.gh_length = sizeof (SmMessageSt); msg_relo.sm_data.d_action = request; strncpy(msg_relo.sm_data.d_svcName, svcName, @@ -1065,13 +1164,13 @@ relocate_service(char *svcName, int request, uint64_t target) if (msg_send(fd_relo, &msg_relo, sizeof (SmMessageSt)) != sizeof (SmMessageSt)) { clulog(LOG_ERR, - "#59: Error sending relocate request to member #%d\n", + "#59: Error sending remote start request to member #%d\n", target); msg_close(fd_relo); return -1; } - clulog(LOG_DEBUG, "Sent relocate request to %d\n", (int)target); + clulog(LOG_DEBUG, "Sent remote start request to %d\n", (int)target); /* Check the response */ do { @@ -1088,7 +1187,7 @@ relocate_service(char *svcName, int request, uint64_t target) clulog(LOG_WARNING, "#XX: Cancelling relocation: Shutting down\n"); msg_close(fd_relo); - return NO; + return RG_NO; } /* Check for node transition in the middle of a relocate */ @@ -1101,7 +1200,7 @@ relocate_service(char *svcName, int request, uint64_t target) "#XX: Cancelling relocation: Target node down\n"); cml_free(ml); msg_close(fd_relo); - return FAIL; + return RG_EFAIL; } while (1); if (msg_ret != sizeof (SmMessageSt)) { @@ -1109,7 +1208,7 @@ relocate_service(char *svcName, int request, uint64_t target) * In this case, we don't restart the service, because the * service state is actually unknown to us at this time. */ - clulog(LOG_ERR, "#60: Mangled reply from member #%d during RG " + clulog(LOG_ERR, "#60: Mangled reply from member #%d during " "relocate\n", target); msg_close(fd_relo); return 0; /* XXX really UNKNOWN */ @@ -1138,7 +1237,7 @@ relocate_service(char *svcName, int request, uint64_t target) * management software, a destination node * is sent as well. This causes us to try * starting the service on that node *first*, - * but does NOT GUARANTEE that the service + * but does RG_NOT GUARANTEE that the service * will end up on that node. It will end up * on whatever node actually successfully * starts it. @@ -1148,24 +1247,51 @@ int handle_relocate_req(char *svcName, int request, uint64_t preferred_target, uint64_t *new_owner) { - cluster_member_list_t *allowed_nodes, *backup = NULL; - uint64_t target = preferred_target, me = my_id(); - int ret, x, tried = 0; + cluster_member_list_t *allowed_nodes = NULL, *backup = NULL; + cluster_member_t *m; + int target = preferred_target, me = my_id(); + int ret, x; + rg_state_t svcStatus; + get_rg_state_local(svcName, &svcStatus); + if (svcStatus.rs_state == RG_STATE_DISABLED || + svcStatus.rs_state == RG_STATE_UNINITIALIZED) + return RG_EINVAL; + + if (preferred_target > 0) { + /* TODO: simplify this and don't keep alloc/freeing + member lists */ + allowed_nodes = member_list(); + /* Avoid even bothering the other node if we can */ + m = memb_id_to_p(allowed_nodes, preferred_target); + if (!m) { + cml_free(allowed_nodes); + return RG_EINVAL; + } + + count_resource_groups_local(m); + if (m->cm_svcexcl || + (m->cm_svccount && is_exclusive(svcName))) { + cml_free(allowed_nodes); + return RG_EDEPEND; + } + cml_free(allowed_nodes); + } + /* * Stop the service - if we haven't already done so. */ if (request != RG_START_RECOVER) { ret = _svc_stop(svcName, request, 0, RG_STATE_STOPPED); - if (ret == FAIL) { + if (ret == RG_EFAIL) { svc_fail(svcName); - return FAIL; + return RG_EFAIL; } if (ret == RG_EFORWARD) return RG_EFORWARD; } - if (preferred_target != NODE_ID_NONE) { + if (preferred_target > 0) { allowed_nodes = member_list(); /* @@ -1181,7 +1307,7 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, allowed_nodes->cml_members[x].cm_id == preferred_target) continue; - allowed_nodes->cml_members[x].cm_state = STATE_DOWN; + allowed_nodes->cml_members[x].cm_state = 0; } /* @@ -1198,9 +1324,10 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, * I am the ONLY one capable of running this service, * PERIOD... */ - if (target == me && me != preferred_target) + if (target == me && me != preferred_target) { + cml_free(backup); goto exhausted; - + } if (target == me) { /* @@ -1216,8 +1343,7 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, * It's legal to start the service on the given * node. Try to do so. */ - ++tried; - if (relocate_service(svcName, request, target) == 0) { + if (svc_start_remote(svcName, request, target) == 0) { *new_owner = target; /* * Great! We're done... @@ -1238,7 +1364,7 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, //count_resource_groups(allowed_nodes); } - if (preferred_target != NODE_ID_NONE) + if (preferred_target > 0) memb_mark_down(allowed_nodes, preferred_target); memb_mark_down(allowed_nodes, me); @@ -1247,36 +1373,41 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, if (target == me) goto exhausted; - ++tried; - - /* Each node gets one try */ - memb_mark_down(allowed_nodes, target); - switch (relocate_service(svcName, request, target)) { + ret = svc_start_remote(svcName, request, target); + switch (ret) { + case RG_ERUN: + /* Someone stole the service while we were + trying to relo it */ + get_rg_state_local(svcName, &svcStatus); + *new_owner = svcStatus.rs_owner; + cml_free(allowed_nodes); + return 0; + case RG_EDEPEND: case RG_EFAIL: + memb_mark_down(allowed_nodes, target); continue; case RG_EABORT: svc_report_failure(svcName); cml_free(allowed_nodes); - return FAIL; - case NO: + return RG_EFAIL; + default: + /* deliberate fallthrough */ + clulog(LOG_ERR, + "#61: Invalid reply from member %d during" + " relocate operation!\n", target); + case RG_NO: /* state uncertain */ cml_free(allowed_nodes); - clulog(LOG_DEBUG, "State Uncertain: svc:%s " - "nid:%08x%08x req:%d\n", svcName, - (uint32_t)(target>>32)&0xffffffff, - (uint32_t)(target&0xffffffff), request); + clulog(LOG_CRIT, "State Uncertain: svc:%s " + "nid:%d req:%s ret:%d\n", svcName, + target, rg_req_str(request), ret); return 0; case 0: + *new_owner = target; clulog(LOG_NOTICE, "Service %s is now running " "on member %d\n", svcName, (int)target); - case RG_ERUN: - *new_owner = target; cml_free(allowed_nodes); return 0; - default: - clulog(LOG_ERR, - "#61: Invalid reply from member %d during" - " relocate operation!\n", target); } } cml_free(allowed_nodes); @@ -1285,8 +1416,10 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, * We got sent here from handle_start_req. * We're DONE. */ - if (request == RG_START_RECOVER) - return FAIL; + if (request == RG_START_RECOVER) { + _svc_stop_finish(svcName, 0, RG_STATE_STOPPED); + return RG_EFAIL; + } /* * All potential places for the service to start have been exhausted. @@ -1294,13 +1427,12 @@ handle_relocate_req(char *svcName, int request, uint64_t preferred_target, */ exhausted: if (!rg_locked()) { - if (tried) - clulog(LOG_WARNING, - "#70: Attempting to restart service %s locally.\n", - svcName); + clulog(LOG_WARNING, + "#70: Failed to relocate %s; restarting locally\n", + svcName); if (svc_start(svcName, RG_START_RECOVER) == 0) { *new_owner = me; - return FAIL; + return RG_EFAIL; } } @@ -1309,7 +1441,8 @@ exhausted: svc_report_failure(svcName); } - return FAIL; + return RG_EFAIL; + } @@ -1328,7 +1461,7 @@ handle_fd_start_req(char *svcName, int request, uint64_t *new_owner) if (target == me) { ret = handle_start_remote_req(svcName, request); } else { - ret = relocate_service(svcName, request, target); + ret = svc_start_remote(svcName, request, target); } switch (ret) { @@ -1340,11 +1473,11 @@ handle_fd_start_req(char *svcName, int request, uint64_t *new_owner) case RG_EABORT: svc_report_failure(svcName); cml_free(allowed_nodes); - return FAIL; - case NO: + return RG_EFAIL; + case RG_NO: /* state uncertain */ cml_free(allowed_nodes); - clulog(LOG_DEBUG, "State Uncertain: svc:%s " + clulog(LOG_DEBUG, "State Uncertain: %s " "nid:%08x%08x req:%d\n", svcName, (uint32_t)(target>>32)&0xffffffff, (uint32_t)(target&0xffffffff), request); @@ -1352,7 +1485,8 @@ handle_fd_start_req(char *svcName, int request, uint64_t *new_owner) case 0: *new_owner = target; clulog(LOG_NOTICE, "Service %s is now running " - "on member %d\n", svcName, (int)target); + "on member %d\n", c_name(svcName), + (int)target); cml_free(allowed_nodes); return 0; default: @@ -1395,7 +1529,7 @@ handle_start_req(char *svcName, int req, uint64_t *new_owner) (node_should_start_safe(my_id(), membership, svcName) < tolerance)) { cml_free(membership); - return FAIL; + return RG_EFAIL; } cml_free(membership); @@ -1416,22 +1550,22 @@ handle_start_req(char *svcName, int req, uint64_t *new_owner) /* If service is already running, return that value */ return ret; - case SUCCESS: + case RG_ESUCCESS: /* If we succeeded, then we're done. */ *new_owner = my_id(); - case NO: - return SUCCESS; + case RG_NO: + return RG_ESUCCESS; } /* * Keep the state open so the other nodes don't try to start * it. This allows us to be the 'root' of a given service. */ - clulog(LOG_DEBUG, "Stopping failed service %s\n", svcName); + clulog(LOG_DEBUG, "Stopping failed service %s\n", c_name(svcName)); if (svc_stop(svcName, RG_STOP_RECOVER) != 0) { clulog(LOG_CRIT, "#13: Service %s failed to stop cleanly\n", - svcName); + c_name(svcName)); (void) svc_fail(svcName); /* @@ -1447,13 +1581,13 @@ handle_start_req(char *svcName, int req, uint64_t *new_owner) * we should relocate the service. */ clulog(LOG_WARNING, "#71: Relocating failed service %s\n", - svcName); + c_name(svcName)); relocate: ret = handle_relocate_req(svcName, RG_START_RECOVER, -1, new_owner); /* If we leave the service stopped, instead of disabled, someone will try to start it after the next node transition */ - if (ret == FAIL) { + if (ret == RG_EFAIL) { if (svc_stop(svcName, RG_STOP) != 0) { svc_fail(svcName); svc_report_failure(svcName); @@ -1498,7 +1632,7 @@ handle_start_remote_req(char *svcName, int req) */ if (node_should_start_safe(me, membership, svcName) < tolerance){ cml_free(membership); - return FAIL; + return RG_EFAIL; } cml_free(membership); @@ -1508,7 +1642,8 @@ handle_start_remote_req(char *svcName, int req) /* Don't relocate from here; it was a remote start */ /* Return fail so the other node can go ahead and try the other nodes in the cluster */ - case NO: + return RG_ERELO; + case RG_NO: return RG_EFAIL; case RG_EAGAIN: @@ -1519,9 +1654,9 @@ handle_start_remote_req(char *svcName, int req) /* If service is already running, return that value */ return x; - case SUCCESS: + case RG_ESUCCESS: /* If we succeeded, then we're done. */ - return SUCCESS; + return RG_ESUCCESS; } if (svc_stop(svcName, RG_STOP_RECOVER) == 0) @@ -1545,7 +1680,17 @@ handle_recover_req(char *svcName, uint64_t *new_owner) if (!strcasecmp(policy, "disable")) { return svc_disable(svcName); } else if (!strcasecmp(policy, "relocate")) { - return handle_relocate_req(svcName, RG_START_RECOVER, -1, + return handle_relocate_req(svcName, RG_START_RECOVER, + NODE_ID_NONE, + new_owner); + } + + /* Check restart counter/timer for this resource */ + if (check_restart(svcName) > 0) { + clulog(LOG_NOTICE, "Restart threshold for %s exceeded; " + "attempting to relocate\n", svcName); + return handle_relocate_req(svcName, RG_START_RECOVER, + NODE_ID_NONE, new_owner); } diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c index 0e7750d..e96982b 100644 --- a/rgmanager/src/daemons/rg_thread.c +++ b/rgmanager/src/daemons/rg_thread.c @@ -391,6 +391,11 @@ resgroup_thread_main(void *arg) error = svc_stop(myname, RG_STOP_RECOVER); if (error == 0) { + if (central_events_enabled()) { + ret = RG_SUCCESS; + break; + } + error = handle_recover_req(myname, &newowner); if (error == 0) ret = RG_SUCCESS; diff --git a/rgmanager/src/daemons/service_op.c b/rgmanager/src/daemons/service_op.c new file mode 100644 index 0000000..6705a5f --- /dev/null +++ b/rgmanager/src/daemons/service_op.c @@ -0,0 +1,207 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * Send a message to the target node to start the service. + */ +int svc_start_remote(char *svcName, int request, uint64_t target); +void svc_report_failure(char *); +int get_service_state_internal(char *svcName, rg_state_t *svcStatus); + + +/** + * + */ +int +service_op_start(char *svcName, + uint64_t *target_list, + int target_list_len, + uint64_t *new_owner) +{ + int target; + int ret, x; + int excl = 0, dep = 0, fail = 0; + rg_state_t svcStatus; + + if (get_service_state_internal(svcName, &svcStatus) < 0) { + return RG_EFAIL; + } + + if (svcStatus.rs_state == RG_STATE_FAILED || + svcStatus.rs_state == RG_STATE_UNINITIALIZED) + return RG_EINVAL; + + if (svcStatus.rs_state == RG_STATE_RECOVER) + add_restart(svcName); + + for (x = 0; x < target_list_len; x++) { + + target = target_list[x]; + ret = svc_start_remote(svcName, RG_START_REMOTE, + target); + switch (ret) { + case RG_ERUN: + /* Someone stole the service while we were + trying to start it */ + get_rg_state_local(svcName, &svcStatus); + if (new_owner) + *new_owner = svcStatus.rs_owner; + return 0; + case RG_EEXCL: + ++excl; + continue; + case RG_EDEPEND: + case RG_ERELO: + ++dep; + continue; + case RG_EFAIL: + ++fail; + continue; + case RG_EABORT: + svc_report_failure(svcName); + return RG_EFAIL; + default: + /* deliberate fallthrough */ + clulog(LOG_ERR, + "#61: Invalid reply from member %d during" + " start operation!\n", target); + case RG_NO: + /* state uncertain */ + clulog(LOG_CRIT, "State Uncertain: svc:%s " + "nid:%d req:%s ret:%s\n", svcName, + target, rg_req_str(RG_START_REMOTE), rg_strerror(ret)); + return 0; + case 0: + if (new_owner) + *new_owner = target; + clulog(LOG_NOTICE, "Service %s is now running " + "on member %d\n", svcName, (int)target); + return 0; + } + } + + ret = RG_EFAIL; + if (excl == target_list_len) + ret = RG_EEXCL; + else if (dep == target_list_len) + ret = RG_EDEPEND; + + clulog(LOG_INFO, "Start failed; node reports: %d failures, " + "%d exclusive, %d dependency errors\n", fail, excl, dep); + return ret; +} + + +int +service_op_stop(char *svcName, int do_disable, int event_type) +{ + SmMessageSt msg; + int msg_ret; + int fd; + rg_state_t svcStatus; + uint64_t msgtarget = my_id(); + + /* Build the message header */ + msg.sm_hdr.gh_magic = GENERIC_HDR_MAGIC; + msg.sm_hdr.gh_command = RG_ACTION_REQUEST; + msg.sm_hdr.gh_arg1 = RG_ACTION_MASTER; + msg.sm_hdr.gh_length = sizeof (SmMessageSt); + + msg.sm_data.d_action = ((!do_disable) ? RG_STOP:RG_DISABLE); + + if (msg.sm_data.d_action == RG_STOP && event_type == EVENT_USER) + msg.sm_data.d_action = RG_STOP_USER; + + strncpy(msg.sm_data.d_svcName, svcName, + sizeof(msg.sm_data.d_svcName)); + msg.sm_data.d_ret = 0; + msg.sm_data.d_svcOwner = 0; + + /* Open a connection to the local node - it will decide what to + do in this case. XXX inefficient; should queue requests + locally and immediately forward requests otherwise */ + + if (get_service_state_internal(svcName, &svcStatus) < 0) + return RG_EFAIL; + if (svcStatus.rs_owner != NODE_ID_NONE) + msgtarget = svcStatus.rs_owner; + + if ((fd = msg_open(msgtarget, RG_PORT, RG_PURPOSE, 2)) < 0) { + clulog(LOG_ERR, + "#58: Failed opening connection to member #%d\n", + msgtarget); + return -1; + } + + /* Encode */ + swab_SmMessageSt(&msg); + + /* Send stop message to the other node */ + if (msg_send(fd, &msg, sizeof (SmMessageSt)) < + (int)sizeof (SmMessageSt)) { + clulog(LOG_ERR, "Failed to send complete message\n"); + msg_close(fd); + return -1; + } + + /* Check the response */ + do { + msg_ret = msg_receive_timeout(fd, &msg, + sizeof (SmMessageSt), 10); + if ((msg_ret == -1 && errno != ETIMEDOUT) || + (msg_ret > 0)) { + break; + } + } while(1); + + if (msg_ret != sizeof (SmMessageSt)) { + clulog(LOG_WARNING, "Strange response size: %d vs %d\n", + msg_ret, (int)sizeof(SmMessageSt)); + return 0; /* XXX really UNKNOWN */ + } + + /* Got a valid response from other node. */ + msg_close(fd); + + /* Decode */ + swab_SmMessageSt(&msg); + + return msg.sm_data.d_ret; +} + + +/* + TODO + service_op_migrate() + */ + diff --git a/rgmanager/src/daemons/slang_event.c b/rgmanager/src/daemons/slang_event.c new file mode 100644 index 0000000..d3a522b --- /dev/null +++ b/rgmanager/src/daemons/slang_event.c @@ -0,0 +1,1286 @@ +/* + Copyright Red Hat, Inc. 2007 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 as published + by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/** + @file S/Lang event handling & intrinsic functions + vars + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static int __sl_initialized = 0; + +static char **_service_list = NULL; +static int _service_list_len = 0; + +char **get_service_names(int *len); /* from groups.c */ +int get_service_property(char *rg_name, char *prop, char *buf, size_t buflen); +void push_int_array(set_type_t *stuff, int len); + + +/* ================================================================ + * Node states + * ================================================================ */ +static const int + _ns_online = 1, + _ns_offline = 0; + +/* ================================================================ + * Event information + * ================================================================ */ +static const int + _ev_none = EVENT_NONE, + _ev_node = EVENT_NODE, + _ev_service = EVENT_RG, + _ev_config = EVENT_CONFIG, + _ev_user = EVENT_USER; + +static const int + _rg_fail = RG_EFAIL, + _rg_success = RG_ESUCCESS, + _rg_edomain = RG_EDOMAIN, + _rg_edepend = RG_EDEPEND, + _rg_eabort = RG_EABORT, + _rg_einval = RG_EINVAL, + _rg_erun = RG_ERUN; + +static int + _stop_processing = 0, + _my_node_id = 0, + _node_state = 0, + _node_id = 0, + _node_clean = 0, + _service_owner = 0, + _service_last_owner = 0, + _service_restarts_exceeded = 0, + _user_request = 0, + _user_arg1 = 0, + _user_arg2 = 0, + _user_return = 0, + _rg_err = 0, + _event_type = 0; + +static char + *_node_name = NULL, + *_service_name = NULL, + *_service_state = NULL, + *_rg_err_str = "No Error"; + +static int + _user_enable = RG_ENABLE, + _user_disable = RG_DISABLE, + _user_stop = RG_STOP_USER, /* From clusvcadm */ + _user_relo = RG_RELOCATE, + _user_restart = RG_RESTART; + + +SLang_Intrin_Var_Type rgmanager_vars[] = +{ + /* Log levels (constants) */ + + /* Node state information */ + MAKE_VARIABLE("NODE_ONLINE", &_ns_online, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("NODE_OFFLINE", &_ns_offline, SLANG_INT_TYPE, 1), + + /* Node event information */ + MAKE_VARIABLE("node_self", &_my_node_id, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("node_state", &_node_state, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("node_id", &_node_id, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("node_name", &_node_name, SLANG_STRING_TYPE,1), + MAKE_VARIABLE("node_clean", &_node_clean, SLANG_INT_TYPE, 1), + + /* Service event information */ + MAKE_VARIABLE("service_name", &_service_name, SLANG_STRING_TYPE,1), + MAKE_VARIABLE("service_state", &_service_state,SLANG_STRING_TYPE,1), + MAKE_VARIABLE("service_owner", &_service_owner,SLANG_INT_TYPE, 1), + MAKE_VARIABLE("service_last_owner", &_service_last_owner, + SLANG_INT_TYPE, 1), + MAKE_VARIABLE("service_restarts_exceeded", &_service_restarts_exceeded, + SLANG_INT_TYPE, 1), + + /* User event information */ + MAKE_VARIABLE("user_request", &_user_request, SLANG_INT_TYPE,1), + MAKE_VARIABLE("user_arg1", &_user_arg1, SLANG_INT_TYPE,1), + MAKE_VARIABLE("user_arg2", &_user_arg2, SLANG_INT_TYPE,1), + MAKE_VARIABLE("user_service", &_service_name, SLANG_STRING_TYPE,1), + MAKE_VARIABLE("user_target", &_service_owner,SLANG_INT_TYPE, 1), + /* Return code to user requests; i.e. clusvcadm */ + MAKE_VARIABLE("user_return", &_user_return, SLANG_INT_TYPE, 0), + + /* General event information */ + MAKE_VARIABLE("event_type", &_event_type, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("EVENT_NONE", &_ev_none, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("EVENT_NODE", &_ev_node, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("EVENT_CONFIG", &_ev_config, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("EVENT_SERVICE", &_ev_service, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("EVENT_USER", &_ev_user, SLANG_INT_TYPE, 1), + + /* User request constants */ + MAKE_VARIABLE("USER_ENABLE", &_user_enable, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("USER_DISABLE", &_user_disable, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("USER_STOP", &_user_stop, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("USER_RELOCATE", &_user_relo, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("USER_RESTART", &_user_restart, SLANG_INT_TYPE, 1), + + /* Errors */ + MAKE_VARIABLE("rg_error", &_rg_err, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("rg_error_string",&_rg_err_str, SLANG_STRING_TYPE,1), + + /* From constants.c */ + MAKE_VARIABLE("FAIL", &_rg_fail, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("SUCCESS", &_rg_success, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("ERR_ABORT", &_rg_eabort, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("ERR_INVALID", &_rg_einval, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("ERR_DEPEND", &_rg_edepend, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("ERR_DOMAIN", &_rg_edomain, SLANG_INT_TYPE, 1), + MAKE_VARIABLE("ERR_RUNNING", &_rg_erun, SLANG_INT_TYPE, 1), + + SLANG_END_INTRIN_VAR_TABLE +}; + + +#define rg_error(errortype) \ +do { \ + _rg_err = errortype; \ + _rg_err_str = ##errortype; \ +} while(0) + + +int +get_service_state_internal(char *svcName, rg_state_t *svcStatus) +{ + void *lock; + char buf[32]; + + get_rg_state_local(svcName, svcStatus); + if (svcStatus->rs_state == RG_STATE_UNINITIALIZED) { + if (rg_lock(svcName, &lock) < 0) { + errno = ENOLCK; + return -1; + } + + if (get_rg_state(svcName, svcStatus) < 0) { + errno = ENOENT; + rg_unlock(svcName, lock); + return -1; + } + + /* We got a copy from another node - don't flip the state */ + if (svcStatus->rs_transition) { + rg_unlock(svcName, lock); + return 0; + } + + /* Finish initializing the service state */ + svcStatus->rs_transition = (uint64_t)time(NULL); + + if (get_service_property(svcName, "autostart", + buf, sizeof(buf)) == 0) { + if (buf[0] == '0' || !strcasecmp(buf, "no")) { + svcStatus->rs_state = RG_STATE_DISABLED; + } else { + svcStatus->rs_state = RG_STATE_STOPPED; + } + } + + set_rg_state(svcName, svcStatus); + + rg_unlock(svcName, lock); + } + + return 0; +} + + +/* + (restarts, last_owner, owner, state) = get_service_status(servicename) + */ +void +sl_service_status(char *svcName) +{ + rg_state_t svcStatus; + int restarts_exceeded = 0; + char *state_str; + + if (get_service_state_internal(svcName, &svcStatus) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to get status for %s", + __FUNCTION__, + svcName); + return; + } + + restarts_exceeded = check_restart(svcName); + if (SLang_push_integer(restarts_exceeded) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to push restarts_exceeded %s", + __FUNCTION__, + svcName); + return; + } + + if (SLang_push_integer(svcStatus.rs_restarts) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to push restarts for %s", + __FUNCTION__, + svcName); + return; + } + + if (SLang_push_integer((int)(svcStatus.rs_last_owner)) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to push last owner of %s", + __FUNCTION__, + svcName); + return; + } + + switch(svcStatus.rs_state) { + case RG_STATE_DISABLED: + case RG_STATE_STOPPED: + case RG_STATE_FAILED: + case RG_STATE_RECOVER: + case RG_STATE_ERROR: + /* There is no owner for these states. Ever. */ + svcStatus.rs_owner = -1; + } + + if (SLang_push_integer((int)(svcStatus.rs_owner)) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to push owner of %s", + __FUNCTION__, + svcName); + return; + } + + state_str = strdup(rg_state_str(svcStatus.rs_state)); + if (!state_str) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to duplicate state of %s", + __FUNCTION__, + svcName); + return; + } + + if (SLang_push_malloced_string(state_str) < 0) { + SLang_verror(SL_INTRINSIC_ERROR, + "%s: Failed to push state of %s", + __FUNCTION__, + svcName); + //free(state_str); + } +} + + +/** + (nofailback, restricted, ordered, nodelist) = service_domain_info(svcName); + */ +void +sl_domain_info(char *svcName) +{ + set_type_t *nodelist = NULL; + int listlen; + char buf[64]; + int flags = 0; + + if (get_service_property(svcName, "domain", buf, sizeof(buf)) < 0) { + /* no nodes */ + SLang_push_integer(0); + + /* no domain? */ +/* + str = strdup("none"); + if (SLang_push_malloced_string(str) < 0) { + free(state_str); + return; + } +*/ + + /* not ordered */ + SLang_push_integer(0); + /* not restricted */ + SLang_push_integer(0); + /* nofailback not set */ + SLang_push_integer(0); + } + + if (node_domain_set_safe(buf, &nodelist, &listlen, &flags) < 0) { + SLang_push_integer(0); + SLang_push_integer(0); + SLang_push_integer(0); + SLang_push_integer(0); + return; + } + + SLang_push_integer(!!(flags & FOD_NOFAILBACK)); + SLang_push_integer(!!(flags & FOD_RESTRICTED)); + SLang_push_integer(!!(flags & FOD_ORDERED)); + + push_int_array(nodelist, listlen); + free(nodelist); + +/* + str = strdup(buf); + if (SLang_push_malloced_string(str) < 0) { + free(state_str); + return; + } +*/ +} + + +static int +get_int_array(set_type_t **nodelist, int *len) +{ + SLang_Array_Type *a = NULL; + set_type_t *nodes = NULL; + int i; + int t, ret = -1, tmp; + + if (!nodelist || !len) + return -1; + + t = SLang_peek_at_stack(); + if (t == SLANG_INT_TYPE) { + + nodes = malloc(sizeof(set_type_t) * 1); + if (!nodes) + goto out; + if (SLang_pop_integer(&tmp) < 0) + goto out; + + /* XXX gulm? */ + nodes[0] = (uint64_t)tmp; + *len = 1; + ret = 0; + + } else if (t == SLANG_ARRAY_TYPE) { + if (SLang_pop_array_of_type(&a, SLANG_INT_TYPE) < 0) + goto out; + if (a->num_dims > 1) + goto out; + if (a->dims[0] < 0) + goto out; + nodes = malloc(sizeof(set_type_t) * a->dims[0]); + if (!nodes) + goto out; + for (i = 0; i < a->dims[0]; i++) { + SLang_get_array_element(a, &i, &tmp); + /* XXX gulm? */ + nodes[i] = (uint64_t)tmp; + } + + *len = a->dims[0]; + ret = 0; + } + +out: + if (a) + SLang_free_array(a); + if (ret == 0) { + *nodelist = nodes; + } else { + if (nodes) + free(nodes); + } + + return ret; +} + + +/** + get_service_property(service_name, property) + */ +char * +sl_service_property(char *svcName, char *prop) +{ + char buf[96]; + + if (get_service_property(svcName, prop, buf, sizeof(buf)) < 0) + return NULL; + + /* does this work or do I have to push a malloce'd string? */ + return strdup(buf); +} + + +/** + usage: + + stop_service(name, disable_flag); + */ +int +sl_stop_service(void) +{ + char *svcname = NULL; + int nargs, t, ret = -1; + int do_disable = 0; + + nargs = SLang_Num_Function_Args; + + /* Takes one or two args */ + if (nargs <= 0 || nargs > 2) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: Wrong # of args (%d), must be 1 or 2\n", + __FUNCTION__, + nargs); + return -1; + } + + if (nargs == 2) { + t = SLang_peek_at_stack(); + if (t != SLANG_INT_TYPE) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: expected type %d got %d\n", + __FUNCTION__, SLANG_INT_TYPE, t); + goto out; + } + + if (SLang_pop_integer(&do_disable) < 0) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: Failed to pop integer from stack!\n", + __FUNCTION__); + goto out; + } + + --nargs; + } + + if (nargs == 1) { + t = SLang_peek_at_stack(); + if (t != SLANG_STRING_TYPE) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: expected type %d got %d\n", + __FUNCTION__, + SLANG_STRING_TYPE, t); + goto out; + } + + if (SLpop_string(&svcname) < 0) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: Failed to pop string from stack!\n", + __FUNCTION__); + goto out; + } + } + + /* TODO: Meat of function goes here */ + ret = service_op_stop(svcname, do_disable, _event_type); +out: + if (svcname) + free(svcname); + _user_return = ret; + return ret; +} + + +/** + usage: + + start_service(name, ordered_node_list_allowed, + node_list_illegal) + */ +int +sl_start_service(void) +{ + char *svcname = NULL; + set_type_t *pref_list = NULL, *illegal_list = NULL; + int pref_list_len = 0, illegal_list_len = 0; + int nargs, t, ret = -1; + uint64_t newowner; + + nargs = SLang_Num_Function_Args; + + /* Takes one, two, or three */ + if (nargs <= 0 || nargs > 3) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: Wrong # of args (%d), must be 1 or 2\n", + __FUNCTION__, nargs); + return -1; + } + + if (nargs == 3) { + if (get_int_array(&illegal_list, &illegal_list_len) < 0) + goto out; + --nargs; + } + + if (nargs == 2) { + if (get_int_array(&pref_list, &pref_list_len) < 0) + goto out; + --nargs; + } + + if (nargs == 1) { + /* Just get the service name */ + t = SLang_peek_at_stack(); + if (t != SLANG_STRING_TYPE) { + SLang_verror(SL_SYNTAX_ERROR, + "%s: expected type %d got %d\n", + __FUNCTION__, + SLANG_STRING_TYPE, t); + goto out; + } + + if (SLpop_string(&svcname) < 0) + goto out; + } + + /* TODO: Meat of function goes here */ + ret = service_op_start(svcname, pref_list, + pref_list_len, &newowner); + + if (ret == 0 && newowner > 0) + ret = newowner; +out: + if (svcname) + free(svcname); + if (illegal_list) + free(illegal_list); + if (pref_list) + free(pref_list); + _user_return = ret; + return ret; +} + + +/* Take an array of integers given its length and + push it on to the S/Lang stack */ +void +push_int_array(set_type_t *stuff, int len) +{ + int arrlen, x; + SLang_Array_Type *arr; + int i; + + arrlen = len; + arr = SLang_create_array(SLANG_INT_TYPE, 0, NULL, &arrlen, 1); + if (!arr) + return; + + x = 0; + for (x = 0; x < len; x++) { + /* XXX gulm? */ + i = (int) (stuff[x]); + SLang_set_array_element(arr, &x, &i); + } + SLang_push_array(arr, 1); +} + + +/* + Returns an array of rgmanager-visible nodes online. How cool is that? + */ +void +sl_nodes_online(void) +{ + int i, nodecount = 0; + set_type_t *nodes; + + cluster_member_list_t *membership = member_list(); + if (!membership) + return; + nodes = malloc(sizeof(set_type_t) * membership->cml_count); + if (!nodes) + return; + + nodecount = 0; + for (i = 0; i < membership->cml_count; i++) { + if (membership->cml_members[i].cm_state && + membership->cml_members[i].cm_id != 0) { + nodes[nodecount] = membership->cml_members[i].cm_id; + ++nodecount; + } + } + cml_free(membership); + push_int_array(nodes, nodecount); + free(nodes); +} + + +/* + Returns an array of rgmanager-defined services, in type:name format + We allocate/kill this list *once* per event to ensure we don't leak + memory + */ +void +sl_service_list(void) +{ + int svccount = _service_list_len, x = 0; + SLang_Array_Type *svcarray; + + svcarray = SLang_create_array(SLANG_STRING_TYPE, 0, NULL, &svccount, 1); + if (!svcarray) + return; + + for (; x < _service_list_len; x++) + SLang_set_array_element(svcarray, &x, &_service_list[x]); + + SLang_push_array(svcarray, 1); +} + + +/* s_union hook (see sets.c) */ +void +sl_union(void) +{ + set_type_t *arr1 = NULL, *arr2 = NULL, *ret = NULL; + int a1len = 0, a2len = 0, retlen = 0; + int nargs = SLang_Num_Function_Args; + + if (nargs != 2) + return; + + /* Remember: args on the stack are reversed */ + get_int_array(&arr2, &a2len); + get_int_array(&arr1, &a1len); + s_union(arr1, a1len, arr2, a2len, &ret, &retlen); + push_int_array(ret, retlen); + if (arr1) + free(arr1); + if (arr2) + free(arr2); + if (ret) + free(ret); + return; +} + + +/* s_intersection hook (see sets.c) */ +void +sl_intersection(void) +{ + set_type_t *arr1 = NULL, *arr2 = NULL, *ret = NULL; + int a1len = 0, a2len = 0, retlen = 0; + int nargs = SLang_Num_Function_Args; + + if (nargs != 2) + return; + + /* Remember: args on the stack are reversed */ + get_int_array(&arr2, &a2len); + get_int_array(&arr1, &a1len); + s_intersection(arr1, a1len, arr2, a2len, &ret, &retlen); + push_int_array(ret, retlen); + if (arr1) + free(arr1); + if (arr2) + free(arr2); + if (ret) + free(ret); + return; +} + + +/* s_delta hook (see sets.c) */ +void +sl_delta(void) +{ + set_type_t *arr1 = NULL, *arr2 = NULL, *ret = NULL; + int a1len = 0, a2len = 0, retlen = 0; + int nargs = SLang_Num_Function_Args; + + if (nargs != 2) + return; + + /* Remember: args on the stack are reversed */ + get_int_array(&arr2, &a2len); + get_int_array(&arr1, &a1len); + s_delta(arr1, a1len, arr2, a2len, &ret, &retlen); + push_int_array(ret, retlen); + if (arr1) + free(arr1); + if (arr2) + free(arr2); + if (ret) + free(ret); + return; +} + + +/* s_subtract hook (see sets.c) */ +void +sl_subtract(void) +{ + set_type_t *arr1 = NULL, *arr2 = NULL, *ret = NULL; + int a1len = 0, a2len = 0, retlen = 0; + int nargs = SLang_Num_Function_Args; + + if (nargs != 2) + return; + + /* Remember: args on the stack are reversed */ + get_int_array(&arr2, &a2len); + get_int_array(&arr1, &a1len); + s_subtract(arr1, a1len, arr2, a2len, &ret, &retlen); + push_int_array(ret, retlen); + if (arr1) + free(arr1); + if (arr2) + free(arr2); + if (ret) + free(ret); + return; +} + + +/* Shuffle array (see sets.c) */ +void +sl_shuffle(void) +{ + set_type_t *arr1 = NULL; + int a1len = 0; + int nargs = SLang_Num_Function_Args; + + if (nargs != 1) + return; + + /* Remember: args on the stack are reversed */ + get_int_array(&arr1, &a1len); + s_shuffle(arr1, a1len); + push_int_array(arr1, a1len); + if (arr1) + free(arr1); + return; +} + + +/* Converts an int array to a string so we can log it in one shot */ +static int +array_to_string(char *buf, int buflen, set_type_t *array, int arraylen) +{ + char intbuf[16]; + int x, len, remain = buflen; + + memset(intbuf, 0, sizeof(intbuf)); + memset(buf, 0, buflen); + len = snprintf(buf, buflen - 1, "[ "); + if (len == buflen) + return -1; + + remain -= len; + for (x = 0; x < arraylen; x++) { + len = snprintf(intbuf, sizeof(intbuf) - 1, "%d ", (int)array[x]); + remain -= len; + if (remain > 0) { + strncat(buf, intbuf, len); + } else { + return -1; + } + } + + len = snprintf(intbuf, sizeof(intbuf) - 1 , "]"); + remain -= len; + if (remain > 0) { + strncat(buf, intbuf, len); + } else { + return -1; + } + return (buflen - remain); +} + + +/** + Start at the end of the arg list and work backwards, prepending a string. + This does not support standard clulog / printf formattting; rather, we + just allow integers / strings to be mixed on the stack, figure out the + type, convert it to the right type, and prepend it on to our log message + + The last must be a log level, as specified above: + LOG_DEBUG + ... + LOG_EMERG + + This matches up with clulog / syslog mappings in the var table; the above + are constants in the S/Lang interpreter. Any number of arguments may + be provided. Examples are: + + log(LOG_INFO, "String", 1, "string2"); + + Result: String1string2 + + log(LOG_INFO, "String ", 1, " string2"); + + Result: String 1 string2 + + */ +void +sl_clulog(int level) +{ + int t, nargs, len; + //int level; + int s_intval; + char *s_strval; + set_type_t *nodes = NULL; + int nlen = 0; + char logbuf[512]; + char tmp[256]; + int need_free; + int remain = sizeof(logbuf)-2; + + nargs = SLang_Num_Function_Args; + if (nargs < 1) + return; + + memset(logbuf, 0, sizeof(logbuf)); + memset(tmp, 0, sizeof(tmp)); + logbuf[sizeof(logbuf)-1] = 0; + logbuf[sizeof(logbuf)-2] = '\n'; + + while (nargs && (t = SLang_peek_at_stack()) >= 0 && remain) { + switch(t) { + case SLANG_ARRAY_TYPE: + if (get_int_array(&nodes, &nlen) < 0) + return; + len = array_to_string(tmp, sizeof(tmp), + nodes, nlen); + if (len < 0) { + free(nodes); + return; + } + free(nodes); + break; + case SLANG_INT_TYPE: + if (SLang_pop_integer(&s_intval) < 0) + return; + len=snprintf(tmp, sizeof(tmp) - 1, "%d", s_intval); + break; + case SLANG_STRING_TYPE: + need_free = 0; + if (SLpop_string(&s_strval) < 0) + return; + len=snprintf(tmp, sizeof(tmp) - 1, "%s", s_strval); + SLfree(s_strval); + break; + default: + need_free = 0; + len=snprintf(tmp, sizeof(tmp) - 1, + "{UnknownType %d}", t); + break; + } + + --nargs; + + if (len > remain) + return; + remain -= len; + + memcpy(&logbuf[remain], tmp, len); + } + +#if 0 + printf("<%d> %s\n", level, &logbuf[remain]); +#endif + clulog(level, &logbuf[remain]); + return; +} + + +/* Logging functions */ +void +sl_log_debug(void) +{ + sl_clulog(LOG_DEBUG); +} + + +void +sl_log_info(void) +{ + sl_clulog(LOG_INFO); +} + + +void +sl_log_notice(void) +{ + sl_clulog(LOG_NOTICE); +} + + +void +sl_log_warning(void) +{ + sl_clulog(LOG_WARNING); +} + + +void +sl_log_err(void) +{ + sl_clulog(LOG_ERR); +} + + +void +sl_log_crit(void) +{ + sl_clulog(LOG_CRIT); +} + + +void +sl_log_alert(void) +{ + sl_clulog(LOG_ALERT); +} + + +void +sl_log_emerg(void) +{ + sl_clulog(LOG_EMERG); +} + + +void +sl_die(void) +{ + _stop_processing = 1; + return; +} + + +SLang_Intrin_Fun_Type rgmanager_slang[] = +{ + MAKE_INTRINSIC_0("nodes_online", sl_nodes_online, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("service_list", sl_service_list, SLANG_VOID_TYPE), + + MAKE_INTRINSIC_SS("service_property", sl_service_property, + SLANG_STRING_TYPE), + MAKE_INTRINSIC_S("service_domain_info", sl_domain_info, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("service_stop", sl_stop_service, SLANG_INT_TYPE), + MAKE_INTRINSIC_0("service_start", sl_start_service, SLANG_INT_TYPE), + MAKE_INTRINSIC_S("service_status", sl_service_status, + SLANG_VOID_TYPE), + + /* Node list manipulation */ + MAKE_INTRINSIC_0("union", sl_union, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("intersection", sl_intersection, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("delta", sl_delta, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("subtract", sl_subtract, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("shuffle", sl_shuffle, SLANG_VOID_TYPE), + + /* Logging */ + MAKE_INTRINSIC_0("debug", sl_log_debug, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("info", sl_log_info, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("notice", sl_log_notice, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("warning", sl_log_warning, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("err", sl_log_err, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("crit", sl_log_crit, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("alert", sl_log_alert, SLANG_VOID_TYPE), + MAKE_INTRINSIC_0("emerg", sl_log_emerg, SLANG_VOID_TYPE), + + MAKE_INTRINSIC_0("stop_processing", sl_die, SLANG_VOID_TYPE), + + SLANG_END_INTRIN_FUN_TABLE +}; + + +/* Hook for when we generate a script error */ +void +rgmanager_slang_error_hook(char *errstr) +{ + /* Don't just send errstr, because it might contain + "%s" for example which would result in a crash! + plus, we like the newline :) */ + clulog(LOG_ERR, "[S/Lang] %s\n", errstr); + //raise(SIGSTOP); +} + + + +/* ================================================================ + * S/Lang initialization + * ================================================================ */ +int +do_init_slang(void) +{ + SLang_init_slang(); + SLang_init_slfile(); + + if (SLadd_intrin_fun_table(rgmanager_slang, NULL) < 0) + return 1; + if (SLadd_intrin_var_table (rgmanager_vars, NULL) < 0) + return 1; + + /* TODO: Make rgmanager S/Lang conformant. Though, it + might be a poor idea to provide access to all the + S/Lang libs */ + SLpath_set_load_path(RESOURCE_ROOTDIR); + + _my_node_id = my_id(); + __sl_initialized = 1; + + SLang_Error_Hook = rgmanager_slang_error_hook; + + return 0; +} + + +/* + Execute a script / file and return the result to the caller + Log an error if we receive one. + */ +int +do_slang_run(const char *file, const char *script) +{ + int ret = 0; + int tries = 0; + + for (tries = 0; tries < 2; tries++) { + /* XXX This is here because there's a stack leak + that I have not been able to track down */ + SLang_restart(1); + SLang_Error = 0; + + if (file) + ret = SLang_load_file((char *)file); + else + ret = SLang_load_string((char *)script); + + if (ret == 0) + break; + } + + if (ret < 0) + clulog(LOG_ERR, "[S/Lang] Script Execution Failure\n"); + + return ret; +} + + +int +S_node_event(const char *file, const char *script, int nodeid, + int state, int clean) +{ + int ret; + cluster_member_list_t *membership = member_list(); + char *nodename; + + nodename = memb_id_to_name(membership, nodeid); + if (nodename) + _node_name = strdup(nodename); + else + _node_name = strdup("unknown"); + _node_state = state; + _node_clean = clean; + _node_id = nodeid; + cml_free(membership); + + ret = do_slang_run(file, script); + + _node_state = 0; + _node_clean = 0; + _node_id = 0; + if (_node_name) + free(_node_name); + _node_name = NULL; + + return ret; +} + + +int +S_service_event(const char *file, const char *script, char *name, + int state, int owner, int last_owner) +{ + int ret; + + _service_name = name; + _service_state = (char *)rg_state_str(state); + _service_owner = owner; + _service_last_owner = last_owner; + _service_restarts_exceeded = check_restart(name); + + switch(state) { + case RG_STATE_DISABLED: + case RG_STATE_STOPPED: + case RG_STATE_FAILED: + case RG_STATE_RECOVER: + case RG_STATE_ERROR: + /* There is no owner for these states. Ever. */ + _service_owner = -1; + } + + ret = do_slang_run(file, script); + + _service_name = NULL; + _service_state = 0; + _service_owner = 0; + _service_last_owner = 0; + _service_restarts_exceeded = 0; + + return ret; +} + + +int +S_user_event(const char *file, const char *script, char *name, + int request, int arg1, int arg2, int target, int fd) +{ + int ret = RG_SUCCESS; + + _service_name = name; + _service_owner = target; + _user_request = request; + _user_arg1 = arg1; + _user_arg2 = arg2; + _user_return = 0; + + ret = do_slang_run(file, script); + if (ret < 0) { + _user_return = RG_ESCRIPT; + } + + _service_name = NULL; + _service_owner = 0; + _user_request = 0; + _user_arg1 = 0; + _user_arg2 = 0; + + /* XXX Send response code to caller - that 0 should be the + new service owner, if there is one */ + if (fd >= 0) { + if (_user_return > 0) { + /* sl_start_service() squashes return code and + node ID into one value. <0 = error, >0 = + success, return-value == node id running + service */ + send_ret(fd, name, 0, request, _user_return); + } else { + /* return value < 0 ... pass directly back; + don't transpose */ + send_ret(fd, name, _user_return, request, 0); + } + msg_close(fd); + } + _user_return = 0; + return ret; +} + + +int +slang_do_script(event_t *pattern, event_t *ev) +{ + _event_type = ev->ev_type; + int ret = 0; + + switch(ev->ev_type) { + case EVENT_NODE: + ret = S_node_event( + pattern->ev_script_file, + pattern->ev_script, + ev->ev.node.ne_nodeid, + ev->ev.node.ne_state, + ev->ev.node.ne_clean); + break; + case EVENT_RG: + ret = S_service_event( + pattern->ev_script_file, + pattern->ev_script, + ev->ev.group.rg_name, + ev->ev.group.rg_state, + ev->ev.group.rg_owner, + ev->ev.group.rg_last_owner); + break; + case EVENT_USER: + ret = S_user_event( + pattern->ev_script_file, + pattern->ev_script, + ev->ev.user.u_name, + ev->ev.user.u_request, + ev->ev.user.u_arg1, + ev->ev.user.u_arg2, + ev->ev.user.u_target, + ev->ev.user.u_fd); + break; + default: + break; + } + + _event_type = EVENT_NONE; + return ret; +} + + + +/** + Process an event given our event table and the event that + occurred. Note that the caller is responsible for freeing the + event - do not free (ev) ... + */ +int +slang_process_event(event_table_t *event_table, event_t *ev) +{ + int x, y; + event_t *pattern; + + if (!__sl_initialized) + do_init_slang(); + + /* Get the service list once before processing events */ + if (!_service_list || !_service_list_len) + _service_list = get_service_names(&_service_list_len); + + _stop_processing = 0; + for (x = 1; x <= event_table->max_prio; x++) { + list_for(&event_table->entries[x], pattern, y) { + if (event_match(pattern, ev)) + slang_do_script(pattern, ev); + if (_stop_processing) + goto out; + } + } + + /* Default level = 0 */ + list_for(&event_table->entries[0], pattern, y) { + if (event_match(pattern, ev)) + slang_do_script(pattern, ev); + if (_stop_processing) + goto out; + } + +out: + /* Free the service list */ + if (_service_list) { + for(x = 0; x < _service_list_len; x++) { + free(_service_list[x]); + } + free(_service_list); + _service_list = NULL; + _service_list_len = 0; + } + + return 0; +} diff --git a/rgmanager/src/daemons/test.c b/rgmanager/src/daemons/test.c index fa77edd..1a6862c 100644 --- a/rgmanager/src/daemons/test.c +++ b/rgmanager/src/daemons/test.c @@ -1,3 +1,21 @@ +/* + Copyright Red Hat, Inc. 2004-2006 + + 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, or (at your option) any + later version. + + This program 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 program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ #include #include #include @@ -7,7 +25,9 @@ #include #include #include +#include #include +#include #include #ifndef NO_CCS @@ -66,20 +86,22 @@ test_func(int argc, char **argv) fod_t *domains = NULL; resource_rule_t *rulelist = NULL, *currule; resource_t *reslist = NULL, *curres; - resource_node_t *tree = NULL; + resource_node_t *tree = NULL, *tmp, *rn = NULL; int ccsfd, ret = 0, rules = 0; + event_table_t *events = NULL; fprintf(stderr,"Running in test mode.\n"); conf_setconfig(argv[1]); ccsfd = ccs_lock(); - if (ccsfd == FAIL) { + if (ccsfd < 0) { printf("Error parsing %s\n", argv[1]); goto out; } load_resource_rules(agentpath, &rulelist); construct_domains(ccsfd, &domains); + construct_events(ccsfd, &events); load_resources(ccsfd, &reslist, &rulelist); build_resource_tree(ccsfd, &tree, &rulelist, &reslist); @@ -114,6 +136,11 @@ test_func(int argc, char **argv) printf("=== Failover Domains ===\n"); print_domains(&domains); } + + if (events) { + printf("=== Event Triggers ===\n"); + print_events(events); + } } ccs_unlock(ccsfd); @@ -128,6 +155,13 @@ test_func(int argc, char **argv) goto out; } + list_do(&tree, tmp) { + if (tmp->rn_resource == curres) { + rn = tmp; + break; + } + } while (!list_done(&tree, tmp)); + if (!strcmp(argv[1], "start")) { printf("Starting %s...\n", argv[3]); @@ -147,12 +181,29 @@ test_func(int argc, char **argv) } printf("Stop of %s complete\n", argv[3]); goto out; + } else if (!strcmp(argv[1], "migrate")) { + printf("Migrating %s to %s...\n", argv[3], argv[4]); + + #if 0 + if (!group_migratory(curres)) { + printf("No can do\n"); + ret = -1; + goto out; + } + #endif + + if (res_exec(rn, RS_MIGRATE, argv[4], 0)) { + ret = -1; + goto out; + } + printf("Migration of %s complete\n", argv[3]); + goto out; } else if (!strcmp(argv[1], "status")) { printf("Checking status of %s...\n", argv[3]); - if (res_status(&tree, curres, NULL)) { + ret = res_status(&tree, curres, NULL); + if (ret) { printf("Status check of %s failed\n", argv[3]); - ret = -1; goto out; } printf("Status of %s is good\n", argv[3]); @@ -160,6 +211,7 @@ test_func(int argc, char **argv) } out: + deconstruct_events(&events); deconstruct_domains(&domains); destroy_resource_tree(&tree); destroy_resources(&reslist); @@ -175,7 +227,9 @@ tree_delta_test(int argc, char **argv) resource_rule_t *rulelist = NULL, *currule, *rulelist2 = NULL; resource_t *reslist = NULL, *curres, *reslist2 = NULL; resource_node_t *tree = NULL, *tree2 = NULL; - int ccsfd, ret = 0; + resource_node_t *tn; + int ccsfd, ret = 0, need_init, need_kill; + char rg[64]; if (argc < 2) { printf("Operation requires two arguments\n"); @@ -234,6 +288,40 @@ tree_delta_test(int argc, char **argv) print_resource_tree(&tree); printf("=== New Resource Tree ===\n"); print_resource_tree(&tree2); + printf("=== Operations (down-phase) ===\n"); + list_do(&tree, tn) { + res_build_name(rg, sizeof(rg), tn->rn_resource); + /* Set state to uninitialized if we're killing a RG */ + need_init = 0; + + /* Set state to uninitialized if we're killing a RG */ + need_kill = 0; + if (tn->rn_resource->r_flags & RF_NEEDSTOP) { + need_kill = 1; + printf("[kill] "); + } + + res_condstop(&tn, tn->rn_resource, NULL); + } while (!list_done(&tree, tn)); + printf("=== Operations (up-phase) ===\n"); + list_do(&tree2, tn) { + res_build_name(rg, sizeof(rg), tn->rn_resource); + /* New RG. We'll need to initialize it. */ + need_init = 0; + if (!(tn->rn_resource->r_flags & RF_RECONFIG) && + (tn->rn_resource->r_flags & RF_NEEDSTART)) + need_init = 1; + + if (need_init) { + printf("[init] "); + } + + if (need_init) { + res_stop(&tn, tn->rn_resource, NULL); + } else { + res_condstart(&tn, tn->rn_resource, NULL); + } + } while (!list_done(&tree2, tn)); out: destroy_resource_tree(&tree2); @@ -289,6 +377,7 @@ main(int argc, char **argv) goto out; } else if (!strcmp(argv[1], "delta")) { shift(); + _no_op_mode(1); ret = tree_delta_test(argc, argv); goto out; } else { @@ -312,5 +401,5 @@ main(int argc, char **argv) out: xmlCleanupParser(); malloc_dump_table(); - return 0; + return ret; } diff --git a/rgmanager/src/daemons/tests/delta-test001-test002.expected b/rgmanager/src/daemons/tests/delta-test001-test002.expected index 030c5c9..34eaf37 100644 --- a/rgmanager/src/daemons/tests/delta-test001-test002.expected +++ b/rgmanager/src/daemons/tests/delta-test001-test002.expected @@ -4,6 +4,14 @@ Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] === New Resource List === Resource type: service [ROOT] @@ -11,12 +19,38 @@ Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; } === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; } +=== Operations (down-phase) === +=== Operations (up-phase) === diff --git a/rgmanager/src/daemons/tests/delta-test002-test003.expected b/rgmanager/src/daemons/tests/delta-test002-test003.expected index d831641..043b74c 100644 --- a/rgmanager/src/daemons/tests/delta-test002-test003.expected +++ b/rgmanager/src/daemons/tests/delta-test002-test003.expected @@ -4,8 +4,30 @@ Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] === New Resource List === +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + Resource type: script [NEEDSTART] Agent: script.sh Attributes: @@ -13,22 +35,36 @@ Attributes: file = /etc/init.d/httpd [ unique required ] service_name [ inherit("service%name") ] -Resource type: service [ROOT] -Instances: 1/1 -Agent: service.sh -Attributes: - name = test1 [ primary unique required ] - === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; } === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script [ NEEDSTART ] { name = "initscript"; file = "/etc/init.d/httpd"; service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +Node script:initscript - CONDSTART +[start] script:initscript diff --git a/rgmanager/src/daemons/tests/delta-test003-test004.expected b/rgmanager/src/daemons/tests/delta-test003-test004.expected index b1126a0..4bdd9ad 100644 --- a/rgmanager/src/daemons/tests/delta-test003-test004.expected +++ b/rgmanager/src/daemons/tests/delta-test003-test004.expected @@ -1,4 +1,18 @@ === Old Resource List === +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + Resource type: script [NEEDSTOP] Agent: script.sh Attributes: @@ -6,13 +20,21 @@ Attributes: file = /etc/init.d/httpd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -=== New Resource List === Resource type: script [NEEDSTART] Agent: script.sh Attributes: @@ -20,15 +42,17 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] -Resource type: service [ROOT] -Instances: 1/1 -Agent: service.sh -Attributes: - name = test1 [ primary unique required ] - === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script [ NEEDSTOP ] { name = "initscript"; file = "/etc/init.d/httpd"; @@ -38,9 +62,23 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script [ NEEDSTART ] { name = "initscript"; file = "/etc/init.d/sshd"; service_name = "test1"; } } +=== Operations (down-phase) === +Node script:initscript - CONDSTOP +[stop] script:initscript +=== Operations (up-phase) === +Node script:initscript - CONDSTART +[start] script:initscript diff --git a/rgmanager/src/daemons/tests/delta-test004-test005.expected b/rgmanager/src/daemons/tests/delta-test004-test005.expected index 9919e56..a3b8b55 100644 --- a/rgmanager/src/daemons/tests/delta-test004-test005.expected +++ b/rgmanager/src/daemons/tests/delta-test004-test005.expected @@ -1,18 +1,18 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -20,11 +20,20 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip [NEEDSTART] Instances: 1/1 @@ -34,9 +43,24 @@ Attributes: monitor_link = 1 nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script { name = "initscript"; file = "/etc/init.d/sshd"; @@ -46,9 +70,18 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip [ NEEDSTART ] { address = "192.168.1.2"; monitor_link = "1"; + nfslock = "0"; } script { name = "initscript"; @@ -56,3 +89,7 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +Node ip:192.168.1.2 - CONDSTART +[start] ip:192.168.1.2 diff --git a/rgmanager/src/daemons/tests/delta-test005-test006.expected b/rgmanager/src/daemons/tests/delta-test005-test006.expected index 879912c..4e0310c 100644 --- a/rgmanager/src/daemons/tests/delta-test005-test006.expected +++ b/rgmanager/src/daemons/tests/delta-test005-test006.expected @@ -1,16 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip [NEEDSTOP] Instances: 1/1 @@ -20,7 +21,6 @@ Attributes: monitor_link = 1 nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -28,11 +28,20 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip [NEEDSTART] Instances: 1/1 @@ -42,12 +51,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip [ NEEDSTOP ] { address = "192.168.1.2"; monitor_link = "1"; + nfslock = "0"; } script { name = "initscript"; @@ -58,9 +83,18 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip [ NEEDSTART ] { address = "192.168.1.2"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -68,3 +102,9 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +Node ip:192.168.1.2 - CONDSTOP +[stop] ip:192.168.1.2 +=== Operations (up-phase) === +Node ip:192.168.1.2 - CONDSTART +[start] ip:192.168.1.2 diff --git a/rgmanager/src/daemons/tests/delta-test006-test007.expected b/rgmanager/src/daemons/tests/delta-test006-test007.expected index baa2187..bd4db79 100644 --- a/rgmanager/src/daemons/tests/delta-test006-test007.expected +++ b/rgmanager/src/daemons/tests/delta-test006-test007.expected @@ -1,16 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip [NEEDSTOP] Instances: 1/1 @@ -20,7 +21,6 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -28,11 +28,20 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip [NEEDSTART] Instances: 1/1 @@ -42,12 +51,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip [ NEEDSTOP ] { address = "192.168.1.2"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -58,9 +83,18 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip [ NEEDSTART ] { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -68,3 +102,9 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +Node ip:192.168.1.2 - CONDSTOP +[stop] ip:192.168.1.2 +=== Operations (up-phase) === +Node ip:192.168.1.3 - CONDSTART +[start] ip:192.168.1.3 diff --git a/rgmanager/src/daemons/tests/delta-test007-test008.expected b/rgmanager/src/daemons/tests/delta-test007-test008.expected index 65140ea..19fe209 100644 --- a/rgmanager/src/daemons/tests/delta-test007-test008.expected +++ b/rgmanager/src/daemons/tests/delta-test007-test008.expected @@ -1,16 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip Instances: 1/1 @@ -20,7 +21,6 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -28,11 +28,30 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: fs [NEEDSTART] +Instances: 0/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -42,22 +61,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs [NEEDSTART] -Instances: 0/1 -Agent: fs.sh +Resource type: script +Agent: script.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -68,9 +93,18 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -78,3 +112,5 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === diff --git a/rgmanager/src/daemons/tests/delta-test008-test009.expected b/rgmanager/src/daemons/tests/delta-test008-test009.expected index d52c211..5168931 100644 --- a/rgmanager/src/daemons/tests/delta-test008-test009.expected +++ b/rgmanager/src/daemons/tests/delta-test008-test009.expected @@ -1,24 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: fs Instances: 0/1 @@ -28,9 +21,16 @@ Attributes: mountpoint = /mnt/cluster [ unique required ] device = /dev/sdb8 [ unique required ] fstype = ext3 - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -38,11 +38,30 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -52,22 +71,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs -Instances: 1/1 -Agent: fs.sh +Resource type: script +Agent: script.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -78,15 +103,25 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs [ NEEDSTART ] { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -94,3 +129,7 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +Node fs:mount1 - CONDSTART +[start] fs:mount1 diff --git a/rgmanager/src/daemons/tests/delta-test009-test010.expected b/rgmanager/src/daemons/tests/delta-test009-test010.expected index 65f42fc..ef379fd 100644 --- a/rgmanager/src/daemons/tests/delta-test009-test010.expected +++ b/rgmanager/src/daemons/tests/delta-test009-test010.expected @@ -1,24 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: fs Instances: 1/1 @@ -28,9 +21,16 @@ Attributes: mountpoint = /mnt/cluster [ unique required ] device = /dev/sdb8 [ unique required ] fstype = ext3 - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -38,18 +38,28 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: ip -Instances: 1/1 -Agent: ip.sh +Resource type: nfsexport [NEEDSTART] +Agent: nfsexport.sh Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] nfslock [ inherit("service%nfslock") ] Resource type: fs @@ -60,29 +70,45 @@ Attributes: mountpoint = /mnt/cluster [ unique required ] device = /dev/sdb8 [ unique required ] fstype = ext3 - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] -Resource type: nfsexport [NEEDSTART] -Agent: nfsexport.sh +Resource type: ip +Instances: 1/1 +Agent: ip.sh Attributes: - name = Dummy Export [ primary ] - device [ inherit("device") ] - path [ inherit("mountpoint") ] - fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -93,15 +119,25 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -109,3 +145,5 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === diff --git a/rgmanager/src/daemons/tests/delta-test010-test011.expected b/rgmanager/src/daemons/tests/delta-test010-test011.expected index 587a96e..38d7fb2 100644 --- a/rgmanager/src/daemons/tests/delta-test010-test011.expected +++ b/rgmanager/src/daemons/tests/delta-test010-test011.expected @@ -1,23 +1,25 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: ip -Instances: 1/1 -Agent: ip.sh +Resource type: nfsexport +Agent: nfsexport.sh Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] nfslock [ inherit("service%nfslock") ] Resource type: fs @@ -28,18 +30,16 @@ Attributes: mountpoint = /mnt/cluster [ unique required ] device = /dev/sdb8 [ unique required ] fstype = ext3 - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] -Resource type: nfsexport -Agent: nfsexport.sh +Resource type: ip +Instances: 1/1 +Agent: ip.sh Attributes: - name = Dummy Export [ primary ] - device [ inherit("device") ] - path [ inherit("mountpoint") ] - fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] -=== New Resource List === Resource type: script Agent: script.sh Attributes: @@ -47,29 +47,20 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] +=== New Resource List === Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -78,7 +69,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient [NEEDSTART] Agent: nfsclient.sh @@ -87,7 +78,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient [NEEDSTART] @@ -97,7 +88,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient [NEEDSTART] @@ -107,7 +98,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTART] @@ -117,7 +108,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTART] @@ -127,21 +118,56 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -152,25 +178,37 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport [ NEEDSTART ] { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -178,6 +216,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -185,3 +224,9 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +Node nfsexport:Dummy Export - CONDSTART +[start] nfsexport:Dummy Export +[start] nfsclient:Admin group +[start] nfsclient:User group diff --git a/rgmanager/src/daemons/tests/delta-test011-test012.expected b/rgmanager/src/daemons/tests/delta-test011-test012.expected index 516cb1a..8b9803d 100644 --- a/rgmanager/src/daemons/tests/delta-test011-test012.expected +++ b/rgmanager/src/daemons/tests/delta-test011-test012.expected @@ -1,34 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTOP] @@ -86,22 +69,18 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test1 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -111,15 +90,27 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -128,7 +119,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -137,7 +128,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -147,7 +138,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -157,7 +148,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -167,7 +158,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTART] @@ -177,31 +168,68 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -209,6 +237,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -219,31 +248,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient [ NEEDSTART ] { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -251,6 +293,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -258,3 +301,7 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +Node nfsclient:red - CONDSTART +[start] nfsclient:red diff --git a/rgmanager/src/daemons/tests/delta-test012-test013.expected b/rgmanager/src/daemons/tests/delta-test012-test013.expected index e6c7cf7..c45223d 100644 --- a/rgmanager/src/daemons/tests/delta-test012-test013.expected +++ b/rgmanager/src/daemons/tests/delta-test012-test013.expected @@ -1,34 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTOP] @@ -86,22 +69,18 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test1 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -111,15 +90,27 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -128,7 +119,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -137,7 +128,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -147,7 +138,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -157,7 +148,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -167,7 +158,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient [NEEDSTART] @@ -177,37 +168,75 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient [ NEEDSTOP ] { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -215,6 +244,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -225,31 +255,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient [ NEEDSTART ] { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -257,6 +300,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -264,3 +308,9 @@ service { service_name = "test1"; } } +=== Operations (down-phase) === +Node nfsclient:red - CONDSTOP +[stop] nfsclient:red +=== Operations (up-phase) === +Node nfsclient:red - CONDSTART +[start] nfsclient:red diff --git a/rgmanager/src/daemons/tests/delta-test013-test014.expected b/rgmanager/src/daemons/tests/delta-test013-test014.expected index 236f2be..d779448 100644 --- a/rgmanager/src/daemons/tests/delta-test013-test014.expected +++ b/rgmanager/src/daemons/tests/delta-test013-test014.expected @@ -1,34 +1,17 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -86,28 +69,18 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] -Instances: 1/1 -Agent: service.sh -Attributes: - name = test1 [ primary unique required ] - -Resource type: service [ROOT] [NEEDSTART] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test2 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -117,33 +90,41 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: ip [NEEDSTART] -Instances: 1/1 -Agent: ip.sh +Resource type: script +Agent: script.sh Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] -Resource type: fs +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: fs [NEEDSTART] +Resource type: service [ROOT] [NEEDSTART] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -152,7 +133,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -161,7 +142,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -171,7 +152,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -181,7 +162,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -191,7 +172,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -201,37 +182,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs [NEEDSTART] +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip [NEEDSTART] +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -239,6 +276,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -249,31 +287,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -281,6 +332,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -290,31 +342,44 @@ service { } service [ NEEDSTART ] { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -322,6 +387,7 @@ service [ NEEDSTART ] { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -329,3 +395,13 @@ service [ NEEDSTART ] { service_name = "test2"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === +[init] [stop] script:initscript +[stop] ip:192.168.1.4 +[stop] nfsclient:red +[stop] nfsclient:User group +[stop] nfsclient:Admin group +[stop] nfsexport:Dummy Export +[stop] fs:mount2 +[stop] service:test2 diff --git a/rgmanager/src/daemons/tests/delta-test014-test015.expected b/rgmanager/src/daemons/tests/delta-test014-test015.expected index 20d730d..6cf0310 100644 --- a/rgmanager/src/daemons/tests/delta-test014-test015.expected +++ b/rgmanager/src/daemons/tests/delta-test014-test015.expected @@ -1,58 +1,31 @@ === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -61,7 +34,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient [NEEDSTOP] Agent: nfsclient.sh @@ -70,7 +43,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -80,7 +53,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -90,7 +63,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -100,7 +73,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -110,28 +83,28 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test1 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test2 [ primary unique required ] + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -149,25 +122,41 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: fs +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -176,7 +165,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient [NEEDSTART] Agent: nfsclient.sh @@ -185,7 +174,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -195,7 +184,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -205,7 +194,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -215,7 +204,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -225,37 +214,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient [ NEEDSTOP ] { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -263,6 +308,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -272,31 +318,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient [ NEEDSTOP ] { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -304,6 +363,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -314,31 +374,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient [ NEEDSTART ] { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -346,6 +419,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -355,31 +429,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient [ NEEDSTART ] { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -387,6 +474,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -394,3 +482,13 @@ service { service_name = "test2"; } } +=== Operations (down-phase) === +Node nfsclient:User group - CONDSTOP +[stop] nfsclient:User group +Node nfsclient:User group - CONDSTOP +[stop] nfsclient:User group +=== Operations (up-phase) === +Node nfsclient:User group - CONDSTART +[start] nfsclient:User group +Node nfsclient:User group - CONDSTART +[start] nfsclient:User group diff --git a/rgmanager/src/daemons/tests/delta-test015-test016.expected b/rgmanager/src/daemons/tests/delta-test015-test016.expected index 51d32ea..7139041 100644 --- a/rgmanager/src/daemons/tests/delta-test015-test016.expected +++ b/rgmanager/src/daemons/tests/delta-test015-test016.expected @@ -1,59 +1,32 @@ Warning: Max references exceeded for resource address (type ip) === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -62,7 +35,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -71,7 +44,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -81,7 +54,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -91,7 +64,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -101,7 +74,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -111,28 +84,28 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test1 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test2 [ primary unique required ] + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -150,25 +123,41 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: fs +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -177,7 +166,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -186,7 +175,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -196,7 +185,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -206,7 +195,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -216,7 +205,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -226,37 +215,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -264,6 +309,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -273,31 +319,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -305,6 +364,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -315,31 +375,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -347,6 +420,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -356,31 +430,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -388,6 +475,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -395,3 +483,5 @@ service { service_name = "test2"; } } +=== Operations (down-phase) === +=== Operations (up-phase) === diff --git a/rgmanager/src/daemons/tests/delta-test016-test017.expected b/rgmanager/src/daemons/tests/delta-test016-test017.expected index 6889295..0b5723b 100644 --- a/rgmanager/src/daemons/tests/delta-test016-test017.expected +++ b/rgmanager/src/daemons/tests/delta-test016-test017.expected @@ -1,59 +1,32 @@ Warning: Max references exceeded for resource address (type ip) === Old Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -62,7 +35,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -71,7 +44,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -81,7 +54,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -91,7 +64,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -101,7 +74,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -111,42 +84,28 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw -=== New Resource List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: script [NEEDSTART] -Agent: script.sh -Attributes: - name = script2 [ primary unique ] - file = /etc/init.d/script2 [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: script [NEEDSTART] -Agent: script.sh -Attributes: - name = script3 [ primary unique ] - file = /etc/init.d/script3 [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test1 [ primary unique required ] + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] -Resource type: service [ROOT] +Resource type: fs Instances: 1/1 -Agent: service.sh +Agent: fs.sh Attributes: - name = test2 [ primary unique required ] + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -164,25 +123,41 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: fs +Resource type: service [ROOT] Instances: 1/1 -Agent: fs.sh +Agent: service.sh Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -191,7 +166,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -200,7 +175,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -210,7 +185,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -220,7 +195,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -230,7 +205,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -240,37 +215,107 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script [NEEDSTART] +Agent: script.sh +Attributes: + name = script2 [ primary unique ] + file = /etc/init.d/script2 [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script [NEEDSTART] +Agent: script.sh +Attributes: + name = script3 [ primary unique ] + file = /etc/init.d/script3 [ unique required ] + service_name [ inherit("service%name") ] + === Old Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -278,6 +323,7 @@ service { ip [ NEEDSTOP ] { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -287,31 +333,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs [ NEEDSTOP ] { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -319,6 +378,7 @@ service { ip [ NEEDSTOP ] { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -329,31 +389,44 @@ service { === New Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -366,6 +439,14 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script { name = "initscript"; file = "/etc/init.d/sshd"; @@ -373,32 +454,38 @@ service { ip [ NEEDSTART ] { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } fs [ NEEDSTART ] { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -406,10 +493,12 @@ service { script [ NEEDSTART ] { name = "script2"; file = "/etc/init.d/script2"; + service_name = "test2"; } ip [ NEEDSTART ] { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } } script [ NEEDSTART ] { @@ -418,3 +507,29 @@ service { service_name = "test2"; } } +=== Operations (down-phase) === +Node ip:192.168.1.3 - CONDSTOP +[stop] ip:192.168.1.3 +Node fs:mount2 - CONDSTOP +[stop] nfsclient:red +[stop] nfsclient:User group +[stop] nfsclient:Admin group +[stop] nfsexport:Dummy Export +[stop] fs:mount2 +Node ip:192.168.1.4 - CONDSTOP +[stop] ip:192.168.1.4 +=== Operations (up-phase) === +Node ip:192.168.1.3 - CONDSTART +[start] ip:192.168.1.3 +Node fs:mount2 - CONDSTART +[start] fs:mount2 +[start] nfsexport:Dummy Export +[start] nfsclient:Admin group +[start] nfsclient:User group +[start] nfsclient:red +Node script:script2 - CONDSTART +[start] script:script2 +Node ip:192.168.1.4 - CONDSTART +[start] ip:192.168.1.4 +Node script:script3 - CONDSTART +[start] script:script3 diff --git a/rgmanager/src/daemons/tests/delta-test017-test018.expected b/rgmanager/src/daemons/tests/delta-test017-test018.expected new file mode 100644 index 0000000..6670d36 --- /dev/null +++ b/rgmanager/src/daemons/tests/delta-test017-test018.expected @@ -0,0 +1,558 @@ +=== Old Resource List === +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: nfsexport +Agent: nfsexport.sh +Attributes: + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = User group [ primary unique ] + target = @users [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,sync + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = Admin group [ primary unique ] + target = @admin [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = yellow [ primary unique ] + target = yellow [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = magenta [ primary unique ] + target = magenta [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = red [ primary unique ] + target = red [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script2 [ primary unique ] + file = /etc/init.d/script2 [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script3 [ primary unique ] + file = /etc/init.d/script3 [ unique required ] + service_name [ inherit("service%name") ] + +=== New Resource List === +Resource type: clusterfs [NEEDSTART] +Agent: clusterfs.sh +Attributes: + name = argle [ primary ] + mountpoint = /mnt/cluster3 [ unique required ] + device = /dev/sdb10 [ unique required ] + nfslock [ inherit("service%nfslock") ] + +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: nfsexport +Agent: nfsexport.sh +Attributes: + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = User group [ primary unique ] + target = @users [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,sync + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = Admin group [ primary unique ] + target = @admin [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = yellow [ primary unique ] + target = yellow [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = magenta [ primary unique ] + target = magenta [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = red [ primary unique ] + target = red [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script2 [ primary unique ] + file = /etc/init.d/script2 [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script3 [ primary unique ] + file = /etc/init.d/script3 [ unique required ] + service_name [ inherit("service%name") ] + +=== Old Resource Tree === +service { + name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + fs { + name = "mount1"; + mountpoint = "/mnt/cluster"; + device = "/dev/sdb8"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb8"; + path = "/mnt/cluster"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test1"; + } +} +service { + name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test2"; + ip { + address = "192.168.1.3"; + monitor_link = "yes"; + nfslock = "0"; + } + fs { + name = "mount2"; + mountpoint = "/mnt/cluster2"; + device = "/dev/sdb9"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb9"; + path = "/mnt/cluster2"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "script2"; + file = "/etc/init.d/script2"; + service_name = "test2"; + } + ip { + address = "192.168.1.4"; + monitor_link = "yes"; + nfslock = "0"; + } + } + script { + name = "script3"; + file = "/etc/init.d/script3"; + service_name = "test2"; + } +} +=== New Resource Tree === +service { + name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + fs { + name = "mount1"; + mountpoint = "/mnt/cluster"; + device = "/dev/sdb8"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb8"; + path = "/mnt/cluster"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test1"; + clusterfs [ NEEDSTART ] { + name = "argle"; + mountpoint = "/mnt/cluster3"; + device = "/dev/sdb10"; + nfslock = "0"; + } + } +} +service { + name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test2"; + clusterfs [ NEEDSTART ] { + name = "argle"; + mountpoint = "/mnt/cluster3"; + device = "/dev/sdb10"; + nfslock = "0"; + } + ip { + address = "192.168.1.3"; + monitor_link = "yes"; + nfslock = "0"; + } + fs { + name = "mount2"; + mountpoint = "/mnt/cluster2"; + device = "/dev/sdb9"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb9"; + path = "/mnt/cluster2"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "script2"; + file = "/etc/init.d/script2"; + service_name = "test2"; + } + ip { + address = "192.168.1.4"; + monitor_link = "yes"; + nfslock = "0"; + } + } + script { + name = "script3"; + file = "/etc/init.d/script3"; + service_name = "test2"; + } +} +=== Operations (down-phase) === +=== Operations (up-phase) === +Node clusterfs:argle - CONDSTART +[start] clusterfs:argle +Node clusterfs:argle - CONDSTART +[start] clusterfs:argle diff --git a/rgmanager/src/daemons/tests/runtests.sh b/rgmanager/src/daemons/tests/runtests.sh index 3fa0c5b..76b548b 100755 --- a/rgmanager/src/daemons/tests/runtests.sh +++ b/rgmanager/src/daemons/tests/runtests.sh @@ -23,7 +23,7 @@ echo "Running sanity+memory leak checks on rgmanager tree operations..." for t in $TESTS; do echo -n " Checking $t.conf..." ../rg_test ../../resources test $t.conf > $t.out 2> $t.out.stderr - diff -w $t.expected $t.out + diff -uw $t.expected $t.out if [ $? -ne 0 ]; then echo "FAILED" echo "*** Basic Test $t failed" @@ -56,7 +56,7 @@ for t in $TESTS; do for svc in $SERVICES; do ../rg_test ../../resources noop $t.conf $phase service $svc >> $t.$phase.out 2> $t.$phase.out.stderr done - diff -w $t.$phase.expected $t.$phase.out + diff -uw $t.$phase.expected $t.$phase.out if [ $? -ne 0 ]; then echo "FAILED" echo "*** Start Test $t failed" @@ -89,7 +89,7 @@ for t in $TESTS; do echo -n " Checking delta between $prev and $t..." ../rg_test ../../resources delta \ $prev.conf $t.conf > delta-$prev-$t.out 2> delta-$prev-$t.out.stderr - diff -w delta-$prev-$t.expected delta-$prev-$t.out + diff -uw delta-$prev-$t.expected delta-$prev-$t.out if [ $? -ne 0 ]; then echo "FAILED" echo "*** Differential test between $prev and $t failed" diff --git a/rgmanager/src/daemons/tests/test001.expected b/rgmanager/src/daemons/tests/test001.expected index bc080ad..43d90e8 100644 --- a/rgmanager/src/daemons/tests/test001.expected +++ b/rgmanager/src/daemons/tests/test001.expected @@ -4,8 +4,29 @@ Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test002.expected b/rgmanager/src/daemons/tests/test002.expected index b21c247..09b160f 100644 --- a/rgmanager/src/daemons/tests/test002.expected +++ b/rgmanager/src/daemons/tests/test002.expected @@ -4,8 +4,29 @@ Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test003.expected b/rgmanager/src/daemons/tests/test003.expected index 0ff5d58..b39a24e 100644 --- a/rgmanager/src/daemons/tests/test003.expected +++ b/rgmanager/src/daemons/tests/test003.expected @@ -1,4 +1,18 @@ === Resources List === +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + Resource type: script Agent: script.sh Attributes: @@ -6,18 +20,25 @@ Attributes: file = /etc/init.d/httpd [ unique required ] service_name [ inherit("service%name") ] -Resource type: service [ROOT] -Instances: 1/1 -Agent: service.sh -Attributes: - name = test1 [ primary unique required ] - === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script { name = "initscript"; file = "/etc/init.d/httpd"; service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test004.expected b/rgmanager/src/daemons/tests/test004.expected index 334cc12..bc2a264 100644 --- a/rgmanager/src/daemons/tests/test004.expected +++ b/rgmanager/src/daemons/tests/test004.expected @@ -1,4 +1,18 @@ === Resources List === +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + Resource type: script Agent: script.sh Attributes: @@ -6,18 +20,25 @@ Attributes: file = /etc/init.d/sshd [ unique required ] service_name [ inherit("service%name") ] -Resource type: service [ROOT] -Instances: 1/1 -Agent: service.sh -Attributes: - name = test1 [ primary unique required ] - === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script { name = "initscript"; file = "/etc/init.d/sshd"; service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test005.expected b/rgmanager/src/daemons/tests/test005.expected index eea6f20..b05749a 100644 --- a/rgmanager/src/daemons/tests/test005.expected +++ b/rgmanager/src/daemons/tests/test005.expected @@ -1,16 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip Instances: 1/1 @@ -20,12 +21,28 @@ Attributes: monitor_link = 1 nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.2"; monitor_link = "1"; + nfslock = "0"; } script { name = "initscript"; @@ -33,3 +50,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test006.expected b/rgmanager/src/daemons/tests/test006.expected index 71714d8..2b77f91 100644 --- a/rgmanager/src/daemons/tests/test006.expected +++ b/rgmanager/src/daemons/tests/test006.expected @@ -1,16 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip Instances: 1/1 @@ -20,12 +21,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.2"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -33,3 +50,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test007.expected b/rgmanager/src/daemons/tests/test007.expected index 243f89f..ea4bcf1 100644 --- a/rgmanager/src/daemons/tests/test007.expected +++ b/rgmanager/src/daemons/tests/test007.expected @@ -1,16 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: ip Instances: 1/1 @@ -20,12 +21,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -33,3 +50,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test008.expected b/rgmanager/src/daemons/tests/test008.expected index 256fa11..82877fe 100644 --- a/rgmanager/src/daemons/tests/test008.expected +++ b/rgmanager/src/daemons/tests/test008.expected @@ -1,16 +1,27 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: fs +Instances: 0/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -20,22 +31,28 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs -Instances: 0/1 -Agent: fs.sh +Resource type: script +Agent: script.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -43,3 +60,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test009.expected b/rgmanager/src/daemons/tests/test009.expected index 52e66df..0c4c274 100644 --- a/rgmanager/src/daemons/tests/test009.expected +++ b/rgmanager/src/daemons/tests/test009.expected @@ -1,16 +1,27 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] Resource type: ip Instances: 1/1 @@ -20,28 +31,35 @@ Attributes: monitor_link = yes nfslock [ inherit("service%nfslock") ] -Resource type: fs -Instances: 1/1 -Agent: fs.sh +Resource type: script +Agent: script.sh Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -49,3 +67,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test010.expected b/rgmanager/src/daemons/tests/test010.expected index 04f1812..bd89cb3 100644 --- a/rgmanager/src/daemons/tests/test010.expected +++ b/rgmanager/src/daemons/tests/test010.expected @@ -1,23 +1,25 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] -Resource type: ip -Instances: 1/1 -Agent: ip.sh +Resource type: nfsexport +Agent: nfsexport.sh Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] nfslock [ inherit("service%nfslock") ] Resource type: fs @@ -28,29 +30,45 @@ Attributes: mountpoint = /mnt/cluster [ unique required ] device = /dev/sdb8 [ unique required ] fstype = ext3 - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] -Resource type: nfsexport -Agent: nfsexport.sh +Resource type: ip +Instances: 1/1 +Agent: ip.sh Attributes: - name = Dummy Export [ primary ] - device [ inherit("device") ] - path [ inherit("mountpoint") ] - fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; } ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -58,3 +76,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test011.expected b/rgmanager/src/daemons/tests/test011.expected index 18b745b..6ce15c4 100644 --- a/rgmanager/src/daemons/tests/test011.expected +++ b/rgmanager/src/daemons/tests/test011.expected @@ -1,34 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -86,31 +69,68 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -118,6 +138,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -125,3 +146,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test012.expected b/rgmanager/src/daemons/tests/test012.expected index 1ab2548..97b07cc 100644 --- a/rgmanager/src/daemons/tests/test012.expected +++ b/rgmanager/src/daemons/tests/test012.expected @@ -1,34 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -86,37 +69,75 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } } @@ -124,6 +145,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -131,3 +153,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test013.expected b/rgmanager/src/daemons/tests/test013.expected index 1fc484a..07564ff 100644 --- a/rgmanager/src/daemons/tests/test013.expected +++ b/rgmanager/src/daemons/tests/test013.expected @@ -1,34 +1,17 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -37,7 +20,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -46,7 +29,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -56,7 +39,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -66,7 +49,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -76,7 +59,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -86,37 +69,75 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -124,6 +145,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -131,3 +153,8 @@ service { service_name = "test1"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test014.expected b/rgmanager/src/daemons/tests/test014.expected index 1954786..c7db038 100644 --- a/rgmanager/src/daemons/tests/test014.expected +++ b/rgmanager/src/daemons/tests/test014.expected @@ -1,58 +1,31 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -61,7 +34,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -70,7 +43,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = ro Resource type: nfsclient @@ -80,7 +53,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -90,7 +63,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -100,7 +73,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -110,37 +83,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -148,6 +177,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -157,31 +187,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "ro"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -189,6 +232,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -196,3 +240,8 @@ service { service_name = "test2"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test015.expected b/rgmanager/src/daemons/tests/test015.expected index 9663d54..6ac189b 100644 --- a/rgmanager/src/daemons/tests/test015.expected +++ b/rgmanager/src/daemons/tests/test015.expected @@ -1,58 +1,31 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -61,7 +34,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -70,7 +43,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -80,7 +53,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -90,7 +63,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -100,7 +73,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -110,37 +83,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -148,6 +177,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -157,31 +187,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -189,6 +232,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -196,3 +240,8 @@ service { service_name = "test2"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test016.expected b/rgmanager/src/daemons/tests/test016.expected index 5d8923f..1ce2579 100644 --- a/rgmanager/src/daemons/tests/test016.expected +++ b/rgmanager/src/daemons/tests/test016.expected @@ -1,59 +1,32 @@ Warning: Max references exceeded for resource address (type ip) === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -62,7 +35,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -71,7 +44,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -81,7 +54,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -91,7 +64,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -101,7 +74,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -111,37 +84,93 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -149,6 +178,7 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -158,31 +188,44 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -190,6 +233,7 @@ service { ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } script { name = "initscript"; @@ -197,3 +241,8 @@ service { service_name = "test2"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test017.expected b/rgmanager/src/daemons/tests/test017.expected index a1d0d6f..4727803 100644 --- a/rgmanager/src/daemons/tests/test017.expected +++ b/rgmanager/src/daemons/tests/test017.expected @@ -1,72 +1,31 @@ === Resources List === -Resource type: script -Agent: script.sh -Attributes: - name = initscript [ primary unique ] - file = /etc/init.d/sshd [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: script -Agent: script.sh -Attributes: - name = script2 [ primary unique ] - file = /etc/init.d/script2 [ unique required ] - service_name [ inherit("service%name") ] - -Resource type: script -Agent: script.sh -Attributes: - name = script3 [ primary unique ] - file = /etc/init.d/script3 [ unique required ] - service_name [ inherit("service%name") ] - Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: service [ROOT] Instances: 1/1 Agent: service.sh Attributes: name = test2 [ primary unique required ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.3 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: ip -Instances: 1/1 -Agent: ip.sh -Attributes: - address = 192.168.1.4 [ primary unique ] - monitor_link = yes - nfslock [ inherit("service%nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount1 [ primary ] - mountpoint = /mnt/cluster [ unique required ] - device = /dev/sdb8 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] - -Resource type: fs -Instances: 1/1 -Agent: fs.sh -Attributes: - name = mount2 [ primary ] - mountpoint = /mnt/cluster2 [ unique required ] - device = /dev/sdb9 [ unique required ] - fstype = ext3 - nfslock [ inherit("nfslock") ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] Resource type: nfsexport Agent: nfsexport.sh @@ -75,7 +34,7 @@ Attributes: device [ inherit("device") ] path [ inherit("mountpoint") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfslock") ] + nfslock [ inherit("service%nfslock") ] Resource type: nfsclient Agent: nfsclient.sh @@ -84,7 +43,7 @@ Attributes: target = @users [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,sync Resource type: nfsclient @@ -94,7 +53,7 @@ Attributes: target = @admin [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw Resource type: nfsclient @@ -104,7 +63,7 @@ Attributes: target = yellow [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -114,7 +73,7 @@ Attributes: target = magenta [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw,no_root_squash Resource type: nfsclient @@ -124,37 +83,107 @@ Attributes: target = red [ required ] path [ inherit("path") ] fsid [ inherit("fsid") ] - nfslock [ inherit("nfsexport%nfslock") ] + nfslock [ inherit("service%nfslock") ] options = rw +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script2 [ primary unique ] + file = /etc/init.d/script2 [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script3 [ primary unique ] + file = /etc/init.d/script3 [ unique required ] + service_name [ inherit("service%name") ] + === Resource Tree === service { name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; fs { name = "mount1"; mountpoint = "/mnt/cluster"; device = "/dev/sdb8"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb8"; path = "/mnt/cluster"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster"; + nfslock = "0"; options = "rw"; } } @@ -167,6 +196,14 @@ service { } service { name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; script { name = "initscript"; file = "/etc/init.d/sshd"; @@ -174,32 +211,38 @@ service { ip { address = "192.168.1.3"; monitor_link = "yes"; + nfslock = "0"; } fs { name = "mount2"; mountpoint = "/mnt/cluster2"; device = "/dev/sdb9"; fstype = "ext3"; + nfslock = "0"; nfsexport { name = "Dummy Export"; device = "/dev/sdb9"; path = "/mnt/cluster2"; + nfslock = "0"; nfsclient { name = "Admin group"; target = "@admin"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } nfsclient { name = "User group"; target = "@users"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw,sync"; } nfsclient { name = "red"; target = "red"; path = "/mnt/cluster2"; + nfslock = "0"; options = "rw"; } } @@ -207,10 +250,12 @@ service { script { name = "script2"; file = "/etc/init.d/script2"; + service_name = "test2"; } ip { address = "192.168.1.4"; monitor_link = "yes"; + nfslock = "0"; } } script { @@ -219,3 +264,8 @@ service { service_name = "test2"; } } +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/daemons/tests/test018.expected b/rgmanager/src/daemons/tests/test018.expected new file mode 100644 index 0000000..225b150 --- /dev/null +++ b/rgmanager/src/daemons/tests/test018.expected @@ -0,0 +1,291 @@ +=== Resources List === +Resource type: clusterfs +Agent: clusterfs.sh +Attributes: + name = argle [ primary ] + mountpoint = /mnt/cluster3 [ unique required ] + device = /dev/sdb10 [ unique required ] + nfslock [ inherit("service%nfslock") ] + +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test1 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: service [ROOT] +Instances: 1/1 +Agent: service.sh +Attributes: + name = test2 [ primary unique required ] + autostart = 1 [ reconfig ] + hardrecovery = 0 [ reconfig ] + exclusive = 0 [ reconfig ] + nfslock = 0 + recovery = restart [ reconfig ] + depend_mode = hard + max_restarts = 0 [ reconfig ] + restart_expire_time = 0 [ reconfig ] + +Resource type: nfsexport +Agent: nfsexport.sh +Attributes: + name = Dummy Export [ primary ] + device [ inherit("device") ] + path [ inherit("mountpoint") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = User group [ primary unique ] + target = @users [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,sync + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = Admin group [ primary unique ] + target = @admin [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = yellow [ primary unique ] + target = yellow [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = magenta [ primary unique ] + target = magenta [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw,no_root_squash + +Resource type: nfsclient +Agent: nfsclient.sh +Attributes: + name = red [ primary unique ] + target = red [ required ] + path [ inherit("path") ] + fsid [ inherit("fsid") ] + nfslock [ inherit("service%nfslock") ] + options = rw + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount1 [ primary ] + mountpoint = /mnt/cluster [ unique required ] + device = /dev/sdb8 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: fs +Instances: 1/1 +Agent: fs.sh +Attributes: + name = mount2 [ primary ] + mountpoint = /mnt/cluster2 [ unique required ] + device = /dev/sdb9 [ unique required ] + fstype = ext3 + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.3 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: ip +Instances: 1/1 +Agent: ip.sh +Attributes: + address = 192.168.1.4 [ primary unique ] + monitor_link = yes + nfslock [ inherit("service%nfslock") ] + +Resource type: script +Agent: script.sh +Attributes: + name = initscript [ primary unique ] + file = /etc/init.d/sshd [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script2 [ primary unique ] + file = /etc/init.d/script2 [ unique required ] + service_name [ inherit("service%name") ] + +Resource type: script +Agent: script.sh +Attributes: + name = script3 [ primary unique ] + file = /etc/init.d/script3 [ unique required ] + service_name [ inherit("service%name") ] + +=== Resource Tree === +service { + name = "test1"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + fs { + name = "mount1"; + mountpoint = "/mnt/cluster"; + device = "/dev/sdb8"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb8"; + path = "/mnt/cluster"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test1"; + clusterfs { + name = "argle"; + mountpoint = "/mnt/cluster3"; + device = "/dev/sdb10"; + nfslock = "0"; + } + } +} +service { + name = "test2"; + autostart = "1"; + hardrecovery = "0"; + exclusive = "0"; + nfslock = "0"; + recovery = "restart"; + depend_mode = "hard"; + max_restarts = "0"; + restart_expire_time = "0"; + script { + name = "initscript"; + file = "/etc/init.d/sshd"; + service_name = "test2"; + clusterfs { + name = "argle"; + mountpoint = "/mnt/cluster3"; + device = "/dev/sdb10"; + nfslock = "0"; + } + ip { + address = "192.168.1.3"; + monitor_link = "yes"; + nfslock = "0"; + } + fs { + name = "mount2"; + mountpoint = "/mnt/cluster2"; + device = "/dev/sdb9"; + fstype = "ext3"; + nfslock = "0"; + nfsexport { + name = "Dummy Export"; + device = "/dev/sdb9"; + path = "/mnt/cluster2"; + nfslock = "0"; + nfsclient { + name = "Admin group"; + target = "@admin"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + nfsclient { + name = "User group"; + target = "@users"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw,sync"; + } + nfsclient { + name = "red"; + target = "red"; + path = "/mnt/cluster2"; + nfslock = "0"; + options = "rw"; + } + } + } + script { + name = "script2"; + file = "/etc/init.d/script2"; + service_name = "test2"; + } + ip { + address = "192.168.1.4"; + monitor_link = "yes"; + nfslock = "0"; + } + } + script { + name = "script3"; + file = "/etc/init.d/script3"; + service_name = "test2"; + } +} +=== Event Triggers === +Event Priority Level 100: + Name: Default + (Any event) + File: /usr/share/cluster/default_event_script.sl diff --git a/rgmanager/src/resources/Makefile b/rgmanager/src/resources/Makefile index d543468..c1f4a71 100644 --- a/rgmanager/src/resources/Makefile +++ b/rgmanager/src/resources/Makefile @@ -21,11 +21,12 @@ RESOURCES=fs.sh service.sh ip.sh nfsclient.sh nfsexport.sh \ script.sh netfs.sh clusterfs.sh smb.sh \ apache.sh openldap.sh samba.sh mysql.sh \ postgres-8.sh tomcat-5.sh lvm.sh lvm_by_lv.sh lvm_by_vg.sh \ - SAPInstance SAPDatabase oracledb.sh + SAPInstance SAPDatabase named.sh \ + oracledb.sh METADATA=apache.metadata openldap.metadata samba.metadata \ mysql.metadata postgres-8.metadata tomcat-5.metadata \ - lvm.metadata + named.metadata lvm.metadata TARGETS=${RESOURCES} ocf-shellfuncs svclib_nfslock @@ -34,6 +35,9 @@ UTIL_TARGETS= \ utils/httpd-parse-config.pl utils/tomcat-parse-config.pl \ utils/member_util.sh +EVENT_TARGETS= \ + default_event_script.sl + all: install: all @@ -44,6 +48,7 @@ install: all install $(TARGETS) ${sharedir} install $(UTIL_TARGETS) ${sharedir}/utils install -m 644 $(METADATA) ${sharedir} + install -m 644 $(EVENT_TARGETS) ${sharedir} uninstall: ${UNINSTALL} ${UTIL_TARGETS} ${sharedir}/utils diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh index 0bf14f0..bf2a3d1 100755 --- a/rgmanager/src/resources/clusterfs.sh +++ b/rgmanager/src/resources/clusterfs.sh @@ -366,7 +366,7 @@ mountInUse () { typeset junk if [ $# -ne 2 ]; then - logAndPrint $LOG_ERR "Usage: mountInUse device mount_point". + ocf_log err "Usage: mountInUse device mount_point". return $FAIL fi @@ -408,7 +408,7 @@ isMounted () { ocf_log err "isMounted: Could not match $1 with a real device" return $FAIL fi - mp=$2 + mp=$(readlink -f $2) while read tmp_dev tmp_mp do @@ -444,14 +444,14 @@ isAlive() declare rw if [ $# -ne 1 ]; then - logAndPrint $LOG_ERR "Usage: isAlive mount_point" + ocf_log err "Usage: isAlive mount_point" return $FAIL fi mount_point=$1 test -d $mount_point if [ $? -ne 0 ]; then - logAndPrint $LOG_ERR "$mount_point is not a directory" + ocf_log err "$mount_point is not a directory" return $FAIL fi @@ -738,7 +738,7 @@ Cannot mount $dev on $mp, the device or mount point is already in use!" # # Mount the device # - logAndPrint $LOG_DEBUG "mount $fstype_option $mount_options $dev $mp" + ocf_log debug "mount $fstype_option $mount_options $dev $mp" mount $fstype_option $mount_options $dev $mp ret_val=$? if [ $ret_val -ne 0 ]; then @@ -761,6 +761,7 @@ stopFilesystem() { typeset -i try=1 typeset -i max_tries=3 # how many times to try umount typeset -i sleep_time=2 # time between each umount failure + typeset -i refs=0 typeset done="" typeset umount_failed="" typeset force_umount="" @@ -815,6 +816,18 @@ stop: Could not match $OCF_RESKEY_device with a real device" esac fi + # + # Check the rgmanager-supplied reference count if one exists. + # If the reference count is <= 1, we can safely proceed + # + if [ -n "$OCF_RESKEY_RGMANAGER_meta_refcnt" ]; then + refs=$OCF_RESKEY_RGMANAGER_meta_refcnt + if [ $refs -gt 1 ]; then + ((refs--)) + ocf_log debug "Not unmounting $OCF_RESOURCE_INSTANCE - still in use by $refs other service(s)" + return $OCF_SUCCESS + fi + fi # # Always do this hackery on clustered file systems. @@ -825,10 +838,10 @@ stop: Could not match $OCF_RESKEY_device with a real device" mkdir -p $mp/.clumanager/statd pkill -KILL -x lockd # Copy out the notify list; our - # IPs are already torn down - if notify_list_store $mp/.clumanager/statd; then - notify_list_broadcast $mp/.clumanager/statd - fi + # IPs are already torn down + if notify_list_store $mp/.clumanager/statd; then + notify_list_broadcast $mp/.clumanager/statd + fi fi # Always invalidate buffers on clusterfs resources @@ -857,7 +870,7 @@ stop: Could not match $OCF_RESKEY_device with a real device" sync; sync; sync ocf_log info "unmounting $dev ($mp)" - umount $dev + umount $mp if [ $? -eq 0 ]; then umount_failed= done=$YES @@ -907,8 +920,20 @@ stop: Could not match $OCF_RESKEY_device with a real device" case $1 in start) - startFilesystem - exit $? + declare tries=0 + declare rv + + while [ $tries -lt 3 ]; do + startFilesystem + rv=$? + if [ $rv -eq 0 ]; then + exit 0 + fi + + ((tries++)) + sleep 3 + done + exit $rv ;; stop) stopFilesystem @@ -916,16 +941,12 @@ stop) ;; status|monitor) isMounted ${OCF_RESKEY_device} ${OCF_RESKEY_mountpoint} - if [ $? -ne $YES ]; then - ocf_log err "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}" - exit $OCF_ERR_GENERIC - fi + [ $? -ne $YES ] && exit $OCF_ERR_GENERIC isAlive ${OCF_RESKEY_mountpoint} - [ $? -eq $YES ] && exit 0 - - ocf_log err "clusterfs:${OCF_RESKEY_name}: Mount point is not accessible!" - exit $OCF_ERR_GENERIC + [ $? -ne $YES ] && exit $OCF_ERR_GENERIC + + exit 0 ;; restart) stopFilesystem diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl new file mode 100644 index 0000000..e961266 --- /dev/null +++ b/rgmanager/src/resources/default_event_script.sl @@ -0,0 +1,314 @@ +define node_in_set(node_list, node) +{ + variable x, len; + + len = length(node_list); + for (x = 0; x < len; x++) { + if (node_list[x] == node) + return 1; + } + + return 0; +} + +define move_or_start(service, node_list) +{ + variable len; + variable state, owner; + variable depends; + + depends = service_property(service, "depend"); + if (depends != "") { + (owner, state) = service_status(depends); + if (owner < 0) { + debug(service, " is not runnable; dependency not met"); + return ERR_DEPEND; + } + } + + (owner, state) = service_status(service); + debug("Evaluating ", service, " state=", state, " owner=", owner); + + len = length(node_list); + if (len == 0) { + debug(service, " is not runnable"); + return ERR_DOMAIN; + } + + if (((event_type != EVENT_USER) and (state == "disabled")) or (state == "failed")) { + % + % Commenting out this block will -not- allow you to + % recover failed services from event scripts. Sorry. + % All it will get you is a false log message about + % starting this service. + % + % You may enable disabled services, but I recommend + % against it. + % + debug(service, " is not runnable"); + return -1; + } + + if (node_list[0] == owner) { + debug(service, " is already running on best node"); + return ERR_RUNNING; + } + + if ((owner >= 0) and (node_in_set(node_list, owner) == 1)) { + notice("Moving ", service, " from ", owner, + " to ", node_list); + if (service_stop(service) < 0) { + return ERR_ABORT; + } + } else { + notice("Starting ", service, " on ", node_list); + } + + return service_start(service, node_list); +} + + +% +% Returns the set of online nodes in preferred/shuffled order which +% are allowed to run this service. Gives highest preference to current +% owner if nofailback is specified. +% +define allowed_nodes(service) +{ + variable anodes; + variable online; + variable nodes_domain; + variable ordered, restricted, nofailback; + variable state, owner; + variable depends; + + (nofailback, restricted, ordered, nodes_domain) = + service_domain_info(service); + + (owner, state) = service_status(service); + + anodes = nodes_online(); + + % Shuffle the array so we don't start all services on the same + % node. TODO - add RR, Least-services, placement policies... + online = shuffle(anodes); + + if (restricted == 1) { + anodes = intersection(nodes_domain, online); + } else { + % Ordered failover domains (nodes_domain) unioned with the + % online nodes basically just reorders the online node list + % according to failover domain priority rules. + anodes = union(intersection(nodes_domain, online), + online); + } + + if ((nofailback == 1) or (ordered == 0)) { + + if ((owner < 0) or (node_in_set(anodes, owner) == 0)) { + return anodes; + } + + % Because union takes left as priority, we can + % return the union of the current owner with the + % allowed node list. This means the service will + % remain on the same node it's currently on. + return union(owner, anodes); + } + + return anodes; +} + + +define default_node_event_handler() +{ + variable services = service_list(); + variable x; + variable nodes; + + % debug("Executing default node event handler"); + for (x = 0; x < length(services); x++) { + nodes = allowed_nodes(services[x]); + ()=move_or_start(services[x], nodes); + } +} + + +define default_service_event_handler() +{ + variable services = service_list(); + variable x; + variable depends; + variable depend_mode; + variable policy; + variable nodes; + variable tmp; + variable owner; + variable state; + + % debug("Executing default service event handler"); + + if (service_state == "recovering") { + + policy = service_property(service_name, "recovery"); + debug("Recovering", + " Service: ", service_name, + " Last owner: ", service_last_owner, + " Policy: ", policy, + " RTE: ", service_restarts_exceeded); + + if (policy == "disable") { + () = service_stop(service_name, 1); + return; + } + + nodes = allowed_nodes(service_name); + if (policy == "restart" and service_restarts_exceeded == 0) { + nodes = union(service_last_owner, nodes); + } else { + % relocate + tmp = subtract(nodes, service_last_owner); + if (length(tmp) == 0) { + () = service_stop(service_name,0); + return; + } + + nodes = union(tmp, service_last_owner); + } + + ()=move_or_start(service_name, nodes); + + return; + } + + for (x = 0; x < length(services); x++) { + if (service_name == services[x]) { + % don't do anything to ourself! + continue; + } + + % + % Simplistic dependency handling + % + depends = service_property(services[x], "depend"); + depend_mode = service_property(services[x], "depend_mode"); + + % No dependency; do nothing + if (depends != service_name) { + continue; + } + + (owner, state) = service_status(services[x]); + if ((service_state == "started") and (owner < 0) and + (state == "stopped")) { + info("Dependency met; starting ", services[x]); + nodes = allowed_nodes(services[x]); + ()=move_or_start(services[x], nodes); + } + + % service died - stop service(s) that depend on the dead + if ((service_owner < 0) and (owner >= 0) and + (depend_mode != "soft")) { + info("Dependency lost; stopping ", services[x]); + ()=service_stop(services[x]); + } + } +} + +define default_config_event_handler() +{ + % debug("Executing default config event handler"); +} + +define default_user_event_handler() +{ + variable ret; + variable nodes; + variable reordered; + variable x; + variable target = user_target; + variable found = 0; + variable owner, state; + + nodes = allowed_nodes(service_name); + (owner, state) = service_status(service_name); + + if (user_request == USER_RESTART) { + + if (owner >= 0) { + reordered = union(owner, nodes); + nodes = reordered; + } + + notice("Stopping ", service_name, " for relocate to ", nodes); + + found = service_stop(service_name); + if (found < 0) { + return ERR_ABORT; + } + + ret = move_or_start(service_name, nodes); + + } else if ((user_request == USER_RELOCATE) or + (user_request == USER_ENABLE)) { + + if (user_target > 0) { + for (x = 0; x < length(nodes); x++) { + % + % Put the preferred node at the front of the + % list for a user-relocate operation + % + if (nodes[x] == user_target) { + reordered = union(user_target, nodes); + nodes = reordered; + found = 1; + } + } + + if (found == 0) { + warning("User specified node ", user_target, + " is offline"); + } + } + + if ((owner >= 0) and (user_request == USER_RELOCATE)) { + if (service_stop(service_name) < 0) { + return ERR_ABORT; + } + + % + % The current owner shouldn't be the default + % for a relocate operation + % + reordered = subtract(nodes, owner); + nodes = union(reordered, owner); + } + + ret = move_or_start(service_name, nodes); + + } else if (user_request == USER_DISABLE) { + + ret = service_stop(service_name, 1); + + } else if (user_request == USER_STOP) { + + ret = service_stop(service_name); + + } + + % + % todo - migrate + % + + return ret; +} + +if (event_type == EVENT_NODE) + default_node_event_handler(); +if (event_type == EVENT_SERVICE) + default_service_event_handler(); +if (event_type == EVENT_CONFIG) + default_config_event_handler(); +if (event_type == EVENT_USER) + user_return=default_user_event_handler(); + diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh index a1e589a..b3381c3 100755 --- a/rgmanager/src/resources/fs.sh +++ b/rgmanager/src/resources/fs.sh @@ -529,7 +529,7 @@ isMounted () { "fs (isMounted): Could not match $1 with a real device" return $FAIL fi - mp=$2 + mp=$(readlink -f $2) while read tmp_dev tmp_mp do @@ -797,21 +797,14 @@ activeMonitor() { # -# Enable quotas on the mount point if the user requested them +# Decide which quota options are enabled and return a string +# which we can pass to quotaon # -enable_fs_quotas() +quota_opts() { - declare -i need_check=0 - declare -i rv declare quotaopts="" - declare mopt declare opts=$1 - declare mp=$2 - - if [ -z "`which quotaon`" ]; then - ocf_log err "quotaon not found in $PATH" - return $OCF_ERR_GENERIC - fi + declare mopt for mopt in `echo $opts | sed -e s/,/\ /g`; do case $mopt in @@ -830,6 +823,33 @@ enable_fs_quotas() esac done + echo $quotaopts + return 0 +} + + + +# +# Enable quotas on the mount point if the user requested them +# +enable_fs_quotas() +{ + declare -i need_check=0 + declare -i rv + declare quotaopts="" + declare mopt + declare opts=$1 + declare mp=$2 + + if [ -z "`which quotaon`" ]; then + ocf_log err "quotaon not found in $PATH" + return $OCF_ERR_GENERIC + fi + + quotaopts=$(quota_opts $opts) + + ocf_log info "quotaopts = $quotaopts" + [ -z "$quotaopts" ] && return 0 # Ok, create quota files if they don't exist @@ -1089,6 +1109,7 @@ stopFilesystem() { typeset force_umount="" typeset self_fence="" typeset fstype="" + typeset quotaopts="" # @@ -1154,11 +1175,15 @@ stop: Could not match $OCF_RESKEY_device with a real device" ;; $YES) sync; sync; sync - ocf_log info "unmounting $mp" + quotaopts=$(quota_opts $OCF_RESKEY_options) + if [ -n "$quotaopts" ]; then + ocf_log debug "Turning off quotas for $mp" + quotaoff -$quotaopts $mp &> /dev/null + fi activeMonitor stop || return $OCF_ERR_GENERIC - quotaoff -gu $mp &> /dev/null + ocf_log info "unmounting $mp" umount $mp if [ $? -eq 0 ]; then umount_failed= diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh index 15759bf..c683ee6 100755 --- a/rgmanager/src/resources/netfs.sh +++ b/rgmanager/src/resources/netfs.sh @@ -335,7 +335,7 @@ isMounted () { fi fullpath=$1 - mp=$2 + mp=$(readlink -f $2) while read tmp_fullpath tmp_mp do diff --git a/rgmanager/src/resources/ocf-shellfuncs b/rgmanager/src/resources/ocf-shellfuncs index eb0147f..98156c0 100755 --- a/rgmanager/src/resources/ocf-shellfuncs +++ b/rgmanager/src/resources/ocf-shellfuncs @@ -174,6 +174,10 @@ ocf_log() { esac pretty_echo $__OCF_PRIO "$__OCF_MSG" + + if [ -z "`which clulog 2> /dev/null`" ]; then + return 0 + fi clulog -p $__LOG_PID -n $__LOG_NAME \ -s $__OCF_PRIO_N "$__OCF_MSG" } diff --git a/rgmanager/src/resources/script.sh b/rgmanager/src/resources/script.sh index 9a9455c..0141c80 100755 --- a/rgmanager/src/resources/script.sh +++ b/rgmanager/src/resources/script.sh @@ -115,5 +115,5 @@ ${OCF_RESKEY_file} $1 declare -i rv=$? if [ $rv -ne 0 ]; then ocf_log err "script:$OCF_RESKEY_name: $1 of $OCF_RESKEY_file failed (returned $rv)" - return $OCF_ERR_GENERIC + exit $OCF_ERR_GENERIC fi diff --git a/rgmanager/src/resources/service.sh b/rgmanager/src/resources/service.sh index da89301..339657d 100755 --- a/rgmanager/src/resources/service.sh +++ b/rgmanager/src/resources/service.sh @@ -1,8 +1,26 @@ #!/bin/bash # -# Dummy OCF script for resource group; the OCF spec doesn't support abstract -# resources. ;( +# Copyright Red Hat, Inc. 2004-2006 +# +# 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, or (at your option) any +# later version. +# +# This program 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 program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +# MA 02139, USA. +# + +# +# Dummy OCF script for resource group # # Grab nfs lock tricks if available @@ -38,7 +56,7 @@ meta_data() - + Fail over domains define lists of cluster members to try in the event that a resource group fails. @@ -49,7 +67,7 @@ meta_data() - + If set to yes, this resource group will automatically be started after the cluster forms a quorum. If set to no, this resource @@ -59,10 +77,10 @@ meta_data() Automatic start after quorum formation - + - + If set to yes, the last owner will reboot if this resource group fails to stop cleanly, thus allowing the resource @@ -74,10 +92,10 @@ meta_data() Reboot if stop phase fails - + - + If set, this resource group will only relocate to nodes which have no other resource groups running in the @@ -91,7 +109,7 @@ meta_data() Exclusive resource group - + @@ -107,10 +125,10 @@ meta_data() Enable NFS lock workarounds - + - + This currently has three possible options: "restart" tries to restart failed parts of this resource group locally before @@ -123,8 +141,60 @@ meta_data() Failure recovery policy + + + + + + Top-level service this depends on, in "service:name" format. + + + Service dependency; will not start without the specified + service running. + + + + + Dependency mode + + + Service dependency mode. + hard - This service is stopped/started if its dependency + is stopped/started + soft - This service only depends on the other service for + initial startip. If the other service stops, this + service is not stopped. + + + + + + + Maximum restarts for this service. + + + Maximum restarts for this service. + + + + + + + Restart expiration time + + + Restart expiration time. A restart is forgotten + after this time. When combined with the max_restarts + option, this lets administrators specify a threshold + for when to fail over services. If max_restarts + is exceeded in this given expiration time, the service + is relocated instead of restarted again. + + + + @@ -135,10 +205,11 @@ meta_data() + - + @@ -149,7 +220,7 @@ meta_data() - + @@ -166,6 +237,7 @@ EOT # case $1 in start) + [ -d "/var/run/cluster/rgmanager" ] && touch "/var/run/cluster/rgmanager/$OCF_RESOURCE_INSTANCE" # # XXX If this is set, we kill lockd. If there is no # child IP address, then clients will NOT get the reclaim @@ -180,6 +252,7 @@ case $1 in exit 0 ;; stop) + [ -d "/var/run/cluster/rgmanager" ] && rm -f "/var/run/cluster/rgmanager/$OCF_RESOURCE_INSTANCE" exit 0 ;; recover|restart) @@ -195,7 +268,10 @@ case $1 in meta_data exit 0 ;; - verify-all) + validate-all) + exit 0 + ;; + reconfig) exit 0 ;; *) diff --git a/rgmanager/src/resources/svclib_nfslock b/rgmanager/src/resources/svclib_nfslock index de996b1..2101e1e 100644 --- a/rgmanager/src/resources/svclib_nfslock +++ b/rgmanager/src/resources/svclib_nfslock @@ -1,5 +1,22 @@ #!/bin/bash # +# Copyright Red Hat Inc., 2006 +# +# 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, or (at your option) any +# later version. +# +# This program 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 program; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +# MA 02139, USA. +# # Do reclaim-broadcasts when we kill lockd during shutdown/startup # of a cluster service. # @@ -163,6 +180,17 @@ notify_list_broadcast() declare lockd_pid=$(pidof lockd) declare nl_dir=$1 + # First of all, send lockd a SIGKILL. We hope nfsd is running. + # If it is, this will cause lockd to reset the grace period for + # lock reclaiming. + if [ -n "$lockd_pid" ]; then + ocf_log info "Asking lockd to drop locks (pid $lockd_pid)" + kill -9 $lockd_pid + else + ocf_log warning "lockd not running; cannot notify clients" + return 1 + fi + while read dev family addr maskbits; do if [ "$family" != "inet" ]; then continue diff --git a/rgmanager/src/resources/utils/named-parse-config.pl b/rgmanager/src/resources/utils/named-parse-config.pl new file mode 100644 index 0000000..4ac39c3 --- /dev/null +++ b/rgmanager/src/resources/utils/named-parse-config.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w + +## +## parse named.conf (from stdin) and add options from cluster.conf +## +## ./named-parse-config.pl "directory" "pid-file" "listen-on" +## +use strict; + +if ($#argv < 2) { + die ("Not enough arguments"); +} + +while (my $line = ) { + chomp($line); + $line =~ s/(.*?)\s*$/$1/; + if ($line =~ /^\s*options\s+\{/) { + print $line, "\n"; + print "\tdirectory \"$ARGV[0]\";\n"; + print "\tpid-file \"$ARGV[1]\";\n"; + print "\tlisten-on { $ARGV[2] };\n"; + } else { + print $line, "\n"; + } +} + diff --git a/rgmanager/src/resources/utils/ra-skelet.sh b/rgmanager/src/resources/utils/ra-skelet.sh index 67630e2..5530ae6 100644 --- a/rgmanager/src/resources/utils/ra-skelet.sh +++ b/rgmanager/src/resources/utils/ra-skelet.sh @@ -65,7 +65,7 @@ stop_generic() if [ ! -d "/proc/$pid" ]; then return 0; fi - + kill -TERM "$pid" if [ $? -ne 0 ]; then diff --git a/rgmanager/src/utils/clusvcadm.c b/rgmanager/src/utils/clusvcadm.c index a608374..0701c18 100644 --- a/rgmanager/src/utils/clusvcadm.c +++ b/rgmanager/src/utils/clusvcadm.c @@ -222,7 +222,8 @@ int main(int argc, char **argv) { extern char *optarg; - char *svcname=NULL, nodename[256]; + char *svcname=NULL, nodename[256], tmp[96]; + char *printname=NULL; int opt; int msgfd = -1, fd, fod = 0; SmMessageSt msg; @@ -314,6 +315,12 @@ main(int argc, char **argv) return 1; } + if (strncmp(svcname, "service:", 8)) { + snprintf(tmp, sizeof(tmp), "service:%s", svcname); + printname = svcname; + svcname = tmp; + } + /* No login */ fd = clu_connect(RG_SERVICE_GROUP, 0); if (fd < 0) { @@ -343,15 +350,18 @@ main(int argc, char **argv) build_message(&msg, action, svcname, svctarget, fod, 0); if (action != RG_RELOCATE) { - printf("Member %s %s %s", nodename, actionstr, svcname); + printf("Member %s %s %s", nodename, actionstr, + printname?printname:svcname); printf("..."); fflush(stdout); msgfd = msg_open(msgtarget, RG_PORT, 0, 5); } else { if (node_specified) - printf("Trying to relocate %s to %s", svcname, nodename); + printf("Trying to relocate %s to %s", + printname?printname:svcname, nodename); else - printf("Trying to relocate %s", svcname); + printf("Trying to relocate %s", + printname?printname:svcname); printf("..."); fflush(stdout); msgfd = msg_open(me, RG_PORT, 0, 5); @@ -395,7 +405,7 @@ main(int argc, char **argv) /* Decode */ swab_SmMessageSt(&msg); switch (msg.sm_data.d_ret) { - case SUCCESS: + case RG_SUCCESS: printf("success\n"); /* Non-start/relo request: done */ @@ -417,31 +427,8 @@ main(int argc, char **argv) printf("Service %s is now running on %s\n", svcname, memb_id_to_name(membership, msg.sm_data.d_svcOwner)); break; - case RG_EFAIL: - printf("failed\n"); - break; - case RG_ENODEDEATH: - printf("node processing request died\n"); - printf("(Status unknown)\n"); - break; - case RG_EABORT: - printf("cancelled by resource manager\n"); - break; - case RG_ENOSERVICE: - printf("failed: Service does not exist\n"); - break; - case RG_EDEADLCK: - printf("failed: Operation would deadlock\n"); - break; - case RG_EAGAIN: - printf("failed: Try again (resource groups locked)\n"); - break; - case RG_ERUN: - printf("failed: Service is already running\n"); - return 0; - break; default: - printf("failed: unknown reason %d\n", msg.sm_data.d_ret); + printf("%s\n", rg_strerror(msg.sm_data.d_ret)); break; } hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Tue Apr 15 15:35:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Tue, 15 Apr 2008 15:35:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-43-g8dc51a6 Message-ID: <20080415153525.6491.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=8dc51a64cf9a0bc1b467353a4161220a7cec0de0 The branch, RHEL4 has been updated via 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 (commit) from 69a3d82a661d0c67dadfc0c02a6839c94ab0cdfb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 Author: Christine Caulfield Date: Tue Apr 15 16:34:48 2008 +0100 [DLM] Add tcp_nodelay option to DLM comms Under some very odd loads, the TCP nagle algorithm can cause annoying delays in lock traffic. This option allows it to be switched off with echo "1" > /proc/cluster/config/dlm/tcp_nodelay This should NOT be a default, in most cases it will cause a huge performance drop. It is global to all DLM communications and cannot be changed per lockspace. It is included specifically for bz#244708. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: dlm-kernel/src/config.c | 6 ++++++ dlm-kernel/src/config.h | 1 + dlm-kernel/src/lowcomms.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/dlm-kernel/src/config.c b/dlm-kernel/src/config.c index 41bdedd..b90d256 100644 --- a/dlm-kernel/src/config.c +++ b/dlm-kernel/src/config.c @@ -20,6 +20,7 @@ /* Config file defaults */ #define DEFAULT_TCP_PORT 21064 +#define DEFAULT_TCP_NODELAY 0 #define DEFAULT_LOCK_TIMEOUT 30 #define DEFAULT_BUFFER_SIZE 4096 #define DEFAULT_RSBTBL_SIZE 256 @@ -31,6 +32,7 @@ struct config_info dlm_config = { .tcp_port = DEFAULT_TCP_PORT, + .tcp_nodelay = DEFAULT_TCP_NODELAY, .lock_timeout = DEFAULT_LOCK_TIMEOUT, .buffer_size = DEFAULT_BUFFER_SIZE, .rsbtbl_size = DEFAULT_RSBTBL_SIZE, @@ -51,6 +53,10 @@ static struct config_proc_info { .value = &dlm_config.tcp_port, }, { + .name = "tcp_nodelay", + .value = &dlm_config.tcp_nodelay, + }, + { .name = "lock_timeout", .value = &dlm_config.lock_timeout, }, diff --git a/dlm-kernel/src/config.h b/dlm-kernel/src/config.h index 9190c6b..0b37cf4 100644 --- a/dlm-kernel/src/config.h +++ b/dlm-kernel/src/config.h @@ -16,6 +16,7 @@ struct config_info { int tcp_port; + int tcp_nodelay; int lock_timeout; int buffer_size; int rsbtbl_size; diff --git a/dlm-kernel/src/lowcomms.c b/dlm-kernel/src/lowcomms.c index 4967092..8ea83dd 100644 --- a/dlm-kernel/src/lowcomms.c +++ b/dlm-kernel/src/lowcomms.c @@ -598,6 +598,16 @@ static int connect_to_sock(struct connection *con) /* Set up for connect */ make_sockaddr(&saddr, dlm_config.tcp_port, &addr_len); + if (dlm_config.tcp_nodelay) { + int one = 1; + mm_segment_t fs; + + fs = get_fs(); + set_fs(get_ds()); + + tcp_setsockopt(sock->sk, SOL_TCP, TCP_NODELAY, (char *)&one, sizeof(one)); + set_fs(fs); + } add_sock(sock, con); log_debug2("connecting to %d", con->nodeid); @@ -653,6 +663,10 @@ static struct socket *create_listen_sock(struct connection *con, char *addr, int fs = get_fs(); set_fs(get_ds()); + + if (dlm_config.tcp_nodelay) + result = tcp_setsockopt(sock->sk, SOL_TCP, TCP_NODELAY, (char *)&one, sizeof(one)); + result = sock_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)); set_fs(fs); if (result < 0) { hooks/post-receive -- Cluster Project From teigland@sourceware.org Tue Apr 15 18:03:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Tue, 15 Apr 2008 18:03:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-47-g0847ffd Message-ID: <20080415180345.10458.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0847ffdaf607aafd538e949c91eb47f2a06c4335 The branch, RHEL5 has been updated via 0847ffdaf607aafd538e949c91eb47f2a06c4335 (commit) from d48a61c7d3fac5cae7528df29614216754ad5880 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0847ffdaf607aafd538e949c91eb47f2a06c4335 Author: David Teigland Date: Mon Mar 31 10:09:37 2008 -0500 gfs: don't cancel glocks when writing to hidden file bz 438268 When glock.c sees the PRIORITY flag, it cancels any outstanding glocks prior to doing the lock request. lock_dlm also uses the PRIORITY flag to give give granting priority to the lock in the dlm. Both of these are necessary when the PRIORITY glock is used for recovery, but only the second is wanted (neither is really needed) when writing to a hidden file. A new GL_NOCANCEL_OTHER flag, combined with PRIORITY, is used to tell glock.c to not do the cancels. Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.c | 3 ++- gfs-kernel/src/gfs/glock.h | 1 + gfs-kernel/src/gfs/ioctl.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c index 255994c..1cb6e7e 100644 --- a/gfs-kernel/src/gfs/glock.c +++ b/gfs-kernel/src/gfs/glock.c @@ -1336,7 +1336,8 @@ glock_wait_internal(struct gfs_holder *gh) spin_unlock(&gl->gl_spin); } - if (gh->gh_flags & LM_FLAG_PRIORITY) + if ((gh->gh_flags & LM_FLAG_PRIORITY) && + !(gh->gh_flags & GL_NOCANCEL_OTHER)) do_cancels(gh); wait_for_completion(&gh->gh_wait); diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index fb1e210..c9bd819 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -34,6 +34,7 @@ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ #define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ +#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) diff --git a/gfs-kernel/src/gfs/ioctl.c b/gfs-kernel/src/gfs/ioctl.c index 1133c8f..32db45c 100644 --- a/gfs-kernel/src/gfs/ioctl.c +++ b/gfs-kernel/src/gfs/ioctl.c @@ -1223,7 +1223,8 @@ gi_do_hfile_write(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user) gfs_write_calc_reserv(ip, gi->gi_size, &data_blocks, &ind_blocks); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, - LM_FLAG_PRIORITY | GL_SYNC, &i_gh); + LM_FLAG_PRIORITY | GL_SYNC | GL_NOCANCEL_OTHER, + &i_gh); if (error) return error; hooks/post-receive -- Cluster Project From teigland@sourceware.org Tue Apr 15 18:05:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Tue, 15 Apr 2008 18:05:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-12-g86a728d Message-ID: <20080415180516.12017.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=86a728d286e95b6db8a46ecd8c9b9a6540d2b138 The branch, STABLE2 has been updated via 86a728d286e95b6db8a46ecd8c9b9a6540d2b138 (commit) from c6bb7557e85b3363ff0fd10f1411373f4b747366 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 86a728d286e95b6db8a46ecd8c9b9a6540d2b138 Author: David Teigland Date: Mon Mar 31 10:09:37 2008 -0500 gfs: don't cancel glocks when writing to hidden file bz 438268 When glock.c sees the PRIORITY flag, it cancels any outstanding glocks prior to doing the lock request. lock_dlm also uses the PRIORITY flag to give give granting priority to the lock in the dlm. Both of these are necessary when the PRIORITY glock is used for recovery, but only the second is wanted (neither is really needed) when writing to a hidden file. A new GL_NOCANCEL_OTHER flag, combined with PRIORITY, is used to tell glock.c to not do the cancels. Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/gfs/glock.c | 3 ++- gfs-kernel/src/gfs/glock.h | 1 + gfs-kernel/src/gfs/ioctl.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c index f112f5f..f4ceaed 100644 --- a/gfs-kernel/src/gfs/glock.c +++ b/gfs-kernel/src/gfs/glock.c @@ -1336,7 +1336,8 @@ glock_wait_internal(struct gfs_holder *gh) spin_unlock(&gl->gl_spin); } - if (gh->gh_flags & LM_FLAG_PRIORITY) + if ((gh->gh_flags & LM_FLAG_PRIORITY) && + !(gh->gh_flags & GL_NOCANCEL_OTHER)) do_cancels(gh); wait_for_completion(&gh->gh_wait); diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index fb1e210..c9bd819 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -34,6 +34,7 @@ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ #define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ +#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) diff --git a/gfs-kernel/src/gfs/ioctl.c b/gfs-kernel/src/gfs/ioctl.c index 1133c8f..32db45c 100644 --- a/gfs-kernel/src/gfs/ioctl.c +++ b/gfs-kernel/src/gfs/ioctl.c @@ -1223,7 +1223,8 @@ gi_do_hfile_write(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user) gfs_write_calc_reserv(ip, gi->gi_size, &data_blocks, &ind_blocks); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, - LM_FLAG_PRIORITY | GL_SYNC, &i_gh); + LM_FLAG_PRIORITY | GL_SYNC | GL_NOCANCEL_OTHER, + &i_gh); if (error) return error; hooks/post-receive -- Cluster Project From lhh@sourceware.org Tue Apr 15 19:21:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Tue, 15 Apr 2008 19:21:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-44-gc9f85c1 Message-ID: <20080415192103.12964.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c9f85c1b3cccdd529005d08fb8e4618f752acaab The branch, RHEL4 has been updated via c9f85c1b3cccdd529005d08fb8e4618f752acaab (commit) from 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c9f85c1b3cccdd529005d08fb8e4618f752acaab Author: Lon Hohberger Date: Tue Apr 15 15:20:32 2008 -0400 [rgmanager] Set +x on SAPInstance/SAPDatabase ----------------------------------------------------------------------- Summary of changes: 0 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 rgmanager/src/resources/SAPDatabase mode change 100644 => 100755 rgmanager/src/resources/SAPInstance diff --git a/rgmanager/src/resources/SAPDatabase b/rgmanager/src/resources/SAPDatabase old mode 100644 new mode 100755 diff --git a/rgmanager/src/resources/SAPInstance b/rgmanager/src/resources/SAPInstance old mode 100644 new mode 100755 hooks/post-receive -- Cluster Project From cfeist@sourceware.org Tue Apr 15 20:01:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Tue, 15 Apr 2008 20:01:00 -0000 Subject: Cluster Project branch, RHEL47, created. gfs-kernel_2_6_9_76-44-gc9f85c1 Message-ID: <20080415200056.1123.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c9f85c1b3cccdd529005d08fb8e4618f752acaab The branch, RHEL47 has been created at c9f85c1b3cccdd529005d08fb8e4618f752acaab (commit) - Log ----------------------------------------------------------------- commit c9f85c1b3cccdd529005d08fb8e4618f752acaab Author: Lon Hohberger Date: Tue Apr 15 15:20:32 2008 -0400 [rgmanager] Set +x on SAPInstance/SAPDatabase commit 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 Author: Christine Caulfield Date: Tue Apr 15 16:34:48 2008 +0100 [DLM] Add tcp_nodelay option to DLM comms Under some very odd loads, the TCP nagle algorithm can cause annoying delays in lock traffic. This option allows it to be switched off with echo "1" > /proc/cluster/config/dlm/tcp_nodelay This should NOT be a default, in most cases it will cause a huge performance drop. It is global to all DLM communications and cannot be changed per lockspace. It is included specifically for bz#244708. Signed-off-by: Christine Caulfield commit 69a3d82a661d0c67dadfc0c02a6839c94ab0cdfb Author: Lon Hohberger Date: Tue Apr 15 11:02:33 2008 -0400 [rgmanager] Fix several bugzillas (see below) - 245381 - restart counter/thresholds before switching to relocation during service recovery - 247772 - one service following another (event scripting ability). This isn't fixed in the usual way, as this feature has limited use. Instead, we allow an alternative method of operation for rgmanager in which administrators can define event triggers for whatever they would like. (Called "RIND") - 247945 - rgmanager restarting services when noncritical parameters are changed - 247980 - strong / weak service dependencies. These are trivial. Weak dependencies are only allowed with the event scripting as noted for 247772 - 250101 - RG event API (internals change). This was required for RIND to operate as well as 247980 - 439948 - clushutdown reference in clusvcadm man page - 440006 - rgmanager stuck on stop in some cases - 440645 - quotaoff causes hanges in some circumstances - 441577 - Symlinks in mount point path cause erroneous failures commit 24945860f4de6118437688aa3e4b7bb3e3edbbf0 Author: Lon Hohberger Date: Tue Apr 8 00:32:04 2008 -0400 [rgmanager] Fix minor crash bug commit 070de9cc3db1a66d427a2aaaef0dbf71d4d404b9 Author: Lon Hohberger Date: Fri Apr 4 13:54:28 2008 -0400 [rgmanager] Fixes for RIND commit 179da28103b843845cad5eaec61a48855b5cf807 Author: Lon Hohberger Date: Fri Apr 4 11:20:09 2008 -0400 [rgmanager] More RIND merges. commit 7c3f3ad887d460c2bd92a7a398048be58f1b4a07 Author: Lon Hohberger Date: Tue Apr 1 16:25:08 2008 -0400 [rgmanager] Fix clusvcadm build commit d35287124adf15a981703c3e0785fa7c644223c1 Author: Lon Hohberger Date: Tue Apr 1 16:23:17 2008 -0400 [rgmanager] Fix build commit fed6e7804f9b092b09a1d243abd03eb87747e566 Author: Lon Hohberger Date: Tue Apr 1 16:22:15 2008 -0400 [rgmanager] Remove extraneous copy of event_script.txt commit 71a51fb8ed4c91c5963665940afca5fc44f42559 Author: Lon Hohberger Date: Tue Apr 1 16:17:55 2008 -0400 [rgmanager] Misc fixes. Update auto testing commit 652fe516bfa1efd5ceff9e1551e8dabc573e294d Author: Lon Hohberger Date: Tue Apr 1 12:54:15 2008 -0400 [rgmanager] Make RIND build on RHEL4 branch commit 0d3a7a758217efbfec3a662269856a30d68fdd63 Author: Lon Hohberger Date: Mon Mar 10 09:58:08 2008 -0400 Merge, part 2 commit 00a395dd63da4728c30b61a04a71224a4f05b82d Author: Lon Hohberger Date: Mon Mar 10 09:56:40 2008 -0400 Commit phase 1 of update from rhel5 branch commit 5f03c06d964894819c182b5112af75e5ee44a256 Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) commit 625364c99277445b97bbb3120736c358b802fb0f Author: Jonathan Brassow Date: Mon Apr 7 10:48:24 2008 -0500 - dm-cmirror.ko: Fix infinite election loop (bug 217895) It was possible for an election to be run just before a machine that was next in line to be server suspened. This would cause the remaining nodes to think a suspended node was the active server - worse, the suspended node would allow itself to become server and then say in was not in charge of the log. This would simply keep going round and round. Fix is to increment 'suspended' before exiting postsuspend, and not allowing a node to be elected server if 'suspended' was set. commit aac75cba36115a59a489c0b1a52be5259f54fb87 Author: Jonathan Brassow Date: Tue Apr 8 11:30:38 2008 -0500 dm-cmirror.ko: Part of the fix for bug 193067 (cluster pvmove) Allow mirror log to be created without the 'block_on_error' flag. commit 9133a6446a47c56bd735d01d761f0c91f8491fe0 Author: Ryan O'Hara Date: Mon Apr 7 11:13:40 2008 -0500 BZ 409391 : fence_scsi and scsi_reserve script no longer use state file for tracking registered devices (/var/run/scsi_reserve). commit 481965dc9ddb3cbbe06e82ecd507a2b77621206a Author: Lon Hohberger Date: Mon Apr 7 09:47:01 2008 -0400 [cman] Resolve 441266 - uninitialized variable causing qdiskd to fail commit 6626fda2200aa1abed902646371eee265be7fc04 Author: Ryan O'Hara Date: Fri Apr 4 17:52:41 2008 -0500 BZ 409391 : fence_scsi and scsi_reserve script no longer use state file for tracking registered devices (/var/run/scsi_reserve). commit c128baa7cc5397f1fcfc72d35cdb39c089c56043 Author: Jonathan Brassow Date: Thu Apr 3 10:48:46 2008 -0500 rgmanager/lvm.sh: Fix bug 431705 - Add another check for improper HA LVM setup. Specifically, check for fail-over VG name in 'volume_list', which would allow a machine to activate a VG regardless of tagging. - Clearer error messages - Better comments commit 0536f85e62db2ac86b0f47c6e6089090261eceae Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent commit 36e10fa435afc59e5a0e658c1b9b7ee2c34f184a Author: Jonathan Brassow Date: Wed Apr 2 14:25:22 2008 -0500 rgmanager/lvm.sh: Make lvm.sh call into lvm_by_*.sh (RE: bz427377) lvm_by_*.sh scripts are updated. Now call them. This makes lvm.sh a wrapper around lvm_by_*.sh scripts commit a0e32d4eea87f15b2e07c8f61ecd53bd2462e73f Author: Jonathan Brassow Date: Wed Apr 2 14:19:02 2008 -0500 rgmanager/lvm.sh: Updated fix for bz242798 When fixing bug Bug 427377 (allow multiple LVs / VG), I failed to commit the changes to lvm.sh - which effectively just became a shell that called functions in other files. Now, I need to update the other files with recent bug fixes and then make the change that was necessary for bug 427377 - removing the functional contents of lvm.sh. commit d0aecbf552f27bb2bf9d3c66015dd4d8df559dd8 Author: Jonathan Brassow Date: Tue Apr 1 15:24:50 2008 -0500 rgmanager/lvm.sh: Fix bug bz242798 Allow a machine to fence itself in the event that it cannot deactivate logical volumes. (The user must explicitly enable this option.) This is useful in cases where one machine in the cluster looses connectivity to its resources, but the others don't. The machine fences itself and the service moves to another machine. commit 2114f9e99321008beef4cc18bcbe4aa8712015f9 Author: Jonathan Brassow Date: Wed Mar 26 09:02:53 2008 -0500 rgmanager/lvm.sh: Fix for bug 438997 Missing VG name parameter to 'vgchange --deltag' call caused tag to be remove from all VGs, not just the intended one. Thanks to Simone Gotti for the patch. commit 22b442ed10069372d306e7f0fd162cf5387c5211 Author: Bob Peterson Date: Tue Mar 25 13:33:48 2008 -0500 Resolves: bz 435469: gfs_tool: Cannot allocate memory commit 9d2d37ee3db933f01c8e5021d6d6a5897d5fe017 Merge: 8c6094c0c5d457c9572ff386c5b53f075ce54f9c c118d0ce03910523ebd6cd533a410283640caf37 Author: Jonathan Brassow Date: Thu Mar 20 10:55:12 2008 -0500 Merge branch 'RHEL4' of ssh://jbrassow@sources.redhat.com/git/cluster into rhel4 commit 8c6094c0c5d457c9572ff386c5b53f075ce54f9c Author: Jonathan Brassow Date: Thu Mar 20 10:37:50 2008 -0500 dm-cmirror.ko: change a blocking I/O to async I/O Sometimes, the mirror subdevices get suspended before the log server suspends. This can lead to the server issuing I/O requests on devices that are suspended. If it waits for the I/O to complete, it could wait indefinitly. Now there is a timeout in place for the I/O, which should prevent the server from getting stuck. commit c118d0ce03910523ebd6cd533a410283640caf37 Author: Bob Peterson Date: Fri Mar 14 11:17:46 2008 -0500 Resolves: bz 421761: 'gfs_tool lockdump' wrongly says 'unknown mountpoint' re HP cciss RAID array commit a623bf5bbecedd41e592d584c790f68fd218b569 Author: Bob Peterson Date: Fri Mar 14 11:09:09 2008 -0500 Resolves: bz 431945: GFS: gfs-kernel should use device major:minor commit b2fb1017061f86f02f3cd864e10b44e9fa347441 Author: Lon Hohberger Date: Tue Mar 11 16:14:01 2008 -0400 Revert "Commit phase 1 of update from rhel5 branch" This reverts commit df101a4507641607e5869f2f15c05cb1be6e0639. This wasn't finished; I committed from the wrong branch. commit edf5a1e10e95e0b02afbbc1e0a260141b128695e Author: Lon Hohberger Date: Tue Mar 11 16:13:32 2008 -0400 Revert "Merge, part 2" This reverts commit 43571d7af75bdb6a0b19d40048da1491b6499efb. This wasn't finished. I pushed from the wrong branch :( commit db6a74a9900257848aa4c07256b77b2d10a7db13 Author: Lon Hohberger Date: Tue Mar 4 17:31:32 2008 -0500 [CMAN] make qdisk master abdication work in all cases Red Hat bugzilla 430264 commit 5aeaf6345cd4672e0ef52a753b4f6cf56a64d5b5 Author: Lon Hohberger Date: Tue Mar 11 14:54:49 2008 -0400 [rgmanager] Make ip.sh check link states of non-ethernet devices Resolves: Red Hat Bugzilla #331661 commit 43571d7af75bdb6a0b19d40048da1491b6499efb Author: Lon Hohberger Date: Mon Mar 10 09:58:08 2008 -0400 Merge, part 2 commit df101a4507641607e5869f2f15c05cb1be6e0639 Author: Lon Hohberger Date: Mon Mar 10 09:56:40 2008 -0400 Commit phase 1 of update from rhel5 branch commit 1befab3b0e83584f08b06b816adbc0f8b9dc11ab Merge: 2a08798bc9b438789e315e638f1911223863ed4f 595e3cad6ac837bd37a7bd6b9280d1ca0c1e868c Author: Chris Feist Date: Tue Mar 4 18:08:41 2008 -0600 Merge branch 'RHEL4' of ssh://sources.redhat.com/git/cluster into r4 commit 2a08798bc9b438789e315e638f1911223863ed4f Author: Chris Feist Date: Tue Mar 4 17:49:04 2008 -0600 Fixed makefiles to build. commit 595e3cad6ac837bd37a7bd6b9280d1ca0c1e868c Author: Lon Hohberger Date: Tue Mar 4 17:58:50 2008 -0500 [rgmanager] Add Oracle 10g database failover agent to RHEL4 branch commit b95f5dd435df474b5b5c55927ae86b52f21c0b28 Author: David Teigland Date: Thu Feb 28 09:49:26 2008 -0600 lock_dlm: skip busy plocks in unlock bz 432707 Another problem with multiple threads manipulating the same plocks (also see bz 383391). In this case thread1 was waiting on a plock that was in the dlm, when thread2 came and tried to unlock it (due to the process exiting and closing all files). dlm returns EBUSY for the unlock, which causes lock_dlm to assert (another work around could be to just not assert on EBUSY.) The "busy" flag was recently added to plocks to work around another similar problem with multiple threads; use that to just skip the unlock on any plock that's busy. commit 9e8a8cd7262ad0228c1d1311d2f6ea45f01034fa Author: Lon Hohberger Date: Tue Feb 26 16:48:23 2008 -0500 Resolve bug 434886 commit 29dfb2374ede46fe2087f2159c91721e035af16c Author: Lon Hohberger Date: Mon Feb 25 16:57:30 2008 -0500 Correct incorrect netmask handling in ip.sh commit 7cd1be561cdb08155964672d0afc2cbe32a5af37 Author: Lon Hohberger Date: Fri Feb 8 18:38:41 2008 +0000 Fix unused variable error commit 515aa3da10e9d73a238cc017ef9a5e4dc9556266 Author: Ryan O'Hara Date: Wed Feb 6 17:39:17 2008 +0000 BZ 431002 - Support for LVM stripes, mirrors. commit 44d293d8ff4b39f31a993fad22bb7b353621dfe5 Author: Benjamin Marzinski Date: Tue Jan 29 22:21:45 2008 +0000 Fix for bz #419391. gfs_glock_dq was traversing the gl_holders list without holding the gl_spin spinlock, this was causing a problem when the list item it was currently looking at got removed from the list. The solution is to not traverse the list, because it is unncessary. Unfortunately, there is also a bug in this section of code, where you can't guarantee that you will not cache a glock held with GL_NOCACHE. Fixing this issue requires significantly more work. commit efad9110a2e0d467f4b548a6a24b77d45b4148ee Author: Lon Hohberger Date: Mon Jan 28 19:42:55 2008 +0000 Fix #292861 - nfsclient doesn't unexport correctly commit 0844bfc6e6d6a4ffb16752ad6520abc655ecb848 Author: Lon Hohberger Date: Mon Jan 28 19:34:32 2008 +0000 Fix #289521 - clulog not respecting rgmanager log level commit cbae6db7de4834347b964953692b55c35bfc99fa Author: Lon Hohberger Date: Mon Jan 28 19:27:20 2008 +0000 Fix #430538 - unbounded status/clustat thread counts cause timeout errors commit 8755d2e9cbb11871c6c01e2b4f73e20808eac039 Author: Lon Hohberger Date: Thu Jan 24 14:58:38 2008 +0000 Unblock signals after fork() so heuristics using signals don't hang commit 05506c5b8f9744f878a4b6790e49ab1d7047f320 Author: Ryan McCabe Date: Tue Jan 15 16:21:17 2008 +0000 fix bz428243: fence_ilo can not recognize option="off" but fence_wti can commit 6242d7d010107098e320b866cdae550c31ef5a45 Author: David Teigland Date: Mon Jan 14 16:00:20 2008 +0000 bz 352731 I've looked at other users of kthread_stop()/kthread_should_stop(), and most seem to incorporate a call to kthread_should_stop() within the test that adds the thread to a wait_queue. I'm guessing that that's what we should be doing also (and at the same time using wait_event_interruptible() instead of an open-coded equivalent.) commit c8d815e711e20c54f38c381df40cf5a6ca75884b Author: David Teigland Date: Mon Jan 14 15:57:46 2008 +0000 bz 351321 add_to_requestqueue() can add a new message to the requestqueue just after process_requestqueue() checks it and determines it's empty. This means dlm_recvd will spin forever in wait_requestqueue() waiting for the message to be removed. The same problem was found and fixed in the RHEL5 code (and then subsequently changed again). This patch is the RHEL4 equivalent of the original RHEL5 fix. commit 54f7f27654b5691e1057dcab09370f523162da4d Author: David Teigland Date: Mon Jan 14 15:35:30 2008 +0000 bz 324881 It's easy to tell if you've hit this bug, because a message like this will always appear in /var/log/messages: SM: 02000378 ignoring service callback id=2000144 event=1324 If you look at /proc/cluster/lock_dlm/debug on this node at this point, you'll see something like this at the end, which shows what the problem is: others_may_mount start_done 1322 b The event_id that others_may_mount uses when calling kcl_start_done() is incorrect; it's using 1322 when it should be 1324. I believe the fix is for others_may_mount() to read the event_id after taking the umount_lock semaphore which serializes others_may_mount() with a start callback from the lock_dlm thread. In this case, I believe the start callback is changing the event_id after others_may_mount reads it, and before othres_may_mount gets the umount_lock semaphore. commit 1801d5ee98bc29996dd6f37c3875e949f4a8c22c Author: David Teigland Date: Mon Jan 14 15:29:42 2008 +0000 bz 353311 Disassembling the module, the oops appears to be when dereferencing dlm->mg_nodes. I see one place where the mg_nodes list is modified without holding mg_nodes_lock, and that's in release_mg_nodes(). commit 2e2c73cfc58c632170a3af839426a33f04b9ff1e Author: Jonathan Brassow Date: Fri Jan 11 21:33:31 2008 +0000 - Bug #428475 - HA LVM service fails to relocate when I/O is running Was failing to add new tag when relocating. commit 56a8258560ccb6c909a9857c63f046a31105bae1 Author: Patrick Caulfield Date: Fri Jan 11 14:22:11 2008 +0000 Always use the nodename in cluster.conf for cluster name. bz#428219 commit 903b90674afb18669f232c0b61e9a6d720dbe95c Author: Lon Hohberger Date: Wed Jan 9 18:55:12 2008 +0000 Fix #294491 - make magma_sm.so retry in dlm EINPROG condition commit e7d713b2b9782ddf9ca85a42152d890cb38761ff Author: Lon Hohberger Date: Wed Jan 9 18:54:46 2008 +0000 Fix #294491 - make magma_sm.so retry in dlm EINPROG condition commit e4519b6ebf713dbce2e97adf2029c8213c9326c5 Author: Jonathan Brassow Date: Fri Jan 4 20:01:50 2008 +0000 - a regression... When tagging at the LV-level, the script should complain if there is more than one LV / VG. commit a6a2d56a114428d184739353d09eb14e1e54c173 Author: David Teigland Date: Fri Jan 4 16:12:05 2008 +0000 Some message gets out of place, but there's no need to panic the machine; just ignore it. bz 427531 commit 2b9bf3c8e87ca307b5c026db89db5c9fdd14a590 Author: Jonathan Brassow Date: Thu Jan 3 20:35:39 2008 +0000 BUG 427377 HA LVM now allows multiple LVs/VG as long as they move together Package builder, please note the addition of 3 new files. commit 59b49a3ba34412f6e614721695eec1989979024f Author: Wendy Cheng Date: Wed Jan 2 19:17:09 2008 +0000 Bugzilla 227892: 1. Warn people about the RG corruption and request a gfs_fsck 2. Upon error detection, perform a minimum error data collection. commit f4973c85c022808bd07dc7ae9d2e95bf6cebd841 Author: Ryan O'Hara Date: Tue Dec 11 20:56:45 2007 +0000 BZ 418961 Fix issue with endian conversion that caused problems for mixed architecture nodes on same subnet. Need to correct swap byte ordering of comm_header_t structure before copying into buffer and when dereferencing. commit 4d91801fac0677798e84600643c3313611b32f64 Author: Lon Hohberger Date: Tue Dec 4 21:06:58 2007 +0000 Remove artificial label size limit commit eaf3713948ba886aa9b7743da3860f6795c35a22 Author: Lon Hohberger Date: Tue Dec 4 20:40:54 2007 +0000 Make qdiskd work with sector sizes other than 512 bytes. Import patch from Fabio M. Di Nitto to make qdiskd use (node_count - 1) for votes if there's none specified in cluster.conf commit 7169d5b23a8ddd3f656a2fb9aa1cfe1c3d873a04 Author: David Teigland Date: Mon Dec 3 16:40:41 2007 +0000 Posix locks don't work between threads, but it seems some programs do involve threads sharing plocks incidentally (with meaningless results). Given the plock state we keep in lock_dlm, multiple threads accessing the locks would not only be meaningless, but could corrupt the state, leaving the threads permanently hung. This patch tries to keep threads from stomping on each other, hopefully preventing most hangs. bz 383391 commit 92e2bf31caf42feb5f92663a399d0b2e188a3b41 Author: Patrick Caulfield Date: Tue Nov 20 11:02:46 2007 +0000 A fix to the last patch. The last_ackneeded_seq_recv variable needed to be cleared when the node went down, otherwise we end up comparing received sequence numbers against old ones and end up throwing all new messages away! bz#387081 shows this happening. The "inconsistent" message is slightly misleading in this context commit c5cd62b6d2e7d8d6a5592f3dff0c9eafd7deed90 Author: Lon Hohberger Date: Wed Nov 14 19:03:37 2007 +0000 Fix #360401 - hang forever during shutdown due to previous service boot problem commit b4f45f8d65c4f07aa0d996c43526e3cd7ca517a5 Author: Lon Hohberger Date: Wed Nov 14 18:49:51 2007 +0000 Apply patch from Marco Ceci to fix #358161 commit 3bd7e7d0931a9d6d7df04ffe7ffa3125a99f7be6 Author: Lon Hohberger Date: Wed Nov 14 17:14:21 2007 +0000 Clarify qdisk man page some commit 7848ceda86f5aa9b32910d7ebf4d283e43880a5e Author: Patrick Caulfield Date: Mon Nov 12 14:35:20 2007 +0000 Message test program for flooding cman with messages. commit 03f840a836e24132931d00c0f46773bf06f42d4f Author: Ryan O'Hara Date: Thu Nov 8 17:00:44 2007 +0000 BZ 248715 - Use cluster ID and node ID for key rather than IP address. commit ef671a3afd9591d3eb23a611c9d715684b1b48b1 Author: Lon Hohberger Date: Wed Nov 7 15:24:19 2007 +0000 Revert broken patch & apply correct patch from 338511 commit c92628dcc39e03a4e9eccc4fa76257c871e5ba00 Author: David Teigland Date: Wed Nov 7 15:22:31 2007 +0000 bz 349001 For the entire life of the dlm, there's been an annoying issue that we've worked around and not "fixed" directly. It's the source of all these messages: process_lockqueue_reply id 2c0224 state 0 The problem that a lock master sends an async "granted" message for a convert request *before* actually sending the reply for the original convert. The work-around is that the requesting node just takes the granted message as an implicit reply to the conversion and ignores the convert reply when it arrives later (the message above is printed when it gets the out-of-order reply for its convert). Apart from the annoying messages, it's never been a problem. Now we've found a case where it's a real problem: 1. nodeA: send convert PR->CW to nodeB nodeB: send granted message to nodeA nodeB: send convert reply to nodeA 2. nodeA: receive granted message for conversion complete request, sending ast to gfs 3. nodeA: send convert CW->EX to nodeB 4. nodeA: receive reply for convert in step 1, which we ordinarily ignore, but since another convert has been sent, we mistake this message as the reply for the convert in step 3, and complete the convert request which is *not* really completed yet 5. nodeA: send unlock to nodeB nodeB: complains about an unlock during a conversion The fix is to have nodeB not send a convert reply if it has already sent a granted message. (We already do this for cases where the conversion is granted when first processing it, but we don't in cases where the grant is done after processing the convert.) commit 3417dfe50b6acd71ce568bb427136d6f2093e105 Author: Ryan O'Hara Date: Fri Nov 2 21:08:50 2007 +0000 BZ 364661 - Fix ccs_tool to return EXIT_SUCCESS for most commands. commit a25f4f8608fa941e2d9d1a3ce092c6e579e103a8 Author: Patrick Caulfield Date: Thu Nov 1 10:44:25 2007 +0000 When checking for old messages, compare against the last ACKed message rather than the last seen message (which could be a NOACK message). otherwise we end up throwing awa messages if they arrive out of order. bz#299061 commit 3738514b6c4fe15cc6380bdf6fe4df33ea99ec2c Author: Lon Hohberger Date: Tue Oct 30 17:41:13 2007 +0000 Fix #338511 - dlm trying to connect from wrong IP commit 9e715649d5341d3c537d4aa3f162398685270c94 Author: Ryan McCabe Date: Mon Oct 29 20:38:13 2007 +0000 Fix a bunch of format string errors. commit f5bb753aed627c49a87564ff2ce6725ff6fe4296 Author: Lon Hohberger Date: Fri Oct 26 20:27:39 2007 +0000 Fix bugzilla #354391 - apps using magmamsg don't connect from correct source IP on multi-homed hosts commit e68c57b32c5b664205321079100bf8dbb41028d4 Author: Lon Hohberger Date: Fri Oct 26 20:26:47 2007 +0000 Fix bugzilla #298831 / #298861 - apps using magmamsg don't connect from correct source IP on multi-homed hosts commit 3df5ddd843b1ac58542d91635ff3ec4cf8efd4e2 Author: Lon Hohberger Date: Fri Oct 26 20:23:46 2007 +0000 Fix bugzilla #298831 - apps using magmamsg don't connect from correct source IP on multi-homed hosts commit 4c1c792c84cd7cb8ab729c347835bcac6c64c753 Author: Lon Hohberger Date: Fri Oct 26 20:15:37 2007 +0000 Fix bugzillas #298831, #298861, #354391 - apps using magmamsg don't connect from correct source IP on multi-homed hosts commit 7ecf055077aab17873a916ff3a46f4c0562513ff Author: Jonathan Brassow Date: Fri Oct 26 18:46:10 2007 +0000 -take out annoying message. commit ca4fbfc2aa0ae450667512399267a89eea926f06 Author: Ryan O'Hara Date: Fri Oct 12 18:16:30 2007 +0000 Update man page to explain 'cman_tool nodes' filter/format options. commit cae74d3be6497e35dbd1603147eb4ae70ef73c9b Author: Ryan O'Hara Date: Fri Oct 12 18:10:12 2007 +0000 Add ability to format output and filter based on node name. commit ed08da2f721563274c8d782ed969708ee205384a Author: Ryan McCabe Date: Wed Oct 10 17:13:57 2007 +0000 Don't use 'new' as an identifier in function prototypes to allow the header to be included by C++ programs. commit effdfce319d004ccb14e214fa420cebb08bbc06c Author: Lon Hohberger Date: Wed Oct 10 16:23:19 2007 +0000 Fix #326531 - fence_xvm using dprintf for debugging can cause corruption commit 007ebe7da57b42c509c60f3a82e71e7076dd31a2 Author: James Parsons Date: Tue Oct 9 14:56:15 2007 +0000 Fix for bz299191 commit cbe80ab7633b83a3682f744953aaaeced4ab227f Author: Patrick Caulfield Date: Fri Oct 5 10:06:24 2007 +0000 Don't overwrite castparam if /it/ is NULL. Checking castaddr is wrong because it's not possible to affect that from the userland API. This is also consistent with the fix for bz#318061 in RHEL5. This check-in fixes bz#318851 but TPTB will decide whether it gets included in RHEL4.6 commit 52598fe04e07201e2c84f1f9d5abd9fa581111a2 Author: Lon Hohberger Date: Wed Oct 3 21:04:04 2007 +0000 Fix 310981 ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From teigland@sourceware.org Tue Apr 15 20:02:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Tue, 15 Apr 2008 20:02:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-171-gebda3b1 Message-ID: <20080415200218.3148.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=ebda3b163cabd4e0f04127637ed73caf9caf2704 The branch, master has been updated via ebda3b163cabd4e0f04127637ed73caf9caf2704 (commit) via 5256ae5d59dd44bfb4b551a2ce1cb9eac71be845 (commit) from f5a705d3ed1843f403f0d03aeae447f0b6ca10a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ebda3b163cabd4e0f04127637ed73caf9caf2704 Author: David Teigland Date: Mon Apr 14 15:44:01 2008 -0500 dlm_controld: max name length sanity Define MAX_LS_NAME 64, and note that it should match MAX_LOCKSPACE_LEN in dlmconstants.h. Including linux/dlm.h directly is difficult because some files need to include libdlm.h which doesn't combine nicely with linux/dlm.h. Signed-off-by: David Teigland commit 5256ae5d59dd44bfb4b551a2ce1cb9eac71be845 Author: David Teigland Date: Mon Apr 14 15:24:34 2008 -0500 libdlm: max name length sanity Attempting to bring some sanity to handling of max lockspace name length and max resource name length. A new kernel patch creates single authoritative definitions in linux/dlmconstants.h: define DLM_LOCKSPACE_LEN 64 define DLM_RESNAME_MAXLEN 64 These definitions are copied in libdlm.h so that user apps don't need to include the kernel header. libdlm itself uses the dlmconstants.h definitions, and now checks both resource and lockspace name params against these definitions before calling into dlm-kernel. dlm-kernel checks each of the input names against these definitions when creating a new rsb or ls. Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: dlm/lib/libdlm.c | 36 ++++++++++++++++++++++++++++-------- dlm/lib/libdlm.h | 7 +++++++ group/dlm_controld/action.c | 4 ++-- group/dlm_controld/dlm_daemon.h | 29 +++++++++++++++++++++++------ group/dlm_controld/group.c | 4 ++-- group/dlm_controld/main.c | 4 +++- 6 files changed, 65 insertions(+), 19 deletions(-) diff --git a/dlm/lib/libdlm.c b/dlm/lib/libdlm.c index 4bafbbc..fe01af2 100644 --- a/dlm/lib/libdlm.c +++ b/dlm/lib/libdlm.c @@ -47,6 +47,10 @@ #include "libdlm.h" #include +/* this define will come through linux/dlm.h in 2.6.25-rc */ +#ifndef EXPERIMENTAL_BUILD +#define DLM_LOCKSPACE_LEN 64 +#endif #define PROC_MISC "/proc/misc" #define MISC_PREFIX "/dev/misc/" @@ -1262,32 +1266,48 @@ int dlm_ls_pthread_init(dlm_lshandle_t ls) static int create_lockspace_v5(const char *name, uint32_t flags) { - char reqbuf[sizeof(struct dlm_write_request_v5) + strlen(name)]; + char reqbuf[sizeof(struct dlm_write_request_v5) + DLM_LOCKSPACE_LEN]; struct dlm_write_request_v5 *req = (struct dlm_write_request_v5 *)reqbuf; + int namelen = strlen(name); int minor; - req->cmd = DLM_USER_CREATE_LOCKSPACE; + memset(reqbuf, 0, sizeof(reqbuf)); set_version_v5(req); - strcpy(req->i.lspace.name, name); + + req->cmd = DLM_USER_CREATE_LOCKSPACE; req->i.lspace.flags = flags; - minor = write(control_fd, req, sizeof(*req) + strlen(name)); + if (namelen > DLM_LOCKSPACE_LEN) { + errno = EINVAL; + return -1; + } + memcpy(req->i.lspace.name, name, namelen); + + minor = write(control_fd, req, sizeof(*req) + namelen); return minor; } static int create_lockspace_v6(const char *name, uint32_t flags) { - char reqbuf[sizeof(struct dlm_write_request) + strlen(name)]; + char reqbuf[sizeof(struct dlm_write_request) + DLM_LOCKSPACE_LEN]; struct dlm_write_request *req = (struct dlm_write_request *)reqbuf; + int namelen = strlen(name); int minor; - req->cmd = DLM_USER_CREATE_LOCKSPACE; + memset(reqbuf, 0, sizeof(reqbuf)); set_version_v6(req); - strcpy(req->i.lspace.name, name); + + req->cmd = DLM_USER_CREATE_LOCKSPACE; req->i.lspace.flags = flags; - minor = write(control_fd, req, sizeof(*req) + strlen(name)); + if (namelen > DLM_LOCKSPACE_LEN) { + errno = EINVAL; + return -1; + } + memcpy(req->i.lspace.name, name, namelen); + + minor = write(control_fd, req, sizeof(*req) + namelen); return minor; } diff --git a/dlm/lib/libdlm.h b/dlm/lib/libdlm.h index 2882c30..f7e64dd 100644 --- a/dlm/lib/libdlm.h +++ b/dlm/lib/libdlm.h @@ -34,6 +34,13 @@ #ifndef BUILDING_LIBDLM +/* + * These two lengths are copied from linux/dlmconstants.h + * They are the max length of a lockspace name and the max length of a + * resource name. + */ + +#define DLM_LOCKSPACE_LEN 64 #define DLM_RESNAME_MAXLEN 64 struct dlm_lksb { diff --git a/group/dlm_controld/action.c b/group/dlm_controld/action.c index b7c422b..6d2db05 100644 --- a/group/dlm_controld/action.c +++ b/group/dlm_controld/action.c @@ -17,7 +17,7 @@ static int dir_members[MAX_NODES]; static int dir_members_count; static int comms_nodes[MAX_NODES]; static int comms_nodes_count; -static char mg_name[MAXNAME+1]; +static char mg_name[MAX_LS_NAME+1]; #define DLM_SYSFS_DIR "/sys/kernel/dlm" #define CLUSTER_DIR "/sys/kernel/config/dlm/cluster" @@ -87,7 +87,7 @@ static int get_mountgroup_name(uint32_t mg_id) log_debug("get_mountgroup_name found %x %s %s", id, de->d_name, fsname); - strncpy(mg_name, fsname, 256); + strncpy(mg_name, fsname, sizeof(mg_name)); rv = 0; break; } diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index b969bdc..e0bca8a 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -51,12 +51,29 @@ #include "list.h" #include "linux_endian.h" -#define MAXARGS 8 -#define MAXLINE 256 -#define MAXCON 4 -#define MAXNAME 255 -#define MAX_NODES 256 /* should be same as MAX_GROUP_MEMBERS */ +/* Maximum lockspace name length, should match MAX_LOCKSPACE_NAME in + linux/dlmconstants.h (copied in libdlm.h). The libcpg limit is + larger at CPG_MAX_NAME_LENGTH 128. Our cpg name includes a "dlm:" + prefix before the lockspace name. */ + +#define MAX_LS_NAME 64 + +/* Maximum members of a lockspace, should match CPG_MEMBERS_MAX in openais/cpg.h. + There are no max defines in dlm-kernel for lockspace members. */ + +#define MAX_NODES 128 + +/* Maximum number of IP addresses per node, when using SCTP and multi-ring in + openais. In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */ + #define MAX_NODE_ADDRESSES 4 + +/* Max string length printed on a line, for debugging/dump output. */ + +#define MAXLINE 256 + +/* Size of the circular debug buffer. */ + #define DUMP_SIZE (1024 * 1024) extern int daemon_debug_opt; @@ -139,7 +156,7 @@ struct dlm_header { struct lockspace { struct list_head list; - char name[MAXNAME+1]; + char name[MAX_LS_NAME+1]; uint32_t global_id; /* lockspace membership stuff */ diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c index 8dc68a1..f9bfccb 100644 --- a/group/dlm_controld/group.c +++ b/group/dlm_controld/group.c @@ -26,12 +26,12 @@ group_handle_t gh; static int cb_action; -static char cb_name[MAX_GROUP_NAME_LEN+1]; +static char cb_name[MAX_LS_NAME+1]; static int cb_event_nr; static unsigned int cb_id; static int cb_type; static int cb_member_count; -static int cb_members[MAX_GROUP_MEMBERS]; +static int cb_members[MAX_NODES]; static void stop_cbfn(group_handle_t h, void *private, char *name) diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index a3f3012..251548b 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -183,7 +183,7 @@ static struct lockspace *create_ls(char *name) if (!ls) goto out; memset(ls, 0, sizeof(*ls)); - strncpy(ls->name, name, MAXNAME); + strncpy(ls->name, name, MAX_LS_NAME); INIT_LIST_HEAD(&ls->changes); INIT_LIST_HEAD(&ls->node_history); @@ -219,6 +219,8 @@ struct lockspace *find_ls_id(uint32_t id) return NULL; } +#define MAXARGS 8 + static char *get_args(char *buf, int *argc, char **argv, char sep, int want) { char *p = buf, *rp = NULL; hooks/post-receive -- Cluster Project From cfeist@sourceware.org Tue Apr 15 20:16:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Tue, 15 Apr 2008 20:16:00 -0000 Subject: Cluster Project tag, cman_2_0_84, created. cmirror_1_1_15-21-g0639b2d Message-ID: <20080415201600.21295.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0639b2dfac1c2591c5fb444548d3a013a3bc230c The tag, cman_2_0_84 has been created at 0639b2dfac1c2591c5fb444548d3a013a3bc230c (commit) - Log ----------------------------------------------------------------- commit 0639b2dfac1c2591c5fb444548d3a013a3bc230c Author: Lon Hohberger Date: Mon Apr 14 12:38:00 2008 -0400 [fence] Fix #441737 - fence_node broken due to internal API change ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From jparsons@sourceware.org Tue Apr 15 22:40:00 2008 From: jparsons@sourceware.org (jparsons@sourceware.org) Date: Tue, 15 Apr 2008 22:40:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-45-g157b65b Message-ID: <20080415224011.20805.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=157b65b58448d29b0111b23990721e03bab1bcaa The branch, RHEL4 has been updated via 157b65b58448d29b0111b23990721e03bab1bcaa (commit) from c9f85c1b3cccdd529005d08fb8e4618f752acaab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 157b65b58448d29b0111b23990721e03bab1bcaa Author: jparsons Date: Tue Apr 15 18:21:28 2008 -0400 Bump MAX_DEVICES in fenced from 4 to 8 Addresses request in rhbz#284701 ----------------------------------------------------------------------- Summary of changes: fence/fenced/agent.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fence/fenced/agent.c b/fence/fenced/agent.c index 241e01f..f439d14 100644 --- a/fence/fenced/agent.c +++ b/fence/fenced/agent.c @@ -24,7 +24,7 @@ #include "ccs.h" #define MAX_METHODS 8 -#define MAX_DEVICES 4 +#define MAX_DEVICES 8 #define MAX_AGENT_ARGS_LEN 512 #define METHOD_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name" hooks/post-receive -- Cluster Project From jparsons@sourceware.org Tue Apr 15 22:48:00 2008 From: jparsons@sourceware.org (jparsons@sourceware.org) Date: Tue, 15 Apr 2008 22:48:00 -0000 Subject: Cluster Project branch, RHEL47, updated. gfs-kernel_2_6_9_76-45-g4f903f2 Message-ID: <20080415224815.22872.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4f903f24b945f53708b0607d186e2fa6b06cd1bf The branch, RHEL47 has been updated via 4f903f24b945f53708b0607d186e2fa6b06cd1bf (commit) from c9f85c1b3cccdd529005d08fb8e4618f752acaab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f903f24b945f53708b0607d186e2fa6b06cd1bf Author: jparsons Date: Tue Apr 15 18:47:23 2008 -0400 Bump fenced MAX_DEVICES from 4 to 8 Fix for rhbz#284701 ----------------------------------------------------------------------- Summary of changes: fence/fenced/agent.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fence/fenced/agent.c b/fence/fenced/agent.c index 241e01f..f439d14 100644 --- a/fence/fenced/agent.c +++ b/fence/fenced/agent.c @@ -24,7 +24,7 @@ #include "ccs.h" #define MAX_METHODS 8 -#define MAX_DEVICES 4 +#define MAX_DEVICES 8 #define MAX_AGENT_ARGS_LEN 512 #define METHOD_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name" hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 03:46:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 03:46:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-173-g4ecbd5d Message-ID: <20080416034647.29380.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4ecbd5d63ff454ed232661a644194ae858ea1830 The branch, master has been updated via 4ecbd5d63ff454ed232661a644194ae858ea1830 (commit) via 73a341b9ba39c6c61ce9248ac74648dfe90b6c9c (commit) from ebda3b163cabd4e0f04127637ed73caf9caf2704 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4ecbd5d63ff454ed232661a644194ae858ea1830 Author: jparsons Date: Tue Apr 15 18:21:28 2008 -0400 Bump MAX_DEVICES in fenced from 4 to 8 Addresses request in rhbz#284701 commit 73a341b9ba39c6c61ce9248ac74648dfe90b6c9c Author: David Teigland Date: Mon Mar 31 10:09:37 2008 -0500 gfs: don't cancel glocks when writing to hidden file bz 438268 When glock.c sees the PRIORITY flag, it cancels any outstanding glocks prior to doing the lock request. lock_dlm also uses the PRIORITY flag to give give granting priority to the lock in the dlm. Both of these are necessary when the PRIORITY glock is used for recovery, but only the second is wanted (neither is really needed) when writing to a hidden file. A new GL_NOCANCEL_OTHER flag, combined with PRIORITY, is used to tell glock.c to not do the cancels. Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: fence/fenced/agent.c | 2 +- gfs-kernel/src/gfs/glock.c | 3 ++- gfs-kernel/src/gfs/glock.h | 1 + gfs-kernel/src/gfs/ioctl.c | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fence/fenced/agent.c b/fence/fenced/agent.c index 1bb9f12..3207fe3 100644 --- a/fence/fenced/agent.c +++ b/fence/fenced/agent.c @@ -27,7 +27,7 @@ #include "ccs.h" #define MAX_METHODS 8 -#define MAX_DEVICES 4 +#define MAX_DEVICES 8 #define MAX_AGENT_ARGS_LEN 512 #define METHOD_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name" diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c index f112f5f..f4ceaed 100644 --- a/gfs-kernel/src/gfs/glock.c +++ b/gfs-kernel/src/gfs/glock.c @@ -1336,7 +1336,8 @@ glock_wait_internal(struct gfs_holder *gh) spin_unlock(&gl->gl_spin); } - if (gh->gh_flags & LM_FLAG_PRIORITY) + if ((gh->gh_flags & LM_FLAG_PRIORITY) && + !(gh->gh_flags & GL_NOCANCEL_OTHER)) do_cancels(gh); wait_for_completion(&gh->gh_wait); diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h index fb1e210..c9bd819 100644 --- a/gfs-kernel/src/gfs/glock.h +++ b/gfs-kernel/src/gfs/glock.h @@ -34,6 +34,7 @@ #define GL_SYNC (0x00000800) /* Sync to disk when no more holders */ #define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */ #define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */ +#define GL_NOCANCEL_OTHER (0x00004000) /* Don't cancel other locks for this */ #define GLR_TRYFAILED (13) #define GLR_CANCELED (14) diff --git a/gfs-kernel/src/gfs/ioctl.c b/gfs-kernel/src/gfs/ioctl.c index 1133c8f..32db45c 100644 --- a/gfs-kernel/src/gfs/ioctl.c +++ b/gfs-kernel/src/gfs/ioctl.c @@ -1223,7 +1223,8 @@ gi_do_hfile_write(struct gfs_sbd *sdp, struct gfs_ioctl *gi, int from_user) gfs_write_calc_reserv(ip, gi->gi_size, &data_blocks, &ind_blocks); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, - LM_FLAG_PRIORITY | GL_SYNC, &i_gh); + LM_FLAG_PRIORITY | GL_SYNC | GL_NOCANCEL_OTHER, + &i_gh); if (error) return error; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 03:47:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 03:47:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-13-g78d0e24 Message-ID: <20080416034709.29616.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=78d0e249946b65ce21d131247d3795965d0a2595 The branch, STABLE2 has been updated via 78d0e249946b65ce21d131247d3795965d0a2595 (commit) from 86a728d286e95b6db8a46ecd8c9b9a6540d2b138 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 78d0e249946b65ce21d131247d3795965d0a2595 Author: jparsons Date: Tue Apr 15 18:21:28 2008 -0400 Bump MAX_DEVICES in fenced from 4 to 8 Addresses request in rhbz#284701 ----------------------------------------------------------------------- Summary of changes: fence/fenced/agent.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fence/fenced/agent.c b/fence/fenced/agent.c index 1bb9f12..3207fe3 100644 --- a/fence/fenced/agent.c +++ b/fence/fenced/agent.c @@ -27,7 +27,7 @@ #include "ccs.h" #define MAX_METHODS 8 -#define MAX_DEVICES 4 +#define MAX_DEVICES 8 #define MAX_AGENT_ARGS_LEN 512 #define METHOD_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name" hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 04:15:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 04:15:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-14-gc1b1327 Message-ID: <20080416041508.17393.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c1b13275db8d088ba9604b274fb3e0ec17d426dc The branch, STABLE2 has been updated via c1b13275db8d088ba9604b274fb3e0ec17d426dc (commit) from 78d0e249946b65ce21d131247d3795965d0a2595 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c1b13275db8d088ba9604b274fb3e0ec17d426dc Author: Fabio M. Di Nitto Date: Wed Apr 16 06:13:19 2008 +0200 Revert "gfs2_tool: Fix build warnings in misc.c bz 441636" This reverts commit e3922593271e97d91e69944a9675d2216e62a186. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 10ad239..0a39f8b 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,12 +198,16 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); + if (di->di_flags & GFS2_DIF_SYSTEM) + printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); + if (di->di_flags & GFS2_DIF_DIRECTIO) + printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -224,18 +228,20 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "jdata", 5) == 0) - return EXT3_JOURNAL_DATA_FL; - else if (strncmp(name, "exhash", 6) == 0) - return EXT3_INDEX_FL; + if (strncmp(name, "system", 6) == 0) + return GFS2_DIF_SYSTEM; + else if (strncmp(name, "jdata", 5) == 0) + return FS_JOURNAL_DATA_FL; + else if (strncmp(name, "directio", 8) == 0) + return FS_DIRECTIO_FL; else if (strncmp(name, "immutable", 9) == 0) - return EXT3_IMMUTABLE_FL; + return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return EXT3_APPEND_FL; + return FS_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return EXT3_NOATIME_FL; + return FS_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return EXT3_SYNC_FL; + return FS_SYNC_FL; else return 0; } @@ -270,13 +276,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 04:15:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 04:15:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-174-gf187911 Message-ID: <20080416041524.17705.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f1879119019bea3029f852a7248101c397777dbd The branch, master has been updated via f1879119019bea3029f852a7248101c397777dbd (commit) from 4ecbd5d63ff454ed232661a644194ae858ea1830 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f1879119019bea3029f852a7248101c397777dbd Author: Fabio M. Di Nitto Date: Wed Apr 16 06:11:42 2008 +0200 Revert "gfs2_tool: Fix build warnings in misc.c bz 441636" This reverts commit d2a926d2122c23e6175a62326b5e2b421b842a93. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 10ad239..0a39f8b 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,12 +198,16 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); + if (di->di_flags & GFS2_DIF_SYSTEM) + printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); + if (di->di_flags & GFS2_DIF_DIRECTIO) + printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -224,18 +228,20 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "jdata", 5) == 0) - return EXT3_JOURNAL_DATA_FL; - else if (strncmp(name, "exhash", 6) == 0) - return EXT3_INDEX_FL; + if (strncmp(name, "system", 6) == 0) + return GFS2_DIF_SYSTEM; + else if (strncmp(name, "jdata", 5) == 0) + return FS_JOURNAL_DATA_FL; + else if (strncmp(name, "directio", 8) == 0) + return FS_DIRECTIO_FL; else if (strncmp(name, "immutable", 9) == 0) - return EXT3_IMMUTABLE_FL; + return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return EXT3_APPEND_FL; + return FS_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return EXT3_NOATIME_FL; + return FS_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return EXT3_SYNC_FL; + return FS_SYNC_FL; else return 0; } @@ -270,13 +276,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Wed Apr 16 11:55:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 16 Apr 2008 11:55:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-175-g2bc77b7 Message-ID: <20080416115543.459.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=2bc77b7c45e9d74eb245a10f454e3041f61a1e7f The branch, master has been updated via 2bc77b7c45e9d74eb245a10f454e3041f61a1e7f (commit) from f1879119019bea3029f852a7248101c397777dbd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2bc77b7c45e9d74eb245a10f454e3041f61a1e7f Author: Christine Caulfield Date: Wed Apr 16 12:54:36 2008 +0100 [MISC] Make it build with gcc 4.3 A few files now need to include and cman was using an illegal access into the sockaddr_in6 structure. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: ccs/daemon/cnx_mgr.c | 1 + cman/daemon/cman-preconfig.c | 2 +- cman/lib/libcman.c | 1 + dlm/tool/main.c | 1 + gnbd/tools/gnbd_export/gnbd_export.c | 1 + gnbd/tools/gnbd_import/gnbd_import.c | 1 + group/gfs_controld/lock_dlm.h | 1 + 7 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ccs/daemon/cnx_mgr.c b/ccs/daemon/cnx_mgr.c index 9fed1bb..a2011af 100644 --- a/ccs/daemon/cnx_mgr.c +++ b/ccs/daemon/cnx_mgr.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c index ba114bc..38f2834 100644 --- a/cman/daemon/cman-preconfig.c +++ b/cman/daemon/cman-preconfig.c @@ -753,7 +753,7 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb) } if (ainfo->ai_family == AF_INET6) { struct sockaddr_in6 *addr = (struct sockaddr_in6 *)ainfo->ai_addr; - memcpy(&nodeid, &addr->sin6_addr.in6_u.u6_addr32[3], sizeof(int)); + memcpy(&nodeid, &addr->sin6_addr.s6_addr32[3], sizeof(int)); } log_printf(LOG_INFO, "Our Node ID is %d\n", nodeid); freeaddrinfo(ainfo); diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c index 7b28dc1..7229342 100644 --- a/cman/lib/libcman.c +++ b/cman/lib/libcman.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "cnxman-socket.h" #include "libcman.h" diff --git a/dlm/tool/main.c b/dlm/tool/main.c index 330d795..814a3bb 100644 --- a/dlm/tool/main.c +++ b/dlm/tool/main.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "libdlm.h" diff --git a/gnbd/tools/gnbd_export/gnbd_export.c b/gnbd/tools/gnbd_export/gnbd_export.c index a7b14f5..633cc5c 100644 --- a/gnbd/tools/gnbd_export/gnbd_export.c +++ b/gnbd/tools/gnbd_export/gnbd_export.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define _GNU_SOURCE #include diff --git a/gnbd/tools/gnbd_import/gnbd_import.c b/gnbd/tools/gnbd_import/gnbd_import.c index cf4e869..8eb4ef2 100644 --- a/gnbd/tools/gnbd_import/gnbd_import.c +++ b/gnbd/tools/gnbd_import/gnbd_import.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/group/gfs_controld/lock_dlm.h b/group/gfs_controld/lock_dlm.h index 7b514df..6d31162 100644 --- a/group/gfs_controld/lock_dlm.h +++ b/group/gfs_controld/lock_dlm.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Wed Apr 16 12:12:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Wed, 16 Apr 2008 12:12:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-176-g4b3ad9a Message-ID: <20080416121240.23057.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4b3ad9a381bdb07f0fe8afd58fdaff39a586095f The branch, master has been updated via 4b3ad9a381bdb07f0fe8afd58fdaff39a586095f (commit) from 2bc77b7c45e9d74eb245a10f454e3041f61a1e7f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4b3ad9a381bdb07f0fe8afd58fdaff39a586095f Author: Christine Caulfield Date: Wed Apr 16 13:12:10 2008 +0100 [FENCE] Make it build with gcc 4.3 fence_tool.c also needs Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: fence/fence_tool/fence_tool.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c index ab737e5..2d193ea 100644 --- a/fence/fence_tool/fence_tool.c +++ b/fence/fence_tool/fence_tool.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 14:09:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 14:09:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-178-gd7d2312 Message-ID: <20080416140910.2414.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d7d23129f8d54db3341a540d079db7f695a63cd5 The branch, master has been updated via d7d23129f8d54db3341a540d079db7f695a63cd5 (commit) via 54648c57140bc7a280013e1b463b40b3179b3ce1 (commit) from 4b3ad9a381bdb07f0fe8afd58fdaff39a586095f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d7d23129f8d54db3341a540d079db7f695a63cd5 Author: Fabio M. Di Nitto Date: Wed Apr 16 16:08:44 2008 +0200 [RGMANAGER] Fix build with gcc4.3 Signed-off-by: Fabio M. Di Nitto commit 54648c57140bc7a280013e1b463b40b3179b3ce1 Author: Fabio M. Di Nitto Date: Wed Apr 16 16:07:35 2008 +0200 [BUILD] Fix clean target Make sure to remove also Module.markers files created by Fedora 9 kernel build system. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: make/clean.mk | 2 +- rgmanager/ChangeLog | 3 +++ rgmanager/src/utils/clustat.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/make/clean.mk b/make/clean.mk index 560c4f9..d4456a6 100644 --- a/make/clean.mk +++ b/make/clean.mk @@ -1,6 +1,6 @@ generalclean: rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d *.pyc rm -rf core core.* .depend cscope.* *.orig *.rej - rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d modules.order + rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers Module.markers .*.o.d modules.order rm -rf ${TARGET} ${TARGETS} ${TARGET}_test rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6} diff --git a/rgmanager/ChangeLog b/rgmanager/ChangeLog index 117e5a3..2387815 100644 --- a/rgmanager/ChangeLog +++ b/rgmanager/ChangeLog @@ -1,3 +1,6 @@ +2008-04-16 Fabio M. Di Nitto + * src/utils/clustat.c: Fix variable init + 2008-03-04 Lon Hohberger * src/resources/ASEHAagent.sh, Makefile: Add Sybase failover agent * src/resources/oracledb.sh, Makefile: Add Oracle 10g failover agent diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c index ed9b29b..dd64ce0 100644 --- a/rgmanager/src/utils/clustat.c +++ b/rgmanager/src/utils/clustat.c @@ -835,7 +835,7 @@ txt_cluster_status(cman_cluster_t *ci, rg_state_list_t *rgs, char *name, char *svcname, int flags) { - int ret; + int ret = 0; if (!svcname && !name) { txt_cluster_info(ci); hooks/post-receive -- Cluster Project From lhh@sourceware.org Wed Apr 16 14:21:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Wed, 16 Apr 2008 14:21:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-179-g257d1b4 Message-ID: <20080416142107.7724.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=257d1b44ad25884c05606773f7a48898b13aed55 The branch, master has been updated via 257d1b44ad25884c05606773f7a48898b13aed55 (commit) from d7d23129f8d54db3341a540d079db7f695a63cd5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 257d1b44ad25884c05606773f7a48898b13aed55 Author: Lon Hohberger Date: Wed Apr 16 10:11:35 2008 -0400 [fence] Preliminary TPS/NBB/NPS support in new WTI agent. ----------------------------------------------------------------------- Summary of changes: fence/agents/wti/wti.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fence/agents/wti/wti.py b/fence/agents/wti/wti.py index c118af3..bf64304 100755 --- a/fence/agents/wti/wti.py +++ b/fence/agents/wti/wti.py @@ -76,7 +76,7 @@ def main(): ## Fence agent specific defaults ##### if 0 == options.has_key("-c"): - options["-c"] = [ "RSM>", "MPC>", "IPS>" ] + options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>" ] ## ## Operate the fencing device hooks/post-receive -- Cluster Project From teigland@sourceware.org Wed Apr 16 14:28:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Wed, 16 Apr 2008 14:28:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-48-gafb6cf2 Message-ID: <20080416142822.13270.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=afb6cf25e46a7afc40f97367e26719b29cd0983d The branch, RHEL5 has been updated via afb6cf25e46a7afc40f97367e26719b29cd0983d (commit) from 0847ffdaf607aafd538e949c91eb47f2a06c4335 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit afb6cf25e46a7afc40f97367e26719b29cd0983d Author: David Teigland Date: Wed Apr 16 09:22:27 2008 -0500 gfs_controld: retry recovery for withdrawn journal bz 442451 This is unfortunate, but seems to be the best solution available. The problem, described more fully in the bz, is that when gfs_controld tries to do recovery on a journal for a withdraw, the withdrawing node may not yet have cleared its dlm locks. This means the journal lock may still be held by the withdrawing node, causing all the recovering node(s) to fail acquiring it, and no one does the recovery. The solution is for all recovering nodes to retry recovery of a withdrawn journal until they succeed (only the first to get the journal lock will actually recover it, the others will see it's recovered and report success.) Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: group/gfs_controld/recover.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/group/gfs_controld/recover.c b/group/gfs_controld/recover.c index 9ce3aa7..52d96ff 100644 --- a/group/gfs_controld/recover.c +++ b/group/gfs_controld/recover.c @@ -1913,6 +1913,25 @@ int kernel_recovery_done(char *table) switch (atoi(buf)) { case LM_RD_GAVEUP: + /* + * This is unfortunate; it's needed for bz 442451 where + * gfs-kernel fails to acquire the journal lock on all nodes + * because a withdrawing node has not yet called + * dlm_release_lockspace() to free it's journal lock. With + * this, all nodes should repeatedly try to to recover the + * journal of the withdrawn node until the withdrawing node + * clears its dlm locks, and gfs on each of the remaining nodes + * succeeds in doing the recovery. + */ + + if (memb->withdrawing) { + log_group(mg, "recovery_done jid %d nodeid %d retry " + "for withdraw", memb->jid, memb->nodeid); + memb->tell_gfs_to_recover = 1; + memb->wait_gfs_recover_done = 0; + usleep(500000); + } + memb->local_recovery_status = RS_GAVEUP; ss = "gaveup"; break; hooks/post-receive -- Cluster Project From teigland@sourceware.org Wed Apr 16 14:30:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Wed, 16 Apr 2008 14:30:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-15-gebdcd11 Message-ID: <20080416143052.15542.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=ebdcd110c758fe0c95285708626f02d7d67c1258 The branch, STABLE2 has been updated via ebdcd110c758fe0c95285708626f02d7d67c1258 (commit) from c1b13275db8d088ba9604b274fb3e0ec17d426dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ebdcd110c758fe0c95285708626f02d7d67c1258 Author: David Teigland Date: Wed Apr 16 09:22:27 2008 -0500 gfs_controld: retry recovery for withdrawn journal bz 442451 This is unfortunate, but seems to be the best solution available. The problem, described more fully in the bz, is that when gfs_controld tries to do recovery on a journal for a withdraw, the withdrawing node may not yet have cleared its dlm locks. This means the journal lock may still be held by the withdrawing node, causing all the recovering node(s) to fail acquiring it, and no one does the recovery. The solution is for all recovering nodes to retry recovery of a withdrawn journal until they succeed (only the first to get the journal lock will actually recover it, the others will see it's recovered and report success.) Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: group/gfs_controld/recover.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/group/gfs_controld/recover.c b/group/gfs_controld/recover.c index 9ce3aa7..52d96ff 100644 --- a/group/gfs_controld/recover.c +++ b/group/gfs_controld/recover.c @@ -1913,6 +1913,25 @@ int kernel_recovery_done(char *table) switch (atoi(buf)) { case LM_RD_GAVEUP: + /* + * This is unfortunate; it's needed for bz 442451 where + * gfs-kernel fails to acquire the journal lock on all nodes + * because a withdrawing node has not yet called + * dlm_release_lockspace() to free it's journal lock. With + * this, all nodes should repeatedly try to to recover the + * journal of the withdrawn node until the withdrawing node + * clears its dlm locks, and gfs on each of the remaining nodes + * succeeds in doing the recovery. + */ + + if (memb->withdrawing) { + log_group(mg, "recovery_done jid %d nodeid %d retry " + "for withdraw", memb->jid, memb->nodeid); + memb->tell_gfs_to_recover = 1; + memb->wait_gfs_recover_done = 0; + usleep(500000); + } + memb->local_recovery_status = RS_GAVEUP; ss = "gaveup"; break; hooks/post-receive -- Cluster Project From teigland@sourceware.org Wed Apr 16 14:32:00 2008 From: teigland@sourceware.org (teigland@sourceware.org) Date: Wed, 16 Apr 2008 14:32:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-180-ga187481 Message-ID: <20080416143236.16872.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a187481779ec3a5321c92a9f9ae587dcacd64d48 The branch, master has been updated via a187481779ec3a5321c92a9f9ae587dcacd64d48 (commit) from 257d1b44ad25884c05606773f7a48898b13aed55 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a187481779ec3a5321c92a9f9ae587dcacd64d48 Author: David Teigland Date: Wed Apr 16 09:22:27 2008 -0500 gfs_controld: retry recovery for withdrawn journal bz 442451 This is unfortunate, but seems to be the best solution available. The problem, described more fully in the bz, is that when gfs_controld tries to do recovery on a journal for a withdraw, the withdrawing node may not yet have cleared its dlm locks. This means the journal lock may still be held by the withdrawing node, causing all the recovering node(s) to fail acquiring it, and no one does the recovery. The solution is for all recovering nodes to retry recovery of a withdrawn journal until they succeed (only the first to get the journal lock will actually recover it, the others will see it's recovered and report success.) Signed-off-by: David Teigland ----------------------------------------------------------------------- Summary of changes: group/gfs_controld/recover.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/group/gfs_controld/recover.c b/group/gfs_controld/recover.c index 9ce3aa7..52d96ff 100644 --- a/group/gfs_controld/recover.c +++ b/group/gfs_controld/recover.c @@ -1913,6 +1913,25 @@ int kernel_recovery_done(char *table) switch (atoi(buf)) { case LM_RD_GAVEUP: + /* + * This is unfortunate; it's needed for bz 442451 where + * gfs-kernel fails to acquire the journal lock on all nodes + * because a withdrawing node has not yet called + * dlm_release_lockspace() to free it's journal lock. With + * this, all nodes should repeatedly try to to recover the + * journal of the withdrawn node until the withdrawing node + * clears its dlm locks, and gfs on each of the remaining nodes + * succeeds in doing the recovery. + */ + + if (memb->withdrawing) { + log_group(mg, "recovery_done jid %d nodeid %d retry " + "for withdraw", memb->jid, memb->nodeid); + memb->tell_gfs_to_recover = 1; + memb->wait_gfs_recover_done = 0; + usleep(500000); + } + memb->local_recovery_status = RS_GAVEUP; ss = "gaveup"; break; hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 14:46:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 14:46:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-18-g438d70d Message-ID: <20080416144602.23043.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=438d70d1558005acd49539449e6ea54a22152a7b The branch, STABLE2 has been updated via 438d70d1558005acd49539449e6ea54a22152a7b (commit) via bd69a108740417366f67e1c2f589e99a0f74dc53 (commit) via ebe9193279336f0ed37eb242bea4e74638ee1a39 (commit) from ebdcd110c758fe0c95285708626f02d7d67c1258 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 438d70d1558005acd49539449e6ea54a22152a7b Author: Fabio M. Di Nitto Date: Wed Apr 16 16:08:44 2008 +0200 [RGMANAGER] Fix build with gcc4.3 Signed-off-by: Fabio M. Di Nitto commit bd69a108740417366f67e1c2f589e99a0f74dc53 Author: Christine Caulfield Date: Wed Apr 16 13:12:10 2008 +0100 [FENCE] Make it build with gcc 4.3 fence_tool.c also needs Signed-off-by: Christine Caulfield commit ebe9193279336f0ed37eb242bea4e74638ee1a39 Author: Christine Caulfield Date: Wed Apr 16 12:54:36 2008 +0100 [MISC] Make it build with gcc 4.3 A few files now need to include and cman was using an illegal access into the sockaddr_in6 structure. Signed-off-by: Christine Caulfield Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: ccs/daemon/cnx_mgr.c | 1 + cman/daemon/cmanccs.c | 3 ++- cman/lib/libcman.c | 1 + dlm/tool/main.c | 1 + fence/fence_tool/fence_tool.c | 1 + gnbd/tools/gnbd_export/gnbd_export.c | 1 + gnbd/tools/gnbd_import/gnbd_import.c | 1 + group/gfs_controld/lock_dlm.h | 1 + rgmanager/ChangeLog | 3 +++ rgmanager/src/utils/clustat.c | 2 +- 10 files changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/define2var mode change 100644 => 100755 scripts/uninstall.pl diff --git a/ccs/daemon/cnx_mgr.c b/ccs/daemon/cnx_mgr.c index 9fed1bb..a2011af 100644 --- a/ccs/daemon/cnx_mgr.c +++ b/ccs/daemon/cnx_mgr.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/cman/daemon/cmanccs.c b/cman/daemon/cmanccs.c index a901df2..2bfc299 100644 --- a/cman/daemon/cmanccs.c +++ b/cman/daemon/cmanccs.c @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -890,7 +891,7 @@ static int noccs_defaults() } if (ainfo->ai_family == AF_INET6) { struct sockaddr_in6 *addr = (struct sockaddr_in6 *)ainfo->ai_addr; - memcpy(&nodeid, &addr->sin6_addr.in6_u.u6_addr32[3], sizeof(int)); + memcpy(&nodeid, &addr->sin6_addr.s6_addr32[3], sizeof(int)); } log_printf(LOG_INFO, "Our Node ID is %d\n", nodeid); freeaddrinfo(ainfo); diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c index 190ad0b..d4e4979 100644 --- a/cman/lib/libcman.c +++ b/cman/lib/libcman.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "cnxman-socket.h" #include "libcman.h" diff --git a/dlm/tool/main.c b/dlm/tool/main.c index 330d795..814a3bb 100644 --- a/dlm/tool/main.c +++ b/dlm/tool/main.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "libdlm.h" diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c index ab737e5..2d193ea 100644 --- a/fence/fence_tool/fence_tool.c +++ b/fence/fence_tool/fence_tool.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/gnbd/tools/gnbd_export/gnbd_export.c b/gnbd/tools/gnbd_export/gnbd_export.c index a7b14f5..633cc5c 100644 --- a/gnbd/tools/gnbd_export/gnbd_export.c +++ b/gnbd/tools/gnbd_export/gnbd_export.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define _GNU_SOURCE #include diff --git a/gnbd/tools/gnbd_import/gnbd_import.c b/gnbd/tools/gnbd_import/gnbd_import.c index cf4e869..8eb4ef2 100644 --- a/gnbd/tools/gnbd_import/gnbd_import.c +++ b/gnbd/tools/gnbd_import/gnbd_import.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/group/gfs_controld/lock_dlm.h b/group/gfs_controld/lock_dlm.h index 7b514df..6d31162 100644 --- a/group/gfs_controld/lock_dlm.h +++ b/group/gfs_controld/lock_dlm.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/rgmanager/ChangeLog b/rgmanager/ChangeLog index 117e5a3..2387815 100644 --- a/rgmanager/ChangeLog +++ b/rgmanager/ChangeLog @@ -1,3 +1,6 @@ +2008-04-16 Fabio M. Di Nitto + * src/utils/clustat.c: Fix variable init + 2008-03-04 Lon Hohberger * src/resources/ASEHAagent.sh, Makefile: Add Sybase failover agent * src/resources/oracledb.sh, Makefile: Add Oracle 10g failover agent diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c index ed9b29b..dd64ce0 100644 --- a/rgmanager/src/utils/clustat.c +++ b/rgmanager/src/utils/clustat.c @@ -835,7 +835,7 @@ txt_cluster_status(cman_cluster_t *ci, rg_state_list_t *rgs, char *name, char *svcname, int flags) { - int ret; + int ret = 0; if (!svcname && !name) { txt_cluster_info(ci); diff --git a/scripts/define2var b/scripts/define2var old mode 100644 new mode 100755 diff --git a/scripts/uninstall.pl b/scripts/uninstall.pl old mode 100644 new mode 100755 hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 14:59:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 14:59:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-181-g4e02817 Message-ID: <20080416145911.28903.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4e028178c761c92ae7aee71754064934c9245dad The branch, master has been updated via 4e028178c761c92ae7aee71754064934c9245dad (commit) from a187481779ec3a5321c92a9f9ae587dcacd64d48 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4e028178c761c92ae7aee71754064934c9245dad Author: Andrew Price Date: Wed Apr 16 16:58:19 2008 +0200 [GFS2] Remove unrequired header file "grep -nr 'list\.h' gfs2/" found that this file was not included anywhere and removing it does not stop any of the gfs2 utils from building so it seems that it can be removed. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/include/list.h | 325 --------------------------------------------------- 1 files changed, 0 insertions(+), 325 deletions(-) delete mode 100644 gfs2/include/list.h diff --git a/gfs2/include/list.h b/gfs2/include/list.h deleted file mode 100644 index 566b377..0000000 --- a/gfs2/include/list.h +++ /dev/null @@ -1,325 +0,0 @@ -/* Copied from include/linux/list.h */ - -#ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/** - * list_empty_careful - tests whether a list is - * empty _and_ checks that no other CPU might be - * in the process of still modifying either member - * - * NOTE: using list_empty_careful() without synchronization - * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used - * if another CPU could re-list_add() it. - * - * @head: the list to test. - */ -static inline int list_empty_careful(const struct list_head *head) -{ - struct list_head *next = head->next; - return (next == head) && (next == head->prev); -} - -static inline void __list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code, no prefetching is done. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define __list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_prepare_entry - prepare a pos entry for use as a start point in - * list_for_each_entry_continue - * @pos: the type * to use as a start point - * @head: the head of the list - * @member: the name of the list_struct within the struct. - */ -#define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) - -/** - * list_for_each_entry_continue - iterate over list of given type - * continuing after existing point - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - - -#endif hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 15:38:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 15:38:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-182-g36f955f Message-ID: <20080416153832.30982.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=36f955f67d2842b382fc93f9d0530a9dcedfd0af The branch, master has been updated via 36f955f67d2842b382fc93f9d0530a9dcedfd0af (commit) from 4e028178c761c92ae7aee71754064934c9245dad (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 36f955f67d2842b382fc93f9d0530a9dcedfd0af Author: Fabio M. Di Nitto Date: Wed Apr 16 17:37:43 2008 +0200 [GFS2] Fix build warning Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/tool/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c index d2817ec..9da366f 100644 --- a/gfs2/tool/main.c +++ b/gfs2/tool/main.c @@ -128,7 +128,7 @@ print_usage(void) int x; for (x = 0; usage[x][0]; x++) - printf(usage[x]); + printf("%s", usage[x]); } /** hooks/post-receive -- Cluster Project From adas@sourceware.org Wed Apr 16 15:58:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Wed, 16 Apr 2008 15:58:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-49-g8b95436 Message-ID: <20080416155851.10742.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=8b95436e966e45031d295348946a9ea3b7e11171 The branch, RHEL5 has been updated via 8b95436e966e45031d295348946a9ea3b7e11171 (commit) from afb6cf25e46a7afc40f97367e26719b29cd0983d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b95436e966e45031d295348946a9ea3b7e11171 Author: Abhijith Das Date: Wed Apr 16 10:57:22 2008 -0500 Revert "gfs2_tool: Fix build warnings in misc.c bz 441636" This reverts commit b0d53e957419d279f5b1846d29160d150f1d02d2. This commit broke build in STABLE2 and HEAD branches with upstream code. This patch is reverted in STABLE2 and HEAD. Reverting in RHEL5 as well to keep all 3 branches in sync. Will push a better fix to this bug shortly. ----------------------------------------------------------------------- Summary of changes: gfs2/tool/misc.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 555976b..1d46e1d 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -29,7 +29,7 @@ #define __user #include #include -#include +#include #include "libgfs2.h" #include "gfs2_tool.h" @@ -198,12 +198,16 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); + if (di->di_flags & GFS2_DIF_SYSTEM) + printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); + if (di->di_flags & GFS2_DIF_DIRECTIO) + printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -224,18 +228,20 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "jdata", 5) == 0) - return EXT3_JOURNAL_DATA_FL; - else if (strncmp(name, "exhash", 6) == 0) - return EXT3_INDEX_FL; + if (strncmp(name, "system", 6) == 0) + return GFS2_DIF_SYSTEM; + else if (strncmp(name, "jdata", 5) == 0) + return FS_JOURNAL_DATA_FL; + else if (strncmp(name, "directio", 8) == 0) + return FS_DIRECTIO_FL; else if (strncmp(name, "immutable", 9) == 0) - return EXT3_IMMUTABLE_FL; + return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) - return EXT3_APPEND_FL; + return FS_APPEND_FL; else if (strncmp(name, "noatime", 7) == 0) - return EXT3_NOATIME_FL; + return FS_NOATIME_FL; else if (strncmp(name, "sync", 4) == 0) - return EXT3_SYNC_FL; + return FS_SYNC_FL; else return 0; } @@ -270,13 +276,13 @@ set_flag(int argc, char **argv) if (fd < 0) die("can't open %s: %s\n", argv[optind], strerror(errno)); /* first get the existing flags on the file */ - error = ioctl(fd, EXT3_IOC_GETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_GETFLAGS, &newflags); if (error) die("can't get flags on %s: %s\n", argv[optind], strerror(errno)); newflags = set ? newflags | flag : newflags & ~flag; /* new flags */ - error = ioctl(fd, EXT3_IOC_SETFLAGS, &newflags); + error = ioctl(fd, FS_IOC_SETFLAGS, &newflags); if (error) die("can't set flags on %s: %s\n", argv[optind], strerror(errno)); hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 16:15:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 16:15:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-19-g8b33b61 Message-ID: <20080416161558.1930.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=8b33b61ac7d4e2971cab0b095d6cefecd3b03cb7 The branch, STABLE2 has been updated via 8b33b61ac7d4e2971cab0b095d6cefecd3b03cb7 (commit) from 438d70d1558005acd49539449e6ea54a22152a7b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b33b61ac7d4e2971cab0b095d6cefecd3b03cb7 Author: Fabio M. Di Nitto Date: Wed Apr 16 17:37:43 2008 +0200 [GFS2] Fix build warning Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/tool/main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c index d2817ec..9da366f 100644 --- a/gfs2/tool/main.c +++ b/gfs2/tool/main.c @@ -128,7 +128,7 @@ print_usage(void) int x; for (x = 0; usage[x][0]; x++) - printf(usage[x]); + printf("%s", usage[x]); } /** hooks/post-receive -- Cluster Project From adas@sourceware.org Wed Apr 16 16:36:00 2008 From: adas@sourceware.org (adas@sourceware.org) Date: Wed, 16 Apr 2008 16:36:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-50-g1e15a60 Message-ID: <20080416163602.13492.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=1e15a60fe192ae8ba3fd608db6af777e947c8a5e The branch, RHEL5 has been updated via 1e15a60fe192ae8ba3fd608db6af777e947c8a5e (commit) from 8b95436e966e45031d295348946a9ea3b7e11171 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1e15a60fe192ae8ba3fd608db6af777e947c8a5e Author: Abhijith Das Date: Wed Apr 16 11:24:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch removes #include linux/fs.h and moves all the required definitions from there to a new local header file iflags.h. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} | 41 +++--------------------------- gfs2/tool/misc.c | 16 +++-------- 2 files changed, 9 insertions(+), 48 deletions(-) copy gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} (72%) diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/tool/iflags.h similarity index 72% copy from gfs2/mkfs/gfs2_mkfs.h copy to gfs2/tool/iflags.h index 627c018..c577c4a 100644 --- a/gfs2/mkfs/gfs2_mkfs.h +++ b/gfs2/tool/iflags.h @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -11,45 +11,13 @@ ******************************************************************************* ******************************************************************************/ -#ifndef __GFS2_MKFS_DOT_H__ -#define __GFS2_MKFS_DOT_H__ - -#include "linux_endian.h" -#include -#include "osi_list.h" -#include "copyright.cf" -#include "ondisk.h" - -#define SRANDOM do { srandom(time(NULL) ^ getpid()); } while (0) -#define RESRANDOM do { srandom(RANDOM(1000000000)); } while (0) - -/* main_grow */ -void main_grow(int argc, char *argv[]); - -/* main_jadd */ -void main_jadd(int argc, char *argv[]); - -/* main_mkfs */ -void main_mkfs(int argc, char *argv[]); - -/* main_shrink */ -void main_shrink(int argc, char *argv[]); - -/* - * The following inode IOCTL macros and inode flags - * are copied from linux/fs.h, because we have duplicate - * definition of symbols when we include both linux/fs.h and - * sys/mount.h in our program - */ +#ifndef __IFLAGS_DOT_H__ +#define __IFLAGS_DOT_H__ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) -#define FS_IOC_GETVERSION _IOR('v', 1, long) -#define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) -#define FS_IOC32_GETVERSION _IOR('v', 1, int) -#define FS_IOC32_SETVERSION _IOW('v', 2, int) /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) @@ -82,5 +50,4 @@ void main_shrink(int argc, char *argv[]); #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ - -#endif /* __GFS2_MKFS_DOT_H__ */ +#endif /* __IFLAGS_DOT_H__ */ diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 1d46e1d..152a9b4 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -29,10 +29,10 @@ #define __user #include #include -#include #include "libgfs2.h" #include "gfs2_tool.h" +#include "iflags.h" #if GFS2_TOOL_FEATURE_IMPLEMENTED /** @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,12 +224,10 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) + if (strncmp(name, "jdata", 5) == 0) return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + else if (strncmp(name, "exhash", 6) == 0) + return FS_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 16 19:13:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 16 Apr 2008 19:13:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-7-g16b6a74 Message-ID: <20080416191349.27703.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=16b6a74c24d437cacd136d3376cae61eb45a4e38 The branch, RHEL46 has been updated via 16b6a74c24d437cacd136d3376cae61eb45a4e38 (commit) from 0413a207c89b6b4d440b4f8bc27545ec4ee76528 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 16b6a74c24d437cacd136d3376cae61eb45a4e38 Author: Christine Caulfield Date: Tue Apr 15 16:34:48 2008 +0100 [DLM] Add tcp_nodelay option to DLM comms Under some very odd loads, the TCP nagle algorithm can cause annoying delays in lock traffic. This option allows it to be switched off with echo "1" > /proc/cluster/config/dlm/tcp_nodelay This should NOT be a default, in most cases it will cause a huge performance drop. It is global to all DLM communications and cannot be changed per lockspace. It is included specifically for bz#244708. 4.6.z bz#442573 Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: dlm-kernel/src/config.c | 6 ++++++ dlm-kernel/src/config.h | 1 + dlm-kernel/src/lowcomms.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/dlm-kernel/src/config.c b/dlm-kernel/src/config.c index 41bdedd..b90d256 100644 --- a/dlm-kernel/src/config.c +++ b/dlm-kernel/src/config.c @@ -20,6 +20,7 @@ /* Config file defaults */ #define DEFAULT_TCP_PORT 21064 +#define DEFAULT_TCP_NODELAY 0 #define DEFAULT_LOCK_TIMEOUT 30 #define DEFAULT_BUFFER_SIZE 4096 #define DEFAULT_RSBTBL_SIZE 256 @@ -31,6 +32,7 @@ struct config_info dlm_config = { .tcp_port = DEFAULT_TCP_PORT, + .tcp_nodelay = DEFAULT_TCP_NODELAY, .lock_timeout = DEFAULT_LOCK_TIMEOUT, .buffer_size = DEFAULT_BUFFER_SIZE, .rsbtbl_size = DEFAULT_RSBTBL_SIZE, @@ -51,6 +53,10 @@ static struct config_proc_info { .value = &dlm_config.tcp_port, }, { + .name = "tcp_nodelay", + .value = &dlm_config.tcp_nodelay, + }, + { .name = "lock_timeout", .value = &dlm_config.lock_timeout, }, diff --git a/dlm-kernel/src/config.h b/dlm-kernel/src/config.h index 9190c6b..0b37cf4 100644 --- a/dlm-kernel/src/config.h +++ b/dlm-kernel/src/config.h @@ -16,6 +16,7 @@ struct config_info { int tcp_port; + int tcp_nodelay; int lock_timeout; int buffer_size; int rsbtbl_size; diff --git a/dlm-kernel/src/lowcomms.c b/dlm-kernel/src/lowcomms.c index 4967092..8ea83dd 100644 --- a/dlm-kernel/src/lowcomms.c +++ b/dlm-kernel/src/lowcomms.c @@ -598,6 +598,16 @@ static int connect_to_sock(struct connection *con) /* Set up for connect */ make_sockaddr(&saddr, dlm_config.tcp_port, &addr_len); + if (dlm_config.tcp_nodelay) { + int one = 1; + mm_segment_t fs; + + fs = get_fs(); + set_fs(get_ds()); + + tcp_setsockopt(sock->sk, SOL_TCP, TCP_NODELAY, (char *)&one, sizeof(one)); + set_fs(fs); + } add_sock(sock, con); log_debug2("connecting to %d", con->nodeid); @@ -653,6 +663,10 @@ static struct socket *create_listen_sock(struct connection *con, char *addr, int fs = get_fs(); set_fs(get_ds()); + + if (dlm_config.tcp_nodelay) + result = tcp_setsockopt(sock->sk, SOL_TCP, TCP_NODELAY, (char *)&one, sizeof(one)); + result = sock_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)); set_fs(fs); if (result < 0) { hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 16 19:21:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 16 Apr 2008 19:21:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-8-g1c9932d Message-ID: <20080416192140.1253.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=1c9932d3cc533daedac7cfb3a50b7d6ff8d07990 The branch, RHEL46 has been updated via 1c9932d3cc533daedac7cfb3a50b7d6ff8d07990 (commit) from 16b6a74c24d437cacd136d3376cae61eb45a4e38 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1c9932d3cc533daedac7cfb3a50b7d6ff8d07990 Author: David Teigland Date: Thu Feb 28 09:49:26 2008 -0600 lock_dlm: skip busy plocks in unlock bz 432707 Another problem with multiple threads manipulating the same plocks (also see bz 383391). In this case thread1 was waiting on a plock that was in the dlm, when thread2 came and tried to unlock it (due to the process exiting and closing all files). dlm returns EBUSY for the unlock, which causes lock_dlm to assert (another work around could be to just not assert on EBUSY.) The "busy" flag was recently added to plocks to work around another similar problem with multiple threads; use that to just skip the unlock on any plock that's busy. 4.6.z bz#440665 ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/dlm/plock.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/gfs-kernel/src/dlm/plock.c b/gfs-kernel/src/dlm/plock.c index bc4cfc4..e1bc46d 100644 --- a/gfs-kernel/src/dlm/plock.c +++ b/gfs-kernel/src/dlm/plock.c @@ -833,6 +833,8 @@ static int punlock_internal(struct dlm_resource *r, unsigned long owner, list_for_each_entry_safe(po, safe, &r->locks, list) { if (po->owner != owner) continue; + if (po->busy) + continue; if (!ranges_overlap(po->start, po->end, start, end)) continue; hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 16 19:24:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 16 Apr 2008 19:24:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-9-g98e82d8 Message-ID: <20080416192431.3504.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=98e82d8e38259f37db87044d1a2446391583d0cf The branch, RHEL46 has been updated via 98e82d8e38259f37db87044d1a2446391583d0cf (commit) from 1c9932d3cc533daedac7cfb3a50b7d6ff8d07990 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 98e82d8e38259f37db87044d1a2446391583d0cf Author: David Teigland Date: Fri Jan 4 16:12:05 2008 +0000 Some message gets out of place, but there's no need to panic the machine; just ignore it. bz 427531 4.6.z bz#441758 ----------------------------------------------------------------------- Summary of changes: dlm-kernel/src/lockqueue.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dlm-kernel/src/lockqueue.c b/dlm-kernel/src/lockqueue.c index 595bc53..70313e9 100644 --- a/dlm-kernel/src/lockqueue.c +++ b/dlm-kernel/src/lockqueue.c @@ -243,8 +243,13 @@ void purge_requestqueue(struct dlm_ls *ls) */ lkb = find_lock_by_id(ls, hd->rh_lkid); - DLM_ASSERT(lkb,); - if (lkb->lkb_lockqueue_state == GDLM_LQSTATE_WAIT_RSB) { + if (!lkb) { + log_error(ls, "purge %x from %d no lkb", + hd->rh_lkid, entry->rqe_nodeid); + list_del(&entry->rqe_list); + kfree(entry); + count++; + } else if (lkb->lkb_lockqueue_state == GDLM_LQSTATE_WAIT_RSB) { list_del(&entry->rqe_list); kfree(entry); count++; hooks/post-receive -- Cluster Project From cfeist@sourceware.org Wed Apr 16 20:30:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Wed, 16 Apr 2008 20:30:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-10-g77ccf10 Message-ID: <20080416203003.16047.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=77ccf101d7d00c3048f7c8c2c489d26b9aebddae The branch, RHEL46 has been updated via 77ccf101d7d00c3048f7c8c2c489d26b9aebddae (commit) from 98e82d8e38259f37db87044d1a2446391583d0cf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 77ccf101d7d00c3048f7c8c2c489d26b9aebddae Author: Chris Feist Date: Wed Apr 16 15:28:33 2008 -0500 Added busy member to posix_lock struct Needed to get bz#440665 to compile. ----------------------------------------------------------------------- Summary of changes: gfs-kernel/src/dlm/lock_dlm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs-kernel/src/dlm/lock_dlm.h b/gfs-kernel/src/dlm/lock_dlm.h index 8807fe7..15f7386 100644 --- a/gfs-kernel/src/dlm/lock_dlm.h +++ b/gfs-kernel/src/dlm/lock_dlm.h @@ -152,6 +152,7 @@ struct posix_lock { uint64_t end; int count; int ex; + int busy; }; #define LFL_NOBLOCK 0 hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 20:40:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 20:40:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-183-g2627512 Message-ID: <20080416204030.19453.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=2627512a870e654665b0d973a2171fbafbcbbf0d The branch, master has been updated via 2627512a870e654665b0d973a2171fbafbcbbf0d (commit) from 36f955f67d2842b382fc93f9d0530a9dcedfd0af (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2627512a870e654665b0d973a2171fbafbcbbf0d Author: Abhijith Das Date: Wed Apr 16 11:24:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch removes #include linux/fs.h and moves all the required definitions from there to a new local header file iflags.h. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} | 41 +++--------------------------- gfs2/tool/misc.c | 16 +++-------- 2 files changed, 9 insertions(+), 48 deletions(-) copy gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} (72%) diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/tool/iflags.h similarity index 72% copy from gfs2/mkfs/gfs2_mkfs.h copy to gfs2/tool/iflags.h index 627c018..c577c4a 100644 --- a/gfs2/mkfs/gfs2_mkfs.h +++ b/gfs2/tool/iflags.h @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -11,45 +11,13 @@ ******************************************************************************* ******************************************************************************/ -#ifndef __GFS2_MKFS_DOT_H__ -#define __GFS2_MKFS_DOT_H__ - -#include "linux_endian.h" -#include -#include "osi_list.h" -#include "copyright.cf" -#include "ondisk.h" - -#define SRANDOM do { srandom(time(NULL) ^ getpid()); } while (0) -#define RESRANDOM do { srandom(RANDOM(1000000000)); } while (0) - -/* main_grow */ -void main_grow(int argc, char *argv[]); - -/* main_jadd */ -void main_jadd(int argc, char *argv[]); - -/* main_mkfs */ -void main_mkfs(int argc, char *argv[]); - -/* main_shrink */ -void main_shrink(int argc, char *argv[]); - -/* - * The following inode IOCTL macros and inode flags - * are copied from linux/fs.h, because we have duplicate - * definition of symbols when we include both linux/fs.h and - * sys/mount.h in our program - */ +#ifndef __IFLAGS_DOT_H__ +#define __IFLAGS_DOT_H__ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) -#define FS_IOC_GETVERSION _IOR('v', 1, long) -#define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) -#define FS_IOC32_GETVERSION _IOR('v', 1, int) -#define FS_IOC32_SETVERSION _IOW('v', 2, int) /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) @@ -82,5 +50,4 @@ void main_shrink(int argc, char *argv[]); #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ - -#endif /* __GFS2_MKFS_DOT_H__ */ +#endif /* __IFLAGS_DOT_H__ */ diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 0a39f8b..7053076 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -29,10 +29,10 @@ #define __user #include #include -#include #include "libgfs2.h" #include "gfs2_tool.h" +#include "iflags.h" #if GFS2_TOOL_FEATURE_IMPLEMENTED /** @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,12 +224,10 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) + if (strncmp(name, "jdata", 5) == 0) return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + else if (strncmp(name, "exhash", 6) == 0) + return FS_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) hooks/post-receive -- Cluster Project From fabbione@sourceware.org Wed Apr 16 20:40:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Wed, 16 Apr 2008 20:40:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-20-g66fd741 Message-ID: <20080416204041.19656.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=66fd7419ac6d0005c7e22c4beca887ccb143a185 The branch, STABLE2 has been updated via 66fd7419ac6d0005c7e22c4beca887ccb143a185 (commit) from 8b33b61ac7d4e2971cab0b095d6cefecd3b03cb7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 66fd7419ac6d0005c7e22c4beca887ccb143a185 Author: Abhijith Das Date: Wed Apr 16 11:24:47 2008 -0500 gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool used to include both linux/fs.h and sys/mount.h that caused some symbols to be defined twice and hence caused some build warnings. This patch removes #include linux/fs.h and moves all the required definitions from there to a new local header file iflags.h. This patch also removes the SYSTEM and DIRECTIO flags as they are not used anymore. ----------------------------------------------------------------------- Summary of changes: gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} | 41 +++--------------------------- gfs2/tool/misc.c | 16 +++-------- 2 files changed, 9 insertions(+), 48 deletions(-) copy gfs2/{mkfs/gfs2_mkfs.h => tool/iflags.h} (72%) diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/tool/iflags.h similarity index 72% copy from gfs2/mkfs/gfs2_mkfs.h copy to gfs2/tool/iflags.h index 627c018..c577c4a 100644 --- a/gfs2/mkfs/gfs2_mkfs.h +++ b/gfs2/tool/iflags.h @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -11,45 +11,13 @@ ******************************************************************************* ******************************************************************************/ -#ifndef __GFS2_MKFS_DOT_H__ -#define __GFS2_MKFS_DOT_H__ - -#include "linux_endian.h" -#include -#include "osi_list.h" -#include "copyright.cf" -#include "ondisk.h" - -#define SRANDOM do { srandom(time(NULL) ^ getpid()); } while (0) -#define RESRANDOM do { srandom(RANDOM(1000000000)); } while (0) - -/* main_grow */ -void main_grow(int argc, char *argv[]); - -/* main_jadd */ -void main_jadd(int argc, char *argv[]); - -/* main_mkfs */ -void main_mkfs(int argc, char *argv[]); - -/* main_shrink */ -void main_shrink(int argc, char *argv[]); - -/* - * The following inode IOCTL macros and inode flags - * are copied from linux/fs.h, because we have duplicate - * definition of symbols when we include both linux/fs.h and - * sys/mount.h in our program - */ +#ifndef __IFLAGS_DOT_H__ +#define __IFLAGS_DOT_H__ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) -#define FS_IOC_GETVERSION _IOR('v', 1, long) -#define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) -#define FS_IOC32_GETVERSION _IOR('v', 1, int) -#define FS_IOC32_SETVERSION _IOW('v', 2, int) /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) @@ -82,5 +50,4 @@ void main_shrink(int argc, char *argv[]); #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ #define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ - -#endif /* __GFS2_MKFS_DOT_H__ */ +#endif /* __IFLAGS_DOT_H__ */ diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c index 0a39f8b..7053076 100644 --- a/gfs2/tool/misc.c +++ b/gfs2/tool/misc.c @@ -2,7 +2,7 @@ ******************************************************************************* ** ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -29,10 +29,10 @@ #define __user #include #include -#include #include "libgfs2.h" #include "gfs2_tool.h" +#include "iflags.h" #if GFS2_TOOL_FEATURE_IMPLEMENTED /** @@ -198,16 +198,12 @@ print_flags(struct gfs2_dinode *di) { if (di->di_flags) { printf("Flags:\n"); - if (di->di_flags & GFS2_DIF_SYSTEM) - printf(" system\n"); if (di->di_flags & GFS2_DIF_JDATA) printf(" jdata\n"); if (di->di_flags & GFS2_DIF_EXHASH) printf(" exhash\n"); if (di->di_flags & GFS2_DIF_EA_INDIRECT) printf(" ea_indirect\n"); - if (di->di_flags & GFS2_DIF_DIRECTIO) - printf(" directio\n"); if (di->di_flags & GFS2_DIF_IMMUTABLE) printf(" immutable\n"); if (di->di_flags & GFS2_DIF_APPENDONLY) @@ -228,12 +224,10 @@ print_flags(struct gfs2_dinode *di) static unsigned int get_flag_from_name(char *name) { - if (strncmp(name, "system", 6) == 0) - return GFS2_DIF_SYSTEM; - else if (strncmp(name, "jdata", 5) == 0) + if (strncmp(name, "jdata", 5) == 0) return FS_JOURNAL_DATA_FL; - else if (strncmp(name, "directio", 8) == 0) - return FS_DIRECTIO_FL; + else if (strncmp(name, "exhash", 6) == 0) + return FS_INDEX_FL; else if (strncmp(name, "immutable", 9) == 0) return FS_IMMUTABLE_FL; else if (strncmp(name, "appendonly", 10) == 0) hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Wed Apr 16 20:46:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Wed, 16 Apr 2008 20:46:00 -0000 Subject: conga ./conga.spec.in.in luci/cluster/fence-ma ... Message-ID: <20080416204641.21587.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-16 20:46:41 Modified files: . : conga.spec.in.in luci/cluster : fence-macros validate_fence.js luci/site/luci/Extensions: FenceHandler.py luci/site/luci/var: Data.fs Log message: Use the 'ipaddr' attribute, not 'hostname' for RSA and RSB fencing. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.78&r2=1.45.2.79 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.3&r2=1.2.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.7&r2=1.1.2.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.11&r2=1.4.2.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.31&r2=1.15.2.32 From rpeterso@sourceware.org Thu Apr 17 14:06:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Thu, 17 Apr 2008 14:06:00 -0000 Subject: Cluster Project branch, RHEL46, updated. cman-kernel_2_6_9_54-11-g02b5f62 Message-ID: <20080417140642.21783.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=02b5f621d1c3d7c06bfafdbd3ad928d8d2728faf The branch, RHEL46 has been updated via 02b5f621d1c3d7c06bfafdbd3ad928d8d2728faf (commit) from 77ccf101d7d00c3048f7c8c2c489d26b9aebddae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 02b5f621d1c3d7c06bfafdbd3ad928d8d2728faf Author: Bob Peterson Date: Wed Apr 2 16:07:53 2008 -0500 Resolves: bz 436383: GFS filesystem size inconsistent ----------------------------------------------------------------------- Summary of changes: gfs/gfs_grow/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gfs/gfs_grow/main.c b/gfs/gfs_grow/main.c index e43fa20..4a2494a 100644 --- a/gfs/gfs_grow/main.c +++ b/gfs/gfs_grow/main.c @@ -684,11 +684,13 @@ create_rgrps(void) uint64_t space = devsize - fssize; uint64_t optimal_rgrp_size = RGRP_STUFFED_BLKS(&fs_sb) + 14 * RGRP_BITMAP_BLKS(&fs_sb) + 15; - uint64_t rgrps = 1 + space / optimal_rgrp_size; + uint64_t rgrps = space / optimal_rgrp_size; uint64_t offset = fssize; uint64_t rgsize; uint64_t n; + if (space % optimal_rgrp_size) + rgrps++; rgsize = optimal_rgrp_size; for (n = 0; n < rgrps; n++) hooks/post-receive -- Cluster Project From lhh@sourceware.org Thu Apr 17 14:15:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Thu, 17 Apr 2008 14:15:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-52-gb2686ff Message-ID: <20080417141512.6031.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b2686ffe984c517110b949d604c54a71800b67c9 The branch, RHEL5 has been updated via b2686ffe984c517110b949d604c54a71800b67c9 (commit) via 4bc8e7b01dff841358666e7596b6726a880e7b62 (commit) from 1e15a60fe192ae8ba3fd608db6af777e947c8a5e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b2686ffe984c517110b949d604c54a71800b67c9 Author: Lon Hohberger Date: Thu Apr 17 10:14:51 2008 -0400 [cman] Fix incarnation assignment ordering bug This bug causes "Node X is undead" in a loop; bz 442541 commit 4bc8e7b01dff841358666e7596b6726a880e7b62 Author: Lon Hohberger Date: Wed Apr 2 13:38:54 2008 -0400 [rgmanager] Remove obsolete clushutdown utility ----------------------------------------------------------------------- Summary of changes: cman/qdisk/main.c | 34 ++++++++++++------------ rgmanager/man/clushutdown.8 | 13 --------- rgmanager/src/utils/clushutdown | 53 --------------------------------------- 3 files changed, 17 insertions(+), 83 deletions(-) delete mode 100644 rgmanager/man/clushutdown.8 delete mode 100755 rgmanager/src/utils/clushutdown diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index b3c29f4..6bec85a 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -254,23 +254,6 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) state_run(ni[x].ni_status.ps_state)) { /* - Write eviction notice if we're the master. - */ - if (ctx->qc_status == S_MASTER) { - clulog(LOG_NOTICE, - "Writing eviction notice for node %d\n", - ni[x].ni_status.ps_nodeid); - qd_write_status(ctx, ni[x].ni_status.ps_nodeid, - S_EVICT, NULL, NULL, NULL); - if (ctx->qc_flags & RF_ALLOW_KILL) { - clulog(LOG_DEBUG, "Telling CMAN to " - "kill the node\n"); - cman_kill_node(ctx->qc_ch, - ni[x].ni_status.ps_nodeid); - } - } - - /* Mark our internal views as dead if nodes miss too many heartbeats... This will cause a master transition if no live master exists. @@ -287,6 +270,23 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) ni[x].ni_evil_incarnation = ni[x].ni_status.ps_incarnation; + /* + Write eviction notice if we're the master. + */ + if (ctx->qc_status == S_MASTER) { + clulog(LOG_NOTICE, + "Writing eviction notice for node %d\n", + ni[x].ni_status.ps_nodeid); + qd_write_status(ctx, ni[x].ni_status.ps_nodeid, + S_EVICT, NULL, NULL, NULL); + if (ctx->qc_flags & RF_ALLOW_KILL) { + clulog(LOG_DEBUG, "Telling CMAN to " + "kill the node\n"); + cman_kill_node(ctx->qc_ch, + ni[x].ni_status.ps_nodeid); + } + } + /* Clear our master mask for the node after eviction */ if (mask) clear_bit(mask, (ni[x].ni_status.ps_nodeid-1), diff --git a/rgmanager/man/clushutdown.8 b/rgmanager/man/clushutdown.8 deleted file mode 100644 index c63159f..0000000 --- a/rgmanager/man/clushutdown.8 +++ /dev/null @@ -1,13 +0,0 @@ -.TH "clushutdown" "27" "Jan 2005" "" "Red Hat Cluster Suite" -.SH "NAME" -clushutdown \- Cluster Mass Service Shutdown -.SH "DESCRIPTION" -.PP -.B Clushutdown -is responsible for stopping all services and ensuring that none are restarted -when a member goes off line. It is only useful for situations where an -administrator needs to take enough cluster members offline such that the -cluster quorum will be disrupted. This is not required for shutting down a -single member when all other members are online. -.SH "SEE ALSO" -clusvcadm(8) diff --git a/rgmanager/src/utils/clushutdown b/rgmanager/src/utils/clushutdown deleted file mode 100755 index ef3eb72..0000000 --- a/rgmanager/src/utils/clushutdown +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# Stop all services and prepare the cluster for a TCO. -# -. /etc/init.d/functions - -action $"Ensuring this member is in the Quorum:" clustat -Q -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo "WARNING: About to stop ALL services managed by Red Hat Cluster Manager." -echo " This should only be done when maintainence is required on " -echo " enough members to dissolve the Cluster Quorum. This utility" -echo " generally does not need to be run when one cluster member" -echo " requires maintenance. This NEVER needs to be run in two" -echo " member clusters." -echo -echo -n "Continue [yes/NO]? " -read a -if [ "$a" != "YES" -a "$a" != "yes" ]; then - echo - echo Aborted. - exit 0 -fi - -action $"Preparing for global service shutdown:" clusvcadm -u -if [ $? -ne 0 ]; then - exit 1; -fi - -errors=0 -for s in `cludb -m services%service[0-9]+%name | cut -f2 -d=`; do - action "Stopping service $s: " clusvcadm -q -s $s - if [ $? -ne 0 ]; then - exit 1 - fi -done - -echo "All clustered services are stopped." - -action $"Locking service managers:" clusvcadm -l -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo $"It is now safe to shut down all cluster members. Be advised that" -echo $"members not controlled by power switches may still reboot when " -echo $"when the cluster quorum is disbanded." -echo -exit 0 hooks/post-receive -- Cluster Project From lhh@sourceware.org Thu Apr 17 14:19:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Thu, 17 Apr 2008 14:19:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-46-gceee2fe Message-ID: <20080417141956.7667.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=ceee2fe27ece59ef6b3643ab1e7a4cce6688727c The branch, RHEL4 has been updated via ceee2fe27ece59ef6b3643ab1e7a4cce6688727c (commit) from 157b65b58448d29b0111b23990721e03bab1bcaa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ceee2fe27ece59ef6b3643ab1e7a4cce6688727c Author: Lon Hohberger Date: Tue Mar 11 10:43:37 2008 -0400 [CMAN] Fix "Node X is undead" loop bug This was caused by an improper assignment to ps_incarnation after a node decides to evict another node. The fix is to simply make the internal (memory) assignments before calling qd_write_status() ----------------------------------------------------------------------- Summary of changes: cman/qdisk/main.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index 8e63c88..a29a5d0 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -253,23 +253,6 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) state_run(ni[x].ni_status.ps_state)) { /* - Write eviction notice if we're the master. - */ - if (ctx->qc_status == S_MASTER) { - clulog(LOG_NOTICE, - "Writing eviction notice for node %d\n", - ni[x].ni_status.ps_nodeid); - qd_write_status(ctx, ni[x].ni_status.ps_nodeid, - S_EVICT, NULL, NULL, NULL); - if (ctx->qc_flags & RF_ALLOW_KILL) { - clulog(LOG_DEBUG, "Telling CMAN to " - "kill the node\n"); - cman_kill_node(ctx->qc_ch, - ni[x].ni_status.ps_nodeid); - } - } - - /* Mark our internal views as dead if nodes miss too many heartbeats... This will cause a master transition if no live master exists. @@ -286,6 +269,23 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) ni[x].ni_evil_incarnation = ni[x].ni_status.ps_incarnation; + /* + Write eviction notice if we're the master. + */ + if (ctx->qc_status == S_MASTER) { + clulog(LOG_NOTICE, + "Writing eviction notice for node %d\n", + ni[x].ni_status.ps_nodeid); + qd_write_status(ctx, ni[x].ni_status.ps_nodeid, + S_EVICT, NULL, NULL, NULL); + if (ctx->qc_flags & RF_ALLOW_KILL) { + clulog(LOG_DEBUG, "Telling CMAN to " + "kill the node\n"); + cman_kill_node(ctx->qc_ch, + ni[x].ni_status.ps_nodeid); + } + } + /* Clear our master mask for the node after eviction */ if (mask) clear_bit(mask, (ni[x].ni_status.ps_nodeid-1), hooks/post-receive -- Cluster Project From lhh@sourceware.org Thu Apr 17 14:28:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Thu, 17 Apr 2008 14:28:00 -0000 Subject: Cluster Project branch, STABLE, updated. rgmanager_1_9_66-13-g703bdf8 Message-ID: <20080417142844.11255.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=703bdf832679cdcad3137017cd07640483bed767 The branch, STABLE has been updated via 703bdf832679cdcad3137017cd07640483bed767 (commit) from 5ee43bab4b9c3048e58eb5f1de61d57b1a28e045 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 703bdf832679cdcad3137017cd07640483bed767 Author: Lon Hohberger Date: Thu Apr 17 10:28:27 2008 -0400 [cman] Allow disk devices with sector sizes != 512 bytes Merged from RHEL4 branch. ----------------------------------------------------------------------- Summary of changes: cman/qdisk/clulog.c | 2 +- cman/qdisk/disk.c | 191 +++++++++++++++++++++++++++--------------------- cman/qdisk/disk.h | 58 +++++++++----- cman/qdisk/disk_util.c | 20 +++--- cman/qdisk/main.c | 61 +++++++++++++-- cman/qdisk/mkqdisk.c | 2 +- cman/qdisk/proc.c | 54 ++++++++++--- cman/qdisk/score.c | 19 +++++ 8 files changed, 269 insertions(+), 138 deletions(-) diff --git a/cman/qdisk/clulog.c b/cman/qdisk/clulog.c index 9ed0eef..6b998f1 100644 --- a/cman/qdisk/clulog.c +++ b/cman/qdisk/clulog.c @@ -273,7 +273,7 @@ do_clulog(int severity, fprintf(stdout, "%s", printmsg); } - syslog(severity, logmsg); + syslog(severity, "%s", logmsg); pthread_mutex_unlock(&log_mutex); diff --git a/cman/qdisk/disk.c b/cman/qdisk/disk.c index ad22b7b..cd9a462 100644 --- a/cman/qdisk/disk.c +++ b/cman/qdisk/disk.c @@ -43,8 +43,9 @@ #include #include #include +#include -static int diskRawRead(int fd, char *buf, int len); +static int diskRawRead(target_info_t *disk, char *buf, int len); uint32_t clu_crc32(const char *data, size_t count); @@ -211,49 +212,57 @@ header_verify(shared_header_t *hdr, const char *data, size_t count) * Returns - (the file descriptor), a value >= 0 on success. */ int -qdisk_open(char *name) +qdisk_open(char *name, target_info_t *disk) { - int fd; - int retval; + int ret; + int ssz; /* * Open for synchronous writes to insure all writes go directly * to disk. */ - fd = open(name, O_RDWR | O_SYNC | O_DIRECT); - if (fd < 0) { - return fd; + disk->d_fd = open(name, O_RDWR | O_SYNC | O_DIRECT); + if (disk->d_fd < 0) + return disk->d_fd; + + ret = ioctl(disk->d_fd, BLKSSZGET, &ssz); + if (ret < 0) { + perror("qdisk_open: ioctl(BLKSSZGET)"); + return -1; } - /* Check to verify that the partition is large enough.*/ - retval = lseek(fd, END_OF_DISK, SEEK_SET); + disk->d_blksz = ssz; + disk->d_pagesz = sysconf(_SC_PAGESIZE); - if (retval < 0) { + /* Check to verify that the partition is large enough.*/ + ret = lseek(disk->d_fd, END_OF_DISK(disk->d_blksz), SEEK_SET); + if (ret < 0) { perror("open_partition: seek"); return -1; } - if (retval < END_OF_DISK) { + if (ret < END_OF_DISK(disk->d_blksz)) { fprintf(stderr, "Partition %s too small\n", name); errno = EINVAL; return -1; } /* Set close-on-exec bit */ - retval = fcntl(fd, F_GETFD, 0); - if (retval < 0) { - close(fd); + ret = fcntl(disk->d_fd, F_GETFD, 0); + if (ret < 0) { + perror("open_partition: fcntl(F_GETFD)"); + close(disk->d_fd); return -1; } - retval |= FD_CLOEXEC; - if (fcntl(fd, F_SETFD, retval) < 0) { - perror("open_partition: fcntl"); - close(fd); + ret |= FD_CLOEXEC; + if (fcntl(disk->d_fd, F_SETFD, ret) < 0) { + perror("open_partition: fcntl(F_SETFD)"); + close(disk->d_fd); return -1; } - return fd; + return 0; } @@ -263,17 +272,17 @@ qdisk_open(char *name) * Returns - value from close syscall. */ int -qdisk_close(int *fd) +qdisk_close(target_info_t *disk) { int retval; - if (!fd || *fd < 0) { + if (!disk || disk->d_fd < 0) { errno = EINVAL; return -1; } - retval = close(*fd); - *fd = -1; + retval = close(disk->d_fd); + disk->d_fd = -1; return retval; } @@ -288,7 +297,7 @@ int qdisk_validate(char *name) { struct stat stat_st, *stat_ptr; - int fd; + target_info_t disk; stat_ptr = &stat_st; if (stat(name, stat_ptr) < 0) { @@ -310,26 +319,25 @@ qdisk_validate(char *name) /* * Verify read/write permission. */ - fd = qdisk_open(name); - if (fd < 0) { + if (qdisk_open(name, &disk) < 0) { fprintf(stderr, "%s: open of %s for RDWR failed: %s\n", __FUNCTION__, name, strerror(errno)); return -1; } - qdisk_close(&fd); + qdisk_close(&disk); return 0; } static int -diskRawReadShadow(int fd, off_t readOffset, char *buf, int len) +diskRawReadShadow(target_info_t *disk, off_t readOffset, char *buf, int len) { int ret; shared_header_t *hdrp; char *data; int datalen; - ret = lseek(fd, readOffset, SEEK_SET); + ret = lseek(disk->d_fd, readOffset, SEEK_SET); if (ret != readOffset) { #if 0 fprintf(stderr, @@ -340,7 +348,7 @@ diskRawReadShadow(int fd, off_t readOffset, char *buf, int len) return -1; } - ret = diskRawRead(fd, buf, len); + ret = diskRawRead(disk, buf, len); if (ret != len) { #if 0 fprintf(stderr, "diskRawReadShadow: aligned read " @@ -375,7 +383,7 @@ diskRawReadShadow(int fd, off_t readOffset, char *buf, int len) * Here we check for alignment and do a bounceio if necessary. */ static int -diskRawRead(int fd, char *buf, int len) +diskRawRead(target_info_t *disk, char *buf, int len) { char *alignedBuf; int readret; @@ -383,21 +391,24 @@ diskRawRead(int fd, char *buf, int len) int readlen; int bounceNeeded = 1; - if ((((unsigned long) buf & (unsigned long) 0x3ff) == 0) && - ((len % 512) == 0)) { + + /* was 3ff, which is (512<<1-1) */ + if ((((unsigned long) buf & + (unsigned long) ((disk->d_blksz << 1) -1)) == 0) && + ((len % (disk->d_blksz)) == 0)) { bounceNeeded = 0; } if (bounceNeeded == 0) { /* Already aligned and even multiple of 512, no bounceio * required. */ - return (read(fd, buf, len)); + return (read(disk->d_fd, buf, len)); } - if (len > 512) { + if (len > disk->d_blksz) { fprintf(stderr, "diskRawRead: not setup for reads larger than %d.\n", - 512); + (int)disk->d_blksz); return (-1); } /* @@ -406,8 +417,8 @@ diskRawRead(int fd, char *buf, int len) * XXX - if the on-disk offsets don't provide enough room we're cooked! */ extraLength = 0; - if (len % 512) { - extraLength = 512 - (len % 512); + if (len % disk->d_blksz) { + extraLength = disk->d_blksz - (len % disk->d_blksz); } readlen = len; @@ -415,18 +426,18 @@ diskRawRead(int fd, char *buf, int len) readlen += extraLength; } - readret = posix_memalign((void **)&alignedBuf, 512, 512); + readret = posix_memalign((void **)&alignedBuf, disk->d_pagesz, disk->d_blksz); if (readret < 0) { return -1; } - readret = read(fd, alignedBuf, readlen); + readret = read(disk->d_fd, alignedBuf, readlen); if (readret > 0) { if (readret > len) { - bcopy(alignedBuf, buf, len); + memcpy(alignedBuf, buf, len); readret = len; } else { - bcopy(alignedBuf, buf, readret); + memcpy(alignedBuf, buf, readret); } } @@ -445,7 +456,7 @@ diskRawRead(int fd, char *buf, int len) * Here we check for alignment and do a bounceio if necessary. */ static int -diskRawWrite(int fd, char *buf, int len) +diskRawWrite(target_info_t *disk, char *buf, int len) { char *alignedBuf; int ret; @@ -453,31 +464,33 @@ diskRawWrite(int fd, char *buf, int len) int writelen; int bounceNeeded = 1; - if ((((unsigned long) buf & (unsigned long) 0x3ff) == 0) && - ((len % 512) == 0)) { + /* was 3ff, which is (512<<1-1) */ + if ((((unsigned long) buf & + (unsigned long) ((disk->d_blksz << 1) -1)) == 0) && + ((len % (disk->d_blksz)) == 0)) { bounceNeeded = 0; } + if (bounceNeeded == 0) { /* Already aligned and even multiple of 512, no bounceio * required. */ - return (write(fd, buf, len)); + return (write(disk->d_fd, buf, len)); } - if (len > 512) { + if (len > disk->d_blksz) { fprintf(stderr, - "diskRawWrite: not setup for larger than %d.\n", - 512); + "diskRawRead: not setup for reads larger than %d.\n", + (int)disk->d_blksz); return (-1); } - /* * All IOs must be of size which is a multiple of 512. Here we * just add in enough extra to accommodate. * XXX - if the on-disk offsets don't provide enough room we're cooked! */ extraLength = 0; - if (len % 512) { - extraLength = 512 - (len % 512); + if (len % disk->d_blksz) { + extraLength = disk->d_blksz - (len % disk->d_blksz); } writelen = len; @@ -485,13 +498,20 @@ diskRawWrite(int fd, char *buf, int len) writelen += extraLength; } - ret = posix_memalign((void **)&alignedBuf, 512,512); + ret = posix_memalign((void **)&alignedBuf, disk->d_pagesz, disk->d_blksz); if (ret < 0) { + return -1; + } + + if (len > disk->d_blksz) { + fprintf(stderr, + "diskRawWrite: not setup for larger than %d.\n", + (int)disk->d_blksz); return (-1); } - bcopy(buf, alignedBuf, len); - ret = write(fd, alignedBuf, writelen); + memcpy(buf, alignedBuf, len); + ret = write(disk->d_fd, alignedBuf, writelen); if (ret > len) { ret = len; } @@ -507,7 +527,7 @@ diskRawWrite(int fd, char *buf, int len) static int -diskRawWriteShadow(int fd, __off64_t writeOffset, char *buf, int len) +diskRawWriteShadow(target_info_t *disk, __off64_t writeOffset, char *buf, int len) { off_t retval_seek; ssize_t retval_write; @@ -519,7 +539,7 @@ diskRawWriteShadow(int fd, __off64_t writeOffset, char *buf, int len) return (-1); } - retval_seek = lseek(fd, writeOffset, SEEK_SET); + retval_seek = lseek(disk->d_fd, writeOffset, SEEK_SET); if (retval_seek != writeOffset) { fprintf(stderr, "diskRawWriteShadow: can't seek to offset %d\n", @@ -527,7 +547,7 @@ diskRawWriteShadow(int fd, __off64_t writeOffset, char *buf, int len) return (-1); } - retval_write = diskRawWrite(fd, buf, len); + retval_write = diskRawWrite(disk, buf, len); if (retval_write != len) { if (retval_write == -1) { fprintf(stderr, "%s: %s\n", __FUNCTION__, @@ -544,7 +564,7 @@ diskRawWriteShadow(int fd, __off64_t writeOffset, char *buf, int len) int -qdisk_read(int fd, __off64_t offset, void *buf, int count) +qdisk_read(target_info_t *disk, __off64_t offset, void *buf, int count) { shared_header_t *hdrp; char *data; @@ -556,15 +576,15 @@ qdisk_read(int fd, __off64_t offset, void *buf, int count) * Raw blocks are 512 byte aligned. */ total = count + sizeof(shared_header_t); - if (total < 512) - total = 512; + if (total < disk->d_blksz) + total = disk->d_blksz; /* Round it up */ - if (total % 512) - total = total + (512 * !!(total % 512)) - (total % 512); + if (total % disk->d_blksz) + total = total + (disk->d_blksz * !!(total % disk->d_blksz)) - (total % disk->d_blksz); hdrp = NULL; - rv = posix_memalign((void **)&hdrp, sysconf(_SC_PAGESIZE), total); + rv = posix_memalign((void **)&hdrp, disk->d_pagesz, disk->d_blksz); if (rv < 0) return -1; @@ -573,7 +593,7 @@ qdisk_read(int fd, __off64_t offset, void *buf, int count) data = (char *)hdrp + sizeof(shared_header_t); - rv = diskRawReadShadow(fd, offset, (char *)hdrp, total); + rv = diskRawReadShadow(disk, offset, (char *)hdrp, disk->d_blksz); if (rv == -1) { return -1; @@ -594,12 +614,12 @@ qdisk_read(int fd, __off64_t offset, void *buf, int count) int -qdisk_write(int fd, __off64_t offset, const void *buf, int count) +qdisk_write(target_info_t *disk, __off64_t offset, const void *buf, int count) { size_t maxsize; shared_header_t *hdrp; char *data; - size_t total = 0, rv = -1, psz = 512; //sysconf(_SC_PAGESIZE); + size_t total = 0, rv = -1, psz = disk->d_blksz; //sysconf(_SC_PAGESIZE); maxsize = psz - (sizeof(shared_header_t)); if (count >= (maxsize + sizeof(shared_header_t))) { @@ -611,7 +631,6 @@ qdisk_write(int fd, __off64_t offset, const void *buf, int count) /* * Calculate the total length of the buffer, including the header. - * Raw blocks are 512 byte aligned. */ total = count + sizeof(shared_header_t); if (total < psz) @@ -622,7 +641,7 @@ qdisk_write(int fd, __off64_t offset, const void *buf, int count) total = total + (psz * !!(total % psz)) - (total % psz); hdrp = NULL; - rv = posix_memalign((void **)&hdrp, sysconf(_SC_PAGESIZE), total); + rv = posix_memalign((void **)&hdrp, disk->d_pagesz, total); if (rv < 0) { perror("posix_memalign"); return -1; @@ -645,7 +664,7 @@ qdisk_write(int fd, __off64_t offset, const void *buf, int count) * about locking here. */ if (total == psz) - rv = diskRawWriteShadow(fd, offset, (char *)hdrp, psz); + rv = diskRawWriteShadow(disk, offset, (char *)hdrp, psz); if (rv == -1) perror("diskRawWriteShadow"); @@ -658,11 +677,11 @@ qdisk_write(int fd, __off64_t offset, const void *buf, int count) static int -header_init(int fd, char *label) +header_init(target_info_t *disk, char *label) { quorum_header_t qh; - if (qdisk_read(fd, OFFSET_HEADER, &qh, sizeof(qh)) == sizeof(qh)) { + if (qdisk_read(disk, OFFSET_HEADER, &qh, sizeof(qh)) == sizeof(qh)) { swab_quorum_header_t(&qh); if (qh.qh_magic == HEADER_MAGIC_OLD) { printf("Warning: Red Hat Cluster Manager 1.2.x " @@ -679,16 +698,20 @@ header_init(int fd, char *label) } /* Copy in the cluster/label name */ - snprintf(qh.qh_cluster, sizeof(qh.qh_cluster)-1, label); + snprintf(qh.qh_cluster, sizeof(qh.qh_cluster)-1, "%s", label); + qh.qh_version = VERSION_MAGIC_V2; if ((qh.qh_timestamp = (uint64_t)time(NULL)) <= 0) { perror("time"); return -1; } qh.qh_magic = HEADER_MAGIC_NUMBER; + qh.qh_blksz = disk->d_blksz; + qh.qh_pad = 0; + swab_quorum_header_t(&qh); - if (qdisk_write(fd, OFFSET_HEADER, &qh, sizeof(qh)) != sizeof(qh)) { + if (qdisk_write(disk, OFFSET_HEADER, &qh, sizeof(qh)) != sizeof(qh)) { return -1; } @@ -699,24 +722,24 @@ header_init(int fd, char *label) int qdisk_init(char *partname, char *label) { - int fd; + target_info_t disk; status_block_t ps, wps; - int nid; + int nid, ret; time_t t; - fd = qdisk_validate(partname); - if (fd < 0) { + ret = qdisk_validate(partname); + if (ret < 0) { perror("qdisk_verify"); return -1; } - fd = qdisk_open(partname); - if (fd < 0) { + ret = qdisk_open(partname, &disk); + if (ret < 0) { perror("qdisk_open"); return -1; } - if (header_init(fd, label) < 0) { + if (header_init(&disk, label) < 0) { return -1; } @@ -744,14 +767,14 @@ qdisk_init(char *partname, char *label) wps = ps; swab_status_block_t(&wps); - if (qdisk_write(fd, qdisk_nodeid_offset(nid), &wps, sizeof(wps)) < 0) { + if (qdisk_write(&disk, qdisk_nodeid_offset(nid, disk.d_blksz), &wps, sizeof(wps)) < 0) { printf("Error writing node ID block %d\n", nid); - qdisk_close(&fd); + qdisk_close(&disk); return -1; } } - qdisk_close(&fd); + qdisk_close(&disk); return 0; } diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h index 277005a..abc870e 100644 --- a/cman/qdisk/disk.h +++ b/cman/qdisk/disk.h @@ -72,7 +72,8 @@ typedef enum { RF_DEBUG = 0x4, RF_PARANOID = 0x8, RF_ALLOW_KILL = 0x10, - RF_UPTIME = 0x20 + RF_UPTIME = 0x20, + RF_CMAN_LABEL = 0x40 } run_flag_t; @@ -86,6 +87,9 @@ typedef enum { #define STATE_MAGIC_NUMBER 0x47bacef8 /* Status block */ #define SHARED_HEADER_MAGIC 0x00DEBB1E /* Per-block headeer */ +/* Version magic. */ +#define VERSION_MAGIC_V2 0x389fabc4 + typedef struct __attribute__ ((packed)) { uint32_t ps_magic; @@ -152,16 +156,21 @@ typedef struct __attribute__ ((packed)) { */ typedef struct __attribute__ ((packed)) { uint32_t qh_magic; - uint32_t qh_align; // 64-bit-ism: alignment fixer. + uint32_t qh_version; // uint64_t qh_timestamp; // time of last update char qh_updatehost[128];// Hostname who put this here... - char qh_cluster[128]; // Cluster name + char qh_cluster[120]; // Cluster name; CMAN only + // supports 16 chars. + uint32_t qh_blksz; // Known block size @ creation + uint32_t qh_pad; } quorum_header_t; #define swab_quorum_header_t(ptr) \ {\ swab32((ptr)->qh_magic); \ - swab32((ptr)->qh_align); \ + swab32((ptr)->qh_version); \ + swab32((ptr)->qh_blksz); \ + swab32((ptr)->qh_pad); \ swab64((ptr)->qh_timestamp); \ } @@ -196,31 +205,35 @@ typedef struct __attribute__ ((packed)) { /* Offsets from RHCM 1.2.x */ #define OFFSET_HEADER 0 -#define HEADER_SIZE 4096 /* Page size for now */ +#define HEADER_SIZE(ssz) (ssz<4096?4096:ssz) -#define OFFSET_FIRST_STATUS_BLOCK (OFFSET_HEADER + HEADER_SIZE) -#define SPACE_PER_STATUS_BLOCK 4096 /* Page size for now */ +#define OFFSET_FIRST_STATUS_BLOCK(ssz) (OFFSET_HEADER + HEADER_SIZE(ssz)) +#define SPACE_PER_STATUS_BLOCK(ssz) (ssz<4096?4096:ssz) #define STATUS_BLOCK_COUNT MAX_NODES_DISK -#define SPACE_PER_MESSAGE_BLOCK (4096) -#define MESSAGE_BLOCK_COUNT MAX_NODES_DISK - -#define END_OF_DISK (OFFSET_FIRST_STATUS_BLOCK + \ +#define END_OF_DISK(ssz) (OFFSET_FIRST_STATUS_BLOCK(ssz) + \ (MAX_NODES_DISK + 1) * \ - SPACE_PER_STATUS_BLOCK) \ + SPACE_PER_STATUS_BLOCK(ssz)) \ + +typedef struct { + int d_fd; + int _pad_; + size_t d_blksz; + size_t d_pagesz; +} target_info_t; /* From disk.c */ -int qdisk_open(char *name); -int qdisk_close(int *fd); +int qdisk_open(char *name, target_info_t *disk); +int qdisk_close(target_info_t *disk); int qdisk_init(char *name, char *clustername); int qdisk_validate(char *name); -int qdisk_read(int fd, __off64_t ofs, void *buf, int len); -int qdisk_write(int fd, __off64_t ofs, const void *buf, int len); +int qdisk_read(target_info_t *disk, __off64_t ofs, void *buf, int len); +int qdisk_write(target_info_t *disk, __off64_t ofs, const void *buf, int len); -#define qdisk_nodeid_offset(nodeid) \ - (OFFSET_FIRST_STATUS_BLOCK + (SPACE_PER_STATUS_BLOCK * (nodeid - 1))) +#define qdisk_nodeid_offset(nodeid, ssz) \ + (OFFSET_FIRST_STATUS_BLOCK(ssz) + (SPACE_PER_STATUS_BLOCK(ssz) * (nodeid - 1))) /* From disk_utils.c */ #define HISTORY_LENGTH 60 @@ -231,11 +244,12 @@ typedef struct { uint16_t pad0; } disk_msg_t; + typedef struct { uint64_t qc_incarnation; struct timeval qc_average; struct timeval qc_last[HISTORY_LENGTH]; - int qc_fd; + target_info_t qc_disk; int qc_my_id; int qc_writes; int qc_interval; @@ -256,6 +270,7 @@ typedef struct { char *qc_device; char *qc_label; char *qc_status_file; + char *qc_cman_label; } qd_ctx; typedef struct { @@ -272,14 +287,15 @@ typedef struct { int qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state, disk_msg_t *msg, memb_mask_t mask, memb_mask_t master); -int qd_read_print_status(int fd, int nid); +int qd_read_print_status(target_info_t *disk, int nid); int qd_init(qd_ctx *ctx, cman_handle_t ch, int me); void qd_destroy(qd_ctx *ctx); /* proc.c */ int find_partitions(const char *partfile, const char *label, char *devname, size_t devlen, int print); -int check_device(char *device, char *label, quorum_header_t *qh); +int check_device(char *device, char *label, int *ssz, quorum_header_t *qh, + int flags); #endif diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c index 80c211d..b36f8d7 100644 --- a/cman/qdisk/disk_util.c +++ b/cman/qdisk/disk_util.c @@ -201,8 +201,9 @@ qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state, if (get_time(&start, ctx->qc_flags&RF_UPTIME) < 0) utime_ok = 0; swab_status_block_t(&ps); - if (qdisk_write(ctx->qc_fd, qdisk_nodeid_offset(nid), &ps, - sizeof(ps)) < 0) { + if (qdisk_write(&ctx->qc_disk, + qdisk_nodeid_offset(nid, ctx->qc_disk.d_blksz), + &ps, sizeof(ps)) < 0) { printf("Error writing node ID block %d\n", nid); return -1; } @@ -223,12 +224,12 @@ qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state, int -qd_print_status(status_block_t *ps) +qd_print_status(target_info_t *disk, status_block_t *ps) { int x; printf("Data @ offset %d:\n", - (int)qdisk_nodeid_offset(ps->ps_nodeid)); + (int)qdisk_nodeid_offset(ps->ps_nodeid, disk->d_blksz)); printf("status_block_t {\n"); printf("\t.ps_magic = %08x;\n", (int)ps->ps_magic); printf("\t.ps_nodeid = %d;\n", (int)ps->ps_nodeid); @@ -261,11 +262,11 @@ qd_print_status(status_block_t *ps) int -qd_read_print_status(int fd, int nid) +qd_read_print_status(target_info_t *disk, int nid) { status_block_t ps; - if (fd < 0) { + if (!disk || disk->d_fd < 0) { errno = EINVAL; return -1; } @@ -275,13 +276,13 @@ qd_read_print_status(int fd, int nid) return -1; } - if (qdisk_read(fd, qdisk_nodeid_offset(nid), &ps, + if (qdisk_read(disk, qdisk_nodeid_offset(nid, disk->d_blksz), &ps, sizeof(ps)) < 0) { printf("Error reading node ID block %d\n", nid); return -1; } swab_status_block_t(&ps); - qd_print_status(&ps); + qd_print_status(disk, &ps); return 0; } @@ -339,6 +340,5 @@ qd_destroy(qd_ctx *ctx) free(ctx->qc_device); ctx->qc_device = NULL; } - close(ctx->qc_fd); - ctx->qc_fd = -1; + qdisk_close(&ctx->qc_disk); } diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index cb20590..a29a5d0 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -147,7 +147,8 @@ read_node_blocks(qd_ctx *ctx, node_info_t *ni, int max) sb = &ni[x].ni_status; - if (qdisk_read(ctx->qc_fd, qdisk_nodeid_offset(x+1), + if (qdisk_read(&ctx->qc_disk, + qdisk_nodeid_offset(x+1, ctx->qc_disk.d_blksz), sb, sizeof(*sb)) < 0) { clulog(LOG_WARNING,"Error reading node ID block %d\n", x+1); @@ -462,12 +463,14 @@ quorum_init(qd_ctx *ctx, node_info_t *ni, int max, struct h_data *h, int maxh) if (qdisk_validate(ctx->qc_device) < 0) return -1; - ctx->qc_fd = qdisk_open(ctx->qc_device); - if (ctx->qc_fd < 0) { + if (qdisk_open(ctx->qc_device, &ctx->qc_disk) < 0) { clulog(LOG_CRIT, "Failed to open %s: %s\n", ctx->qc_device, strerror(errno)); return -1; } + + clulog(LOG_DEBUG, "I/O Size: %d Page Size: %d\n", + ctx->qc_disk.d_blksz, ctx->qc_disk.d_pagesz); if (h && maxh) { start_score_thread(ctx, h, maxh); @@ -1210,14 +1213,30 @@ get_config_data(char *cluster_name, qd_ctx *ctx, struct h_data *h, int maxh, } if (ctx->qc_master_wait <= ctx->qc_tko_up) ctx->qc_master_wait = ctx->qc_tko_up + 1; - + /* Get votes */ + + /* check if votes is set in cluster.conf */ snprintf(query, sizeof(query), "/cluster/quorumd/@votes"); if (ccs_get(ccsfd, query, &val) == 0) { ctx->qc_votes = atoi(val); free(val); if (ctx->qc_votes < 0) ctx->qc_votes = 0; + } else { /* if votes is not set, default to node_num - 1 */ + int nodes = 0, error; + for (;;) { + error = ccs_get_list(ccsfd, "/cluster/clusternodes/child::*", &val); + if (error || !val) + break; + + nodes++; + } + nodes--; + if (nodes < 0) + nodes = 0; + + ctx->qc_votes = nodes; } /* Get device */ @@ -1286,6 +1305,15 @@ get_config_data(char *cluster_name, qd_ctx *ctx, struct h_data *h, int maxh, ctx->qc_flags &= ~RF_REBOOT; free(val); } + + /* Get cman_label */ + snprintf(query, sizeof(query), "/cluster/quorumd/@cman_label"); + if (ccs_get(ccsfd, query, &val) == 0) { + if (strlen(val) > 0) { + ctx->qc_flags |= RF_CMAN_LABEL; + ctx->qc_cman_label = val; + } + } /* * Get flag to see if we're supposed to kill cman if qdisk is not @@ -1348,8 +1376,9 @@ get_config_data(char *cluster_name, qd_ctx *ctx, struct h_data *h, int maxh, *cfh = configure_heuristics(ccsfd, h, maxh); clulog(LOG_DEBUG, - "Quorum Daemon: %d heuristics, %d interval, %d tko, %d votes\n", - *cfh, ctx->qc_interval, ctx->qc_tko, ctx->qc_votes); + "Quorum Daemon: %d heuristics, %d interval, %d tko, %d votes," + " flags=%08x\n", + *cfh, ctx->qc_interval, ctx->qc_tko, ctx->qc_votes, ctx->qc_flags); ccs_disconnect(ccsfd); @@ -1392,6 +1421,7 @@ main(int argc, char **argv) char debug = 0, foreground = 0; char device[128]; pid_t pid; + quorum_header_t qh; if (check_process_running(argv[0], &pid) && pid !=getpid()) { printf("QDisk services already running\n"); @@ -1494,13 +1524,24 @@ main(int argc, char **argv) clulog(LOG_INFO, "Quorum Partition: %s Label: %s\n", ctx.qc_device, ctx.qc_label); } else if (ctx.qc_device) { - if (check_device(ctx.qc_device, NULL, NULL) != 0) { + if (check_device(ctx.qc_device, NULL, &rv, &qh, 0) != 0) { clulog(LOG_CRIT, "Specified partition %s does not have a " "qdisk label\n", ctx.qc_device); check_stop_cman(&ctx); return -1; } + + if (qh.qh_version == VERSION_MAGIC_V2 && + qh.qh_blksz != rv) { + clulog(LOG_CRIT, + "Specified device %s does match kernel's " + "reported sector size (%d != %d)\n", + ctx.qc_device, + ctx.qc_disk.d_blksz, rv); + check_stop_cman(&ctx); + return -1; + } } if (!foreground && !forked) { @@ -1519,7 +1560,11 @@ main(int argc, char **argv) if (!_running) return 0; - cman_register_quorum_device(ctx.qc_ch, ctx.qc_device, ctx.qc_votes); + cman_register_quorum_device(ctx.qc_ch, + (ctx.qc_flags&RF_CMAN_LABEL)? + ctx.qc_cman_label: + ctx.qc_device, + ctx.qc_votes); /* XXX this always returns -1 / EBUSY even when it works?!!! diff --git a/cman/qdisk/mkqdisk.c b/cman/qdisk/mkqdisk.c index 76fa26d..057193a 100644 --- a/cman/qdisk/mkqdisk.c +++ b/cman/qdisk/mkqdisk.c @@ -39,7 +39,7 @@ main(int argc, char **argv) char *newdev = NULL, *newlabel = NULL; int rv; - printf("mkqdisk v0.5.1\n"); + printf("mkqdisk v0.5.2\n"); while ((rv = getopt(argc, argv, "Lf:c:l:h")) != EOF) { switch (rv) { diff --git a/cman/qdisk/proc.c b/cman/qdisk/proc.c index dc0cdf1..8868466 100644 --- a/cman/qdisk/proc.c +++ b/cman/qdisk/proc.c @@ -32,27 +32,33 @@ int -check_device(char *device, char *label, quorum_header_t *qh) +check_device(char *device, char *label, int *ssz, quorum_header_t *qh, + int flags) { - int fd = -1, ret = -1; + int ret = -1; quorum_header_t qh_local; + target_info_t disk; if (!qh) qh = &qh_local; - fd = qdisk_validate(device); - if (fd < 0) { + ret = qdisk_validate(device); + if (ret < 0) { perror("qdisk_verify"); return -1; } - fd = qdisk_open(device); - if (fd < 0) { + ret = qdisk_open(device, &disk); + if (ret < 0) { perror("qdisk_open"); return -1; } - if (qdisk_read(fd, OFFSET_HEADER, qh, sizeof(*qh)) == sizeof(*qh)) { + if (ssz) + *ssz = disk.d_blksz; + + ret = -1; + if (qdisk_read(&disk, OFFSET_HEADER, qh, sizeof(*qh)) == sizeof(*qh)) { swab_quorum_header_t(qh); if (qh->qh_magic == HEADER_MAGIC_NUMBER) { if (!label || !strcmp(qh->qh_cluster, label)) { @@ -61,7 +67,14 @@ check_device(char *device, char *label, quorum_header_t *qh) } } - qdisk_close(&fd); + /* only flag now is 'strict device check'; i.e., + "block size recorded must match kernel's reported size" */ + if (flags && qh->qh_version == VERSION_MAGIC_V2 && + disk.d_blksz != qh->qh_blksz) { + ret = -1; + } + + qdisk_close(&disk); return ret; } @@ -78,6 +91,7 @@ find_partitions(const char *partfile, const char *label, char device[128]; char realdev[256]; quorum_header_t qh; + int ssz; fp = fopen(partfile, "r"); if (!fp) @@ -96,16 +110,30 @@ find_partitions(const char *partfile, const char *label, if (strlen(device)) { snprintf(realdev, sizeof(realdev), "/dev/%s", device); - if (check_device(realdev, (char *)label, &qh) != 0) + + /* If we're not "just printing", then + then reject devices which don't match + the recorded sector size */ + if (check_device(realdev, (char *)label, &ssz, + &qh, !print) != 0) continue; if (print) { printf("%s:\n", realdev); - printf("\tMagic: %08x\n", qh.qh_magic); - printf("\tLabel: %s\n", qh.qh_cluster); - printf("\tCreated: %s", + printf("\tMagic: %08x\n", qh.qh_magic); + printf("\tLabel: %s\n", qh.qh_cluster); + printf("\tCreated: %s", ctime((time_t *)&qh.qh_timestamp)); - printf("\tHost: %s\n\n", qh.qh_updatehost); + printf("\tHost: %s\n", qh.qh_updatehost); + printf("\tKernel Sector Size: %d\n", ssz); + if (qh.qh_version == VERSION_MAGIC_V2) { + printf("\tRecorded Sector Size: %d\n\n", (int)qh.qh_blksz); + if (qh.qh_blksz != ssz) { + printf("WARNING: Sector size mismatch: Header: %d Kernel: %d\n", + (int)qh.qh_blksz, ssz); + } + } else + printf("\n"); } if (devname && devlen) { diff --git a/cman/qdisk/score.c b/cman/qdisk/score.c index d8d7a8f..3f508a2 100644 --- a/cman/qdisk/score.c +++ b/cman/qdisk/score.c @@ -75,6 +75,24 @@ nullify(void) /** + Set all signal handlers to default for exec of a script. + ONLY do this after a fork(). + */ +void +restore_signals(void) +{ + sigset_t set; + int x; + + for (x = 1; x < _NSIG; x++) + signal(x, SIG_DFL); + + sigfillset(&set); + sigprocmask(SIG_UNBLOCK, &set, NULL); +} + + +/** Spin off a user-defined heuristic */ static int @@ -117,6 +135,7 @@ fork_heuristic(struct h_data *h) */ set_priority(SCHED_OTHER, -1); munlockall(); + restore_signals(); argv[0] = "/bin/sh"; argv[1] = "-c"; hooks/post-receive -- Cluster Project From bmarzins@sourceware.org Thu Apr 17 18:17:00 2008 From: bmarzins@sourceware.org (bmarzins@sourceware.org) Date: Thu, 17 Apr 2008 18:17:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-53-gb0fdc2f Message-ID: <20080417181707.10672.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b0fdc2f9d6ce482ba6a7cb54cc9f17a0be1ff395 The branch, RHEL5 has been updated via b0fdc2f9d6ce482ba6a7cb54cc9f17a0be1ff395 (commit) from b2686ffe984c517110b949d604c54a71800b67c9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b0fdc2f9d6ce482ba6a7cb54cc9f17a0be1ff395 Author: Benjamin Marzinski Date: Thu Apr 17 11:41:09 2008 -0500 The gnbd kernel module on 64 bit architectures didn't handle ioctls from 32 bit userspace processes. Now it does. Resolves: bz #440454 Also, I was getting an error because on ppc64, the manual definition of O_DIRECT in gnbd/server/device.c was incorrect. I switched to defining _GNU_SOURCE, which should mean that O_DIRECT will be automatically defined. ----------------------------------------------------------------------- Summary of changes: gnbd-kernel/src/gnbd.c | 33 +++++++++++++++++++++++++++++++++ gnbd/server/device.c | 7 ++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c index 2795961..d637141 100644 --- a/gnbd-kernel/src/gnbd.c +++ b/gnbd-kernel/src/gnbd.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef CONFIG_COMPAT +#include +#endif #include #include @@ -801,6 +804,33 @@ static int gnbd_ctl_ioctl(struct inode *inode, struct file *file, return -EINVAL; } +#ifdef CONFIG_COMPAT +static long gnbd_ctl_compat_ioctl(struct file *f, unsigned cmd, + unsigned long arg) +{ + int ret; + switch (cmd) { + case GNBD_DISCONNECT: + case GNBD_CLEAR_QUE: + case GNBD_PING: + case GNBD_PRINT_DEBUG: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, arg); + unlock_kernel(); + return ret; + case GNBD_DO_IT: + case GNBD_GET_TIME: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, + (unsigned long)compat_ptr(arg)); + unlock_kernel(); + return ret; + default: + return -ENOIOCTLCMD; + } +} +#endif + static int gnbd_open(struct inode *inode, struct file *file) { struct gnbd_device *dev = inode->i_bdev->bd_disk->private_data; @@ -836,6 +866,9 @@ static int gnbd_release(struct inode *inode, struct file *file) static struct file_operations _gnbd_ctl_fops = { .ioctl = gnbd_ctl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = gnbd_ctl_compat_ioctl, +#endif .owner = THIS_MODULE, }; diff --git a/gnbd/server/device.c b/gnbd/server/device.c index 2c830ae..b547897 100644 --- a/gnbd/server/device.c +++ b/gnbd/server/device.c @@ -10,6 +10,7 @@ ******************************************************************************* ******************************************************************************/ +#define _GNU_SOURCE #include #include #include @@ -27,10 +28,6 @@ #define BLKGETSIZE64 _IOR(0x12, 114, uint64_t) #endif -#ifndef O_DIRECT -#define O_DIRECT 040000 -#endif - #include "list.h" #include "gnbd_utils.h" #include "local_req.h" @@ -106,7 +103,7 @@ int open_file(char *path, unsigned int flags, int *devfd) if (fd < 0){ err = -errno; log_err("cannot open %s in %s%s mode : %s\n", path, - (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | OSYNC", + (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | O_SYNC", (flags & GNBD_FLAGS_UNCACHED)? " | O_DIRECT" : "", strerror(errno)); return err; hooks/post-receive -- Cluster Project From lhh@sourceware.org Thu Apr 17 20:00:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Thu, 17 Apr 2008 20:00:00 -0000 Subject: Cluster Project branch, RHEL47, updated. gfs-kernel_2_6_9_76-46-g5eec9c0 Message-ID: <20080417200054.902.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb The branch, RHEL47 has been updated via 5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb (commit) from 4f903f24b945f53708b0607d186e2fa6b06cd1bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb Author: Lon Hohberger Date: Tue Mar 11 10:43:37 2008 -0400 [CMAN] Fix "Node X is undead" loop bug This was caused by an improper assignment to ps_incarnation after a node decides to evict another node. The fix is to simply make the internal (memory) assignments before calling qd_write_status() ----------------------------------------------------------------------- Summary of changes: cman/qdisk/main.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c index 8e63c88..a29a5d0 100644 --- a/cman/qdisk/main.c +++ b/cman/qdisk/main.c @@ -253,23 +253,6 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) state_run(ni[x].ni_status.ps_state)) { /* - Write eviction notice if we're the master. - */ - if (ctx->qc_status == S_MASTER) { - clulog(LOG_NOTICE, - "Writing eviction notice for node %d\n", - ni[x].ni_status.ps_nodeid); - qd_write_status(ctx, ni[x].ni_status.ps_nodeid, - S_EVICT, NULL, NULL, NULL); - if (ctx->qc_flags & RF_ALLOW_KILL) { - clulog(LOG_DEBUG, "Telling CMAN to " - "kill the node\n"); - cman_kill_node(ctx->qc_ch, - ni[x].ni_status.ps_nodeid); - } - } - - /* Mark our internal views as dead if nodes miss too many heartbeats... This will cause a master transition if no live master exists. @@ -286,6 +269,23 @@ check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask) ni[x].ni_evil_incarnation = ni[x].ni_status.ps_incarnation; + /* + Write eviction notice if we're the master. + */ + if (ctx->qc_status == S_MASTER) { + clulog(LOG_NOTICE, + "Writing eviction notice for node %d\n", + ni[x].ni_status.ps_nodeid); + qd_write_status(ctx, ni[x].ni_status.ps_nodeid, + S_EVICT, NULL, NULL, NULL); + if (ctx->qc_flags & RF_ALLOW_KILL) { + clulog(LOG_DEBUG, "Telling CMAN to " + "kill the node\n"); + cman_kill_node(ctx->qc_ch, + ni[x].ni_status.ps_nodeid); + } + } + /* Clear our master mask for the node after eviction */ if (mask) clear_bit(mask, (ni[x].ni_status.ps_nodeid-1), hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Fri Apr 18 03:28:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 03:28:00 -0000 Subject: conga conga.spec.in.in Message-ID: <20080418032844.30270.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-18 03:28:44 Modified files: . : conga.spec.in.in Log message: Update the changelog now that we've got a bz ticket. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.79&r2=1.45.2.80 From rmccabe@sourceware.org Fri Apr 18 03:31:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 03:31:00 -0000 Subject: conga ./clustermon.spec.in.in ./conga.spec.in. ... Message-ID: <20080418033146.31257.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-18 03:31:46 Modified files: . : clustermon.spec.in.in conga.spec.in.in luci/cluster : fence-macros validate_fence.js luci/site/luci/Extensions: FenceHandler.py Log message: Fix bz442933 (Luci inserts "hostname" instead of "ipaddr" for rsa II fencing device) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/clustermon.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.25.2.13&r2=1.25.2.14 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.24&r2=1.67.2.25 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.3&r2=1.2.4.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.5&r2=1.3.2.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.17.2.7&r2=1.17.2.8 From rmccabe@sourceware.org Fri Apr 18 04:15:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 04:15:00 -0000 Subject: conga ./conga.spec.in.in luci/cluster/resource ... Message-ID: <20080418041552.31642.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-18 04:15:52 Modified files: . : conga.spec.in.in luci/cluster : resource-form-macros Log message: fix bz442806 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.80&r2=1.45.2.81 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.10&r2=1.21.2.11 From rmccabe@sourceware.org Fri Apr 18 04:19:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 04:19:00 -0000 Subject: conga ./conga.spec.in.in luci/cluster/resource ... Message-ID: <20080418041957.32724.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-18 04:19:57 Modified files: . : conga.spec.in.in luci/cluster : resource-form-macros Log message: Fix bz443002 (luci shows wrong state for 'Monitor link' checkbox in IP resource) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.25&r2=1.67.2.26 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.31.2.8&r2=1.31.2.9 From lhh@sourceware.org Fri Apr 18 18:19:00 2008 From: lhh@sourceware.org (lhh@sourceware.org) Date: Fri, 18 Apr 2008 18:19:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-184-gf448484 Message-ID: <20080418181926.11111.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f44848458ce9ec9c32d3854c575368812318da63 The branch, master has been updated via f44848458ce9ec9c32d3854c575368812318da63 (commit) from 2627512a870e654665b0d973a2171fbafbcbbf0d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f44848458ce9ec9c32d3854c575368812318da63 Author: Lon Hohberger Date: Fri Apr 18 14:19:07 2008 -0400 [fence] Close file descriptors that are in invalid/error states If poll was returning with a file descriptor noted as active, but with the POLLERR/POLLNVAL flags set (but not POLLIN or POLLHUP), fenced and groupd would enter a tight spin loop. This fixes that condition. ----------------------------------------------------------------------- Summary of changes: fence/fenced/main.c | 2 +- group/daemon/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fence/fenced/main.c b/fence/fenced/main.c index 8f7960c..e9ebfb8 100644 --- a/fence/fenced/main.c +++ b/fence/fenced/main.c @@ -494,7 +494,7 @@ static int loop(void) for (i = 1; i <= maxi; i++) { if (client[i].fd < 0) continue; - if (pollfd[i].revents & POLLHUP) { + if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) { if (pollfd[i].fd == member_fd) { log_error("cluster is down, exiting"); exit(1); diff --git a/group/daemon/main.c b/group/daemon/main.c index 3274b79..af7d5bd 100644 --- a/group/daemon/main.c +++ b/group/daemon/main.c @@ -764,7 +764,7 @@ static int loop(void) for (i = 0; i <= client_maxi; i++) { if (client[i].fd < 0) continue; - if (pollfd[i].revents & POLLHUP) { + if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) { deadfn = client[i].deadfn; deadfn(i); } else if (pollfd[i].revents & POLLIN) { hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Fri Apr 18 19:03:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 18 Apr 2008 19:03:00 -0000 Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-54-g7578e4c Message-ID: <20080418190357.11618.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=7578e4c888fe556031fd553eb891743e29ae3cf2 The branch, RHEL5 has been updated via 7578e4c888fe556031fd553eb891743e29ae3cf2 (commit) from b0fdc2f9d6ce482ba6a7cb54cc9f17a0be1ff395 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7578e4c888fe556031fd553eb891743e29ae3cf2 Author: Bob Peterson Date: Fri Apr 18 14:00:21 2008 -0500 bz295301: Need man page for gfs_edit ----------------------------------------------------------------------- Summary of changes: gfs/man/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs/man/Makefile b/gfs/man/Makefile index 9a26a81..e56134c 100644 --- a/gfs/man/Makefile +++ b/gfs/man/Makefile @@ -14,6 +14,7 @@ TARGET8= \ gfs.8 \ gfs_mount.8 \ + gfs_edit.8 \ gfs_fsck.8 \ gfs_grow.8 \ gfs_jadd.8 \ hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Fri Apr 18 19:09:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 18 Apr 2008 19:09:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-185-g0732a36 Message-ID: <20080418190956.31085.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0732a367878643b4dc4fc9d37d0b24dbcd623f25 The branch, master has been updated via 0732a367878643b4dc4fc9d37d0b24dbcd623f25 (commit) from f44848458ce9ec9c32d3854c575368812318da63 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0732a367878643b4dc4fc9d37d0b24dbcd623f25 Author: Bob Peterson Date: Fri Apr 18 14:00:21 2008 -0500 bz295301: Need man page for gfs_edit ----------------------------------------------------------------------- Summary of changes: gfs/man/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs/man/Makefile b/gfs/man/Makefile index 2308fb6..e84c8d9 100644 --- a/gfs/man/Makefile +++ b/gfs/man/Makefile @@ -13,6 +13,7 @@ TARGET= gfs.8 \ gfs_mount.8 \ + gfs_edit.8 \ gfs_fsck.8 \ gfs_grow.8 \ gfs_jadd.8 \ hooks/post-receive -- Cluster Project From rpeterso@sourceware.org Fri Apr 18 19:13:00 2008 From: rpeterso@sourceware.org (rpeterso@sourceware.org) Date: Fri, 18 Apr 2008 19:13:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-21-ge1fbc8c Message-ID: <20080418191329.393.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e1fbc8c16993ba4b6957f20c21473ecddbe824e6 The branch, STABLE2 has been updated via e1fbc8c16993ba4b6957f20c21473ecddbe824e6 (commit) from 66fd7419ac6d0005c7e22c4beca887ccb143a185 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e1fbc8c16993ba4b6957f20c21473ecddbe824e6 Author: Bob Peterson Date: Fri Apr 18 14:00:21 2008 -0500 bz295301: Need man page for gfs_edit ----------------------------------------------------------------------- Summary of changes: gfs/man/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gfs/man/Makefile b/gfs/man/Makefile index 2308fb6..e84c8d9 100644 --- a/gfs/man/Makefile +++ b/gfs/man/Makefile @@ -13,6 +13,7 @@ TARGET= gfs.8 \ gfs_mount.8 \ + gfs_edit.8 \ gfs_fsck.8 \ gfs_grow.8 \ gfs_jadd.8 \ hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Fri Apr 18 20:34:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 20:34:00 -0000 Subject: conga ./conga.spec.in.in luci/site/luci/Extens ... Message-ID: <20080418203451.4321.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe@sourceware.org 2008-04-18 20:34:51 Modified files: . : conga.spec.in.in luci/site/luci/Extensions: cluster_adapters.py Log message: Fix bz443152 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.81&r2=1.45.2.82 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.43&r2=1.120.2.44 From rmccabe@sourceware.org Fri Apr 18 20:37:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Fri, 18 Apr 2008 20:37:00 -0000 Subject: conga/luci/site/luci/Extensions cluster_adapte ... Message-ID: <20080418203746.5690.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-18 20:37:46 Modified files: luci/site/luci/Extensions: cluster_adapters.py Log message: Pass in the right object. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.227.2.26&r2=1.227.2.27 From ccaulfield@sourceware.org Mon Apr 21 10:35:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Mon, 21 Apr 2008 10:35:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-186-g288ab73 Message-ID: <20080421103558.8588.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=288ab73e51f51ce174f51dc2fc67c6dd1fe03e85 The branch, master has been updated via 288ab73e51f51ce174f51dc2fc67c6dd1fe03e85 (commit) from 0732a367878643b4dc4fc9d37d0b24dbcd623f25 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 288ab73e51f51ce174f51dc2fc67c6dd1fe03e85 Author: Christine Caulfield Date: Mon Apr 21 11:34:11 2008 +0100 [CMAN] Disallow a new dirty node from joining the cman cluster Patch from David Robinson, bz#443358 Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/daemon/commands.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index 27e6697..09802c2 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -1787,7 +1787,8 @@ static void do_process_transition(int nodeid, char *data, int len) /* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down and has state then we mark it disallowed because we cannot merge stateful nodes */ - if (msg->flags & NODE_FLAGS_DIRTY && node->flags & NODE_FLAGS_BEENDOWN) { + if (msg->flags & NODE_FLAGS_DIRTY && (node->flags & NODE_FLAGS_BEENDOWN || + (us->flags & NODE_FLAGS_DIRTY && nodeid != us->node_id))) { /* Don't duplicate messages */ if (node->state != NODESTATE_AISONLY) { if (cluster_is_quorate) { hooks/post-receive -- Cluster Project From ccaulfield@sourceware.org Mon Apr 21 10:41:00 2008 From: ccaulfield@sourceware.org (ccaulfield@sourceware.org) Date: Mon, 21 Apr 2008 10:41:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-22-gb01cdba Message-ID: <20080421104119.11366.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b01cdba509d81b3a660ad85302765ee2294fad11 The branch, STABLE2 has been updated via b01cdba509d81b3a660ad85302765ee2294fad11 (commit) from e1fbc8c16993ba4b6957f20c21473ecddbe824e6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b01cdba509d81b3a660ad85302765ee2294fad11 Author: Christine Caulfield Date: Mon Apr 21 11:40:58 2008 +0100 [CMAN] Disallow a new dirty node from joining the cman cluster Patch from David Robinson, bz#443358 Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/daemon/commands.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index c96fe52..9ea1e89 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -1733,7 +1733,8 @@ static void do_process_transition(int nodeid, char *data, int len) /* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down and has state then we mark it disallowed because we cannot merge stateful nodes */ - if (msg->flags & NODE_FLAGS_DIRTY && node->flags & NODE_FLAGS_BEENDOWN) { + if (msg->flags & NODE_FLAGS_DIRTY && (node->flags & NODE_FLAGS_BEENDOWN || + (us->flags & NODE_FLAGS_DIRTY && nodeid != us->node_id))) { /* Don't duplicate messages */ if (node->state != NODESTATE_AISONLY) { if (cluster_is_quorate) { hooks/post-receive -- Cluster Project From rmccabe@sourceware.org Mon Apr 21 18:16:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 21 Apr 2008 18:16:00 -0000 Subject: conga ./conga.spec.in.in luci/cluster/fence-ma ... Message-ID: <20080421181601.17608.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-21 18:16:01 Modified files: . : conga.spec.in.in luci/cluster : fence-macros form-macros resource-form-macros validate_fence.js luci/site/luci/Extensions: FenceHandler.py LuciClusterInfo.py luci/site/luci/var: Data.fs make : version.in Log message: Fix bz442729 (Add UI support for ssh for fence agents that now support it) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.67.2.26&r2=1.67.2.27 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.4&r2=1.2.4.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.23&r2=1.176.2.24 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.31.2.9&r2=1.31.2.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.6&r2=1.3.2.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.17.2.8&r2=1.17.2.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.4&r2=1.10.2.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.22&r2=1.20.2.23 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.28.2.11&r2=1.28.2.12 From rmccabe@sourceware.org Mon Apr 21 18:19:00 2008 From: rmccabe@sourceware.org (rmccabe@sourceware.org) Date: Mon, 21 Apr 2008 18:19:00 -0000 Subject: conga/luci/site/luci/Extensions homebase_adapt ... Message-ID: <20080421181945.19473.qmail@sourceware.org> CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe@sourceware.org 2008-04-21 18:19:45 Modified files: luci/site/luci/Extensions: homebase_adapters.py Log message: Missed in last commit Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.48.2.4&r2=1.48.2.5 From cfeist@sourceware.org Mon Apr 21 18:32:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Mon, 21 Apr 2008 18:32:00 -0000 Subject: Cluster Project tag, dlm-kernel_2_6_9_54, created. gfs-kernel_2_6_9_76-43-g8dc51a6 Message-ID: <20080421183231.25487.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=8dc51a64cf9a0bc1b467353a4161220a7cec0de0 The tag, dlm-kernel_2_6_9_54 has been created at 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 (commit) - Log ----------------------------------------------------------------- commit 8dc51a64cf9a0bc1b467353a4161220a7cec0de0 Author: Christine Caulfield Date: Tue Apr 15 16:34:48 2008 +0100 [DLM] Add tcp_nodelay option to DLM comms Under some very odd loads, the TCP nagle algorithm can cause annoying delays in lock traffic. This option allows it to be switched off with echo "1" > /proc/cluster/config/dlm/tcp_nodelay This should NOT be a default, in most cases it will cause a huge performance drop. It is global to all DLM communications and cannot be changed per lockspace. It is included specifically for bz#244708. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Mon Apr 21 18:32:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Mon, 21 Apr 2008 18:32:00 -0000 Subject: Cluster Project tag, cman_1_0_24, created. gfs-kernel_2_6_9_76-46-g5eec9c0 Message-ID: <20080421183230.25468.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb The tag, cman_1_0_24 has been created at 5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb (commit) - Log ----------------------------------------------------------------- commit 5eec9c0832cd1c91d00d2f3e4bd42389a5cbc7bb Author: Lon Hohberger Date: Tue Mar 11 10:43:37 2008 -0400 [CMAN] Fix "Node X is undead" loop bug This was caused by an improper assignment to ps_incarnation after a node decides to evict another node. The fix is to simply make the internal (memory) assignments before calling qd_write_status() ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Mon Apr 21 18:32:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Mon, 21 Apr 2008 18:32:00 -0000 Subject: Cluster Project tag, fence_1_32_53, created. gfs-kernel_2_6_9_76-45-g4f903f2 Message-ID: <20080421183231.25524.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4f903f24b945f53708b0607d186e2fa6b06cd1bf The tag, fence_1_32_53 has been created at 4f903f24b945f53708b0607d186e2fa6b06cd1bf (commit) - Log ----------------------------------------------------------------- commit 4f903f24b945f53708b0607d186e2fa6b06cd1bf Author: jparsons Date: Tue Apr 15 18:47:23 2008 -0400 Bump fenced MAX_DEVICES from 4 to 8 Fix for rhbz#284701 ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Mon Apr 21 18:32:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Mon, 21 Apr 2008 18:32:00 -0000 Subject: Cluster Project tag, rgmanager_1_9_77, created. gfs-kernel_2_6_9_76-44-gc9f85c1 Message-ID: <20080421183231.25646.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=c9f85c1b3cccdd529005d08fb8e4618f752acaab The tag, rgmanager_1_9_77 has been created at c9f85c1b3cccdd529005d08fb8e4618f752acaab (commit) - Log ----------------------------------------------------------------- commit c9f85c1b3cccdd529005d08fb8e4618f752acaab Author: Lon Hohberger Date: Tue Apr 15 15:20:32 2008 -0400 [rgmanager] Set +x on SAPInstance/SAPDatabase ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From cfeist@sourceware.org Mon Apr 21 18:32:00 2008 From: cfeist@sourceware.org (cfeist@sourceware.org) Date: Mon, 21 Apr 2008 18:32:00 -0000 Subject: Cluster Project tag, gfs_6_1_18, created. gfs-kernel_2_6_9_76-31-g5f03c06 Message-ID: <20080421183231.25566.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=5f03c06d964894819c182b5112af75e5ee44a256 The tag, gfs_6_1_18 has been created at 5f03c06d964894819c182b5112af75e5ee44a256 (commit) - Log ----------------------------------------------------------------- commit 5f03c06d964894819c182b5112af75e5ee44a256 Author: Bob Peterson Date: Sun Apr 13 11:23:49 2008 -0500 bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383) ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 21 19:00:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 21 Apr 2008 19:00:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-187-g032432b Message-ID: <20080421185958.10207.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=032432b43f211f8b592f9771c9cbfb74e1996a23 The branch, master has been updated via 032432b43f211f8b592f9771c9cbfb74e1996a23 (commit) from 288ab73e51f51ce174f51dc2fc67c6dd1fe03e85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 032432b43f211f8b592f9771c9cbfb74e1996a23 Author: Andrew Price Date: Mon Apr 21 20:59:02 2008 +0200 [GFS2] gfs2_edit: Remove duplicate linux_endian.h gfs2/edit/linux_endian.h is an exact duplicate of gfs2/include/linux_endian.h and can be removed as gfs2/include/linux_endian.h is picked up instead. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/edit/linux_endian.h | 81 ---------------------------------------------- 1 files changed, 0 insertions(+), 81 deletions(-) delete mode 100644 gfs2/edit/linux_endian.h diff --git a/gfs2/edit/linux_endian.h b/gfs2/edit/linux_endian.h deleted file mode 100644 index 8054673..0000000 --- a/gfs2/edit/linux_endian.h +++ /dev/null @@ -1,81 +0,0 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ - -#ifndef __LINUX_ENDIAN_DOT_H__ -#define __LINUX_ENDIAN_DOT_H__ - - -#include -#include - - -/* I'm not sure which versions of alpha glibc/gcc are broken, - so fix all of them. */ -#ifdef __alpha__ -#undef bswap_64 -static __inline__ unsigned long bswap_64(unsigned long x) -{ - unsigned int h = x >> 32; - unsigned int l = x; - - h = bswap_32(h); - l = bswap_32(l); - - return ((unsigned long)l << 32) | h; -} -#endif /* __alpha__ */ - - -#if __BYTE_ORDER == __BIG_ENDIAN - -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define be64_to_cpu(x) (x) - -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) -#define cpu_to_be64(x) (x) - -#define le16_to_cpu(x) (bswap_16((x))) -#define le32_to_cpu(x) (bswap_32((x))) -#define le64_to_cpu(x) (bswap_64((x))) - -#define cpu_to_le16(x) (bswap_16((x))) -#define cpu_to_le32(x) (bswap_32((x))) -#define cpu_to_le64(x) (bswap_64((x))) - -#endif /* __BYTE_ORDER == __BIG_ENDIAN */ - - -#if __BYTE_ORDER == __LITTLE_ENDIAN - -#define be16_to_cpu(x) (bswap_16((x))) -#define be32_to_cpu(x) (bswap_32((x))) -#define be64_to_cpu(x) (bswap_64((x))) - -#define cpu_to_be16(x) (bswap_16((x))) -#define cpu_to_be32(x) (bswap_32((x))) -#define cpu_to_be64(x) (bswap_64((x))) - -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) - -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_le64(x) (x) - -#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ - - -#endif /* __LINUX_ENDIAN_DOT_H__ */ hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 21 19:04:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 21 Apr 2008 19:04:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-23-g645cfa6 Message-ID: <20080421190405.12098.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=645cfa68bc805836f830d9695229dc8f719518be The branch, STABLE2 has been updated via 645cfa68bc805836f830d9695229dc8f719518be (commit) from b01cdba509d81b3a660ad85302765ee2294fad11 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 645cfa68bc805836f830d9695229dc8f719518be Author: Andrew Price Date: Mon Apr 21 20:59:02 2008 +0200 [GFS2] gfs2_edit: Remove duplicate linux_endian.h gfs2/edit/linux_endian.h is an exact duplicate of gfs2/include/linux_endian.h and can be removed as gfs2/include/linux_endian.h is picked up instead. Signed-off-by: Andrew Price Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gfs2/edit/linux_endian.h | 81 ---------------------------------------------- 1 files changed, 0 insertions(+), 81 deletions(-) delete mode 100644 gfs2/edit/linux_endian.h diff --git a/gfs2/edit/linux_endian.h b/gfs2/edit/linux_endian.h deleted file mode 100644 index 8054673..0000000 --- a/gfs2/edit/linux_endian.h +++ /dev/null @@ -1,81 +0,0 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ - -#ifndef __LINUX_ENDIAN_DOT_H__ -#define __LINUX_ENDIAN_DOT_H__ - - -#include -#include - - -/* I'm not sure which versions of alpha glibc/gcc are broken, - so fix all of them. */ -#ifdef __alpha__ -#undef bswap_64 -static __inline__ unsigned long bswap_64(unsigned long x) -{ - unsigned int h = x >> 32; - unsigned int l = x; - - h = bswap_32(h); - l = bswap_32(l); - - return ((unsigned long)l << 32) | h; -} -#endif /* __alpha__ */ - - -#if __BYTE_ORDER == __BIG_ENDIAN - -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define be64_to_cpu(x) (x) - -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) -#define cpu_to_be64(x) (x) - -#define le16_to_cpu(x) (bswap_16((x))) -#define le32_to_cpu(x) (bswap_32((x))) -#define le64_to_cpu(x) (bswap_64((x))) - -#define cpu_to_le16(x) (bswap_16((x))) -#define cpu_to_le32(x) (bswap_32((x))) -#define cpu_to_le64(x) (bswap_64((x))) - -#endif /* __BYTE_ORDER == __BIG_ENDIAN */ - - -#if __BYTE_ORDER == __LITTLE_ENDIAN - -#define be16_to_cpu(x) (bswap_16((x))) -#define be32_to_cpu(x) (bswap_32((x))) -#define be64_to_cpu(x) (bswap_64((x))) - -#define cpu_to_be16(x) (bswap_16((x))) -#define cpu_to_be32(x) (bswap_32((x))) -#define cpu_to_be64(x) (bswap_64((x))) - -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) - -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_le64(x) (x) - -#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ - - -#endif /* __LINUX_ENDIAN_DOT_H__ */ hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 21 19:14:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 21 Apr 2008 19:14:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.00-24-ge80c1ff Message-ID: <20080421191422.29374.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e80c1ff7cfb63e247a4479c4a20f65d373d99b62 The branch, STABLE2 has been updated via e80c1ff7cfb63e247a4479c4a20f65d373d99b62 (commit) from 645cfa68bc805836f830d9695229dc8f719518be (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e80c1ff7cfb63e247a4479c4a20f65d373d99b62 Author: Fabio M. Di Nitto Date: Wed Apr 9 10:10:28 2008 +0200 [KERNEL] Update modules to build with 2.6.25 Update clean target to cope with a new file that Kbuild creates at build time. Bump minimum kernel requirements to 2.6.25. Port modules to new kobj api. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: configure | 2 +- gfs-kernel/src/gfs/sys.c | 25 +++++++++++-------------- gnbd-kernel/src/gnbd.c | 18 +++++++----------- make/clean.mk | 2 +- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/configure b/configure index 13ed3e6..2501059 100755 --- a/configure +++ b/configure @@ -28,7 +28,7 @@ my $ret = 0; # this should be only the major version without the extra version # eg. only the first 3 digits -my $required_kernelversion = '2.6.24'; +my $required_kernelversion = '2.6.25'; my %options = ( help => \$help, diff --git a/gfs-kernel/src/gfs/sys.c b/gfs-kernel/src/gfs/sys.c index de64a3f..8afbebd 100644 --- a/gfs-kernel/src/gfs/sys.c +++ b/gfs-kernel/src/gfs/sys.c @@ -85,24 +85,20 @@ static struct kobj_type gfs_ktype = { .sysfs_ops = &gfs_attr_ops, }; -static struct kset gfs_kset = { - .ktype = &gfs_ktype, -}; +static struct kset *gfs_kset; int gfs_sys_fs_add(struct gfs_sbd *sdp) { int error; - sdp->sd_kobj.kset = &gfs_kset; - sdp->sd_kobj.ktype = &gfs_ktype; + sdp->sd_kobj.kset = gfs_kset; - error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); + error = kobject_init_and_add(&sdp->sd_kobj, &gfs_ktype, NULL, + "%s", sdp->sd_table_name); if (error) goto fail; - error = kobject_register(&sdp->sd_kobj); - if (error) - goto fail; + kobject_uevent(&sdp->sd_kobj, KOBJ_ADD); return 0; @@ -112,20 +108,21 @@ int gfs_sys_fs_add(struct gfs_sbd *sdp) void gfs_sys_fs_del(struct gfs_sbd *sdp) { - kobject_unregister(&sdp->sd_kobj); + kobject_put(&sdp->sd_kobj); } int gfs_sys_init(void) { gfs_sys_margs = NULL; spin_lock_init(&gfs_sys_margs_lock); - kobject_set_name(&gfs_kset.kobj, "gfs"); - kobj_set_kset_s(&gfs_kset, fs_subsys); - return kset_register(&gfs_kset); + gfs_kset = kset_create_and_add("gfs", NULL, fs_kobj); + if (!gfs_kset) + return -ENOMEM; + return 0; } void gfs_sys_uninit(void) { kfree(gfs_sys_margs); - kset_unregister(&gfs_kset); + kset_unregister(gfs_kset); } diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c index 1be2eee..9a6abe3 100644 --- a/gnbd-kernel/src/gnbd.c +++ b/gnbd-kernel/src/gnbd.c @@ -266,21 +266,19 @@ static const char *gnbdcmd_to_ascii(int cmd) static void gnbd_end_request(struct request *req) { - int uptodate = (req->errors == 0) ? 1 : 0; + int error = req->errors ? -EIO : 0; struct request_queue *q = req->q; unsigned long flags; dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name, - req, uptodate? "done": "failed"); + req, error ? "failed" : "done"); - if (!uptodate) + if (error) printk("%s %d called gnbd_end_request with an error\n", current->comm, current->pid); spin_lock_irqsave(q->queue_lock, flags); - if (!end_that_request_first(req, uptodate, req->nr_sectors)) { - end_that_request_last(req, uptodate); - } + __blk_end_request(req, error, req->nr_sectors << 9); spin_unlock_irqrestore(q->queue_lock, flags); } @@ -879,10 +877,8 @@ static int __init gnbd_init(void) struct timeval tv; int i; - if (sizeof(struct gnbd_request) != 28) { - printk(KERN_CRIT "gnbd: sizeof gnbd_request needs to be 28 in order to work!\n" ); - return -EIO; - } + BUILD_BUG_ON(sizeof(struct gnbd_request) != 28); + shutdown_req.cmd_type = REQ_TYPE_SPECIAL; gnbd_cmd(&shutdown_req) = GNBD_CMD_DISC; shutdown_req.sector = 0; @@ -984,7 +980,7 @@ static int __init gnbd_init(void) set_capacity(disk, 0); add_disk(disk); if(sysfs_create_link(&gnbd_dev[i].class_dev.kobj, - &gnbd_dev[i].disk->kobj, "block")) + &gnbd_dev[i].disk->dev.kobj, "block")) goto out_remove_disk; } diff --git a/make/clean.mk b/make/clean.mk index 68a0980..ac5f603 100644 --- a/make/clean.mk +++ b/make/clean.mk @@ -1,6 +1,6 @@ generalclean: rm -rf *~* *.o *.a *.so *.so.* a.out *.po *.s *.d rm -rf core core.* .depend cscope.* *.orig *.rej - rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d + rm -rf linux .*.o.cmd .*.ko.cmd *.mod.c .tmp_versions Module.symvers .*.o.d modules.order rm -rf ${TARGET} ${TARGETS} ${TARGET}_test rm -rf ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6} hooks/post-receive -- Cluster Project From fabbione@sourceware.org Mon Apr 21 19:25:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Mon, 21 Apr 2008 19:25:00 -0000 Subject: Cluster Project annotated tag, cluster-2.03.01, created. cluster-2.03.01 Message-ID: <20080421192546.2848.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a4391c7b5c974a9bf1ab5be575e230496535d07d The annotated tag, cluster-2.03.01 has been created at a4391c7b5c974a9bf1ab5be575e230496535d07d (tag) tagging e80c1ff7cfb63e247a4479c4a20f65d373d99b62 (commit) replaces cluster-2.03.00 tagged by Fabio M. Di Nitto on Mon Apr 21 21:22:28 2008 +0200 - Log ----------------------------------------------------------------- cluster-2.03.01 release Abhijith Das (3): gfs2_tool: Fix build warnings in misc.c bz 441636 gfs2_tool manpage: Updates to the manpage for bz441636 gfs2_tool: Fix build warnings in misc.c bz 441636 Andrew Price (2): [GFS2] gfs2_fsck: Fix operation on 'ptr' may be undefined warnings [GFS2] gfs2_edit: Remove duplicate linux_endian.h Bob Peterson (4): bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption bz425421: gfs mount attempt hangs if no more journals available bz438762: gfs_tool: Cannot allocate memory bz295301: Need man page for gfs_edit Christine Caulfield (4): [CMAN] Save the new expected_votes when a node is removed [MISC] Make it build with gcc 4.3 [FENCE] Make it build with gcc 4.3 [CMAN] Disallow a new dirty node from joining the cman cluster David Teigland (2): gfs: don't cancel glocks when writing to hidden file gfs_controld: retry recovery for withdrawn journal Fabio M. Di Nitto (6): [GFS2] Fix build warning [BUILD] Fix typo Revert "gfs2_tool: Fix build warnings in misc.c bz 441636" [RGMANAGER] Fix build with gcc4.3 [GFS2] Fix build warning [KERNEL] Update modules to build with 2.6.25 Lon Hohberger (2): [fence] Fix #441737 - fence_node broken due to internal API change Revert "[fence] Fix #441737 - fence_node broken due to internal API change" jparsons (1): Bump MAX_DEVICES in fenced from 4 to 8 ----------------------------------------------------------------------- hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 22 07:43:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 22 Apr 2008 07:43:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-190-gacfe61e Message-ID: <20080422074350.12379.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=acfe61e4b1edc65b69416ac06964a0831b50b50d The branch, master has been updated via acfe61e4b1edc65b69416ac06964a0831b50b50d (commit) via 53f93f18b996c590de34f21a6eb3f14236f1cf69 (commit) via 0beeaf51b376f00d5ec8c9354caa8e79a623b029 (commit) from 032432b43f211f8b592f9771c9cbfb74e1996a23 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit acfe61e4b1edc65b69416ac06964a0831b50b50d Author: Benjamin Marzinski Date: Thu Apr 17 11:41:09 2008 -0500 The gnbd kernel module on 64 bit architectures didn't handle ioctls from 32 bit userspace processes. Now it does. Resolves: bz #440454 Also, I was getting an error because on ppc64, the manual definition of O_DIRECT in gnbd/server/device.c was incorrect. I switched to defining _GNU_SOURCE, which should mean that O_DIRECT will be automatically defined. commit 53f93f18b996c590de34f21a6eb3f14236f1cf69 Author: Lon Hohberger Date: Wed Nov 14 17:17:15 2007 +0000 Remove clushutdown man page references from clusvcadm.8; resolves #324151 commit 0beeaf51b376f00d5ec8c9354caa8e79a623b029 Author: Fabio M. Di Nitto Date: Tue Apr 22 09:36:30 2008 +0200 [rgmanager] Remove obsolete clushutdown utility Merge from RHEL5 branch. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: gnbd-kernel/src/gnbd.c | 33 ++++++++++++++++++++++++ gnbd/server/device.c | 7 +--- rgmanager/man/clushutdown.8 | 13 --------- rgmanager/man/clusvcadm.8 | 13 +++------ rgmanager/src/utils/clushutdown | 53 --------------------------------------- 5 files changed, 39 insertions(+), 80 deletions(-) delete mode 100644 rgmanager/man/clushutdown.8 delete mode 100755 rgmanager/src/utils/clushutdown diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c index 9a6abe3..21ecf9d 100644 --- a/gnbd-kernel/src/gnbd.c +++ b/gnbd-kernel/src/gnbd.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef CONFIG_COMPAT +#include +#endif #include #include @@ -795,6 +798,33 @@ static int gnbd_ctl_ioctl(struct inode *inode, struct file *file, return -EINVAL; } +#ifdef CONFIG_COMPAT +static long gnbd_ctl_compat_ioctl(struct file *f, unsigned cmd, + unsigned long arg) +{ + int ret; + switch (cmd) { + case GNBD_DISCONNECT: + case GNBD_CLEAR_QUE: + case GNBD_PING: + case GNBD_PRINT_DEBUG: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, arg); + unlock_kernel(); + return ret; + case GNBD_DO_IT: + case GNBD_GET_TIME: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, + (unsigned long)compat_ptr(arg)); + unlock_kernel(); + return ret; + default: + return -ENOIOCTLCMD; + } +} +#endif + static int gnbd_open(struct inode *inode, struct file *file) { struct gnbd_device *dev = inode->i_bdev->bd_disk->private_data; @@ -830,6 +860,9 @@ static int gnbd_release(struct inode *inode, struct file *file) static struct file_operations _gnbd_ctl_fops = { .ioctl = gnbd_ctl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = gnbd_ctl_compat_ioctl, +#endif .owner = THIS_MODULE, }; diff --git a/gnbd/server/device.c b/gnbd/server/device.c index 2c830ae..b547897 100644 --- a/gnbd/server/device.c +++ b/gnbd/server/device.c @@ -10,6 +10,7 @@ ******************************************************************************* ******************************************************************************/ +#define _GNU_SOURCE #include #include #include @@ -27,10 +28,6 @@ #define BLKGETSIZE64 _IOR(0x12, 114, uint64_t) #endif -#ifndef O_DIRECT -#define O_DIRECT 040000 -#endif - #include "list.h" #include "gnbd_utils.h" #include "local_req.h" @@ -106,7 +103,7 @@ int open_file(char *path, unsigned int flags, int *devfd) if (fd < 0){ err = -errno; log_err("cannot open %s in %s%s mode : %s\n", path, - (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | OSYNC", + (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | O_SYNC", (flags & GNBD_FLAGS_UNCACHED)? " | O_DIRECT" : "", strerror(errno)); return err; diff --git a/rgmanager/man/clushutdown.8 b/rgmanager/man/clushutdown.8 deleted file mode 100644 index c63159f..0000000 --- a/rgmanager/man/clushutdown.8 +++ /dev/null @@ -1,13 +0,0 @@ -.TH "clushutdown" "27" "Jan 2005" "" "Red Hat Cluster Suite" -.SH "NAME" -clushutdown \- Cluster Mass Service Shutdown -.SH "DESCRIPTION" -.PP -.B Clushutdown -is responsible for stopping all services and ensuring that none are restarted -when a member goes off line. It is only useful for situations where an -administrator needs to take enough cluster members offline such that the -cluster quorum will be disrupted. This is not required for shutting down a -single member when all other members are online. -.SH "SEE ALSO" -clusvcadm(8) diff --git a/rgmanager/man/clusvcadm.8 b/rgmanager/man/clusvcadm.8 index dcc5691..20ae823 100644 --- a/rgmanager/man/clusvcadm.8 +++ b/rgmanager/man/clusvcadm.8 @@ -49,12 +49,8 @@ service Lock the local resource group manager. This should only be used if the administrator intends to perform a global, cluster-wide shutdown. This prevents starting resource groups on the local node, allowing -services will not fail over during the shutdown of the cluster. Generally, -administrators should use the -.B -clushutdown(8) -command to accomplish this. Once the cluster quorum is dissolved, this -state is reset. +services will not fail over during the shutdown of the cluster. +Once the cluster quorum is dissolved, this state is reset. .IP "\-m " When used in conjunction with either the .B @@ -88,11 +84,10 @@ service until a member transition or until it is enabled again. .IP \-u Unlock the cluster's service managers. This allows services to transition -again. It will be necessary to re-enable all services in the stopped state -if this is run after \fB clushutdown(8)\fR. +again. .IP \-v Display version information and exit. .SH "SEE ALSO" -clustat(8), clushutdown(8) +clustat(8) diff --git a/rgmanager/src/utils/clushutdown b/rgmanager/src/utils/clushutdown deleted file mode 100755 index ef3eb72..0000000 --- a/rgmanager/src/utils/clushutdown +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# Stop all services and prepare the cluster for a TCO. -# -. /etc/init.d/functions - -action $"Ensuring this member is in the Quorum:" clustat -Q -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo "WARNING: About to stop ALL services managed by Red Hat Cluster Manager." -echo " This should only be done when maintainence is required on " -echo " enough members to dissolve the Cluster Quorum. This utility" -echo " generally does not need to be run when one cluster member" -echo " requires maintenance. This NEVER needs to be run in two" -echo " member clusters." -echo -echo -n "Continue [yes/NO]? " -read a -if [ "$a" != "YES" -a "$a" != "yes" ]; then - echo - echo Aborted. - exit 0 -fi - -action $"Preparing for global service shutdown:" clusvcadm -u -if [ $? -ne 0 ]; then - exit 1; -fi - -errors=0 -for s in `cludb -m services%service[0-9]+%name | cut -f2 -d=`; do - action "Stopping service $s: " clusvcadm -q -s $s - if [ $? -ne 0 ]; then - exit 1 - fi -done - -echo "All clustered services are stopped." - -action $"Locking service managers:" clusvcadm -l -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo $"It is now safe to shut down all cluster members. Be advised that" -echo $"members not controlled by power switches may still reboot when " -echo $"when the cluster quorum is disbanded." -echo -exit 0 hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 22 07:45:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 22 Apr 2008 07:45:00 -0000 Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.01-4-gf3b6ea9 Message-ID: <20080422074553.13126.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f3b6ea990e81e9234903a7fb65565f7dd3d3d43f The branch, STABLE2 has been updated via f3b6ea990e81e9234903a7fb65565f7dd3d3d43f (commit) via 0fdda26db52d31e20d0524168859dfbffce4ffa0 (commit) via 89c885f73b4d90c2be407125d62379fb32a11e3e (commit) via a286ab41b67c9b6cd22fb88d862375e09259639e (commit) from e80c1ff7cfb63e247a4479c4a20f65d373d99b62 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f3b6ea990e81e9234903a7fb65565f7dd3d3d43f Author: Lon Hohberger Date: Fri Apr 18 14:19:07 2008 -0400 [fence] Close file descriptors that are in invalid/error states If poll was returning with a file descriptor noted as active, but with the POLLERR/POLLNVAL flags set (but not POLLIN or POLLHUP), fenced and groupd would enter a tight spin loop. This fixes that condition. commit 0fdda26db52d31e20d0524168859dfbffce4ffa0 Author: Benjamin Marzinski Date: Thu Apr 17 11:41:09 2008 -0500 The gnbd kernel module on 64 bit architectures didn't handle ioctls from 32 bit userspace processes. Now it does. Resolves: bz #440454 Also, I was getting an error because on ppc64, the manual definition of O_DIRECT in gnbd/server/device.c was incorrect. I switched to defining _GNU_SOURCE, which should mean that O_DIRECT will be automatically defined. commit 89c885f73b4d90c2be407125d62379fb32a11e3e Author: Lon Hohberger Date: Wed Nov 14 17:17:15 2007 +0000 Remove clushutdown man page references from clusvcadm.8; resolves #324151 commit a286ab41b67c9b6cd22fb88d862375e09259639e Author: Fabio M. Di Nitto Date: Tue Apr 22 09:36:30 2008 +0200 [rgmanager] Remove obsolete clushutdown utility Merge from RHEL5 branch. Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: fence/fenced/main.c | 2 +- gnbd-kernel/src/gnbd.c | 33 ++++++++++++++++++++++++ gnbd/server/device.c | 7 +--- group/daemon/main.c | 2 +- rgmanager/man/clushutdown.8 | 13 --------- rgmanager/man/clusvcadm.8 | 13 +++------ rgmanager/src/utils/clushutdown | 53 --------------------------------------- 7 files changed, 41 insertions(+), 82 deletions(-) delete mode 100644 rgmanager/man/clushutdown.8 delete mode 100755 rgmanager/src/utils/clushutdown diff --git a/fence/fenced/main.c b/fence/fenced/main.c index 8f7960c..e9ebfb8 100644 --- a/fence/fenced/main.c +++ b/fence/fenced/main.c @@ -494,7 +494,7 @@ static int loop(void) for (i = 1; i <= maxi; i++) { if (client[i].fd < 0) continue; - if (pollfd[i].revents & POLLHUP) { + if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) { if (pollfd[i].fd == member_fd) { log_error("cluster is down, exiting"); exit(1); diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c index 9a6abe3..21ecf9d 100644 --- a/gnbd-kernel/src/gnbd.c +++ b/gnbd-kernel/src/gnbd.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef CONFIG_COMPAT +#include +#endif #include #include @@ -795,6 +798,33 @@ static int gnbd_ctl_ioctl(struct inode *inode, struct file *file, return -EINVAL; } +#ifdef CONFIG_COMPAT +static long gnbd_ctl_compat_ioctl(struct file *f, unsigned cmd, + unsigned long arg) +{ + int ret; + switch (cmd) { + case GNBD_DISCONNECT: + case GNBD_CLEAR_QUE: + case GNBD_PING: + case GNBD_PRINT_DEBUG: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, arg); + unlock_kernel(); + return ret; + case GNBD_DO_IT: + case GNBD_GET_TIME: + lock_kernel(); + ret = gnbd_ctl_ioctl(f->f_dentry->d_inode, f, cmd, + (unsigned long)compat_ptr(arg)); + unlock_kernel(); + return ret; + default: + return -ENOIOCTLCMD; + } +} +#endif + static int gnbd_open(struct inode *inode, struct file *file) { struct gnbd_device *dev = inode->i_bdev->bd_disk->private_data; @@ -830,6 +860,9 @@ static int gnbd_release(struct inode *inode, struct file *file) static struct file_operations _gnbd_ctl_fops = { .ioctl = gnbd_ctl_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = gnbd_ctl_compat_ioctl, +#endif .owner = THIS_MODULE, }; diff --git a/gnbd/server/device.c b/gnbd/server/device.c index 2c830ae..b547897 100644 --- a/gnbd/server/device.c +++ b/gnbd/server/device.c @@ -10,6 +10,7 @@ ******************************************************************************* ******************************************************************************/ +#define _GNU_SOURCE #include #include #include @@ -27,10 +28,6 @@ #define BLKGETSIZE64 _IOR(0x12, 114, uint64_t) #endif -#ifndef O_DIRECT -#define O_DIRECT 040000 -#endif - #include "list.h" #include "gnbd_utils.h" #include "local_req.h" @@ -106,7 +103,7 @@ int open_file(char *path, unsigned int flags, int *devfd) if (fd < 0){ err = -errno; log_err("cannot open %s in %s%s mode : %s\n", path, - (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | OSYNC", + (flags & GNBD_FLAGS_READONLY)? "O_RDONLY" : "O_RDWR | O_SYNC", (flags & GNBD_FLAGS_UNCACHED)? " | O_DIRECT" : "", strerror(errno)); return err; diff --git a/group/daemon/main.c b/group/daemon/main.c index 3274b79..af7d5bd 100644 --- a/group/daemon/main.c +++ b/group/daemon/main.c @@ -764,7 +764,7 @@ static int loop(void) for (i = 0; i <= client_maxi; i++) { if (client[i].fd < 0) continue; - if (pollfd[i].revents & POLLHUP) { + if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) { deadfn = client[i].deadfn; deadfn(i); } else if (pollfd[i].revents & POLLIN) { diff --git a/rgmanager/man/clushutdown.8 b/rgmanager/man/clushutdown.8 deleted file mode 100644 index c63159f..0000000 --- a/rgmanager/man/clushutdown.8 +++ /dev/null @@ -1,13 +0,0 @@ -.TH "clushutdown" "27" "Jan 2005" "" "Red Hat Cluster Suite" -.SH "NAME" -clushutdown \- Cluster Mass Service Shutdown -.SH "DESCRIPTION" -.PP -.B Clushutdown -is responsible for stopping all services and ensuring that none are restarted -when a member goes off line. It is only useful for situations where an -administrator needs to take enough cluster members offline such that the -cluster quorum will be disrupted. This is not required for shutting down a -single member when all other members are online. -.SH "SEE ALSO" -clusvcadm(8) diff --git a/rgmanager/man/clusvcadm.8 b/rgmanager/man/clusvcadm.8 index dcc5691..20ae823 100644 --- a/rgmanager/man/clusvcadm.8 +++ b/rgmanager/man/clusvcadm.8 @@ -49,12 +49,8 @@ service Lock the local resource group manager. This should only be used if the administrator intends to perform a global, cluster-wide shutdown. This prevents starting resource groups on the local node, allowing -services will not fail over during the shutdown of the cluster. Generally, -administrators should use the -.B -clushutdown(8) -command to accomplish this. Once the cluster quorum is dissolved, this -state is reset. +services will not fail over during the shutdown of the cluster. +Once the cluster quorum is dissolved, this state is reset. .IP "\-m " When used in conjunction with either the .B @@ -88,11 +84,10 @@ service until a member transition or until it is enabled again. .IP \-u Unlock the cluster's service managers. This allows services to transition -again. It will be necessary to re-enable all services in the stopped state -if this is run after \fB clushutdown(8)\fR. +again. .IP \-v Display version information and exit. .SH "SEE ALSO" -clustat(8), clushutdown(8) +clustat(8) diff --git a/rgmanager/src/utils/clushutdown b/rgmanager/src/utils/clushutdown deleted file mode 100755 index ef3eb72..0000000 --- a/rgmanager/src/utils/clushutdown +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# Stop all services and prepare the cluster for a TCO. -# -. /etc/init.d/functions - -action $"Ensuring this member is in the Quorum:" clustat -Q -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo "WARNING: About to stop ALL services managed by Red Hat Cluster Manager." -echo " This should only be done when maintainence is required on " -echo " enough members to dissolve the Cluster Quorum. This utility" -echo " generally does not need to be run when one cluster member" -echo " requires maintenance. This NEVER needs to be run in two" -echo " member clusters." -echo -echo -n "Continue [yes/NO]? " -read a -if [ "$a" != "YES" -a "$a" != "yes" ]; then - echo - echo Aborted. - exit 0 -fi - -action $"Preparing for global service shutdown:" clusvcadm -u -if [ $? -ne 0 ]; then - exit 1; -fi - -errors=0 -for s in `cludb -m services%service[0-9]+%name | cut -f2 -d=`; do - action "Stopping service $s: " clusvcadm -q -s $s - if [ $? -ne 0 ]; then - exit 1 - fi -done - -echo "All clustered services are stopped." - -action $"Locking service managers:" clusvcadm -l -if [ $? -ne 0 ]; then - exit 1 -fi - -echo -echo $"It is now safe to shut down all cluster members. Be advised that" -echo $"members not controlled by power switches may still reboot when " -echo $"when the cluster quorum is disbanded." -echo -exit 0 hooks/post-receive -- Cluster Project From fabbione@sourceware.org Tue Apr 22 15:28:00 2008 From: fabbione@sourceware.org (fabbione@sourceware.org) Date: Tue, 22 Apr 2008 15:28:00 -0000 Subject: Cluster Project branch, master, updated. gfs-kernel_0_1_22-192-g73c8dfb Message-ID: <20080422152832.29388.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=73c8dfbd5a5b1440ba31de983a95dd5c900747c6 The branch, master has been updated via 73c8dfbd5a5b1440ba31de983a95dd5c900747c6 (commit) via 0dcc8ce541c2fe776fb91c30635a90b737f7d30f (commit) from acfe61e4b1edc65b69416ac06964a0831b50b50d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 73c8dfbd5a5b1440ba31de983a95dd5c900747c6 Author: Fabio M. Di Nitto Date: Tue Apr 22 12:23:05 2008 +0200 [CCS] Convert to logsys Signed-off-by: Fabio M. Di Nitto commit 0dcc8ce541c2fe776fb91c30635a90b737f7d30f Author: Fabio M. Di Nitto Date: Tue Apr 22 12:12:38 2008 +0200 [CCS] libraries should never log Signed-off-by: Fabio M. Di Nitto ----------------------------------------------------------------------- Summary of changes: ccs/common/log.c | 23 --- ccs/common/log.h | 98 ------------- ccs/daemon/Makefile | 3 +- ccs/daemon/ccsd.c | 179 +++++++++++++----------- ccs/daemon/cluster_mgr.c | 114 ++++++++-------- ccs/daemon/cnx_mgr.c | 338 +++++++++++++++++++++++----------------------- ccs/daemon/misc.c | 30 +++-- ccs/include/debug.h | 11 +- ccs/lib/Makefile | 11 +- ccs/lib/libccs.c | 53 +------- 10 files changed, 351 insertions(+), 509 deletions(-) delete mode 100644 ccs/common/log.c delete mode 100644 ccs/common/log.h diff --git a/ccs/common/log.c b/ccs/common/log.c deleted file mode 100644 index a9c70f1..0000000 --- a/ccs/common/log.c +++ /dev/null @@ -1,23 +0,0 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ -#include - -int log_is_open = 0; - -void log_open(const char *ident, int option, int facility){ - openlog(ident, option, facility); - log_is_open = 1; -} - -void log_close(void){ - log_is_open = 0; -} diff --git a/ccs/common/log.h b/ccs/common/log.h deleted file mode 100644 index 29bb69d..0000000 --- a/ccs/common/log.h +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** -******************************************************************************* -** -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. -** -** This copyrighted material is made available to anyone wishing to use, -** modify, copy, or redistribute it subject to the terms and conditions -** of the GNU General Public License v.2. -** -******************************************************************************* -******************************************************************************/ -#ifndef __LOG_H__ -#define __LOG_H__ - -#include - -extern int log_is_open; - -void log_open(const char *ident, int option, int facility); -void log_close(void); - -/* Note, messages will always be sent to syslog, but userland programs ** -** will have to close stdout, stderr if they don't want messages ** -** printed to the controling terminal (as all good daemon's should). */ - -#ifdef DEBUG -#define log_dbg(fmt, args...) { \ - if(log_is_open){ \ - syslog(LOG_DEBUG, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \ - }else { \ - fprintf(stdout, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \ - } \ -} -#else -#define log_dbg(fmt, args...) -#endif - -#define log_msg(fmt, args...) {\ - if(log_is_open){ \ - syslog(LOG_NOTICE, fmt, ## args); \ - }else { \ - fprintf(stdout, fmt , ## args ); \ - } \ -} - -#ifdef DEBUG -#define log_err(fmt, args...){ \ - if(log_is_open){ \ - syslog(LOG_ERR, "[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); \ - }else { \ - fprintf(stderr, "[%s:%d] ", __FILE__ , __LINE__); \ - fprintf(stderr, fmt, ## args ); \ - } \ -} -#else -#define log_err(fmt, args...){ \ - if(log_is_open){ \ - syslog(LOG_ERR, fmt, ## args ); \ - }else { \ - fprintf(stderr, fmt, ## args ); \ - } \ -} -#endif - - -#ifdef DEBUG -#define log_sys_err(fmt, args...){ \ - if(log_is_open){ \ - syslog(LOG_ERR, "[%s:%d] " fmt ": %m\n" , __FILE__ , __LINE__ , ## args ); \ - }else { \ - fprintf(stderr, "[%s:%d] ", __FILE__ , __LINE__); \ - fprintf(stderr, fmt ": " , ## args ); \ - perror(NULL); \ - } \ -} -#else -#define log_sys_err(fmt, args...){ \ - if(log_is_open){ \ - syslog(LOG_ERR, fmt ": %m\n" , ## args ); \ - }else { \ - fprintf(stderr, fmt ": " , ## args ); \ - perror(NULL); \ - } \ -} -#endif - -#define die(ext, fmt, args...) { \ - if(log_is_open){ \ - syslog(LOG_ERR, "In %s, at %d (%s) death by:\n" fmt , __FILE__ , \ - __LINE__ , RELEASE_VERSION , ## args ); exit(ext); \ - }else { \ - fprintf(stderr, "In %s, at %d (%s) death by:\n" fmt , __FILE__ , \ - __LINE__ , RELEASE_VERSION , ## args ); exit(ext); \ - } \ -} - - -#endif /* __LOG_H__ */ diff --git a/ccs/daemon/Makefile b/ccs/daemon/Makefile index c4a862d..e41aec5 100644 --- a/ccs/daemon/Makefile +++ b/ccs/daemon/Makefile @@ -29,11 +29,12 @@ OBJS= ccsd.o \ globals.o CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -CFLAGS += -I${cmanincdir} `xml2-config --cflags` +CFLAGS += -I${cmanincdir} `xml2-config --cflags` -I${openaisincdir} CFLAGS += -I$(S) -I$(S)/../include -I$(S)/../common CFLAGS += -I${incdir} LDFLAGS += -L${cmanlibdir} -lcman -L${ccslibdir} -lccs +LDFLAGS += -L${openaislibdir} -llogsys LDFLAGS += -L${libdir} `xml2-config --libs` -lpthread diff --git a/ccs/daemon/ccsd.c b/ccs/daemon/ccsd.c index d1e04c7..c3ba84f 100644 --- a/ccs/daemon/ccsd.c +++ b/ccs/daemon/ccsd.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************i ** -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -24,8 +24,8 @@ #include #include #include +#include -#include "log.h" #include "debug.h" #include "cnx_mgr.h" #include "cluster_mgr.h" @@ -34,6 +34,7 @@ #include "copyright.cf" +static int debug = 0; extern volatile int quorate; int no_manager_opt=0; static int exit_now=0; @@ -50,6 +51,13 @@ static int join_group(int sfd, int loopback, int port); static int setup_local_socket(int backlog); static inline void process_signals(void); +LOGSYS_DECLARE_SYSTEM (NULL, + LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_BUFFER_BEFORE_CONFIG, + NULL, + LOG_LOCAL4); + +LOGSYS_DECLARE_SUBSYS ("CCS", LOG_LEVEL_INFO); + int main(int argc, char *argv[]){ int i,error=0; int trueint = 1; @@ -63,6 +71,11 @@ int main(int argc, char *argv[]){ msg = parse_cli_args(argc, argv); + logsys_config_mode_set (LOG_MODE_OUTPUT_STDERR | LOG_MODE_OUTPUT_SYSLOG_THREADED | LOG_MODE_DISPLAY_DEBUG | LOG_MODE_FLUSH_AFTER_CONFIG); + + if(debug || getenv("CCS_DEBUGLOG")) + logsys_config_priority_set (LOG_LEVEL_DEBUG); + if(check_cluster_conf()){ /* check_cluster_conf will print out errors if there are any */ exit(EXIT_FAILURE); @@ -78,7 +91,7 @@ int main(int argc, char *argv[]){ if (!no_manager_opt){ if(start_cluster_monitor_thread()){ - log_err("Unable to create thread.\n"); + log_printf(LOG_ERR, "Unable to create thread.\n"); exit(EXIT_FAILURE); } } @@ -88,10 +101,10 @@ int main(int argc, char *argv[]){ /** Setup the socket to communicate with the CCS library **/ if(IPv6 && (sfds[0] = socket(PF_INET6, SOCK_STREAM, 0)) < 0){ if(IPv6 == -1){ - log_dbg("Unable to create IPv6 socket:: %s\n", strerror(errno)); + log_printf(LOG_DEBUG, "Unable to create IPv6 socket:: %s\n", strerror(errno)); IPv6=0; } else { - log_sys_err("Unable to create IPv6 socket"); + log_printf(LOG_ERR, "Unable to create IPv6 socket"); exit(EXIT_FAILURE); } } else { @@ -100,15 +113,15 @@ int main(int argc, char *argv[]){ */ } - log_dbg("Using %s\n", IPv6?"IPv6":"IPv4"); + log_printf(LOG_DEBUG, "Using %s\n", IPv6?"IPv6":"IPv4"); if(!IPv6 && (sfds[0] = socket(PF_INET, SOCK_STREAM, 0)) < 0){ - log_sys_err("Unable to create IPv4 socket"); + log_printf(LOG_ERR, "Unable to create IPv4 socket"); exit(EXIT_FAILURE); } if(setsockopt(sfds[0], SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){ - log_sys_err("Unable to set socket option"); + log_printf(LOG_ERR, "Unable to set socket option"); exit(EXIT_FAILURE); } @@ -126,7 +139,7 @@ int main(int argc, char *argv[]){ } if(bind(sfds[0], (struct sockaddr *)&addr, addr_size) < 0){ - log_sys_err("Unable to bind socket"); + log_printf(LOG_ERR, "Unable to bind socket"); close(sfds[0]); exit(EXIT_FAILURE); } @@ -137,12 +150,12 @@ int main(int argc, char *argv[]){ /** Setup the socket to communicate with the CCS library **/ sfds[1] = socket((IPv6)? PF_INET6: PF_INET, SOCK_DGRAM, 0); if(sfds[1] < 0){ - log_sys_err("Socket creation failed"); + log_printf(LOG_ERR, "Socket creation failed"); exit(EXIT_FAILURE); } else { int trueint = 1; if(setsockopt(sfds[1], SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){ - log_sys_err("Unable to set socket option"); + log_printf(LOG_ERR, "Unable to set socket option"); exit(EXIT_FAILURE); } } @@ -158,14 +171,14 @@ int main(int argc, char *argv[]){ } if(bind(sfds[1], (struct sockaddr *)&addr, addr_size) < 0){ - log_sys_err("Unable to bind socket"); + log_printf(LOG_ERR, "Unable to bind socket"); close(sfds[1]); return -errno; } if(IPv6 || multicast_address){ if(join_group(sfds[1], 1, backend_port)){ - log_err("Unable to join multicast group.\n"); + log_printf(LOG_ERR, "Unable to join multicast group.\n"); exit(EXIT_FAILURE); } } @@ -179,7 +192,7 @@ int main(int argc, char *argv[]){ if (sfds[2] >= 0) FD_SET(sfds[2], &rset); - log_dbg("Sending SIGTERM to parent\n"); + log_printf(LOG_DEBUG, "Sending SIGTERM to parent\n"); kill(getppid(), SIGTERM); while(1){ @@ -191,7 +204,7 @@ int main(int argc, char *argv[]){ if((select(FD_SETSIZE, &tmp_set, NULL,NULL,NULL) < 0)){ if(errno != EINTR){ - log_sys_err("Select failed"); + log_printf(LOG_ERR, "Select failed"); } continue; } @@ -202,44 +215,44 @@ int main(int argc, char *argv[]){ } if(i == 0){ uint16_t port; - log_dbg("NORMAL CCS REQUEST.\n"); + log_printf(LOG_DEBUG, "NORMAL CCS REQUEST.\n"); afd = accept(sfds[i], (struct sockaddr *)&addr, &len); if(afd < 0){ - log_sys_err("Unable to accept connection"); + log_printf(LOG_ERR, "Unable to accept connection"); continue; } port = (IPv6) ? addr6->sin6_port : addr4->sin_port; - log_dbg("Connection requested from port %u.\n", ntohs(port)); + log_printf(LOG_DEBUG, "Connection requested from port %u.\n", ntohs(port)); if(ntohs(port) > 1024){ - log_err("Refusing connection from port > 1024: port = %d", ntohs(port)); + log_printf(LOG_ERR, "Refusing connection from port > 1024: port = %d", ntohs(port)); close(afd); continue; } if((error = process_request(afd))){ - log_err("Error while processing request: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing request: %s\n", strerror(-error)); } close(afd); } else if (i == 2) { - log_dbg("NORMAL CCS REQUEST.\n"); + log_printf(LOG_DEBUG, "NORMAL CCS REQUEST.\n"); afd = accept(sfds[i], NULL, NULL); if(afd < 0){ - log_sys_err("Unable to accept connection"); + log_printf(LOG_ERR, "Unable to accept connection"); continue; } - log_dbg("Connection requested from local socket\n"); + log_printf(LOG_DEBUG, "Connection requested from local socket\n"); if((error = process_request(afd))){ - log_err("Error while processing request: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing request: %s\n", strerror(-error)); } close(afd); } else { - log_dbg("BROADCAST REQUEST.\n"); + log_printf(LOG_DEBUG, "BROADCAST REQUEST.\n"); if((error = process_broadcast(sfds[i]))){ - log_err("Error while processing broadcast: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing broadcast: %s\n", strerror(-error)); } } } @@ -254,7 +267,7 @@ int main(int argc, char *argv[]){ * */ static void print_usage(FILE *stream){ - ENTER("print_usage"); + CCSENTER("print_usage"); fprintf(stream, "Usage:\n" "\n" @@ -273,7 +286,7 @@ static void print_usage(FILE *stream){ " -V Print version information.\n" " -X No cluster manager, just read local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n" ); - EXIT("print_usage"); + CCSEXIT("print_usage"); } @@ -283,7 +296,7 @@ static int is_multicast_addr(char *addr_string){ struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr; struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr; - ENTER("is_multicast_addr"); + CCSENTER("is_multicast_addr"); if(inet_pton(AF_INET6, addr_string, &(addr6->sin6_addr)) > 0){ if(IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr)){ @@ -294,7 +307,7 @@ static int is_multicast_addr(char *addr_string){ rtn = AF_INET; } } - EXIT("is_multicast_addr"); + CCSEXIT("is_multicast_addr"); return rtn; } @@ -317,7 +330,7 @@ static char *parse_cli_args(int argc, char *argv[]){ char buff[buff_size]; int buff_index=0; - ENTER("parse_cli_args"); + CCSENTER("parse_cli_args"); config_file_location = strdup(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE); lockfile_location = strdup(DEFAULT_CCSD_LOCKFILE); @@ -366,11 +379,9 @@ static char *parse_cli_args(int argc, char *argv[]){ "Try '-h' for help.\n"); error = -EINVAL; goto fail; - case 'd': /* might be usable for upgrade */ - fprintf(stderr, "The '-d' option is deprecated.\n" - "Try '-h' for help.\n"); - error = -EINVAL; - goto fail; + case 'd': + debug = 1; + break; case 'f': /* might be usable for upgrade */ free(config_file_location); config_file_location = optarg; @@ -491,7 +502,7 @@ static char *parse_cli_args(int argc, char *argv[]){ } fail: - EXIT("parse_cli_args"); + CCSEXIT("parse_cli_args"); if(error){ exit(EXIT_FAILURE); @@ -516,10 +527,12 @@ static int check_cluster_conf(void){ struct stat stat_buf; xmlDocPtr doc = NULL; + CCSENTER("check_cluster_conf"); + if(!stat(config_file_location, &stat_buf)){ doc = xmlParseFile(config_file_location); if(!doc){ - log_err("\nUnable to parse %s.\n" + log_printf(LOG_ERR, "\nUnable to parse %s.\n" "You should either:\n" " 1. Correct the XML mistakes, or\n" " 2. (Re)move the file and attempt to grab a " @@ -530,7 +543,7 @@ static int check_cluster_conf(void){ } else { /* no cluster.conf file. This is fine, just need to get it from the network */ if(no_manager_opt){ - log_err("\nNo local config file found: %s\n", config_file_location); + log_printf(LOG_ERR, "\nNo local config file found: %s\n", config_file_location); return -1; } } @@ -551,17 +564,17 @@ static int create_lockfile(char *lockfile){ struct flock lock; char buffer[50]; - ENTER("create_lockfile"); + CCSENTER("create_lockfile"); if(!strncmp(lockfile, "/var/run/cluster/", 17)){ if(stat("/var/run/cluster", &stat_buf)){ if(mkdir("/var/run/cluster", S_IRWXU)){ - log_sys_err("Cannot create lockfile directory"); + log_printf(LOG_ERR, "Cannot create lockfile directory"); error = -errno; goto fail; } } else if(!S_ISDIR(stat_buf.st_mode)){ - log_err("/var/run/cluster is not a directory.\n" + log_printf(LOG_ERR, "/var/run/cluster is not a directory.\n" "Cannot create lockfile.\n"); error = -ENOTDIR; goto fail; @@ -570,7 +583,7 @@ static int create_lockfile(char *lockfile){ if((fd = open(lockfile, O_CREAT | O_WRONLY, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0){ - log_sys_err("Cannot create lockfile"); + log_printf(LOG_ERR, "Cannot create lockfile"); error = -errno; goto fail; } @@ -582,7 +595,7 @@ static int create_lockfile(char *lockfile){ if (fcntl(fd, F_SETLK, &lock) < 0) { close(fd); - log_err("The ccsd process is already running.\n"); + log_printf(LOG_ERR, "The ccsd process is already running.\n"); error = -errno; goto fail; } @@ -603,7 +616,7 @@ static int create_lockfile(char *lockfile){ } fail: - EXIT("create_lockfile"); + CCSEXIT("create_lockfile"); /* leave fd open - rely on exit to close it */ if(error){ @@ -620,9 +633,9 @@ static int create_lockfile(char *lockfile){ * */ static void parent_exit_handler(int sig){ - ENTER("parent_exit_handler"); + CCSENTER("parent_exit_handler"); exit_now=1; - EXIT("parent_exit_handler"); + CCSEXIT("parent_exit_handler"); } @@ -640,32 +653,32 @@ static void sig_handler(int sig){ static void process_signal(int sig){ int err; - ENTER("sig_handler"); + CCSENTER("sig_handler"); switch(sig) { case SIGINT: - log_msg("Stopping ccsd, SIGINT received.\n"); + log_printf(LOG_INFO, "Stopping ccsd, SIGINT received.\n"); err = EXIT_SUCCESS; break; case SIGQUIT: - log_msg("Stopping ccsd, SIGQUIT received.\n"); + log_printf(LOG_INFO, "Stopping ccsd, SIGQUIT received.\n"); err = EXIT_SUCCESS; break; case SIGTERM: - log_msg("Stopping ccsd, SIGTERM received.\n"); + log_printf(LOG_INFO, "Stopping ccsd, SIGTERM received.\n"); err = EXIT_SUCCESS; break; case SIGHUP: - log_msg("SIGHUP received.\n"); - log_msg("Use ccs_tool for updates.\n"); + log_printf(LOG_INFO, "SIGHUP received.\n"); + log_printf(LOG_INFO, "Use ccs_tool for updates.\n"); return; break; default: - log_err("Stopping ccsd, unknown signal %d received.\n", sig); + log_printf(LOG_ERR, "Stopping ccsd, unknown signal %d received.\n", sig); err = EXIT_FAILURE; } - EXIT("sig_handler"); + CCSEXIT("sig_handler"); exit(err); } @@ -702,22 +715,22 @@ static void daemonize(void){ int error=0; int pid; - ENTER("daemonize"); + CCSENTER("daemonize"); if(flags & FLAG_NODAEMON){ - log_dbg("Entering non-daemon mode.\n"); + log_printf(LOG_DEBUG, "Entering non-daemon mode.\n"); if((error = create_lockfile(lockfile_location))){ goto fail; } } else { - log_dbg("Entering daemon mode.\n"); + log_printf(LOG_DEBUG, "Entering daemon mode.\n"); signal(SIGTERM, &parent_exit_handler); pid = fork(); if(pid < 0){ - fprintf(stderr, "Unable to fork().\n"); + log_printf(LOG_ERR, "Unable to fork().\n"); error = pid; goto fail; } @@ -725,16 +738,17 @@ static void daemonize(void){ if(pid){ int status; while(!waitpid(pid, &status, WNOHANG) && !exit_now); - if(exit_now) + if(exit_now) { exit(EXIT_SUCCESS); + } switch(WEXITSTATUS(status)){ case EXIT_CLUSTER_FAIL: - fprintf(stderr, "Failed to connect to cluster manager.\n"); + log_printf(LOG_ERR, "Failed to connect to cluster manager.\n"); break; case EXIT_LOCKFILE: - fprintf(stderr, "Failed to create lockfile.\n"); - fprintf(stderr, "Hint: ccsd is already running.\n"); + log_printf(LOG_ERR, "Failed to create lockfile.\n"); + log_printf(LOG_ERR, "Hint: ccsd is already running.\n"); break; } exit(EXIT_FAILURE); @@ -749,14 +763,13 @@ static void daemonize(void){ open("/dev/null", O_WRONLY); /* reopen stdout */ open("/dev/null", O_WRONLY); /* reopen stderr */ - log_open("ccsd", LOG_PID, LOG_DAEMON); - if((error = create_lockfile(lockfile_location))){ exit(EXIT_LOCKFILE); } /* Make the parent stop waiting */ - /* kill(getppid(), SIGTERM); */ + //log_printf(LOG_DEBUG, "Die early\n"); + //kill(getppid(), SIGTERM); } signal(SIGINT, &sig_handler); @@ -768,7 +781,7 @@ static void daemonize(void){ signal_received = 0; fail: - EXIT("daemonize"); + CCSEXIT("daemonize"); if(error){ exit(EXIT_FAILURE); @@ -781,13 +794,15 @@ static void daemonize(void){ * */ static void print_start_msg(char *msg){ + CCSENTER("print_start_msg"); /* We want the start message to print every time */ - log_msg("Starting ccsd %s:\n", RELEASE_VERSION); - log_msg(" Built: "__DATE__" "__TIME__"\n"); - log_msg(" %s\n", REDHAT_COPYRIGHT); + log_printf(LOG_INFO, "Starting ccsd %s:\n", RELEASE_VERSION); + log_printf(LOG_INFO, " Built: "__DATE__" "__TIME__"\n"); + log_printf(LOG_INFO, " %s\n", REDHAT_COPYRIGHT); if(msg){ - log_msg("%s\n", msg); + log_printf(LOG_INFO, "%s\n", msg); } + CCSEXIT("print_start_msg"); } @@ -798,7 +813,7 @@ static int join_group(int sfd, int loopback, int port){ struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr; struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr; - ENTER("join_group"); + CCSENTER("join_group"); if(IPv6){ if(!multicast_address || !strcmp("default", multicast_address)){ @@ -828,13 +843,13 @@ static int join_group(int sfd, int loopback, int port){ if(setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loopback, sizeof(loopback)) < 0){ - log_err("Unable to %s loopback.\n", loopback?"SET":"UNSET"); + log_printf(LOG_ERR, "Unable to %s loopback.\n", loopback?"SET":"UNSET"); error = -errno; goto fail; } if(setsockopt(sfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0){ - log_err("Unable to add to membership.\n"); + log_printf(LOG_ERR, "Unable to add to membership.\n"); error = -errno; goto fail; } @@ -847,22 +862,22 @@ static int join_group(int sfd, int loopback, int port){ if(setsockopt(sfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loopback, sizeof(loopback)) < 0){ - log_err("Unable to %s loopback.\n", loopback?"SET":"UNSET"); + log_printf(LOG_ERR, "Unable to %s loopback.\n", loopback?"SET":"UNSET"); error = -errno; goto fail; } if(setsockopt(sfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0){ - log_err("Unable to add to membership: %s\n", strerror(errno)); + log_printf(LOG_ERR, "Unable to add to membership: %s\n", strerror(errno)); error = -errno; goto fail; } } else { - log_err("Unknown address family.\n"); + log_printf(LOG_ERR, "Unknown address family.\n"); error = -EINVAL; } fail: - EXIT("join_group"); + CCSEXIT("join_group"); return 0; } @@ -872,7 +887,7 @@ int setup_local_socket(int backlog) struct sockaddr_un su; mode_t om; - ENTER("setup_local_socket"); + CCSENTER("setup_local_socket"); if (use_local == 0) goto fail; @@ -895,12 +910,12 @@ int setup_local_socket(int backlog) if (listen(sock, backlog) < 0) goto fail; - log_dbg("Set up local socket on %s\n", su.sun_path); - EXIT("setup_local_socket"); + log_printf(LOG_DEBUG, "Set up local socket on %s\n", su.sun_path); + CCSEXIT("setup_local_socket"); return sock; fail: if (sock >= 0) close(sock); - EXIT("setup_local_socket"); + CCSEXIT("setup_local_socket"); return -1; } diff --git a/ccs/daemon/cluster_mgr.c b/ccs/daemon/cluster_mgr.c index 3ce2957..bbfbee0 100644 --- a/ccs/daemon/cluster_mgr.c +++ b/ccs/daemon/cluster_mgr.c @@ -22,9 +22,9 @@ #include #include #include +#include #include "comm_headers.h" -#include "log.h" #include "debug.h" #include "misc.h" #include "globals.h" @@ -48,6 +48,8 @@ static int select_retry(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *xfds, static ssize_t read_retry(int fd, void *buf, int count, struct timeval *timeout); +LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO); + static int check_update_doc(xmlDocPtr tmp_doc) { int error = 0; @@ -55,32 +57,32 @@ static int check_update_doc(xmlDocPtr tmp_doc) char *str1 = NULL; char *str2 = NULL; - ENTER("check_update_doc"); + CCSENTER("check_update_doc"); if (!(str1 = get_cluster_name(tmp_doc))) { - log_err("Unable to get cluster name from new config file.\n"); + log_printf(LOG_ERR, "Unable to get cluster name from new config file.\n"); error = -EINVAL; goto fail; } if (master_doc && master_doc->od_doc && !(str2 = get_cluster_name(master_doc->od_doc))) { - log_dbg("Unable to get cluster name from current master doc.\n"); + log_printf(LOG_DEBUG, "Unable to get cluster name from current master doc.\n"); } if (str2 && strcmp(str1, str2)) { - log_err("Cluster names for current and update configs do not match.\n"); - log_err(" Current cluster name:: <%s>\n", str2); - log_err(" Proposed update name:: <%s>\n", str1); + log_printf(LOG_ERR, "Cluster names for current and update configs do not match.\n"); + log_printf(LOG_ERR, " Current cluster name:: <%s>\n", str2); + log_printf(LOG_ERR, " Proposed update name:: <%s>\n", str1); error = -EINVAL; goto fail; } if (master_doc && master_doc->od_doc && (get_doc_version(tmp_doc) <= get_doc_version(master_doc->od_doc))) { - log_err("Proposed updated config file does not have greater version number.\n"); - log_err(" Current config_version :: %d\n", get_doc_version(master_doc->od_doc)); - log_err(" Proposed config_version:: %d\n", get_doc_version(tmp_doc)); + log_printf(LOG_ERR, "Proposed updated config file does not have greater version number.\n"); + log_printf(LOG_ERR, " Current config_version :: %d\n", get_doc_version(master_doc->od_doc)); + log_printf(LOG_ERR, " Proposed config_version:: %d\n", get_doc_version(tmp_doc)); error = -EINVAL; } @@ -94,7 +96,7 @@ fail: free(str2); } - EXIT("check_update_doc"); + CCSEXIT("check_update_doc"); return error; } @@ -116,39 +118,39 @@ static int handle_cluster_message(int fd) struct sockaddr client_addr; static uint64_t master_node = 0; - ENTER("handle_cluster_message"); + CCSENTER("handle_cluster_message"); - log_dbg("Cluster message on socket: %d\n", fd); + log_printf(LOG_DEBUG, "Cluster message on socket: %d\n", fd); client_len = sizeof(client_addr); if ((socket = accept(fd, &client_addr, &client_len)) < 0) { - log_sys_err("Failed to accept connection.\n"); + log_printf(LOG_ERR, "Failed to accept connection.\n"); goto fail; } if ((nodeid = member_addr_to_id(members, &client_addr)) < 0) { - log_err("Unable to determine node ID.\n"); + log_printf(LOG_ERR, "Unable to determine node ID.\n"); goto fail; } - log_dbg("Accept socket: %d\n", socket); + log_printf(LOG_DEBUG, "Accept socket: %d\n", socket); error = recv(socket, &ch, sizeof(comm_header_t), MSG_PEEK); if (error < 0) { - log_sys_err("Failed to receive message from %s\n", + log_printf(LOG_ERR, "Failed to receive message from %s\n", member_id_to_name(members, nodeid)); goto fail; } - log_dbg("Message (%d bytes) received from %s\n", + log_printf(LOG_DEBUG, "Message (%d bytes) received from %s\n", error, member_id_to_name(members, nodeid)); swab_header(&ch); if (ch.comm_type != COMM_UPDATE) { - log_err("Unexpected communication type (%d)... ignoring.\n", + log_printf(LOG_ERR, "Unexpected communication type (%d)... ignoring.\n", ch.comm_type); error = -EINVAL; goto fail; @@ -157,12 +159,12 @@ static int handle_cluster_message(int fd) if (ch.comm_flags == COMM_UPDATE_NOTICE) { buffer = malloc(ch.comm_payload_size + sizeof(comm_header_t)); if (!buffer) { - log_err("Unable to allocate space to perform update.\n"); + log_printf(LOG_ERR, "Unable to allocate space to perform update.\n"); error = -ENOMEM; goto fail; } - log_dbg("Updated config size:: %d\n", ch.comm_payload_size); + log_printf(LOG_DEBUG, "Updated config size:: %d\n", ch.comm_payload_size); tv.tv_sec = 5; tv.tv_usec = 0; @@ -170,19 +172,19 @@ static int handle_cluster_message(int fd) error = read_retry(socket, buffer, ch.comm_payload_size + sizeof(comm_header_t), &tv); if (error < 0) { - log_sys_err("Unable to retrieve updated config"); + log_printf(LOG_ERR, "Unable to retrieve updated config"); goto fail; } pthread_mutex_lock(&update_lock); unlock = 1; - log_dbg("Got lock 0\n"); + log_printf(LOG_DEBUG, "Got lock 0\n"); tmp_doc = xmlParseMemory(buffer+sizeof(comm_header_t), ch.comm_payload_size); if (!tmp_doc) { - log_err("Unable to parse updated config file.\n"); + log_printf(LOG_ERR, "Unable to parse updated config file.\n"); /* ATTENTION -- need better error code */ error = -EIO; goto fail; @@ -199,28 +201,28 @@ static int handle_cluster_message(int fd) umask(old_mode); if (!fp) { - log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update"); + log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update"); error = -errno; goto fail; } if (xmlDocDump(fp, tmp_doc) < 0) { - log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update"); + log_printf(LOG_ERR, "Unable to write " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update"); goto fail; } - log_dbg("Upload of new config file from %s complete.\n", + log_printf(LOG_DEBUG, "Upload of new config file from %s complete.\n", member_id_to_name(members, nodeid)); ch.comm_payload_size = 0; ch.comm_flags = COMM_UPDATE_NOTICE_ACK; - log_dbg("Sending COMM_UPDATE_NOTICE_ACK.\n"); + log_printf(LOG_DEBUG, "Sending COMM_UPDATE_NOTICE_ACK.\n"); swab_header(&ch); if ((error = write(socket, &ch, sizeof(comm_header_t))) < 0) { - log_sys_err("Unable to send COMM_UPDATE_NOTICE_ACK.\n"); + log_printf(LOG_ERR, "Unable to send COMM_UPDATE_NOTICE_ACK.\n"); goto fail; } @@ -236,8 +238,8 @@ static int handle_cluster_message(int fd) error = read_retry(socket, &ch, sizeof(comm_header_t), &tv); if (master_node != nodeid) { - log_err("COMM_UPDATE_COMMIT received from node other than initiator.\n"); - log_err("Hint: There may be multiple updates happening at once.\n"); + log_printf(LOG_ERR, "COMM_UPDATE_COMMIT received from node other than initiator.\n"); + log_printf(LOG_ERR, "Hint: There may be multiple updates happening at once.\n"); error = -EPERM; goto fail; } @@ -246,12 +248,12 @@ static int handle_cluster_message(int fd) unlock = 1; - log_dbg("Got lock 1\n"); + log_printf(LOG_DEBUG, "Got lock 1\n"); tmp_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update"); if (!tmp_doc) { - log_err("Unable to parse updated config file.\n"); + log_printf(LOG_ERR, "Unable to parse updated config file.\n"); /* ATTENTION -- need better error code */ error = -EIO; goto fail; @@ -268,13 +270,13 @@ static int handle_cluster_message(int fd) umask(old_mode); if (!fp) { - log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE); + log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE); error = -errno; goto fail; } if (xmlDocDump(fp, tmp_doc) < 0) { - log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE); + log_printf(LOG_ERR, "Unable to write " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE); goto fail; } @@ -283,12 +285,12 @@ static int handle_cluster_message(int fd) update_required = 1; ch.comm_flags = COMM_UPDATE_COMMIT_ACK; - log_dbg("Sending COMM_UPDATE_COMMIT_ACK.\n"); + log_printf(LOG_DEBUG, "Sending COMM_UPDATE_COMMIT_ACK.\n"); swab_header(&ch); if ((error = write(socket, &ch, sizeof(comm_header_t))) < 0) { - log_sys_err("Unable to send COMM_UPDATE_NOTICE_ACK.\n"); + log_printf(LOG_ERR, "Unable to send COMM_UPDATE_NOTICE_ACK.\n"); goto fail; } @@ -317,7 +319,7 @@ fail: pthread_mutex_unlock(&update_lock); } - EXIT("handle_cluster_message"); + CCSEXIT("handle_cluster_message"); return error; } @@ -343,7 +345,7 @@ static void cman_callback(cman_handle_t handle, void *private, int reason, int a static int handle_cluster_event(cman_handle_t handle) { - ENTER("handle_cluster_event"); + CCSENTER("handle_cluster_event"); int rv = 1; while (rv > 0) { @@ -353,7 +355,7 @@ static int handle_cluster_event(cman_handle_t handle) return -1; } - EXIT("handle_cluster_event"); + CCSEXIT("handle_cluster_event"); return 0; } @@ -376,14 +378,14 @@ static void cluster_communicator(void) struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr; int addr_size=0; - ENTER("cluster_communicator"); + CCSENTER("cluster_communicator"); memset(&addr, 0, sizeof(struct sockaddr_storage)); if (IPv6) { if ((ccsd_fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) { if(IPv6 == -1) { - log_dbg("Unable to create IPv6 socket:: %s\n", strerror(errno)); + log_printf(LOG_DEBUG, "Unable to create IPv6 socket:: %s\n", strerror(errno)); IPv6=0; } } @@ -391,13 +393,13 @@ static void cluster_communicator(void) if (!IPv6) { if ((ccsd_fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) { - log_err("Unable to create IPv4 socket.\n"); + log_printf(LOG_ERR, "Unable to create IPv4 socket.\n"); exit(EXIT_FAILURE); } } if (setsockopt(ccsd_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) { - log_sys_err("Unable to set socket option"); + log_printf(LOG_ERR, "Unable to set socket option"); exit(EXIT_FAILURE); } @@ -418,13 +420,13 @@ static void cluster_communicator(void) fcntl(ccsd_fd, F_SETFD, flags); if (bind(ccsd_fd, (struct sockaddr *)&addr, addr_size) < 0) { - log_err("Unable to bind to socket.\n"); + log_printf(LOG_ERR, "Unable to bind to socket.\n"); close(ccsd_fd); exit(EXIT_FAILURE); } if (listen(ccsd_fd, 15) < 0) { - log_err("Unable to listen to socket.\n"); + log_printf(LOG_ERR, "Unable to listen to socket.\n"); close(ccsd_fd); exit(EXIT_FAILURE); } @@ -441,7 +443,7 @@ restart: if (!(warn_user % 30)) { - log_err("Unable to connect to cluster infrastructure after %d seconds.\n", + log_printf(LOG_ERR, "Unable to connect to cluster infrastructure after %d seconds.\n", warn_user); } @@ -458,7 +460,7 @@ restart: quorate = cman_is_quorate(handle); - log_msg("Initial status:: %s\n", (quorate)? "Quorate" : "Inquorate"); + log_printf(LOG_INFO, "Initial status:: %s\n", (quorate)? "Quorate" : "Inquorate"); members = get_member_list(handle); @@ -472,18 +474,18 @@ restart: max_fd = (ccsd_fd > cman_fd) ? ccsd_fd : cman_fd; - log_dbg("Waiting for cluster event.\n"); + log_printf(LOG_DEBUG, "Waiting for cluster event.\n"); if ((n = select((max_fd + 1), &rset, NULL, NULL, NULL)) < 0) { - log_sys_err("Select failed"); + log_printf(LOG_ERR, "Select failed"); continue; } - log_dbg("There are %d cluster messages waiting.\n", n); + log_printf(LOG_DEBUG, "There are %d cluster messages waiting.\n", n); while (n) { - log_dbg("There are %d messages remaining.\n", n); + log_printf(LOG_DEBUG, "There are %d messages remaining.\n", n); n--; @@ -501,7 +503,7 @@ restart: } } - EXIT("cluster_communicator"); + CCSEXIT("cluster_communicator"); } @@ -509,14 +511,14 @@ int start_cluster_monitor_thread(void) { int error = 0; pthread_t thread; - ENTER("start_cluster_monitor_thread"); + CCSENTER("start_cluster_monitor_thread"); pthread_mutex_init(&update_lock, NULL); error = pthread_create(&thread, NULL, (void *)cluster_communicator, NULL); if (error) { - log_err("Failed to create thread: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Failed to create thread: %s\n", strerror(-error)); goto fail; } @@ -524,7 +526,7 @@ int start_cluster_monitor_thread(void) { fail: - EXIT("start_cluster_monitor_thread"); + CCSEXIT("start_cluster_monitor_thread"); return error; } diff --git a/ccs/daemon/cnx_mgr.c b/ccs/daemon/cnx_mgr.c index a2011af..8cdc579 100644 --- a/ccs/daemon/cnx_mgr.c +++ b/ccs/daemon/cnx_mgr.c @@ -28,8 +28,8 @@ #include #include #include +#include -#include "log.h" #include "comm_headers.h" #include "debug.h" #include "misc.h" @@ -65,6 +65,8 @@ typedef struct open_connection_s { time_t oc_expire; } open_connection_t; +LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO); + /* ATTENTION: need to lock on this if we start forking the daemon ** ** Also would need to create a shared memory area for open cnx's */ static open_connection_t **ocs = NULL; @@ -76,23 +78,23 @@ static int _update_config(char *location){ open_doc_t *tmp_odoc = NULL; xmlDocPtr tmp_doc = NULL; - ENTER("_update_config"); + CCSENTER("_update_config"); tmp_doc = xmlParseFile(location); if(!tmp_doc){ - log_err("Unable to parse %s\n", location); + log_printf(LOG_ERR, "Unable to parse %s\n", location); error = -EINVAL; goto fail; } else if((v2 = get_doc_version(tmp_doc)) < 0){ - log_err("Unable to get config_version from %s.\n", location); + log_printf(LOG_ERR, "Unable to get config_version from %s.\n", location); error = v2; goto fail; } else if(master_doc && master_doc->od_doc){ v1 = get_doc_version(master_doc->od_doc); if(v1 >= v2){ - log_err("%s on-disk version is <= to in-memory version.\n", location); - log_err(" On-disk version : %d\n", v2); - log_err(" In-memory version : %d\n", v1); + log_printf(LOG_ERR, "%s on-disk version is <= to in-memory version.\n", location); + log_printf(LOG_ERR, " On-disk version : %d\n", v2); + log_printf(LOG_ERR, " In-memory version : %d\n", v1); error = -EPERM; goto fail; } @@ -108,10 +110,10 @@ static int _update_config(char *location){ tmp_odoc->od_doc = tmp_doc; - log_dbg("There are %d references open on version %d of the config file.\n", + log_printf(LOG_DEBUG, "There are %d references open on version %d of the config file.\n", (master_doc)?master_doc->od_refs:0, v1); if(master_doc && !master_doc->od_refs){ - log_dbg("Freeing version %d\n", v1); + log_printf(LOG_DEBUG, "Freeing version %d\n", v1); xmlFreeDoc(master_doc->od_doc); free(master_doc); master_doc = tmp_odoc; @@ -119,7 +121,7 @@ static int _update_config(char *location){ master_doc = tmp_odoc; } - log_msg("Update of "DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " complete (version %d -> %d).\n", v1, v2); + log_printf(LOG_INFO, "Update of "DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " complete (version %d -> %d).\n", v1, v2); fail: if(tmp_odoc != master_doc){ free(tmp_odoc); @@ -129,14 +131,14 @@ static int _update_config(char *location){ } - EXIT("_update_config"); + CCSEXIT("_update_config"); return error; } static int update_config(void){ int error = 0; - ENTER("update_config"); + CCSENTER("update_config"); /* If update_required is set, it means that there is still a pending ** ** update. We need to pull this one in before doing anything else. */ @@ -144,13 +146,13 @@ static int update_config(void){ error = _update_config(DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE); update_required = 0; if(error){ - log_err("Previous update could not be completed.\n"); + log_printf(LOG_ERR, "Previous update could not be completed.\n"); goto fail; } } fail: - EXIT("update_config"); + CCSEXIT("update_config"); return error; } @@ -179,17 +181,17 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ struct timeval tv; xmlDocPtr tmp_doc = NULL; - ENTER("broadcast_for_doc"); + CCSENTER("broadcast_for_doc"); try_again: if(!master_doc){ - log_err("No master_doc!!!\n"); + log_printf(LOG_ERR, "No master_doc!!!\n"); exit(EXIT_FAILURE); } if(quorate && !cluster_name){ - log_err("Node is part of quorate cluster, but the cluster name is unknown.\n"); - log_err(" Unable to validate remote config files. Refusing connection.\n"); + log_printf(LOG_ERR, "Node is part of quorate cluster, but the cluster name is unknown.\n"); + log_printf(LOG_ERR, " Unable to validate remote config files. Refusing connection.\n"); error = -ECONNREFUSED; goto fail; } @@ -202,13 +204,13 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ memset(ch, 0, sizeof(comm_header_t)); if(IPv6 && (sfd = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) <0){ - log_sys_err("Unable to create IPv6 socket"); + log_printf(LOG_ERR, "Unable to create IPv6 socket"); error = -errno; goto fail; } if(!IPv6 && ((sfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)){ - log_sys_err("Unable to create socket for broadcast"); + log_printf(LOG_ERR, "Unable to create socket for broadcast"); error = -errno; goto fail; } @@ -223,16 +225,16 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ addr6->sin6_port = htons(backend_port); if(!multicast_address || !strcmp(multicast_address, "default")){ - log_dbg("Trying IPv6 multicast (default).\n"); + log_printf(LOG_DEBUG, "Trying IPv6 multicast (default).\n"); if(inet_pton(AF_INET6, "ff02::3:1", &(addr6->sin6_addr)) <= 0){ - log_sys_err("Unable to convert multicast address"); + log_printf(LOG_ERR, "Unable to convert multicast address"); error = -errno; goto fail; } } else { - log_dbg("Trying IPv6 multicast (%s).\n", multicast_address); + log_printf(LOG_DEBUG, "Trying IPv6 multicast (%s).\n", multicast_address); if(inet_pton(AF_INET6, multicast_address, &(addr6->sin6_addr)) <= 0){ - log_sys_err("Unable to convert multicast address"); + log_printf(LOG_ERR, "Unable to convert multicast address"); error = -errno; goto fail; } @@ -244,7 +246,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ if(setsockopt(sfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &opt, sizeof(opt)) < 0){ - log_err("Unable to %s loopback.\n", opt?"SET":"UNSET"); + log_printf(LOG_ERR, "Unable to %s loopback.\n", opt?"SET":"UNSET"); error = -errno; goto fail; } @@ -252,28 +254,28 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ addr4->sin_family = AF_INET; addr4->sin_port = htons(backend_port); if(!multicast_address){ - log_dbg("Trying IPv4 broadcast.\n"); + log_printf(LOG_DEBUG, "Trying IPv4 broadcast.\n"); addr4->sin_addr.s_addr = INADDR_BROADCAST; if((error = setsockopt(sfd, SOL_SOCKET, SO_BROADCAST, &trueint, sizeof(int)))){ - log_sys_err("Unable to set socket options"); + log_printf(LOG_ERR, "Unable to set socket options"); error = -errno; goto fail; } else { - log_dbg(" Broadcast enabled.\n"); + log_printf(LOG_DEBUG, " Broadcast enabled.\n"); } } else { if(!strcmp(multicast_address, "default")){ - log_dbg("Trying IPv4 multicast (default).\n"); + log_printf(LOG_DEBUG, "Trying IPv4 multicast (default).\n"); if(inet_pton(AF_INET, "224.0.2.5", &(addr4->sin_addr)) <= 0){ - log_sys_err("Unable to convert multicast address"); + log_printf(LOG_ERR, "Unable to convert multicast address"); error = -errno; goto fail; } } else { - log_dbg("Trying IPv4 multicast (%s).\n", multicast_address); + log_printf(LOG_DEBUG, "Trying IPv4 multicast (%s).\n", multicast_address); if(inet_pton(AF_INET, multicast_address, &(addr4->sin_addr)) <= 0){ - log_sys_err("Unable to convert multicast address"); + log_printf(LOG_ERR, "Unable to convert multicast address"); error = -errno; goto fail; } @@ -281,7 +283,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ opt = 0; setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_LOOP, &opt, sizeof(opt)); if(setsockopt(sfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0){ - log_sys_err("Unable to set multicast threshold.\n"); + log_printf(LOG_ERR, "Unable to set multicast threshold.\n"); } } } @@ -292,12 +294,12 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ do { ch->comm_type = COMM_BROADCAST; - log_dbg("Sending broadcast.\n"); + log_printf(LOG_DEBUG, "Sending broadcast.\n"); swab_header(ch); if(sendto(sfd, (char *)ch, sizeof(comm_header_t), 0, (struct sockaddr *)&addr, addr_size) < 0){ - log_sys_err("Unable to perform sendto"); + log_printf(LOG_ERR, "Unable to perform sendto"); if(retry > 0){ retry--; close(sfd); @@ -315,16 +317,16 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ tv.tv_sec = 0; tv.tv_usec = 250000 + (random()%500000); - log_dbg("Select waiting %ld usec\n", tv.tv_usec); + log_printf(LOG_DEBUG, "Select waiting %ld usec\n", tv.tv_usec); while((error = select(sfd+1, &rset, NULL,NULL, &tv))){ - log_dbg("Select returns %d\n", error); + log_printf(LOG_DEBUG, "Select returns %d\n", error); if(error < 0){ - log_sys_err("Select failed"); + log_printf(LOG_ERR, "Select failed"); error = -errno; goto fail; } if(error){ - log_dbg("Checking broadcast response.\n"); + log_printf(LOG_DEBUG, "Checking broadcast response.\n"); error = 0; recvfrom(sfd, (char *)ch, sizeof(comm_header_t), MSG_PEEK, (struct sockaddr *)&recv_addr, (socklen_t *)&len); @@ -349,22 +351,22 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ tmp_doc = xmlParseMemory(bdoc+sizeof(comm_header_t), ch->comm_payload_size); if(!tmp_doc){ - log_err("Unable to parse remote configuration.\n"); + log_printf(LOG_ERR, "Unable to parse remote configuration.\n"); free(bdoc); bdoc = NULL; goto reset_timer; } tmp_name = get_cluster_name(tmp_doc); - log_dbg(" Given cluster name = %s\n", cluster_name); - log_dbg(" Remote cluster name= %s\n", tmp_name); + log_printf(LOG_DEBUG, " Given cluster name = %s\n", cluster_name); + log_printf(LOG_DEBUG, " Remote cluster name= %s\n", tmp_name); if(!tmp_name){ - log_err("Unable to find cluster name in remote configuration.\n"); + log_printf(LOG_ERR, "Unable to find cluster name in remote configuration.\n"); free(bdoc); bdoc = NULL; xmlFreeDoc(tmp_doc); tmp_doc = NULL; goto reset_timer; } else if(cluster_name && strcmp(cluster_name, tmp_name)){ - log_dbg("Remote and local configuration have different cluster names.\n"); - log_dbg("Skipping...\n"); + log_printf(LOG_DEBUG, "Remote and local configuration have different cluster names.\n"); + log_printf(LOG_DEBUG, "Skipping...\n"); free(tmp_name); tmp_name = NULL; free(bdoc); bdoc = NULL; xmlFreeDoc(tmp_doc); tmp_doc = NULL; @@ -373,7 +375,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ free(tmp_name); tmp_name = NULL; if(!master_doc->od_doc){ if((v2 = get_doc_version(tmp_doc)) >= 0){ - log_msg("Remote configuration copy (version = %d) found.\n", v2); + log_printf(LOG_INFO, "Remote configuration copy (version = %d) found.\n", v2); master_doc->od_doc = tmp_doc; tmp_doc = NULL; write_to_disk = 1; @@ -382,11 +384,11 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ if(((v1 = get_doc_version(master_doc->od_doc)) >= 0) && ((v2 = get_doc_version(tmp_doc)) >= 0)){ if(ch->comm_flags & COMM_BROADCAST_FROM_QUORATE){ - log_msg("Remote configuration copy is from quorate node.\n"); - log_msg(" Local version # : %d\n", v1); - log_msg(" Remote version #: %d\n", v2); + log_printf(LOG_INFO, "Remote configuration copy is from quorate node.\n"); + log_printf(LOG_INFO, " Local version # : %d\n", v1); + log_printf(LOG_INFO, " Remote version #: %d\n", v2); if(v1 != v2){ - log_msg("Switching to remote copy.\n"); + log_printf(LOG_INFO, "Switching to remote copy.\n"); } if(master_doc->od_refs){ open_doc_t *tmp_odoc; @@ -405,9 +407,9 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ write_to_disk = 1; goto out; } else if(v2 > v1){ - log_msg("Remote configuration copy is newer than local copy.\n"); - log_msg(" Local version # : %d\n", v1); - log_msg(" Remote version #: %d\n", v2); + log_printf(LOG_INFO, "Remote configuration copy is newer than local copy.\n"); + log_printf(LOG_INFO, " Local version # : %d\n", v1); + log_printf(LOG_INFO, " Remote version #: %d\n", v2); if(master_doc->od_refs){ open_doc_t *tmp_odoc; if(!(tmp_odoc = malloc(sizeof(open_doc_t)))){ @@ -436,7 +438,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ reset_timer: tv.tv_sec = 0; tv.tv_usec = 250000 + (random()%500000); - log_dbg("Select waiting %ld usec\n", tv.tv_usec); + log_printf(LOG_DEBUG, "Select waiting %ld usec\n", tv.tv_usec); } } while(blocking && !master_doc); out: @@ -454,12 +456,12 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ ** but it has not been written to disk....................................... */ if(stat(DEFAULT_CONFIG_DIR, &stat_buf)){ if(mkdir(DEFAULT_CONFIG_DIR, S_IRWXU | S_IRWXG)){ - log_sys_err("Unable to create directory " DEFAULT_CONFIG_DIR); + log_printf(LOG_ERR, "Unable to create directory " DEFAULT_CONFIG_DIR); error = -errno; goto fail; } } else if(!S_ISDIR(stat_buf.st_mode)){ - log_err(DEFAULT_CONFIG_DIR " is not a directory.\n"); + log_printf(LOG_ERR, DEFAULT_CONFIG_DIR " is not a directory.\n"); error = -ENOTDIR; goto fail; } @@ -468,7 +470,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ f = fopen(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE, "w"); umask(old_mode); if(!f){ - log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE); + log_printf(LOG_ERR, "Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE); error = -errno; goto fail; } @@ -485,7 +487,7 @@ static int broadcast_for_doc(char *cluster_name, int blocking){ if(bdoc) free(bdoc); if(tmp_doc) xmlFreeDoc(tmp_doc); if(sfd >= 0) close(sfd); - EXIT("broadcast_for_doc"); + CCSEXIT("broadcast_for_doc"); return error; } @@ -502,11 +504,11 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ char *tmp_name = NULL; time_t now; - ENTER("process_connect"); + CCSENTER("process_connect"); ch->comm_payload_size = 0; - log_dbg("Given cluster name is = %s\n", cluster_name); + log_printf(LOG_DEBUG, "Given cluster name is = %s\n", cluster_name); if(!ocs){ /* this will never be freed - unless exit */ @@ -519,7 +521,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ } if(!quorate && !(ch->comm_flags & COMM_CONNECT_FORCE)){ - log_msg("Cluster is not quorate. Refusing connection.\n"); + log_printf(LOG_INFO, "Cluster is not quorate. Refusing connection.\n"); error = -ECONNREFUSED; goto fail; } @@ -538,26 +540,26 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ if(!master_doc->od_doc){ master_doc->od_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE); if(!master_doc->od_doc){ - log_msg("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n"); - log_msg("Searching cluster for valid copy.\n"); + log_printf(LOG_INFO, "Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n"); + log_printf(LOG_INFO, "Searching cluster for valid copy.\n"); } else if((error = get_doc_version(master_doc->od_doc)) < 0){ - log_err("Unable to get config_version from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); - log_err("Discarding data and searching for valid copy.\n"); + log_printf(LOG_ERR, "Unable to get config_version from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); + log_printf(LOG_ERR, "Discarding data and searching for valid copy.\n"); xmlFreeDoc(master_doc->od_doc); master_doc->od_doc = NULL; } else if(!(tmp_name = get_cluster_name(master_doc->od_doc))){ - log_err("Unable to get cluster name from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); - log_err("Discarding data and searching for valid copy.\n"); + log_printf(LOG_ERR, "Unable to get cluster name from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); + log_printf(LOG_ERR, "Discarding data and searching for valid copy.\n"); xmlFreeDoc(master_doc->od_doc); master_doc->od_doc = NULL; } else if(cluster_name && strcmp(cluster_name, tmp_name)){ - log_err("Given cluster name does not match local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); - log_err("Discarding data and searching for matching copy.\n"); + log_printf(LOG_ERR, "Given cluster name does not match local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); + log_printf(LOG_ERR, "Discarding data and searching for matching copy.\n"); xmlFreeDoc(master_doc->od_doc); master_doc->od_doc = NULL; free(tmp_name); tmp_name = NULL; } else { /* Either the names match, or a name wasn't specified. */ - log_msg(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " (cluster name = %s, version = %d) found.\n", + log_printf(LOG_INFO, DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " (cluster name = %s, version = %d) found.\n", tmp_name, error); /* We must check with the others to make sure this is valid. */ } @@ -571,8 +573,8 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ ** for the config of the name specified............................... */ if(cluster_name && strcmp(cluster_name, tmp_name)){ - log_err("Request for configuration with cluster name, %s\n", cluster_name); - log_err(" However, a configuration with cluster name, %s, is already loaded.\n", + log_printf(LOG_ERR, "Request for configuration with cluster name, %s\n", cluster_name); + log_printf(LOG_ERR, " However, a configuration with cluster name, %s, is already loaded.\n", tmp_name); error = -EINVAL; goto fail; @@ -590,32 +592,32 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ } } - log_dbg("Blocking is %s.\n", + log_printf(LOG_DEBUG, "Blocking is %s.\n", (ch->comm_flags & COMM_CONNECT_BLOCKING)? "SET": "UNSET"); - log_dbg("Flags = 0x%x\n", ch->comm_flags); + log_printf(LOG_DEBUG, "Flags = 0x%x\n", ch->comm_flags); /* Need to broadcast regardless (unless quorate) to check version # */ if(bcast_needed){ - log_dbg("Broadcast is neccessary.\n"); + log_printf(LOG_DEBUG, "Broadcast is neccessary.\n"); } if(bcast_needed && (error = broadcast_for_doc(tmp_name, ch->comm_flags & COMM_CONNECT_BLOCKING)) && !master_doc->od_doc){ - log_err("Broadcast for config file failed: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Broadcast for config file failed: %s\n", strerror(-error)); goto fail; } error = 0; if(!master_doc || !master_doc->od_doc){ - log_err("The appropriate config file could not be loaded.\n"); + log_printf(LOG_ERR, "The appropriate config file could not be loaded.\n"); error = -ENODATA; goto fail; } if(update_required){ - log_dbg("Update is required.\n"); + log_printf(LOG_DEBUG, "Update is required.\n"); if((error = update_config())){ - log_err("Failed to update config file, required by cluster.\n"); + log_printf(LOG_ERR, "Failed to update config file, required by cluster.\n"); /* ATTENTION -- remove all open_doc_t's ? */ goto fail; } @@ -627,7 +629,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ if (!ocs[i]) continue; if (now >= ocs[i]->oc_expire) { - log_dbg("Recycling connection descriptor %d: Expired\n", + log_printf(LOG_DEBUG, "Recycling connection descriptor %d: Expired\n", ocs[i]->oc_desc ); _cleanup_descriptor(i); } @@ -670,7 +672,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ if(!ocs[i]->oc_ctx){ ocs[i]->oc_odoc->od_refs--; free(ocs[i]); - log_err("Error: unable to create new XPath context.\n"); + log_printf(LOG_ERR, "Error: unable to create new XPath context.\n"); error = -EIO; /* ATTENTION -- what should this be? */ goto fail; } @@ -690,7 +692,7 @@ static int process_connect(comm_header_t *ch, char *cluster_name){ } else { ch->comm_desc = ocs[i]->oc_desc; } - EXIT("process_connect"); + CCSEXIT("process_connect"); return error; } @@ -711,12 +713,12 @@ _cleanup_descriptor(int desc) } tmp_odoc = ocs[desc]->oc_odoc; if(tmp_odoc->od_refs < 1){ - log_err("Number of references on an open doc should never be < 1.\n"); - log_err("This is a fatal error. Exiting...\n"); + log_printf(LOG_ERR, "Number of references on an open doc should never be < 1.\n"); + log_printf(LOG_ERR, "This is a fatal error. Exiting...\n"); exit(EXIT_FAILURE); } if(tmp_odoc != master_doc && tmp_odoc->od_refs == 1){ - log_dbg("No more references on version %d of config file, freeing...\n", + log_printf(LOG_DEBUG, "No more references on version %d of config file, freeing...\n", get_doc_version(tmp_odoc->od_doc)); xmlFreeDoc(tmp_odoc->od_doc); free(tmp_odoc); @@ -741,20 +743,20 @@ _cleanup_descriptor(int desc) static int process_disconnect(comm_header_t *ch){ int desc = dindex(ch->comm_desc); int error=0; - ENTER("process_disconnect"); + CCSENTER("process_disconnect"); ch->comm_payload_size = 0; if(desc < 0){ - log_err("Invalid descriptor specified (%d).\n", desc); - log_err("Someone may be attempting something evil.\n"); + log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", desc); + log_printf(LOG_ERR, "Someone may be attempting something evil.\n"); error = -EBADR; goto fail; } if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){ /* send failure to requestor ? */ - log_err("Attempt to close an unopened CCS descriptor (%d).\n", + log_printf(LOG_ERR, "Attempt to close an unopened CCS descriptor (%d).\n", ch->comm_desc); error = -EBADR; @@ -769,7 +771,7 @@ static int process_disconnect(comm_header_t *ch){ } else { ch->comm_desc = -1; } - EXIT("process_disconnect"); + CCSEXIT("process_disconnect"); return error; } @@ -793,33 +795,33 @@ static int _process_get(comm_header_t *ch, char **payload){ xmlXPathObjectPtr obj = NULL; char *query = NULL; - ENTER("_process_get"); + CCSENTER("_process_get"); if(!ch->comm_payload_size){ - log_err("process_get: payload size is zero.\n"); + log_printf(LOG_ERR, "process_get: payload size is zero.\n"); error = -EINVAL; goto fail; } if(ch->comm_desc < 0){ - log_err("Invalid descriptor specified (%d).\n", ch->comm_desc); - log_err("Someone may be attempting something evil.\n"); + log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc); + log_printf(LOG_ERR, "Someone may be attempting something evil.\n"); error = -EBADR; goto fail; } if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){ - log_err("process_get: Invalid connection descriptor received.\n"); + log_printf(LOG_ERR, "process_get: Invalid connection descriptor received.\n"); error = -EBADR; goto fail; } if(ocs[desc]->oc_query && !strcmp(*payload,ocs[desc]->oc_query)){ ocs[desc]->oc_index++; - log_dbg("Index = %d\n",ocs[desc]->oc_index); - log_dbg(" Query = %s\n", *payload); + log_printf(LOG_DEBUG, "Index = %d\n",ocs[desc]->oc_index); + log_printf(LOG_DEBUG, " Query = %s\n", *payload); } else { - log_dbg("Index reset (new query).\n"); - log_dbg(" Query = %s\n", *payload); + log_printf(LOG_DEBUG, "Index reset (new query).\n"); + log_printf(LOG_DEBUG, " Query = %s\n", *payload); ocs[desc]->oc_index = 0; if(ocs[desc]->oc_query){ free(ocs[desc]->oc_query); @@ -831,7 +833,7 @@ static int _process_get(comm_header_t *ch, char **payload){ if(((ch->comm_payload_size > 1) && ((*payload)[0] == '/')) || !ocs[desc]->oc_cwp){ - log_dbg("Query involves absolute path or cwp is not set.\n"); + log_printf(LOG_DEBUG, "Query involves absolute path or cwp is not set.\n"); query = (char *)strdup(*payload); if(!query){ error = -ENOMEM; @@ -839,7 +841,7 @@ static int _process_get(comm_header_t *ch, char **payload){ } } else { /* +2 because of NULL and '/' character */ - log_dbg("Query involves relative path.\n"); + log_printf(LOG_DEBUG, "Query involves relative path.\n"); query = malloc(strlen(*payload)+strlen(ocs[desc]->oc_cwp)+2); if(!query){ error = -ENOMEM; @@ -853,8 +855,8 @@ static int _process_get(comm_header_t *ch, char **payload){ obj = xmlXPathEvalExpression((xmlChar *)query, ocs[desc]->oc_ctx); if(obj){ - log_dbg("Obj type = %d (%s)\n", obj->type, (obj->type == 1)?"XPATH_NODESET":""); - log_dbg("Number of matches: %d\n", (obj->nodesetval)?obj->nodesetval->nodeNr:0); + log_printf(LOG_DEBUG, "Obj type = %d (%s)\n", obj->type, (obj->type == 1)?"XPATH_NODESET":""); + log_printf(LOG_DEBUG, "Number of matches: %d\n", (obj->nodesetval)?obj->nodesetval->nodeNr:0); if(obj->nodesetval && (obj->nodesetval->nodeNr > 0) ){ xmlNodePtr node; int size=0; @@ -863,17 +865,17 @@ static int _process_get(comm_header_t *ch, char **payload){ if(ocs[desc]->oc_index >= obj->nodesetval->nodeNr){ ocs[desc]->oc_index = 0; error = 1; - log_dbg("Index reset to zero (end of list).\n"); + log_printf(LOG_DEBUG, "Index reset to zero (end of list).\n"); } node = obj->nodesetval->nodeTab[ocs[desc]->oc_index]; - log_dbg("Node (%s) type = %d (%s)\n", node->name, node->type, + log_printf(LOG_DEBUG, "Node (%s) type = %d (%s)\n", node->name, node->type, (node->type == 1)? "XML_ELEMENT_NODE": (node->type == 2)? "XML_ATTRIBUTE_NODE":""); if(!node) { - log_dbg("No content found.\n"); + log_printf(LOG_DEBUG, "No content found.\n"); error = -ENODATA; goto fail; } @@ -898,7 +900,7 @@ static int _process_get(comm_header_t *ch, char **payload){ } if(size <= ch->comm_payload_size){ /* do we already have enough space? */ - log_dbg("No extra space needed.\n"); + log_printf(LOG_DEBUG, "No extra space needed.\n"); if(nnv){ sprintf(*payload, "%s=%s", node->name, node->children ? (char *)node->children->content:""); @@ -908,7 +910,7 @@ static int _process_get(comm_header_t *ch, char **payload){ } } else { - log_dbg("Extra space needed.\n"); + log_printf(LOG_DEBUG, "Extra space needed.\n"); free(*payload); *payload = (char *)malloc(size); if(!*payload){ @@ -923,16 +925,16 @@ static int _process_get(comm_header_t *ch, char **payload){ node->name); } } - log_dbg("Query results:: %s\n", *payload); + log_printf(LOG_DEBUG, "Query results:: %s\n", *payload); ch->comm_payload_size = size; } else { - log_dbg("No nodes found.\n"); + log_printf(LOG_DEBUG, "No nodes found.\n"); ch->comm_payload_size = 0; error = -ENODATA; goto fail; } } else { - log_err("Error: unable to evaluate xpath query \"%s\"\n", *payload); + log_printf(LOG_ERR, "Error: unable to evaluate xpath query \"%s\"\n", *payload); error = -EINVAL; goto fail; } @@ -946,23 +948,23 @@ static int _process_get(comm_header_t *ch, char **payload){ ch->comm_payload_size = 0; } if(query) { free(query); } - EXIT("_process_get"); + CCSEXIT("_process_get"); return error; } static int process_get(comm_header_t *ch, char **payload){ int error; - ENTER("process_get"); + CCSENTER("process_get"); error = _process_get(ch, payload); - EXIT("process_get"); + CCSEXIT("process_get"); return (error < 0)? error: 0; } static int process_get_list(comm_header_t *ch, char **payload){ int error; - ENTER("process_get_list"); + CCSENTER("process_get_list"); error = _process_get(ch, payload); if(error){ @@ -971,7 +973,7 @@ static int process_get_list(comm_header_t *ch, char **payload){ ocs[dindex(ch->comm_desc)]->oc_index = -1; } - EXIT("process_get_list"); + CCSEXIT("process_get_list"); return (error < 0)? error: 0; } @@ -979,22 +981,22 @@ static int process_set(comm_header_t *ch, char *payload){ int error = 0; int desc = dindex(ch->comm_desc); - ENTER("process_set"); + CCSENTER("process_set"); if(!ch->comm_payload_size){ - log_err("process_set: payload size is zero.\n"); + log_printf(LOG_ERR, "process_set: payload size is zero.\n"); error = -EINVAL; goto fail; } if(ch->comm_desc < 0){ - log_err("Invalid descriptor specified (%d).\n", ch->comm_desc); - log_err("Someone may be attempting something evil.\n"); + log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc); + log_printf(LOG_ERR, "Someone may be attempting something evil.\n"); error = -EBADR; goto fail; } if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){ - log_err("process_set: Invalid connection descriptor received.\n"); + log_printf(LOG_ERR, "process_set: Invalid connection descriptor received.\n"); error = -EBADR; goto fail; } @@ -1007,7 +1009,7 @@ static int process_set(comm_header_t *ch, char *payload){ if(error){ ch->comm_error = error; } - EXIT("process_set"); + CCSEXIT("process_set"); return error; } @@ -1016,22 +1018,22 @@ static int process_get_state(comm_header_t *ch, char **payload){ int error = 0, desc = dindex(ch->comm_desc); char *load = NULL; - ENTER("process_get_state"); + CCSENTER("process_get_state"); if(ch->comm_payload_size){ - log_err("process_get_state: payload size is nonzero.\n"); + log_printf(LOG_ERR, "process_get_state: payload size is nonzero.\n"); error = -EINVAL; goto fail; } if(ch->comm_desc < 0){ - log_err("Invalid descriptor specified (%d).\n", ch->comm_desc); - log_err("Someone may be attempting something evil.\n"); + log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc); + log_printf(LOG_ERR, "Someone may be attempting something evil.\n"); error = -EBADR; goto fail; } if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){ - log_err("process_get_state: Invalid connection descriptor received.\n"); + log_printf(LOG_ERR, "process_get_state: Invalid connection descriptor received.\n"); error = -EBADR; goto fail; } @@ -1039,7 +1041,7 @@ static int process_get_state(comm_header_t *ch, char **payload){ if(ocs[desc]->oc_cwp && ocs[desc]->oc_query){ int size = strlen(ocs[desc]->oc_cwp) + strlen(ocs[desc]->oc_query) + 2; - log_dbg("Both cwp and query are set.\n"); + log_printf(LOG_DEBUG, "Both cwp and query are set.\n"); load = malloc(size); if(!load){ error = -ENOMEM; @@ -1049,7 +1051,7 @@ static int process_get_state(comm_header_t *ch, char **payload){ strcpy(load+strlen(ocs[desc]->oc_cwp)+1, ocs[desc]->oc_query); ch->comm_payload_size = size; } else if(ocs[desc]->oc_cwp){ - log_dbg("Only cwp is set.\n"); + log_printf(LOG_DEBUG, "Only cwp is set.\n"); load = (char *)strdup(ocs[desc]->oc_cwp); if(!load){ error = -ENOMEM; @@ -1058,7 +1060,7 @@ static int process_get_state(comm_header_t *ch, char **payload){ ch->comm_payload_size = strlen(load)+1; } else if(ocs[desc]->oc_query){ int size = strlen(ocs[desc]->oc_query) + 2; - log_dbg("Only query is set.\n"); + log_printf(LOG_DEBUG, "Only query is set.\n"); load = malloc(size); if(!load){ error = -ENOMEM; @@ -1078,7 +1080,7 @@ static int process_get_state(comm_header_t *ch, char **payload){ ch->comm_error = error; ch->comm_payload_size = 0; } - EXIT("process_get_state"); + CCSEXIT("process_get_state"); return error; } @@ -1086,22 +1088,22 @@ static int process_get_state(comm_header_t *ch, char **payload){ static int process_set_state(comm_header_t *ch, char *payload){ int error = 0, desc = dindex(ch->comm_desc); - ENTER("process_set_state"); + CCSENTER("process_set_state"); if(!ch->comm_payload_size){ - log_err("process_set_state: payload size is zero.\n"); + log_printf(LOG_ERR, "process_set_state: payload size is zero.\n"); error = -EINVAL; goto fail; } if(ch->comm_desc < 0){ - log_err("Invalid descriptor specified (%d).\n", ch->comm_desc); - log_err("Someone may be attempting something evil.\n"); + log_printf(LOG_ERR, "Invalid descriptor specified (%d).\n", ch->comm_desc); + log_printf(LOG_ERR, "Someone may be attempting something evil.\n"); error = -EBADR; goto fail; } if(!ocs || !ocs[desc] || (ocs[desc]->oc_desc != ch->comm_desc)){ - log_err("process_set_state: Invalid connection descriptor received.\n"); + log_printf(LOG_ERR, "process_set_state: Invalid connection descriptor received.\n"); error = -EBADR; goto fail; } @@ -1125,7 +1127,7 @@ static int process_set_state(comm_header_t *ch, char *payload){ ch->comm_error = error; } - EXIT("process_set_state"); + CCSEXIT("process_set_state"); return error; } @@ -1144,7 +1146,7 @@ int process_request(int afd){ comm_header_t *ch = NULL, *tmp_ch; char *payload = NULL; - ENTER("process_request"); + CCSENTER("process_request"); if(!(ch = (comm_header_t *)malloc(sizeof(comm_header_t)))){ error = -ENOMEM; @@ -1153,10 +1155,10 @@ int process_request(int afd){ error = read(afd, ch, sizeof(comm_header_t)); if(error < 0){ - log_sys_err("Unable to read comm_header_t"); + log_printf(LOG_ERR, "Unable to read comm_header_t"); goto fail; } else if(error < sizeof(comm_header_t)){ - log_err("Unable to read complete comm_header_t.\n"); + log_printf(LOG_ERR, "Unable to read complete comm_header_t.\n"); error = -EBADE; goto fail; } @@ -1168,10 +1170,10 @@ int process_request(int afd){ } error = read(afd, payload, ch->comm_payload_size); if(error < 0){ - log_sys_err("Unable to read payload"); + log_printf(LOG_ERR, "Unable to read payload"); goto fail; } else if(error < ch->comm_payload_size){ - log_err("Unable to read complete payload.\n"); + log_printf(LOG_ERR, "Unable to read complete payload.\n"); error = -EBADE; goto fail; } @@ -1180,20 +1182,20 @@ int process_request(int afd){ switch(ch->comm_type){ case COMM_CONNECT: if((error = process_connect(ch, payload)) < 0){ - log_err("Error while processing connect: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing connect: %s\n", strerror(-error)); goto fail; } break; case COMM_DISCONNECT: if((error = process_disconnect(ch)) < 0){ - log_err("Error while processing disconnect: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing disconnect: %s\n", strerror(-error)); goto fail; } break; case COMM_GET: if((error = process_get(ch, &payload)) < 0){ if(error != -ENODATA){ - log_err("Error while processing get: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing get: %s\n", strerror(-error)); } goto fail; } @@ -1201,43 +1203,43 @@ int process_request(int afd){ case COMM_GET_LIST: if((error = process_get_list(ch, &payload)) < 0){ if(error != -ENODATA){ - log_err("Error while processing get: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing get: %s\n", strerror(-error)); } goto fail; } break; case COMM_SET: if((error = process_set(ch, payload)) < 0){ - log_err("Error while processing set: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing set: %s\n", strerror(-error)); goto fail; } break; case COMM_GET_STATE: if((error = process_get_state(ch, &payload)) < 0){ - log_err("Error while processing get_state: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing get_state: %s\n", strerror(-error)); goto fail; } break; case COMM_SET_STATE: if((error = process_set_state(ch, payload)) < 0){ - log_err("Error while processing set_state: %s\n", strerror(-error)); + log_printf(LOG_ERR, "Error while processing set_state: %s\n", strerror(-error)); goto fail; } break; default: - log_err("Unknown connection request received.\n"); + log_printf(LOG_ERR, "Unknown connection request received.\n"); error = -EINVAL; ch->comm_error = error; ch->comm_payload_size = 0; } if(ch->comm_payload_size){ - log_dbg("Reallocating transfer buffer.\n"); + log_printf(LOG_DEBUG, "Reallocating transfer buffer.\n"); tmp_ch = (comm_header_t *) realloc(ch,sizeof(comm_header_t)+ch->comm_payload_size); if(tmp_ch) { ch = tmp_ch; } else { - log_err("Not enough memory to complete request.\n"); + log_printf(LOG_ERR, "Not enough memory to complete request.\n"); error = -ENOMEM; goto fail; } @@ -1252,10 +1254,10 @@ int process_request(int afd){ if (errno == EPIPE) { error = 0; } else { - log_sys_err("Unable to write package back to sender"); + log_printf(LOG_ERR, "Unable to write package back to sender"); } } else if(error < (sizeof(comm_header_t)+ch->comm_payload_size)){ - log_err("Unable to write complete package.\n"); + log_printf(LOG_ERR, "Unable to write complete package.\n"); error = -EBADE; goto fail; } else { @@ -1265,7 +1267,7 @@ int process_request(int afd){ if(ch){ free(ch); } if(payload){ free(payload); } - EXIT("process_request"); + CCSEXIT("process_request"); return error; } @@ -1286,7 +1288,7 @@ int process_broadcast(int sfd){ int sendlen; int discard = 0; - ENTER("process_broadcast"); + CCSENTER("process_broadcast"); ch = malloc(sizeof(comm_header_t)); if(!ch){ @@ -1296,9 +1298,9 @@ int process_broadcast(int sfd){ memset(ch, 0, sizeof(comm_header_t)); memset(&addr, 0, sizeof(struct sockaddr_storage)); /* just to make sure */ - log_dbg("Waiting to receive broadcast request.\n"); + log_printf(LOG_DEBUG, "Waiting to receive broadcast request.\n"); if(recvfrom(sfd, ch, sizeof(comm_header_t), 0, (struct sockaddr *)&addr, &len) < 0){ - log_sys_err("Unable to perform recvfrom"); + log_printf(LOG_ERR, "Unable to perform recvfrom"); error = -errno; goto fail; } @@ -1308,7 +1310,7 @@ int process_broadcast(int sfd){ /* Either someone is pinging this port, or there is an older version ** ** of ccs trying to get bcast response. Either way, we should not ** ** respond to them.................................................. */ - log_dbg("Received invalid request on broadcast port. %x\n",ch->comm_type); + log_printf(LOG_DEBUG, "Received invalid request on broadcast port. %x\n",ch->comm_type); error = -EINVAL; goto fail; } @@ -1321,7 +1323,7 @@ int process_broadcast(int sfd){ if(!master_doc){ discard = 1; - log_dbg("master_doc not loaded. Attempting to load it.\n"); + log_printf(LOG_DEBUG, "master_doc not loaded. Attempting to load it.\n"); if(!(master_doc = malloc(sizeof(open_doc_t)))){ error = -ENOMEM; goto fail; @@ -1331,15 +1333,15 @@ int process_broadcast(int sfd){ if(!master_doc->od_doc){ free(master_doc); master_doc = NULL; - log_err("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); + log_printf(LOG_ERR, "Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"); error = -ENODATA; goto fail; } - log_dbg("master_doc found and loaded.\n"); + log_printf(LOG_DEBUG, "master_doc found and loaded.\n"); } else if(update_required){ - log_dbg("Update is required.\n"); + log_printf(LOG_DEBUG, "Update is required.\n"); if((error = update_config())){ - log_err("Failed to update config file, required by cluster.\n"); + log_printf(LOG_ERR, "Failed to update config file, required by cluster.\n"); /* ATTENTION -- remove all open_doc_t's ? */ goto fail; } @@ -1352,7 +1354,7 @@ int process_broadcast(int sfd){ 0); if(!ch->comm_payload_size){ error = -ENOMEM; - log_err("Document dump to memory failed.\n"); + log_printf(LOG_ERR, "Document dump to memory failed.\n"); goto fail; } @@ -1371,11 +1373,11 @@ int process_broadcast(int sfd){ swab_header(ch); /* Swab back to dip into ch for payload_size */ memcpy(buffer+sizeof(comm_header_t), payload, ch->comm_payload_size); - log_dbg("Sending configuration (version %d)...\n", get_doc_version(master_doc->od_doc)); + log_printf(LOG_DEBUG, "Sending configuration (version %d)...\n", get_doc_version(master_doc->od_doc)); sendlen = ch->comm_payload_size + sizeof(comm_header_t); if(sendto(sfd, buffer, sendlen, 0, (struct sockaddr *)&addr, (socklen_t)len) < 0){ - log_sys_err("Sendto failed"); + log_printf(LOG_ERR, "Sendto failed"); error = -errno; } @@ -1389,6 +1391,6 @@ int process_broadcast(int sfd){ if(master_doc) free(master_doc); master_doc = NULL; } - EXIT("process_broadcast"); + CCSEXIT("process_broadcast"); return error; } diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c index 6907268..54b94ef 100644 --- a/ccs/daemon/misc.c +++ b/ccs/daemon/misc.c @@ -28,9 +28,9 @@ #include #include #include +#include #include "comm_headers.h" -#include "log.h" #include "debug.h" #include "misc.h" @@ -41,6 +41,8 @@ pthread_mutex_t update_lock; open_doc_t *master_doc = NULL; +LOGSYS_DECLARE_SUBSYS ("CCS", LOG_INFO); + int get_doc_version(xmlDocPtr ldoc){ int i; int error = 0; @@ -48,38 +50,38 @@ int get_doc_version(xmlDocPtr ldoc){ xmlXPathContextPtr ctx = NULL; xmlNodePtr node = NULL; - ENTER("get_doc_version"); + CCSENTER("get_doc_version"); ctx = xmlXPathNewContext(ldoc); if(!ctx){ - log_err("Error: unable to create new XPath context.\n"); + log_printf(LOG_ERR, "Error: unable to create new XPath context.\n"); error = -EIO; /* ATTENTION -- what should this be? */ goto fail; } obj = xmlXPathEvalExpression((xmlChar *)"//cluster/@config_version", ctx); if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){ - log_err("Error while retrieving config_version.\n"); + log_printf(LOG_ERR, "Error while retrieving config_version.\n"); error = -ENODATA; goto fail; } node = obj->nodesetval->nodeTab[0]; if(node->type != XML_ATTRIBUTE_NODE){ - log_err("Object returned is not of attribute type.\n"); + log_printf(LOG_ERR, "Object returned is not of attribute type.\n"); error = -ENODATA; goto fail; } if(!node->children->content || !strlen((char *)node->children->content)){ - log_dbg("No content found.\n"); + log_printf(LOG_DEBUG, "No content found.\n"); error = -ENODATA; goto fail; } for(i=0; i < strlen((char *)node->children->content); i++){ if(!isdigit(node->children->content[i])){ - log_err("config_version is not a valid integer.\n"); + log_printf(LOG_ERR, "config_version is not a valid integer.\n"); error = -EINVAL; goto fail; } @@ -94,7 +96,7 @@ fail: if(obj){ xmlXPathFreeObject(obj); } - EXIT("get_doc_version"); + CCSEXIT("get_doc_version"); return error; } @@ -114,31 +116,31 @@ char *get_cluster_name(xmlDocPtr ldoc){ xmlXPathContextPtr ctx = NULL; xmlNodePtr node = NULL; - ENTER("get_cluster_name"); + CCSENTER("get_cluster_name"); ctx = xmlXPathNewContext(ldoc); if(!ctx){ - log_err("Error: unable to create new XPath context.\n"); + log_printf(LOG_ERR, "Error: unable to create new XPath context.\n"); error = -EIO; /* ATTENTION -- what should this be? */ goto fail; } obj = xmlXPathEvalExpression((xmlChar *)"//cluster/@name", ctx); if(!obj || !obj->nodesetval || (obj->nodesetval->nodeNr != 1)){ - log_err("Error while retrieving config_version.\n"); + log_printf(LOG_ERR, "Error while retrieving config_version.\n"); error = -ENODATA; goto fail; } node = obj->nodesetval->nodeTab[0]; if(node->type != XML_ATTRIBUTE_NODE){ - log_err("Object returned is not of attribute type.\n"); + log_printf(LOG_ERR, "Object returned is not of attribute type.\n"); error = -ENODATA; goto fail; } if(!node->children->content || !strlen((char *)node->children->content)){ - log_dbg("No content found.\n"); + log_printf(LOG_DEBUG, "No content found.\n"); error = -ENODATA; goto fail; } @@ -153,7 +155,7 @@ fail: if(obj){ xmlXPathFreeObject(obj); } - EXIT("get_cluster_name"); + CCSEXIT("get_cluster_name"); return rtn; } diff --git a/ccs/include/debug.h b/ccs/include/debug.h index 176ab48..49af319 100644 --- a/ccs/include/debug.h +++ b/ccs/include/debug.h @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2004 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -13,12 +13,7 @@ #ifndef __DEBUG_DOT_H__ #define __DEBUG_DOT_H__ -#ifdef DEBUG -#define ENTER(x) log_dbg("Entering %s\n", x) -#define EXIT(x) log_dbg("Exiting %s\n", x) -#else -#define ENTER(x) -#define EXIT(x) -#endif +#define CCSENTER(x) log_printf(LOG_DEBUG, "Entering " x "\n") +#define CCSEXIT(x) log_printf(LOG_DEBUG, "Exiting " x "\n") #endif /* __DEBUG_DOT_H__ */ diff --git a/ccs/lib/Makefile b/ccs/lib/Makefile index 63d32f0..820342f 100644 --- a/ccs/lib/Makefile +++ b/ccs/lib/Makefile @@ -1,7 +1,7 @@ ############################################################################### ############################################################################### ## -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -23,12 +23,11 @@ include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -OBJS= libccs.o \ - log.o +OBJS= libccs.o CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -fPIC -CFLAGS += -I$(S)/../include -I$(S)/../common +CFLAGS += -I$(S)/../include CFLAGS += -I${incdir} @@ -36,10 +35,6 @@ ${TARGET}: ${OBJS} ${AR} cr $@ $^ ${RANLIB} $@ -log.c: - ln -sf $(S)/../common/log.c log.c - clean: generalclean - rm -rf ccs.h.gch log.c -include $(OBJS:.o=.d) diff --git a/ccs/lib/libccs.c b/ccs/lib/libccs.c index 3c1c451..ad566d8 100644 --- a/ccs/lib/libccs.c +++ b/ccs/lib/libccs.c @@ -1,7 +1,7 @@ /****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions @@ -21,7 +21,6 @@ #include #include -#include "log.h" /* Libraries should not print - so only use log_dbg */ #include "debug.h" #include "comm_headers.h" #include "ccs.h" @@ -37,7 +36,6 @@ static int setup_interface_ipv6(int *sp, int port){ struct sockaddr_in6 addr; int trueint = 1; - ENTER("setup_interface_ipv6"); memset(&addr, 0, sizeof(struct sockaddr_in6)); sock = socket(PF_INET6, SOCK_STREAM, 0); @@ -46,17 +44,13 @@ static int setup_interface_ipv6(int *sp, int port){ goto fail; } - if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int))){ - log_sys_err("Unable to set socket option SO_REUSEADDR"); - log_err("This may slow things down a bit.\n"); - } + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &trueint, sizeof(int)); addr.sin6_family = AF_INET6; addr.sin6_port = htons(port); addr.sin6_addr = in6addr_loopback; if(bind(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6))){ - log_dbg("Unable to (pre)bind to port %d: %s\n", port, strerror(errno)); error = -errno; goto fail; } @@ -67,20 +61,17 @@ static int setup_interface_ipv6(int *sp, int port){ error = connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6)); if(error < 0){ - log_dbg("Unable to connect to server: %s\n", strerror(errno)); error = -errno; goto fail; } *sp = sock; - EXIT("setup_interface_ipv6"); return 0; fail: if(sock >= 0){ close(sock); } - EXIT("setup_interface_ipv6"); return error; } @@ -89,8 +80,6 @@ static int setup_interface_ipv4(int *sp, int port){ int error = 0; struct sockaddr_in addr; - ENTER("setup_interface_ipv4"); - memset(&addr, 0, sizeof(struct sockaddr_in)); sock = socket(PF_INET, SOCK_STREAM, 0); if(sock < 0){ @@ -103,7 +92,6 @@ static int setup_interface_ipv4(int *sp, int port){ addr.sin_port = htons(port); if(bindresvport(sock, &addr)){ - log_dbg("Unable to bindresvport: %s\n", strerror(errno)); error = -errno; goto fail; } @@ -114,20 +102,17 @@ static int setup_interface_ipv4(int *sp, int port){ error = connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); if(error < 0){ - log_dbg("Unable to connect to server: %s\n", strerror(errno)); error = -errno; goto fail; } *sp = sock; - EXIT("setup_interface_ipv4"); return 0; fail: if(sock >= 0){ close(sock); } - EXIT("setup_interface_ipv4"); return error; } @@ -138,7 +123,6 @@ setup_interface_local(int *sp) struct sockaddr_un sun; int sock = -1, error = 0; - ENTER("setup_interface_local"); sun.sun_family = PF_LOCAL; snprintf(sun.sun_path, sizeof(sun.sun_path), COMM_LOCAL_SOCKET); @@ -155,14 +139,12 @@ setup_interface_local(int *sp) } *sp = sock; - EXIT("setup_interface_local"); return PF_LOCAL; fail: if (sock >= 0){ close(sock); } - EXIT("setup_interface_local"); return -error; } @@ -184,7 +166,6 @@ static int setup_interface(int *sp){ int ipv6 = (comm_proto < 0) ? 1 : (comm_proto == PF_INET6); int local = (comm_proto < 0) ? 1 : (comm_proto == PF_LOCAL); - ENTER("setup_interface"); srandom(getpid()); /* Try to do a local connect first */ @@ -213,7 +194,6 @@ static int setup_interface(int *sp){ sleep(timo); } } - EXIT("setup_interface"); return error; } @@ -233,8 +213,6 @@ static int do_request(char *buffer){ char *proto; comm_header_t *ch = (comm_header_t *)buffer; - ENTER("do_request"); - if((error = setup_interface(&sock)) < 0){ goto fail; } @@ -252,15 +230,12 @@ static int do_request(char *buffer){ } comm_proto = error; - log_dbg("Protocol set to %s.\n", proto); } error = write(sock, buffer, sizeof(comm_header_t)+ch->comm_payload_size); if(error < 0){ - log_dbg("Write to socket failed.\n"); goto fail; } else if(error < (sizeof(comm_header_t)+ch->comm_payload_size)){ - log_dbg("Failed to write full package to socket.\n"); error = -EBADE; goto fail; } @@ -268,14 +243,11 @@ static int do_request(char *buffer){ /* ok to take in two passes ? */ error = read(sock, buffer, sizeof(comm_header_t)); if(error < 0){ - log_dbg("Read from socket failed.\n"); goto fail; } else if(error < sizeof(comm_header_t)){ - log_dbg("Failed to read complete comm_header_t.\n"); error = -EBADE; goto fail; } else if(ch->comm_error){ - log_dbg("Server reports failure: %s\n", strerror(-ch->comm_error)); error = ch->comm_error; goto fail; } else { @@ -284,10 +256,8 @@ static int do_request(char *buffer){ if(ch->comm_payload_size){ error = read(sock, buffer+sizeof(comm_header_t), ch->comm_payload_size); if(error < 0){ - log_dbg("Read from socket failed.\n"); goto fail; } else if(error < ch->comm_payload_size){ - log_dbg("Failed to read complete payload.\n"); error = -EBADE; goto fail; } else { @@ -296,7 +266,6 @@ static int do_request(char *buffer){ } fail: if(sock >= 0) { close(sock); } - EXIT("do_request"); return error; } @@ -317,8 +286,6 @@ int _ccs_connect(const char *cluster_name, int flags){ comm_header_t *ch = NULL; char *payload = NULL; - ENTER("ccs_connect"); - if(!(buffer = malloc(512))){ error = -ENOMEM; goto fail; @@ -354,7 +321,6 @@ int _ccs_connect(const char *cluster_name, int flags){ fail: if(buffer) { free(buffer); } - EXIT("ccs_connect"); return error; } @@ -408,8 +374,6 @@ int ccs_disconnect(int desc){ comm_header_t *ch = NULL; char *payload = NULL; - ENTER("ccs_disconnect"); - if (desc < 0) return -EINVAL; @@ -430,7 +394,6 @@ int ccs_disconnect(int desc){ fail: if(buffer) { free(buffer); } - EXIT("ccs_disconnect"); return error; } @@ -454,8 +417,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){ comm_header_t *ch = NULL; char *payload = NULL; - ENTER("_ccs_get"); - if (desc < 0) return -EINVAL; @@ -468,7 +429,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){ ch = (comm_header_t *)buffer; payload = (buffer + sizeof(comm_header_t)); - log_dbg("ccs_get list? %s\n", (list)?"YES":"NO"); ch->comm_type = (list)?COMM_GET_LIST:COMM_GET; ch->comm_desc = desc; @@ -488,7 +448,6 @@ int _ccs_get(int desc, const char *query, char **rtn, int list){ fail: if(buffer) { free(buffer); } - EXIT("_ccs_get"); return error; } @@ -516,8 +475,6 @@ int ccs_get_list(int desc, const char *query, char **rtn){ * Returns: 0 on success, < 0 on failure */ int ccs_set(int desc, const char *path, char *val){ - ENTER("ccs_set"); - EXIT("ccs_set"); return -ENOSYS; } @@ -540,8 +497,6 @@ int ccs_get_state(int desc, char **cw_path, char **prev_query){ comm_header_t *ch = NULL; char *payload = NULL; - ENTER("ccs_get_state"); - if (desc < 0) return -EINVAL; @@ -578,7 +533,6 @@ int ccs_get_state(int desc, char **cw_path, char **prev_query){ fail: if(buffer) { free(buffer); } - EXIT("ccs_get_state"); return error; } @@ -602,8 +556,6 @@ int ccs_set_state(int desc, const char *cw_path, int reset_query){ comm_header_t *ch = NULL; char *payload = NULL; - ENTER("ccs_set_state"); - if (desc < 0) return -EINVAL; @@ -636,7 +588,6 @@ int ccs_set_state(int desc, const char *cw_path, int reset_query){ fail: if(buffer) { free(buffer); } - EXIT("ccs_set_state"); return error; } hooks/post-receive -- Cluster Project From mgrac@sourceware.org Tue Apr 22 15:55:00 2008 From: mgrac@sourceware.org (mgrac@sourceware.org) Date: Tue, 22 Apr 2008 15:55:00 -0000 Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-47-gbcfdaa6 Message-ID: <20080422155459.10459.qmail@sourceware.org> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=bcfdaa69b501fef4d01abcf1104d87d00484da66 The branch, RHEL4 has been updated via bcfdaa69b501fef4d01abcf1104d87d00484da66 (commit) from ceee2fe27ece59ef6b3643ab1e7a4cce6688727c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bcfdaa69b501fef4d01abcf1104d87d00484da66 Author: Marek 'marx' Grac Date: Tue Apr 22 17:52:01 2008 +0200 fence/agents: New fencings agents There are new fencing agents based on a new library. They need a 'pexpect' package. If it is possible there is support for both telnet and ssh. In this patch there are agents for: APC, BladeCenter, Drac 5, ILo and WTI. Fence agents that support ssh in 4.7 are iLO, DRAC5, WTI, APC, and BladeCenter ----------------------------------------------------------------------- Summary of changes: fence/agents/apc/apc.py | 94 +++++++++ fence/agents/bladecenter/bladecenter.py | 84 ++++++++ fence/agents/drac/drac5.py | 73 +++++++ fence/agents/ilo/ilo.py | 71 +++++++ fence/agents/lib/fencing.py | 339 +++++++++++++++++++++++++++++++ fence/agents/wti/wti.py | 103 ++++++++++ 6 files changed, 764 insertions(+), 0 deletions(-) create mode 100755 fence/agents/apc/apc.py create mode 100755 fence/agents/bladecenter/bladecenter.py create mode 100755 fence/agents/drac/drac5.py create mode 100755 fence/agents/ilo/ilo.py create mode 100644 fence/agents/lib/fencing.py create mode 100755 fence/agents/wti/wti.py diff --git a/fence/agents/apc/apc.py b/fence/agents/apc/apc.py new file mode 100755 index 0000000..bcea997 --- /dev/null +++ b/fence/agents/apc/apc.py @@ -0,0 +1,94 @@ +#!/usr/bin/python + +## +## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. +## +## The Following Agent Has Been Tested On: +## +## Model Firmware +## +---------------------------------------------+ +## AP7951 AOS v2.7.0, PDU APP v2.7.3 +## +## @note: ssh is very slow on AP7951 device +##### + +import sys, re, pexpect +sys.path.append("../lib/") +from fencing import * + +def get_power_status(conn, options): + result = "" + try: + conn.send("1\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send("2\r\n") + while 1 == conn.log_expect(options, [ options["-c"], "Press " ], SHELL_TIMEOUT): + result += conn.before + conn.send("\r\n") + result += conn.before + conn.send(chr(03)) + conn.log_expect(options, "- Logout", SHELL_TIMEOUT) + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + + status = re.compile("\s*"+options["-n"]+"-.*(ON|OFF)", re.IGNORECASE).search(result).group(1) + return status.lower().strip() + +def set_power_status(conn, options): + action = { + 'on' : "1", + 'off': "2" + }[options["-o"]] + + try: + conn.send("1\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send("2\r\n") + while 1 == conn.log_expect(options, [ options["-c"], "Press " ], SHELL_TIMEOUT): + conn.send("\r\n") + conn.send(options["-n"]+"\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send(action+"\r\n") + conn.log_expect(options, "Enter 'YES' to continue or to cancel :", SHELL_TIMEOUT) + conn.send("YES\r\n") + conn.log_expect(options, "Press to continue...", SHELL_TIMEOUT) + conn.send("\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send(chr(03)) + conn.log_expect(options, "- Logout", SHELL_TIMEOUT) + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexcept.EOF: + fail(EC_CONNECTION_LOST) + except pexcept.TIMEOUT: + fail(EC_TIMED_OUT) + +def main(): + device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", + "action", "ipaddr", "login", "passwd", "passwd_script", + "secure", "port", "test" ] + + options = check_input(device_opt, process_input(device_opt)) + + ## + ## Fence agent specific defaults + ##### + if 0 == options.has_key("-c"): + options["-c"] = "\n>" + + ## + ## Operate the fencing device + #### + conn = fence_login(options) + fence_action(conn, options, set_power_status, get_power_status) + + ## + ## Logout from system + ###### + conn.sendline("4") + conn.close() + +if __name__ == "__main__": + main() diff --git a/fence/agents/bladecenter/bladecenter.py b/fence/agents/bladecenter/bladecenter.py new file mode 100755 index 0000000..cbc7daa --- /dev/null +++ b/fence/agents/bladecenter/bladecenter.py @@ -0,0 +1,84 @@ +#!/usr/bin/python + +## +## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. +## +## The Following Agent Has Been Tested On: +## +## Model Firmware +## +--------------------+---------------------------+ +## (1) Main application BRET85K, rev 16 +## Boot ROM BRBR67D, rev 16 +## Remote Control BRRG67D, rev 16 +## +##### + +import sys, re, pexpect +sys.path.append("../lib/") +from fencing import * + +def get_power_status(conn, options): + try: + node_cmd = "system:blade\[" + options["-n"] + "\]>" + + conn.send("env -T system:blade[" + options["-n"] + "]\r\n") + conn.log_expect(options, node_cmd, SHELL_TIMEOUT) + conn.send("power -state\r\n") + conn.log_expect(options, node_cmd, SHELL_TIMEOUT) + status = conn.before.splitlines()[-1] + conn.send("env -T system\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + + return status.lower().strip() + +def set_power_status(conn, options): + action = { + 'on' : "powerup", + 'off': "powerdown" + }[options["-o"]] + + try: + node_cmd = "system:blade\[" + options["-n"] + "\]>" + + conn.send("env -T system:blade[" + options["-n"] + "]\r\n") + conn.log_expect(options, node_cmd, SHELL_TIMEOUT) + conn.send("power -"+options["-o"]+"\r\n") + conn.log_expect(options, node_cmd, SHELL_TIMEOUT) + conn.send("env -T system\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexcept.EOF: + fail(EC_CONNECTION_LOST) + except pexcept.TIMEOUT: + fail(EC_TIMED_OUT) + +def main(): + device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", + "action", "ipaddr", "login", "passwd", "passwd_script", + "cmd_prompt", "secure", "port" ] + + options = check_input(device_opt, process_input(device_opt)) + + ## + ## Fence agent specific defaults + ##### + if 0 == options.has_key("-c"): + options["-c"] = "system>" + + ## + ## Operate the fencing device + ###### + conn = fence_login(options) + fence_action(conn, options, set_power_status, get_power_status) + + ## + ## Logout from system + ###### + conn.send("exit\r\n") + conn.close() + +if __name__ == "__main__": + main() diff --git a/fence/agents/drac/drac5.py b/fence/agents/drac/drac5.py new file mode 100755 index 0000000..63012fc --- /dev/null +++ b/fence/agents/drac/drac5.py @@ -0,0 +1,73 @@ +#!/usr/bin/python + +## +## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. +## +## The Following Agent Has Been Tested On: +## +## DRAC Version Firmware +## +-----------------+---------------------------+ +## DRAC 5 1.0 (Build 06.05.12) +## DRAC 5 1.21 (Build 07.05.04) +## +## @note: drac_version, modulename were removed +##### + +import sys, re, pexpect +sys.path.append("../lib/") +from fencing import * + +def get_power_status(conn, options): + try: + conn.sendline("racadm serveraction powerstatus") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + + status = re.compile("Server power status: (.*)", re.IGNORECASE).search(conn.before).group(1) + return status.lower().strip() + +def set_power_status(conn, options): + action = { + 'on' : "powerup", + 'off': "powerdown" + }[options["-o"]] + + try: + conn.sendline("racadm serveraction " + action) + conn.log_expect(options, options["-c"], POWER_TIMEOUT) + except pexcept.EOF: + fail(EC_CONNECTION_LOST) + except pexcept.TIMEOUT: + fail(EC_TIMED_OUT) + +def main(): + device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", + "action", "ipaddr", "login", "passwd", "passwd_script", + "cmd_prompt", "secure", + "drac_version", "module_name" ] + + options = check_input(device_opt, process_input(device_opt)) + + ## + ## Fence agent specific defaults + ##### + if 0 == options.has_key("-c"): + options["-c"] = "\$" + + ## + ## Operate the fencing device + ###### + conn = fence_login(options) + fence_action(conn, options, set_power_status, get_power_status) + + ## + ## Logout from system + ###### + conn.sendline("exit") + conn.close() + +if __name__ == "__main__": + main() diff --git a/fence/agents/ilo/ilo.py b/fence/agents/ilo/ilo.py new file mode 100755 index 0000000..1f3e330 --- /dev/null +++ b/fence/agents/ilo/ilo.py @@ -0,0 +1,71 @@ +#!/usr/bin/python + +## +## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. +## +## The Following Agent Has Been Tested On: +## +## iLO Version +## +---------------------------------------------+ +## iLO Advanced 1.91 +## +## @note: We can't use conn.sendline because we need to send CR/LF +##### + +import sys, re, pexpect +sys.path.append("../lib/") +from fencing import * + +def get_power_status(conn, options): + try: + conn.send("POWER\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + except pexpect.EOF: + fail(EC_CONNECTION_LOST) + except pexpect.TIMEOUT: + fail(EC_TIMED_OUT) + + status = re.compile("server power is currently: (.*)", re.IGNORECASE).search(conn.before).group(1) + return status.lower().strip() + +def set_power_status(conn, options): + action = { + 'on' : "powerup", + 'off': "powerdown" + }[options["-o"]] + + try: + conn.send("power " + options["-o"] + "\r\n") + conn.log_expect(options, options["-c"], POWER_TIMEOUT) + except pexcept.EOF: + fail(EC_CONNECTION_LOST) + except pexcept.TIMEOUT: + fail(EC_TIMED_OUT) + +def main(): + device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", + "action", "ipaddr", "login", "passwd", "passwd_script", + "secure", "ribcl" ] + + options = check_input(device_opt, process_input(device_opt)) + + ## + ## Fence agent specific defaults + ##### + if 0 == options.has_key("-c"): + options["-c"] = "hpiLO->" + + ## + ## Operate the fencing device + #### + conn = fence_login(options) + fence_action(conn, options, set_power_status, get_power_status) + + ## + ## Logout from system + ###### + conn.send("quit\r\n") + conn.close() + +if __name__ == "__main__": + main() diff --git a/fence/agents/lib/fencing.py b/fence/agents/lib/fencing.py new file mode 100644 index 0000000..39d1285 --- /dev/null +++ b/fence/agents/lib/fencing.py @@ -0,0 +1,339 @@ +#!/usr/bin/python + +## +## Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. +## +##### +import sys, getopt, time, os +import pexpect, re +import telnetlib + +POWER_TIMEOUT = 20 +SHELL_TIMEOUT = 3 +LOGIN_TIMEOUT = 5 + +LOG_MODE_VERBOSE = 100 +LOG_MODE_QUIET = 0 + +EC_BAD_ARGS = 2 +EC_LOGIN_DENIED = 3 +EC_CONNECTION_LOST = 4 +EC_TIMED_OUT = 5 +EC_WAITING_ON = 6 +EC_WAITING_OFF = 7 + +all_opt = { + "help" : { + "getopt" : "h", + "help" : "-h Display this help and exit", + "order" : 54 }, + "version" : { + "getopt" : "V", + "help" : "-V Output version information and exit", + "order" : 53 }, + "quiet" : { + "getopt" : "q", + "help" : "-q Quiet mode", + "order" : 50 }, + "verbose" : { + "getopt" : "v", + "help" : "-v Verbose mode", + "order" : 51 }, + "debug" : { + "getopt" : "D:", + "help" : "-D Debugging to output file", + "order" : 52 }, + "agent" : { + "getopt" : "", + "help" : "", + "order" : 1 }, + "action" : { + "getopt" : "o:", + "help" : "-o Action: status, reboot (default), off or on", + "order" : 1 }, + "ipaddr" : { + "getopt" : "a:", + "help" : "-a IP address or hostname of fencing device", + "order" : 1 }, + "login" : { + "getopt" : "l:", + "help" : "-l Login name", + "order" : 1 }, + "no_login" : { + "getopt" : "", + "help" : "", + "order" : 1 }, + "passwd" : { + "getopt" : "p:", + "help" : "-p Login password", + "order" : 1 }, + "passwd_script" : { + "getopt" : "S:", + "help" : "-S