Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 15d53e132b4d9261995675245797778f0e211af9
Parent: 629b148b43ec1442a056cf9798b26de4dfe0cdd4
Author: Masahiro Matsuya <mmatsuya(a)redhat.com>
AuthorDate: Fri Jul 9 14:40:51 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Jul 20 11:55:21 2010 -0400
resource-agents: Fix migration mapping behavior w/ virsh
Consider a two node cluster. The hostname of the nodes
are 'sk010001' and 'sk010002'. Each nodes has two bonded
network interfaces for public and private communications.
The hostname matches the hostname of the IP address on
public network.
Node1: sk010001
bond0 (for public network) : 172.22.51.1 sk010001
bond2 (for private network): 172.22.48.131 sk010001-hb
Node2: sk010002
bond0 (for public network) : 172.22.51.2 sk010002
bond2 (for private network): 172.22.48.132 sk010002-hb
In cluster.conf, a migration mapping is used to specify
that the private interfaces should be used for migration traffic.
Unfortunately, when doing a live migration, while the traffic
should use the -hb interfaces, bond0 is used.
This is because the vm.sh agent uses the following command
for live migration from sk010001 to sk010002:
virsh migrate --live su21k003 \
qemu+ssh://sk010002-hb/system
This is not enough to ensure the guest goes over the private
interface. The --migrateuri option of 'virsh migrate' is needed
for it. The following command should be executed instead:
virsh migrate --live su21k003 \
qemu+ssh://sk010002-hb/system tcp:sk010002-hb
Resolves: rhbz#596918
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/vm.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 66828ef..d2bd0b7 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -810,6 +810,7 @@ validate_all()
# Virsh makes it easier to do this. Really.
if [ "$OCF_RESKEY_hypervisor" = "qemu" ]; then
export OCF_RESKEY_migration_uri="qemu+ssh://%s/system"
+ export migrateuriopt="tcp:%s"
fi
# I just need to believe in it more.
@@ -845,7 +846,7 @@ virsh_migrate()
err=$($cmd 2>&1 | head -1; exit ${PIPESTATUS[0]})
rv=$?
elif [ "$OCF_RESKEY_hypervisor" = "qemu" ]; then
- cmd="virsh migrate $migrate_opt $OCF_RESKEY_name $(printf $OCF_RESKEY_migration_uri $target)"
+ cmd="virsh migrate $migrate_opt $OCF_RESKEY_name $(printf $OCF_RESKEY_migration_uri $target) $(printf $migrateuriopt $target)"
ocf_log debug "$cmd"
err=$($cmd 2>&1 | head -1; exit ${PIPESTATUS[0]})
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 629b148b43ec1442a056cf9798b26de4dfe0cdd4
Parent: ded66f61ba8967d686dc200eaeadec309bb7c60f
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Jul 9 14:36:44 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Jul 20 11:55:10 2010 -0400
resource-agents: Add NFSv4 support
This patch allows the nfsserver agent to export
NFSv4 and map recovery directories to places on
shared file systems in order to allow v4 recovery
to take place when the NFS daemons are started.
Resolves: rhbz#595547
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/nfsserver.sh | 180 ++++++++++++++++++++++++----------
1 files changed, 130 insertions(+), 50 deletions(-)
diff --git a/rgmanager/src/resources/nfsserver.sh b/rgmanager/src/resources/nfsserver.sh
index 6df0c1a..17f472d 100644
--- a/rgmanager/src/resources/nfsserver.sh
+++ b/rgmanager/src/resources/nfsserver.sh
@@ -8,6 +8,10 @@
LC_ALL=C
LANG=C
PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+V4RECOVERY="/var/lib/nfs/v4recovery"
+PROC_V4RECOVERY="/proc/fs/nfsd/nfsv4recoverydir"
+
export LC_ALL LANG PATH
. $(dirname $0)/ocf-shellfuncs
@@ -32,18 +36,24 @@ meta_data()
<version>1.0</version>
<longdesc lang="en">
- This defines an NFS server.
+ This defines an NFS server resource. The NFS server
+ resource is useful for exporting NFSv4 file systems
+ to clients. Because of the way NFSv4 works, only
+ one NFSv4 resource may exist on a server at a
+ time. Additionally, it is not possible to use
+ the nfsserver resource when also using local instances
+ of NFS on each cluster node.
</longdesc>
<shortdesc lang="en">
- This defines an NFS server.
+ This defines an NFS server resource.
</shortdesc>
<parameters>
<parameter name="name" primary="1">
<longdesc lang="en">
Descriptive name for this server. Generally, only
- one serveris ever defined.
+ one server is ever defined per service.
</longdesc>
<shortdesc lang="en">
Name
@@ -55,7 +65,8 @@ meta_data()
<longdesc lang="en">
This is the path you intend to export. Usually, this is
left blank, and the mountpoint of the parent file system
- is used.
+ is used. This path is passed to nfsclient resources as
+ the export path when exportfs is called.
</longdesc>
<shortdesc lang="en">
This is the path you intend to export.
@@ -65,11 +76,14 @@ meta_data()
<parameter name="nfspath">
<longdesc lang="en">
- This is the path containing shared NFS information. This
- is relative to the export path.
+ This is the path containing shared NFS information which
+ is used for NFS recovery after a failover. This
+ is relative to the export path, and defaults to
+ ".clumanager/nfs".
</longdesc>
<shortdesc lang="en">
- This is the path containing shared NFS information.
+ This is the path containing shared NFS recovery
+ information, relative to the path parameter.
</shortdesc>
<content type="string" default=".clumanager/nfs"/>
</parameter>
@@ -142,6 +156,8 @@ verify_all()
nfs_daemons()
{
declare oper
+ declare val
+
case $1 in
start)
ocf_log info "Starting NFS daemons"
@@ -162,9 +178,15 @@ nfs_daemons()
fi
ocf_log debug "NFS daemons are stopped"
+
return 0
;;
status|monitor)
+ declare recoverydir="$OCF_RESKEY_path/$OCF_RESKEY_nfspath/v4recovery"
+ val=$(cat $PROC_V4RECOVERY)
+
+ [ "$val" = "$recoverydir" ] || ocf_log warning \
+ "NFSv4 recovery directory is $val instead of $recoverydir"
/etc/init.d/nfs status
if [ $? -eq 0 ]; then
ocf_log debug "NFS daemons are running"
@@ -180,62 +202,126 @@ create_tree()
{
declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
- [ -d "$fp" ] || mkdir -p $fp
- #
- # is this really needed?
- #
- #[ -d "$fp/rpc_pipefs" ] || mkdir -p $fp/rpc_pipefs
+ [ -d "$fp" ] || mkdir -p "$fp"
- [ -d "$fp/statd" ] || mkdir -p $fp/statd
+ [ -d "$fp/statd" ] || mkdir -p "$fp/statd"
+ [ -d "$fp/v4recovery" ] || mkdir -p "$fp/v4recovery"
#
# Create our own private copy which we use for notifies.
# This way, we can be sure to advertise on possibly multiple
# IP addresses.
#
- [ -d "$fp/statd/sm-ha" ] || mkdir -p $fp/statd/sm-ha
+ [ -d "$fp/statd/sm" ] || mkdir -p "$fp/statd/sm"
+ [ -d "$fp/statd/sm.bak" ] || mkdir -p "$fp/statd/sm.bak"
+ [ -d "$fp/statd/sm-ha" ] || mkdir -p "$fp/statd/sm-ha"
+ [ -n "`id -u rpcuser`" -a "`id -g rpcuser`" ] && chown -R rpcuser.rpcuser "$fp/statd"
# Create if they don't exist
- [ -f "$fp/etab" ] || touch $fp/etab
- [ -f "$fp/xtab" ] || touch $fp/xtab
- [ -f "$fp/rmtab" ] || touch $fp/rmtab
- [ -f "$fp/state" ] || touch $fp/state
+ [ -f "$fp/etab" ] || touch "$fp/etab"
+ [ -f "$fp/xtab" ] || touch "$fp/xtab"
+ [ -f "$fp/rmtab" ] || touch "$fp/rmtab"
+
+ #
+ # Generate a random state file. If this ends up being what a client
+ # already has in its list, that's bad, but the chances of this
+ # are small - and relocations should be rare.
+ #
+ dd if=/dev/urandom of=$fp/state bs=1 count=4 &> /dev/null
+ [ -n "`id -u rpcuser`" -a "`id -g rpcuser`" ] && chown rpcuser.rpcuser "$fp/state"
+}
+
+setup_v4recovery()
+{
+ declare recoverydir="$OCF_RESKEY_path/$OCF_RESKEY_nfspath/v4recovery"
+
+ # mounts /proc/fs/nfsd for us
+ lsmod | grep -q nfsd
+ if [ $? -ne 0 ]; then
+ modprobe nfsd
+ fi
+
+ val=$(cat "$PROC_V4RECOVERY")
+
+ # Ensure start-after-start works
+ if [ "$val" = "$recoverydir" ]; then
+ return 0
+ fi
+
+ #
+ # If the value is not default, there may be another
+ # cluster service here already which has replaced
+ # the v4 recovery directory. In that case,
+ # we must refuse to go any further.
+ #
+ if [ "$val" != "$V4RECOVERY" ]; then
+ ocf_log err "NFSv4 recovery directory has an unexpected value: $val"
+ return 1
+ fi
+
+ #
+ # Redirect nfs v4 recovery dir to shared storage
+ #
+ echo "$recoverydir" > "$PROC_V4RECOVERY"
+ if [ $? -ne 0 ]; then
+ echo "Uh oh... echo failed!?"
+ fi
+
+ val="$(cat $PROC_V4RECOVERY)"
+ if [ "$val" != "$recoverydir" ]; then
+ ocf_log err "Failed to change NFSv4 recovery path"
+ ocf_log err "Wanted: $recoverydir; got $val"
+ return 1
+ fi
+
+ return 0
+}
+
+
+cleanup_v4recovery()
+{
+ #
+ # Restore nfsv4 recovery directory to default
+ #
+ echo "$V4RECOVERY" > "$PROC_V4RECOVERY"
+ return $?
}
is_bound()
{
- mount | grep -q "$1 on $2 type none (.*bind)"
+ mount | grep -q "$1 on $2 type none (.*bind.*)"
return $?
}
-mount_tree()
+setup_tree()
{
declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
- # what about /var/lib/nfs/rpc_pipefs ? sunrpc mount?
- # is that really needed?
-
- if is_bound $fp /var/lib/nfs; then
- ocf_log debug "$fp is already bound to /var/lib/nfs"
+ if is_bound $fp/statd /var/lib/nfs/statd; then
+ ocf_log debug "$fp is already bound to /var/lib/nfs/statd"
return 0
fi
- log_do mount -o bind $fp /var/lib/nfs
+ mount -o bind "$fp/statd" /var/lib/nfs/statd
+ cp -a "$fp"/*tab /var/lib/nfs
+ restorecon /var/lib/nfs
}
-umount_tree()
+cleanup_tree()
{
declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
- if is_bound $fp /var/lib/nfs; then
- log_do umount /var/lib/nfs
- return $?
+ if is_bound "$fp/statd" /var/lib/nfs/statd; then
+ log_do umount /var/lib/nfs/statd || return 1
+ else
+ ocf_log debug "$fp is not bound to /var/lib/nfs/statd"
fi
- ocf_log debug "$fp is not bound to /var/lib/nfs"
+ cp -a /var/lib/nfs/*tab "$fp"
+
return 0
}
@@ -247,8 +333,8 @@ start_locking()
#
# Synchronize these before starting statd
#
- cp -f /var/lib/nfs/statd/sm-ha/* /var/lib/nfs/statd/sm/* 2> /dev/null
- cp -f /var/lib/nfs/statd/sm/* /var/lib/nfs/statd/sm-ha/* 2> /dev/null
+ cp -f /var/lib/nfs/statd/sm-ha/* /var/lib/nfs/statd/sm 2> /dev/null
+ cp -f /var/lib/nfs/statd/sm/* /var/lib/nfs/statd/sm-ha 2> /dev/null
if pidof rpc.statd &> /dev/null; then
ocf_log debug "rpc.statd is already running"
@@ -261,7 +347,8 @@ start_locking()
# because we can't do the "copy" that we do on the down-state...
#
ocf_log info "Starting rpc.statd"
- rpc.statd -H $0 -Fd &
+ rm -f /var/run/sm-notify.pid
+ rpc.statd -H $0 -d
ret=$?
if [ $ret -ne 0 ]; then
ocf_log err "Failed to start rpc.statd"
@@ -308,15 +395,6 @@ stop_locking()
{
declare ret
- # Rip from nfslock
- ocf_log info "Stopping NFS lockd"
- if killkill lockd; then
- ocf_log debug "NFS lockd is stopped"
- else
- ocf_log err "Failed to stop NFS lockd"
- return 1
- fi
-
ocf_log info "Stopping rpc.statd"
if terminate rpc.statd; then
ocf_log debug "rpc.statd is stopped"
@@ -335,18 +413,20 @@ case $1 in
start)
# Check for and source configuration file
ocf_log info "Starting NFS Server $OCF_RESKEY_name"
- create_tree
- mount_tree
+ create_tree || exit 1
+ setup_tree || exit 1
+ setup_v4recovery || exit 1
start_locking
nfs_daemons start
- if [ $? -eq 0 ]; then
+ rv=$?
+ if [ $rv -eq 0 ]; then
ocf_log info "Started NFS Server $OCF_RESKEY_name"
exit 0
fi
ocf_log err "Failed to start NFS Server $OCF_RESKEY_name"
- exit $?
+ exit $rv
;;
status|monitor)
@@ -365,9 +445,9 @@ stop)
rm -f /var/lib/nfs/statd/sm-ha/* &> /dev/null
cp -f /var/lib/nfs/statd/sm/* /var/lib/nfs/statd/sm-ha &> /dev/null
- stop_locking
- umount_tree
- # todo - error check here?
+ stop_locking || exit 1
+ cleanup_v4recovery
+ cleanup_tree || exit 1
exit 0
;;
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d1…
Commit: d1f160b7adc26c41029186d071e4562ffcd98a4b
Parent: 3580d8c1e9d4dd0c7ad1259d1430e34ac87034e7
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Fri Jul 16 11:36:37 2010 +0200
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Jul 16 17:14:56 2010 -0400
cman config: copy all logging objects to the top level tree
Resolves: rhbz#615202
NOTE: this fix also recommends the proposed patch for rhbz#615203
or in certain configuration cases, corosync will refuse to start.
Workaround, disable custom logging_daemon options in cluster.conf.
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
cman/daemon/cman-preconfig.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index fb08e96..36620c6 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1080,7 +1080,7 @@ static int copy_config_tree(struct objdb_iface_ver0 *objdb, hdb_handle_t source_
while ( (res = objdb->object_find_next(find_handle, &object_handle) == 0)) {
/* Down we go ... */
- copy_config_tree(objdb, object_handle, new_object, 0);
+ copy_config_tree(objdb, object_handle, new_object, always_create);
}
objdb->object_find_destroy(find_handle);
@@ -1188,7 +1188,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
}
/* copy /cluster/logging to /logging */
- ret = copy_tree_to_root(objdb, "logging", 0);
+ ret = copy_tree_to_root(objdb, "logging", 1);
/* Note: we do NOT delete /totem as corosync stores other things in there that
it needs! */
@@ -1320,7 +1320,7 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error
else {
/* Move these to a place where corosync expects to find them */
ret = copy_tree_to_root(objdb, "totem", 0);
- ret = copy_tree_to_root(objdb, "logging", 0);
+ ret = copy_tree_to_root(objdb, "logging", 1);
ret = copy_tree_to_root(objdb, "event", 0);
ret = copy_tree_to_root(objdb, "amf", 0);
ret = copy_tree_to_root(objdb, "aisexec", 0);
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=35…
Commit: 3580d8c1e9d4dd0c7ad1259d1430e34ac87034e7
Parent: 81613313c567bf9357cc8218876753dc32fd26f7
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Jul 16 17:02:46 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Jul 16 17:07:52 2010 -0400
doc: Add tomcat-6 to cluster_conf.html
Resolves: rhbz#614127
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
doc/cluster_conf.html | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/doc/cluster_conf.html b/doc/cluster_conf.html
index c540927..17d3f37 100644
--- a/doc/cluster_conf.html
+++ b/doc/cluster_conf.html
@@ -104,6 +104,10 @@
<<a href="#tag_tomcat-5">tomcat-5</a> ...><br/>
<a href="#ref_CHILDREN">CHILDREN</a><br/>
<<a href="#tag_tomcat-5">/tomcat-5</a>><br/>
+<br/><a name="ref_TOMCAT-6"/>TOMCAT-6 definition<br/>
+ <<a href="#tag_tomcat-6">tomcat-6</a> ...><br/>
+ <a href="#ref_CHILDREN">CHILDREN</a><br/>
+ <<a href="#tag_tomcat-6">/tomcat-6</a>><br/>
<br/><a name="ref_LVM"/>LVM definition<br/>
<<a href="#tag_lvm">lvm</a> ...><br/>
<a href="#ref_CHILDREN">CHILDREN</a><br/>
@@ -154,6 +158,7 @@
<a href="#ref_MYSQL">MYSQL</a><br/>
<a href="#ref_POSTGRES-8">POSTGRES-8</a><br/>
<a href="#ref_TOMCAT-5">TOMCAT-5</a><br/>
+ <a href="#ref_TOMCAT-6">TOMCAT-6</a><br/>
<a href="#ref_LVM">LVM</a><br/>
<a href="#ref_VM">VM</a><br/>
<a href="#ref_SAPINSTANCE">SAPINSTANCE</a><br/>
@@ -236,6 +241,7 @@
<tr valign="top"><td><a href="#tag_script"><b>script</b></a></td><td>LSB-compliant init script as a clustered resource.</td></tr>
<tr valign="top"><td><a href="#tag_service"><b>service</b></a></td><td>Defines a service (resource group).</td></tr>
<tr valign="top"><td><a href="#tag_tomcat-5"><b>tomcat-5</b></a></td><td>Defines a Tomcat server</td></tr>
+<tr valign="top"><td><a href="#tag_tomcat-6"><b>tomcat-6</b></a></td><td>Defines a Tomcat server</td></tr>
<tr valign="top"><td><a href="#tag_totem"><b>totem</b></a></td><td>OpenAIS msg transport protocol</td></tr>
<tr valign="top"><td><a href="#tag_unfence"><b>unfence</b></a></td><td>Contains devices for unfencing the node. fence_node(8)</td></tr>
<tr valign="top"><td><a href="#tag_vm"><b>vm</b></a></td><td>Defines a Virtual Machine</td></tr>
@@ -920,6 +926,7 @@ This element and its attributes define parameters for the quorum disk daemon, qu
<br/>
<table><tr valign="top"><td>Attribute</td><td>Description</td></tr>
<tr><td><b>allow_kill</b></td><td>Instruct cman to evict nodes which are not updating the quorum disk. qdisk(5).</td></tr>
+ <tr><td><b>cman_label</b></td><td>This is the name used by CMAN for the quorum device instead of the device name. qdisk(5).</td></tr>
<tr><td><b>device</b></td><td>The storage device the quorum daemon uses. The device must be the same on all nodes. qdisk(5).</td></tr>
<tr><td><b>interval</b></td><td>The frequency of read/write cycles, in seconds. qdisk(5).</td></tr>
<tr><td><b>io_timeout</b></td><td>Die if we cannot get a write out to disk after interval*tko. qdisk(5).</td></tr>
@@ -1072,6 +1079,21 @@ Defines a Tomcat server<br/>
<tr><td><b>__max_failures</b></td><td>Maximum number of failures before returning a failure to a status check.</td></tr>
</table><br/>
Children: <a href="#ref_CHILDREN">CHILDREN</a> <br/><a href="#" onClick="history.go(-1)" />Back</a> | <a href="#toc_tag_reference">Contents</a>
+<h3><a name="tag_tomcat-6"/>tomcat-6</h3>
+Defines a Tomcat server<br/>
+<br/>
+<table><tr valign="top"><td>Attribute</td><td>Description</td></tr>
+ <tr><td><b>config_file</b></td><td>Config File</td></tr>
+ <tr><td><b>name</b></td><td>Name</td></tr>
+ <tr><td><b>ref</b></td><td>Reference to existing tomcat-6 resource in the resources section.</td></tr>
+ <tr><td><b>service_name</b></td><td>Inherit the service name.</td></tr>
+ <tr><td><b>shutdown_wait</b></td><td>Wait X seconds for correct end of service shutdown</td></tr>
+ <tr><td><b>__enforce_timeouts</b></td><td>Consider a timeout for operations as fatal.</td></tr>
+ <tr><td><b>__failure_expire_time</b></td><td>Amount of time before a failure is forgotten.</td></tr>
+ <tr><td><b>__independent_subtree</b></td><td>Treat this and all children as an independent subtree.</td></tr>
+ <tr><td><b>__max_failures</b></td><td>Maximum number of failures before returning a failure to a status check.</td></tr>
+</table><br/>
+Children: <a href="#ref_CHILDREN">CHILDREN</a> <br/><a href="#" onClick="history.go(-1)" />Back</a> | <a href="#toc_tag_reference">Contents</a>
<h3><a name="tag_totem"/>totem</h3>
OpenAIS msg transport protocol<br/>
<br/>