diff -Nru lvm2-2.02.66/debian/changelog lvm2-2.02.66/debian/changelog --- lvm2-2.02.66/debian/changelog 2010-12-07 07:08:52.000000000 -0600 +++ lvm2-2.02.66/debian/changelog 2011-01-14 15:39:12.000000000 -0600 @@ -1,3 +1,12 @@ +lvm2 (2.02.66-4ubuntu2) natty; urgency=low + + * Add support for corosync based clusters. (LP: #525287) + - Build clvm with support for corosync, openais and cman + - Add and install clvmd resource agent, written by Xinwei Hu, + slightly modified by Ante Karamatic to work on Ubuntu + + -- Andres Rodriguez Fri, 14 Jan 2011 15:39:03 -0600 + lvm2 (2.02.66-4ubuntu1) natty; urgency=low * Merge from debian unstable. Remaining changes: diff -Nru lvm2-2.02.66/debian/clvmd.ra lvm2-2.02.66/debian/clvmd.ra --- lvm2-2.02.66/debian/clvmd.ra 1969-12-31 18:00:00.000000000 -0600 +++ lvm2-2.02.66/debian/clvmd.ra 2011-01-13 16:04:33.000000000 -0600 @@ -0,0 +1,221 @@ +#!/bin/bash +# Copyright (c) 2008 Xinwei Hu +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +####################################################################### + +# OCF initialization +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs + +# Parameter defaults +: ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"} +: ${OCF_RESKEY_daemon_timeout:="80"} +: ${OCF_RESKEY_daemon_options:="-d0"} + +# Common variables +DAEMON="/usr/sbin/clvmd" + +status_daemon() +{ + PID=`pidof "$DAEMON"` + if [ -n "$PID" ]; then + return $OCF_SUCCESS + fi + return $OCF_NOT_RUNNING +} + +bringup_daemon() +{ + if [ ! -e "$DAEMON" ]; then + ocf_log err "Required binary not found: $DAEMON" + return $OCF_ERR_INSTALLED + fi + + "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$? + if [ $rc != 0 ]; then + ocf_log err "Could not start $DAEMON" + return $OCF_ERR_GENERIC + fi + + sleep 1 + COUNT=0 + rc=$OCF_NOT_RUNNING + + while [ $rc = $OCF_NOT_RUNNING ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $DAEMON` did not come up" + return $OCF_ERR_GENERIC + fi + status_daemon; rc=$? + sleep 1 + done + + return $rc +} + +kill_daemon() +{ + status_daemon; rc=$? + if [ $rc != $OCF_SUCCESS ]; then + return rc + fi + + ocf_log info "Stopping `basename "$DAEMON"`" + killall -INT "$DAEMON" + + sleep 1 + status_daemon; rc=$? + + COUNT=0 + while [ $rc = $OCF_SUCCESS ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $DAEMON` shutdown emergency" + killall -9 "$DAEMON" + status_daemon; rc=$? + if [ $rc = $OCF_NOT_RUNNING ]; then + return $OCF_SUCCESS + else + return $OCF_ERR_GENERIC + fi + fi + killall -INT "$DAEMON" + sleep 1 + status_daemon; rc=$? + done + + return $OCF_SUCCESS +} + +clvmd_start() { + + clvmd_monitor; rc=$? + if [ $rc != $OCF_NOT_RUNNING ]; then + return $rc + fi + + ocf_log info "Starting $OCF_RESOURCE_INSTANCE" + + bringup_daemon + return $? +} + +clvmd_stop() { + clvmd_monitor; rc=$? + case $rc in + $OCF_NOT_RUNNING) return $OCF_SUCCESS;; + esac + + ocf_log info "Stopping $OCF_RESOURCE_INSTANCE" + + kill_daemon +} + +clvmd_monitor() { + clvmd_validate + + status_daemon + return $? +} + +clvmd_usage() { + echo "usage: $0 {start|stop|monitor|validate-all|meta-data}" + echo " Expects to have a fully populated OCF RA-compliant environment set." + echo " In particualr, a value for OCF_ROOT" +} + +clvmd_validate() { + : TODO: check for gloablly_unique=true and return OCF_ERR_CONFIGURED + case ${OCF_RESKEY_CRM_meta_gloablly_unique} in + yes|Yes|true|True|1) + ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the gloablly_unique=false meta attribute" + exit $OCF_ERR_CONFIGURED + ;; + esac + + return $OCF_SUCCESS +} + +meta_data() { + cat < + + + 1.0 + +This is a clvmd Resource Agent. +It starts clvmd as anonymous clones. + + clvmd resource agent + + + + +Number of seconds to allow the control daemon to come up and down + + Daemon Timeout + + + + + +Options to clvmd. Refer to clvmd.8 for detailed descriptions. + + Daemon Options + + + + + + + + + + + + + +END +} + +case $__OCF_ACTION in +meta-data) meta_data + exit $OCF_SUCCESS + ;; +start) clvmd_start + ;; +stop) clvmd_stop + ;; +monitor) clvmd_monitor + ;; +validate-all) clvmd_validate + ;; +usage|help) clvmd_usage + exit $OCF_SUCCESS + ;; +*) clvmd_usage + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac + +exit $? diff -Nru lvm2-2.02.66/debian/clvm.install lvm2-2.02.66/debian/clvm.install --- lvm2-2.02.66/debian/clvm.install 2010-05-15 10:23:36.000000000 -0500 +++ lvm2-2.02.66/debian/clvm.install 2011-01-14 15:25:03.000000000 -0600 @@ -1,2 +1,3 @@ usr/sbin/clvmd usr/share/man/man8/clvmd* +usr/lib/ocf/resource.d/lvm2/clvmd diff -Nru lvm2-2.02.66/debian/control lvm2-2.02.66/debian/control --- lvm2-2.02.66/debian/control 2010-11-18 16:41:58.000000000 -0600 +++ lvm2-2.02.66/debian/control 2011-01-13 16:00:37.000000000 -0600 @@ -4,7 +4,7 @@ Maintainer: Ubuntu Core Developers XSBC-Original-Maintainer: Debian LVM Team Uploaders: Bastian Blank -Build-Depends: debhelper (>> 4.2), automake, libcman-dev (>> 2), libdlm-dev (>> 2), libreadline-dev, libselinux1-dev, libudev-dev, pkg-config, quilt +Build-Depends: debhelper (>> 4.2), automake, libcman-dev (>> 2), libcorosync-dev, libopenais-dev, libdlm-dev (>> 2), libreadline-dev, libselinux1-dev, libudev-dev, pkg-config, quilt Standards-Version: 3.7.3 Homepage: http://sources.redhat.com/lvm2/ Vcs-Svn: svn://svn.debian.org/pkg-lvm/lvm2/trunk/ @@ -40,11 +40,12 @@ Package: clvm Priority: extra Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, lvm2 (= ${binary:Version}), lsb-base, cman +Depends: ${shlibs:Depends}, ${misc:Depends}, lvm2 (= ${binary:Version}), lsb-base, corosync | cman Description: Cluster LVM Daemon for lvm2 - This package provides the clustering interface for lvm2, when used with - Red Hat's "cman" cluster infrastructure. It allows logical volumes to - be created on shared storage devices (eg Fibre Channel, or iSCSI). + This package provides the clustering interface for lvm2, when used with + Red Hat's "cman" or corosync based (eg Pacemaker) cluster infrastructure. + It allows logical volumes to be created on shared storage devices + (eg Fibre Channel, or iSCSI). Package: libdevmapper-dev Section: libdevel diff -Nru lvm2-2.02.66/debian/rules lvm2-2.02.66/debian/rules --- lvm2-2.02.66/debian/rules 2010-11-15 12:31:19.000000000 -0600 +++ lvm2-2.02.66/debian/rules 2011-01-14 15:32:08.000000000 -0600 @@ -76,7 +76,7 @@ ./configure CFLAGS="$(CFLAGS)" \ $(CONFIGURE_FLAGS) \ --with-optimisation="" \ - --with-clvmd=cman \ + --with-clvmd=all \ --with-cluster=internal \ --with-device-uid=0 \ --with-device-gid=6 \ @@ -163,6 +163,8 @@ install_clvm: export DH_OPTIONS = -pclvm install_clvm: DIR = $(BUILD_DIR)/install_deb install_clvm: $(STAMPS_DIR)/install_deb + mkdir -p $(BUILD_DIR)/install_deb/usr/lib/ocf/resource.d/lvm2 + install -m 755 debian/clvmd.ra $(BUILD_DIR)/install_deb/usr/lib/ocf/resource.d/lvm2/clvmd +$(MAKE_SELF) install-base-prep INSTALL_DIR='$(DIR)' dh_installinit --no-start -- start 63 S . start 51 0 6 . +$(MAKE_SELF) install-base