Bug 124238 - sysutils/heartbeat: patch request
sysutils/heartbeat: patch request
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Stefan Walter
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-03 16:30 UTC by meritus
Modified: 2009-01-27 11:00 UTC (History)
0 users

See Also:


Attachments
patch-configure (8.90 KB, text/plain)
2009-01-18 02:40 UTC, ryba
no flags Details
patch_heartbeat (13.41 KB, text/plain)
2009-01-21 20:40 UTC, ryba
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description meritus 2008-06-03 16:30:01 UTC
#1
port sysutils/heartbeat has problem when trying to find an interface for ip address.
To fetch this interface, following line is applied (shell script):

 $IFCONFIG | grep "$ipaddr" -B4 | grep "UP," | cut -d ":" -f 1

This usability is limited to one alias per interface (grep -B4).
I provide here a patch which drops this limitation. 

#2
heartbeat lacks a proper 'resource' for starting/stopping rc.d scripts upon moving  through the nodes. I provide here a script (BSDService) which allows this functionality. This file should be installed in /usr/local/etc/ha.d/resource.d

Please update this port by adding my 2 patches.
Best regards & have a good day!

Fix: #1 - patch

# diff -u ~ryba/_ha_orig/IPaddr /usr/local/etc/ha.d/resource.d/IPaddr


#
+#      Find out which alias serves the given IP address
+#      The argument is an IP address, and its output
+#      is an aliased interface name (e.g., "eth0:0").
+#
+find_interface_bsd() {
+
+  ipaddr="$1";
+
+  for ifname in `$IFCONFIG -l`
+  do
+#    echo "IFNAME:$ifname"
+    $IFCONFIG $ifname | grep "inet.*[: ]$ipaddr " >/dev/null 2>&1
+    if [ $? -eq 0 ]
+    then
+      echo $ifname
+      return 0
+    fi
+  done
+  return 1
+}
+
+#
 #      Find out which alias serves the given IP address
 #      The argument is an IP address, and its output
 #      is an aliased interface name (e.g., "eth0:0").
@@ -131,6 +153,9 @@
        SunOS)
                IF=`find_interface_solaris $BASEIP`
         ;;
+       *BSD)
+               IF=`find_interface_bsd $BASEIP`
+       ;;
       *)
                IF=`find_interface_generic $BASEIP`
        ;;
@@ -461,6 +486,9 @@
        SunOS)
                j=1
                ;;
+       *BSD)
+               j=1
+               ;;
        *)
                j=0
                 TRYADRCNT=`ls "${NICBASE}:"* | wc -l | tr -d ' ' 2>/dev/null`



#2) - BSDService resource file:

# cat BSDService
#!/bin/sh
#
# Created VI 2008 by Piotr Rybicki (meritus@innervision.pl)
#
#       This script can be used do start/stop FreeBSD's
#       /usr/local/etc/rc.d/* services.
#
#       One MUST NOT enable service (in /etc/rc.conf
#       there cannot be SERVICE_enable"YES" line)
#
#       usage: $0 {start|stop|status}
#
# An example usage in /usr/local/etc/ha.d/haresources:
#       node1  10.0.0.170 BSDService::mysql-server
#

usage() {
  cat <<-!
        usage: $0 SERVICE {start|stop|status}";
        !
  exit 1
}

. /usr/local/etc/ha.d/shellfuncs

RCD=/usr/local/etc/rc.d

#VARLIB=/var/lib/heartbeat
#VLFILE=$VARLIB/rsctmp/Delay

BSDService_Status() {
  if [ ! -f $RCD/$1 ]
  then
    echo "There is no $RCD/$1 script!. Fatal"
  fi
  $RCD/$1 onestatus 2>&1 1>/dev/null
  if [ $? -eq 0 ]
  then
    if [ $2 = 'verbose' ]
    then
      echo "Service $1 is running OK"
    fi
    return 0
  else
    if [ $2 = 'verbose' ]
    then
      echo "Service $1 is NOT running"
    fi
    return 1
  fi
}

BSDService_Start() {
    BSDService_Status $1 noverbose
  if [ $? -eq 0 ]
  then
    echo "Service $1 already running"
    return 0
  else
    $RCD/$1 onestart
    return $?
  fi
}

BSDService_Stop() {
  BSDService_Status $1 noverbose
  if [ $? -eq 0 ]
  then
    $RCD/$1 onestop
    return $?
  else
    echo "Service $1 already stopped"
    return 0
  fi
}


if [ $# -ne 2 ]
then
  usage; exit 1;
fi

case $2 in
  start)                BSDService_Start $1 ;;
  stop)                 BSDService_Stop $1 ;;
  status)               BSDService_Status $1 verbose ;;
  *)                    usage
                        exit 1;;
esac
exit $?--4nmtixDVKE4UaWjzM63Vtk8m4HDHKJ6pVRLbwcOUiVSbXe65
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- /home/ryba/_ha_orig/IPaddr  2008-06-03 13:48:41.000000000 +0200
+++ /usr/local/etc/ha.d/resource.d/IPaddr       2008-06-03 14:24:26.000000000 +0200
@@ -80,6 +80,28 @@
 }
How-To-Repeat: #1 - try using more than one IP alias as a cluster resource

#2 - try to use rc.d service as a cluster resource (in an easy way)
Comment 1 Edwin Groothuis freebsd_committer 2008-06-03 22:39:15 UTC
Maintainer of sysutils/heartbeat,

Please note that PR ports/124238 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/124238

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer 2008-06-03 22:39:17 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Wesley Shields freebsd_committer 2008-06-04 20:49:31 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wxs

I'll take it.
Comment 4 scott 2008-06-04 21:02:12 UTC
The patch adds functionality outside of the upstream package, and should be
applied upstream so that users of all flavours of BSD can benefit, to
keep the FreeBSD port simple, and to make sure that the additional code
conforms to the original project's coding practices.

-- 
Regards,                    tummy.com, ltd
Scott Kleihege              Linux Consulting since 1995
                            http://www.tummy.com/
Comment 5 Wesley Shields freebsd_committer 2008-06-04 21:15:01 UTC
On Wed, Jun 04, 2008 at 08:10:03PM +0000, Scott Kleihege wrote:
> The following reply was made to PR ports/124238; it has been noted by GNATS.
> 
> From: Scott Kleihege <scott@tummy.com>
> To: bug-followup@FreeBSD.org
> Cc:  
> Subject: Re: ports/124238: sysutils/heartbeat - patch request
> Date: Wed, 4 Jun 2008 14:02:12 -0600
> 
>  The patch adds functionality outside of the upstream package, and should be
>  applied upstream so that users of all flavours of BSD can benefit, to
>  keep the FreeBSD port simple, and to make sure that the additional code
>  conforms to the original project's coding practices.

Does this mean you are rejecting the changes and asking that they be
submitted upstream?  Or should we add the patches and until the next
release (and subsequent update of the port) include them in our port?

If the functionality is useful enough I'd suggest the latter.

-- WXS
Comment 6 scott-ports 2008-06-04 22:10:47 UTC
On Wed, Jun 04, 2008 at 04:15:01PM -0400, Wesley Shields wrote:
>On Wed, Jun 04, 2008 at 08:10:03PM +0000, Scott Kleihege wrote:
>> The following reply was made to PR ports/124238; it has been noted by GNATS.
>> 
>> From: Scott Kleihege <scott@tummy.com>
>> To: bug-followup@FreeBSD.org
>> Cc:  
>> Subject: Re: ports/124238: sysutils/heartbeat - patch request
>> Date: Wed, 4 Jun 2008 14:02:12 -0600
>> 
>>  The patch adds functionality outside of the upstream package, and should be
>>  applied upstream so that users of all flavours of BSD can benefit, to
>>  keep the FreeBSD port simple, and to make sure that the additional code
>>  conforms to the original project's coding practices.
>
>Does this mean you are rejecting the changes and asking that they be
>submitted upstream?  Or should we add the patches and until the next
>release (and subsequent update of the port) include them in our port?
>
>If the functionality is useful enough I'd suggest the latter.
>
>-- WXS

Sounds good.

I accept the changes until the next release of the port, and encourage
Piotr to submit the patches upstream.  Information about contacting
the development mailing list is available at

   http://linux-ha.org/ContactUs

-- 
Regards,                    tummy.com, ltd
Scott Kleihege              Linux Consulting since 1995
                            http://www.tummy.com/
Comment 7 wxs 2008-08-27 04:25:09 UTC
Sorry for the delay but upon second thought I agree with Scott on this.
These patches should be submitted upstream and picked up in the next
update of the port.  As neither of these are FreeBSD specific we should
try to get them upstream rather than into our own tree.

Piotr, can you please work with the upstream to get these into the next
release?

-- WXS
Comment 8 Stefan Walter freebsd_committer 2008-10-16 19:13:20 UTC
Hi,

please note that issue #1 should be fixed by the patch from ports/126628
which has just been committed.

Regards,
Stefan
Comment 9 Wesley Shields freebsd_committer 2008-11-02 19:42:40 UTC
Responsible Changed
From-To: wxs->freebsd-ports-bugs

Back to the pool.
Comment 10 Stefan Walter freebsd_committer 2008-12-12 15:35:02 UTC
Hi Scott, hi Piotr,

there hasn't been an update on this issue [1] for quite a while. Can you
let me know what the state of this is? Scott, should any more changes be
committed to the port, or would you prefer the changes to be integrated
upstream first? In the latter case, I would close this PR.

Best regards,
Stefan

[1]: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/124238
Comment 11 Stefan Walter freebsd_committer 2008-12-16 15:22:40 UTC
Hi Scott, hi Piotr,

Scott Kleihege, 16.12.08, 13:14h CET:

> On Fri, Dec 12, 2008 at 04:35:02PM +0100, Stefan Walter wrote:
> >there hasn't been an update on this issue [1] for quite a while. Can you
> >let me know what the state of this is? Scott, should any more changes be
> >committed to the port, or would you prefer the changes to be integrated
> >upstream first? In the latter case, I would close this PR.
> 
> Hi Stefan,
> 
> As you noted on Thu, 16 Oct 2008, issue [1] should be fixed by the patch
> from ports/126628.  Issue [2] is an enhancement that I still think would be
> beneficial to submit upstream, but is useful enough that I approve it
> for the port.

OK. It was unclear to me from reading the history of followups if the
second part should or shouldn't be committed now.

> Is there any new information you are looking for?

Can you (Piotr and/or Scott) please send a patch containing the changes to
be made to the port's directory?

Regards,
Stefan
Comment 12 Stefan Walter freebsd_committer 2008-12-17 17:00:44 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stefan

Take.
Comment 13 Stefan Walter freebsd_committer 2009-01-08 10:40:26 UTC
Hi Piotr, hi Scott,

is anyone of you working on a patch for the port?

Regards,
Stefan
Comment 14 scott-ports 2009-01-10 00:06:01 UTC
On Thu, Jan 08, 2009 at 11:40:26AM +0100, Stefan Walter wrote:
>Hi Piotr, hi Scott,
>
>is anyone of you working on a patch for the port?

Not I.  Not enough free time to work on a patch at present here.

-- 
Regards,                    tummy.com, ltd
Scott Kleihege              Linux Consulting since 1995
                            http://www.tummy.com/
Comment 15 ryba 2009-01-11 12:59:19 UTC
Hi there

If You examine closely, commited patch for issue #1 just pushes limit of
IP addresses a little bit further. My proiposal doesn't contain any
limit of IP aliases for interface.
Issue #2 is also solved - new resurce appears - bsdservice.

In my opinion, patch is (and was) ready do be commited.
I don't see real chances to success if i shoud send this to upstream,
because version1.X of heartbeat is no longer developed for years.

I believe there should be paid more attention do heartbeat2 new port
request
(http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/121050)

Best regards
Piotr Rybicki
Comment 16 Stefan Walter freebsd_committer 2009-01-11 15:44:14 UTC
Hi Piotr,

Piotr Rybicki, 11.01.09, 14:20h CET:

>  If You examine closely, commited patch for issue #1 just pushes limit of
>  IP addresses a little bit further. My proiposal doesn't contain any
>  limit of IP aliases for interface.
>  Issue #2 is also solved - new resurce appears - bsdservice.
>  
>  In my opinion, patch is (and was) ready do be commited.

The changes to be made might still be valid, but what I meant was that the
patch you sent does not apply to the port's files - it applies to the
files after installation. What would be needed for testing/committing is a
patch that modifies the port's directory (sysutils/heartbeat).

>  I don't see real chances to success if i shoud send this to upstream,
>  because version1.X of heartbeat is no longer developed for years.
>  
>  I believe there should be paid more attention do heartbeat2 new port
>  request
>  (http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/121050)

I might have a look at that one later when I have the time.

Regards,
Stefan
Comment 17 ryba 2009-01-11 22:47:03 UTC
Stefan Walter pisze:
> Hi Piotr,
>
>
> The changes to be made might still be valid, but what I meant was that the
> patch you sent does not apply to the port's files - it applies to the
> files after installation. What would be needed for testing/committing is a
> patch that modifies the port's directory (sysutils/heartbeat).
>   
Ahh, i've forgotten that my patch is no-use for commiting to ports tree.
Same excuse here - lack of time ;-) . But i believe it's my part to
create an acceptable patch ans send in this PR. So stay tuned...

Best regards
Piotr Rybicki
Comment 18 ryba 2009-01-18 02:40:54 UTC
I've got one problem with one patch. Can't apply plainly.

patch done witch : diff -u configure.orig configure

I suppose problem lies in line length, but i can't figure out how to
solve it.
If this issue is solved, then i'm ready with a final patch for the port.
Please help.

Thanks & best regards

Piotr Rybicki
Comment 19 ryba 2009-01-21 20:40:23 UTC
Ok, here is final patch for heartbeat1 port.

Please commit. Thanks
Piotr Rybicki
Comment 20 dfilter freebsd_committer 2009-01-27 10:52:32 UTC
stefan      2009-01-27 10:52:18 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/heartbeat   Makefile pkg-plist 
    sysutils/heartbeat/files patch-heartbeat_resource.d_IPaddr.in 
  Added files:
    sysutils/heartbeat/files patch-configure 
                             patch-heartbeat-resource.d-BSDService.in 
                             patch-heartbeat-resource.d-Makefile.in 
  Removed files:
    sysutils/heartbeat/files extrapatch-lib-clplumbing-resource.h 
  Log:
  - Add a proper resource for starting/stopping rc.d script.
  - Improve detection of interfaces.
  
  PR:             124238
  Submitted by:   Piotr Rybicki <meritus@innervision.pl>
  Approved by:    maintainer
  
  Revision  Changes    Path
  1.17      +1 -1      ports/sysutils/heartbeat/Makefile
  1.2       +0 -154    ports/sysutils/heartbeat/files/extrapatch-lib-clplumbing-resource.h (dead)
  1.1       +20 -0     ports/sysutils/heartbeat/files/patch-configure (new)
  1.1       +95 -0     ports/sysutils/heartbeat/files/patch-heartbeat-resource.d-BSDService.in (new)
  1.1       +37 -0     ports/sysutils/heartbeat/files/patch-heartbeat-resource.d-Makefile.in (new)
  1.2       +52 -9     ports/sysutils/heartbeat/files/patch-heartbeat_resource.d_IPaddr.in
  1.5       +1 -0      ports/sysutils/heartbeat/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 21 Stefan Walter freebsd_committer 2009-01-27 10:53:47 UTC
State Changed
From-To: feedback->closed

Patch committed (with a couple of modifications), thanks!