Re: [Sheepdog] [PATCH v2 09/13] trace: add a ring buffer
On 02/16/2012 08:33 PM, Liu Yuan wrote: On 02/16/2012 11:40 PM, Steven Dake wrote: Have a look at the ring buffer in libqb. (http://www.libqb.org). It allows arbitrary sized ring buffers with arbitrary sized blocks of data (rather then pointers as in this implementation). I think libqb is kind of overkill for trace buffer. Simple ring buffer will suffice for the sheepdog trace data buffering currently. There is also tracing/logging in this library, but you may be more interested in the on/off model vs the always-on model imposed by libqb. (Even though the always-on model is very low overhead). Libqb is very powerful at logging, but not at tracing. It doesn't provide ftrace-like dynamic code patching for accounting the CPU usage at function granularity. Current sheepdog's logging system is sync logging, I have considered it to replace the sheepdog's current logging system to gain async logging for better performance, lower overhead. But I found that libqb does much more than logging, and the LOC of code base is even more than sheep's. So we are considering to add async capability to the current logging system instead of replacing it completely. Also has a nice flight recorder. But I hear you on LOC issue. In any regard keep it in mind for future projects. I am using for pacemaker cloud, and have found it really rocks and thus far haven't found any bugs (which is surprising). Regards -steve Thanks, Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH] Update sheepdog.spec.in to match Fedora upstream rpm
Signed-off-by: Steven Dake sd...@redhat.com --- sheepdog.spec.in | 32 +--- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sheepdog.spec.in b/sheepdog.spec.in index 937ea04..ce4ef14 100644 --- a/sheepdog.spec.in +++ b/sheepdog.spec.in @@ -2,13 +2,16 @@ Name: sheepdog Summary: The Sheepdog Distributed Storage System for KVM/QEMU Version: @version@ Release: 1%{?dist} -License: GPL +License: GPLv2 and GPLv2+ Group: System Environment/Base URL: http://www.osrg.net/sheepdog Source0: http://downloads.sourceforge.net/project/sheepdog/%{name}/%{version}/%{name}-%{version}.tar.gz # Runtime bits -Requires: corosync corosynclib +Requires: corosync +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts # Build bits BuildRequires: autoconf automake @@ -16,8 +19,12 @@ BuildRequires: corosync corosynclib corosynclib-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XX) +%description +This package contains the Sheepdog server, and command line tool which offer +a distributed object storage system for KVM. + %prep -%setup -q -n %{name}-%{version} +%setup -q %build ./autogen.sh @@ -37,15 +44,26 @@ rm -f %{buildroot}%{_libdir}/*.a %clean rm -rf %{buildroot} -%description -This package contains the Sheepdog server, and command line tool. +%post +/sbin/chkconfig --add sheepdog + +%preun +if [ $1 -eq 0 ] ; then + /sbin/service sheepdog stop /dev/null 21 + /sbin/chkconfig --del sheepdog +fi + +%postun +if [ $1 -ge 1 ] ; then + /sbin/service sheepdog condrestart /dev/null 21 || : +fi %files %defattr(-,root,root,-) -%doc COPYING README +%doc COPYING README INSTALL %{_sbindir}/sheep %{_sbindir}/collie -%{_initddir}/sheepdog +%attr(755,-,-)%config %{_initddir}/sheepdog %dir %{_localstatedir}/lib/sheepdog %{_mandir}/man8/sheep.8* -- 1.7.4.4 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] corosync.conf
On 05/03/2011 02:41 PM, MORITA Kazutaka wrote: At Sat, 30 Apr 2011 10:42:47 -0700 (PDT), Ski Mountain wrote: yes, stupid spelling mistake. So once I got the spelling mistake fixed fixed, it still did not start. So in the /var/log/corosync/corosync.log Is the fowling error message. I was able to fix it as it states by adding in consensus: 3200 just above the interface line. Just thought I should reply in case others has the same issue as I did when copying the included configuration files. Any idea why that line is not included in the example? The default values looks working in my environment. Perhaps, your corosync (0.2.0) is too old to use implicit default values. Thanks, Kazutaka Apr 30 13:38:06 corosync [SERV ] Unloading all Corosync service engines. Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync extended virtual synchrony service Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync configuration service Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync cluster closed process group service v1.01 Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync cluster config database access v1.01 Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync profile loading service Apr 30 13:38:06 corosync [SERV ] Service engine unloaded: corosync cluster quorum service v0.1 Apr 30 13:38:20 corosync [MAIN ] Corosync Cluster Engine ('1.2.0'): started and ready to provide service. Apr 30 13:38:20 corosync [MAIN ] Corosync built-in features: nss Apr 30 13:38:20 corosync [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'. Apr 30 13:38:20 corosync [MAIN ] parse error in config: The consensus timeout parameter (1200 ms) must be atleast 1.2 * token (1200 ms). This is a known bu whih was fixed atleast a year ago. If you compile by yourself, please use corosync 1.3.1 (available on www.corosync.org). If you use a distro compile, I'd suggest filing a bug asking for a rebase. To fix the problem, you can do something like totem { ... all the totem configuration data consensus: 1201 } Apr 30 13:38:20 corosync [MAIN ] Corosync Cluster Engine exiting with status -9 at main.c:1359. Thanks From: MORITA Kazutaka morita.kazut...@lab.ntt.co.jp To: Ski Mountain ski_the_mount...@yahoo.com Cc: sheepdog@lists.wpkg.org Sent: Thu, April 28, 2011 9:55:31 AM Subject: Re: [Sheepdog] corosync.conf At Thu, 28 Apr 2011 06:43:41 -0700 (PDT), Ski Mountain wrote: I am having some corosync configuration issues. I am very unfamiliar with corosync. When I try to start up corosync I get this error in syslog Apr 28 08:59:31 duo corosync[3614]: parse error in config: parse error in config: . Apr 28 08:59:31 duo corosync[3614]: [MAIN ] Corosync Cluster Engine ('1.2.0'): started and ready to provide service. Apr 28 08:59:31 duo corosync[3614]: [MAIN ] Corosync built-in features: nss Apr 28 08:59:31 duo corosync[3614]: [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'. Apr 28 08:59:31 duo corosync[3614]: [MAIN ] parse error in config: parse error in config: . Apr 28 08:59:31 duo corosync[3614]: [MAIN ] Corosync Cluster Engine exiting with status -9 at main.c:1331. and the corosync.conf pretty much copied from http://sourceforge.net/apps/trac/sheepdog/wiki/Corosync%20Config, with the bindnetaddr modified. What else do I need to do? I am asuming that I need to incurment ringnumber for each node, is that it. What could be causing the syntax error, this log is quite lacking in details. Thanks # Please read the corosync.conf 5 manual page compatibility: whitetank totem { version: 2 secauth: off threads: 0 # Note, fail_recv_const is only needed if you're # having problems with corosync crashing under # heavy sheepdog traffic. This crash is due to # delayed/resent/misordered multicast packets. # fail_recv_const: 5000 interface { ringnumber: 0 bindnetaddr: 10.1.2.145 mcastaddr: 226.94.1.1 mcastport: 5405 } } logging { fileline: off to_stderr: no to_logfile: yes to_syslog: yes # the pathname of the log file logfile: /var/log/corosyn/corosync.log I think you don't create /var/log/corosyn (misstype of /var/log/corosync/corosync.log?). Thanks, Kazutaka [1.2 text/html; us-ascii (7bit)] [2 text/plain; us-ascii (7bit)] -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] corosync performance
On 12/02/2010 09:38 AM, Gnep Zhao wrote: Hi, I'm just wondering whether corosync might be a bottleneck of sheepdog's performance? Depends how you define performance. In terms of I/O throughput/latency there is no impact from corosync. In terms of scale, there is a limiting factor imposed by Corosync. Regards -steve Gnep -- = *Often wrong, Never in doubt* = -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] CloudFS feature proposal
On 11/14/2010 05:52 PM, wari...@gmail.com wrote: Any plan to package Sheepdog? short answer : yes The sheepdog upstream repo needs one more man page which is sitting around on my harddisk in incomplete state. Once that is done, sheepdog needs a new upstream release with the current set of software. Once that is complete the userland component will be packaged, and the qemu portion is already available in rawhide. Hopeful can find a package reviewer once this is complete - the package is very simple, two binaries two man pages and an init script. If you are interested in reviewing the package, ping me offlist. Not sure how far we will get on libvirt integration in F15 - which is why this technology will be tech preview and may require manual launching of vms. Regards -steve On Mon, Nov 15, 2010 at 2:19 AM, Steven Dake sd...@redhat.com mailto:sd...@redhat.com wrote: On 11/13/2010 09:50 PM, Pete Zaitcev wrote: On Sat, 13 Nov 2010 19:58:37 -0700 Robyn Bergeron robyn.berge...@gmail.com mailto:robyn.berge...@gmail.com wrote: Jeff had mentioned on irc the idea of packaging RBD, which uses the lower layer of Ceph (per Jeff's description when we were talking). See, my agenda was to ask next if Jeff's CloudFS had enough consistency to back a block device emulator and thus displace Speepdog, which I see as too ad-hoc. Now if Jeff himself prefers to package RBD (RADOS), then It is true that sheepdog is not generically useful outside of block storage and specifically QEMU enabled systems (and perhaps XEN). However in the Fedora performance case, I expect sheepdog with its lower memory copy operation count and tight integration with QEMU to produce better performance results and lower cpu utilization, resulting in higher density of VMs on equivalent hardware. There is only one way to validate this speculation - integrate the various solutions into Fedora and see which has the best mix of real-world attributes. Regards -steve this may be an admission that CloudFS is not up to it. Or perhaps he does not like the idea for other reason. I just basically want him to discuss the alternatives. I know he knows about them more than I do, hence the question. -- Pete ___ cloud mailing list cl...@lists.fedoraproject.org mailto:cl...@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/cloud ___ cloud mailing list cl...@lists.fedoraproject.org mailto:cl...@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/cloud -- .: war|ola :. Use Fedora Linux for better computing experience http://fedoraproject.org ___ cloud mailing list cl...@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/cloud -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] Configuring simple cluster on CentOS 5.5 x86_64
Someone on the list was working on a fuse sheepdog daemon that exported the vdi's via the fs. Regards -steve On 10/21/2010 07:12 AM, Yuriy Kohut wrote: Hi, Is there a way translate Sheepdog VDIs into block devices on the boxes which belong to the cluster without using iSCSI ? --- Yura On Oct 20, 2010, at 2:23 PM, Yuriy Kohut wrote: One quick question. Is there any way to save/store created targets and logicalunits with 'tgtadm' ? They all are lost after machine reboot. --- Yura On Oct 19, 2010, at 6:40 PM, Yuriy Kohut wrote: Got it working. The next step is to try all that on real hardware 3 node cluster. Thank you for help. --- Yura On Oct 19, 2010, at 3:02 PM, MORITA Kazutaka wrote: Hi, Your sheep.log says Oct 19 05:59:06 send_message(169) failed to send message, 2 This means that the sheep daemon failed to communicate with corosync. Unfortunatelly, I've never seen such an error... Try following things: - restart corosync daemon - disable iptable and restart corosync - disable selinux and restart corosync Did sheepdog work fine when you tested it on debian? Thanks, Kazutaka On 2010/10/19 19:56, Yuriy Kohut wrote: Attached. Please feel free to kick me if anything else required. --- Yura On Oct 19, 2010, at 1:45 PM, MORITA Kazutaka wrote: Could you send me a sheep.log in the store directory? It would be helpful for debugging. Kazutaka On 2010/10/19 19:16, Yuriy Kohut wrote: The patch doesn't help. Probably I'm doing something wrong. but the following operation won't finish: # tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b test0 --bstype sheepdog Attached please find the the operation/command strace log archived: strace.log.tar.gz Please advise. Thank you --- Yura On Oct 19, 2010, at 11:52 AM, Yuriy Kohut wrote: Hi, Sure. I'll let you know results. Thank you. --- Yura On Oct 19, 2010, at 11:46 AM, MORITA Kazutaka wrote: Hi, At Fri, 15 Oct 2010 17:33:18 +0300, Yuriy Kohut wrote: One more new issue with TGTd. Initially we have one sheepdog vdi (on which we would like to create iscsi unit) and no tgt targets/units: [r...@centos ~]# tgtadm --op show --mode target [r...@centos ~]# collie vdi list nameidsizeused sharedcreation time vdi id -- test01 4.0 GB 4.0 GB 0.0 MB 2010-10-15 17:55 fd34af [r...@centos ~]# Creating new target: [r...@centos ~]# tgtadm --op new --mode target --tid 1 -T some.vps:disk0 [r...@centos ~]# tgtadm --op show --mode target Target 1: some.vps:disk0 System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 0001 SCSI SN: beaf10 Size: 0 MB Online: Yes Removable media: No Readonly: No Backing store type: null Backing store path: None Backing store flags: Account information: ACL information: [r...@centos ~]# Try to create new logicalunit on existing tgt target and sheepdog vdi: [r...@centos ~]# tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b test0 --bstype sheepdog But the process never ends. Please advise ... Thanks for your report. Can you try the following patch I sent minutes ago? http://lists.wpkg.org/pipermail/sheepdog/2010-October/000741.html Thanks, Kazutaka --- Yura On Oct 15, 2010, at 4:55 PM, Yuriy Kohut wrote: Cool, that works. Thanks --- Yura On Oct 15, 2010, at 3:52 PM, MORITA Kazutaka wrote: At Fri, 15 Oct 2010 13:38:16 +0300, Yuriy Kohut wrote: Hi, I'm using the following 'Getting Started' guide to configure simple cluster: http://www.osrg.net/sheepdog/usage.html I have configured cluster on 1 node/box, so the first questions are: Can I configure cluster on single node (1 box) under CentOS 5.5 x86_64 ? Is it required at least 3 nodes/boxes ... ? I have faced with the following issue on my single-node cluster. I have rebooted the box after my first image creation. The following done for that: - corosync is up and running udp0 0 192.168.128.195:54040.0.0.0:* 3541/corosync udp0 0 192.168.128.195:54050.0.0.0:* 3541/corosync udp0 0 226.94.1.1:5405 0.0.0.0:* 3541/corosync - sheep is up and running tcp0 0 0.0.0.0:70000.0.0.0:* LISTEN 3561/sheep - cluster is formatted with 1 copy only #collie cluster format --copies=1 - the image with prelocated data is created # qemu-img create sheepdog:test0 -o preallocation=data 4G So after such siple steps I got: # collie vdi list nameidsizeused sharedcreation time vdi id
Re: [Sheepdog] Configuring simple cluster on CentOS 5.5 x86_64
On 10/21/2010 07:47 AM, Yuriy Kohut wrote: As I know, fuse is ready to use filesystem. I would like to have block device mapped into existing VDI. Yes, the fuse fs exports all VDIs into a block devices. Not sure what the status of this work is though. Regards -steve --- Yura On Oct 21, 2010, at 5:33 PM, Steven Dake wrote: Someone on the list was working on a fuse sheepdog daemon that exported the vdi's via the fs. Regards -steve On 10/21/2010 07:12 AM, Yuriy Kohut wrote: Hi, Is there a way translate Sheepdog VDIs into block devices on the boxes which belong to the cluster without using iSCSI ? --- Yura On Oct 20, 2010, at 2:23 PM, Yuriy Kohut wrote: One quick question. Is there any way to save/store created targets and logicalunits with 'tgtadm' ? They all are lost after machine reboot. --- Yura On Oct 19, 2010, at 6:40 PM, Yuriy Kohut wrote: Got it working. The next step is to try all that on real hardware 3 node cluster. Thank you for help. --- Yura On Oct 19, 2010, at 3:02 PM, MORITA Kazutaka wrote: Hi, Your sheep.log says Oct 19 05:59:06 send_message(169) failed to send message, 2 This means that the sheep daemon failed to communicate with corosync. Unfortunatelly, I've never seen such an error... Try following things: - restart corosync daemon - disable iptable and restart corosync - disable selinux and restart corosync Did sheepdog work fine when you tested it on debian? Thanks, Kazutaka On 2010/10/19 19:56, Yuriy Kohut wrote: Attached. Please feel free to kick me if anything else required. --- Yura On Oct 19, 2010, at 1:45 PM, MORITA Kazutaka wrote: Could you send me a sheep.log in the store directory? It would be helpful for debugging. Kazutaka On 2010/10/19 19:16, Yuriy Kohut wrote: The patch doesn't help. Probably I'm doing something wrong. but the following operation won't finish: # tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b test0 --bstype sheepdog Attached please find the the operation/command strace log archived: strace.log.tar.gz Please advise. Thank you --- Yura On Oct 19, 2010, at 11:52 AM, Yuriy Kohut wrote: Hi, Sure. I'll let you know results. Thank you. --- Yura On Oct 19, 2010, at 11:46 AM, MORITA Kazutaka wrote: Hi, At Fri, 15 Oct 2010 17:33:18 +0300, Yuriy Kohut wrote: One more new issue with TGTd. Initially we have one sheepdog vdi (on which we would like to create iscsi unit) and no tgt targets/units: [r...@centos ~]# tgtadm --op show --mode target [r...@centos ~]# collie vdi list nameidsizeused sharedcreation time vdi id -- test01 4.0 GB 4.0 GB 0.0 MB 2010-10-15 17:55 fd34af [r...@centos ~]# Creating new target: [r...@centos ~]# tgtadm --op new --mode target --tid 1 -T some.vps:disk0 [r...@centos ~]# tgtadm --op show --mode target Target 1: some.vps:disk0 System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 0001 SCSI SN: beaf10 Size: 0 MB Online: Yes Removable media: No Readonly: No Backing store type: null Backing store path: None Backing store flags: Account information: ACL information: [r...@centos ~]# Try to create new logicalunit on existing tgt target and sheepdog vdi: [r...@centos ~]# tgtadm --op new --mode logicalunit --tid 1 --lun 1 -b test0 --bstype sheepdog But the process never ends. Please advise ... Thanks for your report. Can you try the following patch I sent minutes ago? http://lists.wpkg.org/pipermail/sheepdog/2010-October/000741.html Thanks, Kazutaka --- Yura On Oct 15, 2010, at 4:55 PM, Yuriy Kohut wrote: Cool, that works. Thanks --- Yura On Oct 15, 2010, at 3:52 PM, MORITA Kazutaka wrote: At Fri, 15 Oct 2010 13:38:16 +0300, Yuriy Kohut wrote: Hi, I'm using the following 'Getting Started' guide to configure simple cluster: http://www.osrg.net/sheepdog/usage.html I have configured cluster on 1 node/box, so the first questions are: Can I configure cluster on single node (1 box) under CentOS 5.5 x86_64 ? Is it required at least 3 nodes/boxes ... ? I have faced with the following issue on my single-node cluster. I have rebooted the box after my first image creation. The following done for that: - corosync is up and running udp0 0 192.168.128.195:54040.0.0.0:* 3541/corosync udp0 0 192.168.128.195:54050.0.0.0:* 3541/corosync udp0 0 226.94.1.1:5405 0.0.0.0:* 3541/corosync - sheep is up and running tcp0 0 0.0.0.0:70000.0.0.0:* LISTEN 3561/sheep
Re: [Sheepdog] corosync crashes
On 10/03/2010 11:43 PM, Robert Terhaar wrote: Hi All, I'm having some problems with corosync crashes in Fedora 14. Occasionally after pushing a lot of traffic thru sheepdog, corosync crashes, and writes to the logs a fairly unhelpful message corosync[23367]: [TOTEM ] FAILED TO RECEIVE I've attached my very basic corosync.conf below. Does this config look ok? compatibility: whitetank This is caused by delayed multicast messages. There is a patch in the below bz to address this issue. https://bugzilla.redhat.com/show_bug.cgi?id=619496 Another workaround that might be helpful if you don't want to rebuild your own package is changing the fail_recv_const (goes in totem directive) to a very large value such as 5000. Regards -steve totem { version: 2 secauth: off threads: 0 interface { ringnumber: 0 bindnetaddr: 192.168.10.185 mcastaddr: 226.94.1.1 mcastport: 5405 } } logging { fileline: off to_stderr: no to_logfile: yes to_syslog: yes logfile: /var/log/cluster/corosync.log debug: on timestamp: on logger_subsys { subsys: AMF debug: off } } amf { mode: disabled } and my corosync version info: # yum info corosync Installed Packages Name: corosync Arch: x86_64 Version : 1.2.8 Release : 1.fc14 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH] Add LSB style init script to build system
This patch adds an LSB style init script to the build system. It also installs it within the created RPM file. Please ignore last patch, was missing generic.in file. Signed-off-by: Steven Dake sd...@redhat.com --- configure.ac |1 + script/Makefile.am | 28 ++ script/generic.in | 141 sheepdog.spec.in |1 + 4 files changed, 171 insertions(+), 0 deletions(-) create mode 100755 script/generic.in diff --git a/configure.ac b/configure.ac index bf4d86e..b09b9e3 100644 --- a/configure.ac +++ b/configure.ac @@ -274,6 +274,7 @@ AC_SUBST([OS_DYFLAGS]) AM_CONDITIONAL(BUILD_HTML_DOCS, test -n ${GROFF}) +AC_SUBST([INITDDIR]) AC_SUBST([LINT_FLAGS]) AC_DEFINE_UNQUOTED([LOCALSTATEDIR], $(eval echo ${localstatedir}), [localstate directory]) diff --git a/script/Makefile.am b/script/Makefile.am index 3e6c380..22987ca 100644 --- a/script/Makefile.am +++ b/script/Makefile.am @@ -1,3 +1,31 @@ MAINTAINERCLEANFILES= Makefile.in +EXTRA_DIST = generic.in + noinst_HEADERS = bash_completion_collie checkarch.sh check-dog.pl start-sheepdog stop-sheepdog vditest + +target_INIT = generic + +%: %.in Makefile + rm -f $...@-t $@ + sed \ + -e 's#@''sbin...@#$(sbindir)#g' \ + -e 's#@''sysconf...@#$(sysconfdir)#g' \ + -e 's#@''initd...@#$(INITDDIR)#g' \ + -e 's#@''localstate...@#$(localstatedir)#g' \ + $ $...@-t + chmod 0755 $...@-t + mv $...@-t $@ + +all-local: $(target_INIT) + +clean-local: + rm -rf $(target_INIT) + +install-exec-local: + $(INSTALL) -d $(DESTDIR)/$(INITDDIR) + $(INSTALL) -m 755 generic $(DESTDIR)/$(INITDDIR)/sheepdog + +uninstall-local: + cd $(DESTDIR)/$(INITDDIR) \ + rm -f sheepdog diff --git a/script/generic.in b/script/generic.in new file mode 100755 index 000..a57ebc5 --- /dev/null +++ b/script/generic.in @@ -0,0 +1,141 @@ +#!/bin/bash +# chkconfig: - 21 21 +# description: Sheepdog +# processname: sheep +# +### BEGIN INIT INFO +# Provides:sheepdog +# Required-Start: $network +# Should-Start:$syslog +# Required-Stop: $network +# Default-Start: +# Default-Stop: +# Short-Description: Starts and stops Sheepdog. +# Description: Starts and stops Sheepdog. +### END INIT INFO +desc=Sheepdog QEMU/KVM Block Storage +prog=sheep + +# set secure PATH +PATH=/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@ +sheepdo...@sbindir@/sheep + +success() +{ + echo -ne [ OK ]\r +} + +failure() +{ + echo -ne [FAILED]\r +} + +status() +{ + pid=$(pidof $1 2/dev/null) + rtrn=$? + if [ $rtrn -ne 0 ]; then + echo $1 is stopped + else + echo $1 (pid $pid) is running... + fi + return $rtrn +} + +# rpm based distros +if [ -d @SYSCONFDIR@/sysconfig ]; then + [ -f @INITDDIR@/functions ] . @INITDDIR@/functions + [ -f @SYSCONFDIR@/sysconfig/$prog ] . @SYSCONFDIR@/sysconfig/$prog + [ -z $LOCK_FILE ] LOCK_FILE=@LOCALSTATEDIR@/lock/subsys/$prog +fi + +# deb based distros +if [ -d @SYSCONFDIR@/default ]; then + [ -f @SYSCONFDIR@/default/$prog ] . @SYSCONFDIR@/default/$prog + [ -z $LOCK_FILE ] LOCK_FILE=@LOCALSTATEDIR@/lock/$prog +fi + +# The version of __pids_pidof in /etc/init.d/functions calls pidof with -x +# This means it matches scripts, including this one. +# Redefine it here so that status (from the same file) works. +# Otherwise simultaneous calls to stop() will loop forever +__pids_pidof() { +pidof -c -o $$ -o $PPID -o %PPID $1 || \ +pidof -c -o $$ -o $PPID -o %PPID ${1##*/} +} + +start() +{ + echo -n Starting $desc ($prog): + + # most recent distributions use tmpfs for @LOCALSTATEDIR@/run + # to avoid to clean it up on every boot. + # they also assume that init scripts will create + # required subdirectories for proper operations + mkdir -p @LOCALSTATEDIR@/run + + if status $prog /dev/null 21; then + success + else + $prog -p 7000 @LOCALSTATEDIR@/lib/sheepdog /dev/null 21 + + # give it time to fail + sleep 2 + if status $prog /dev/null 21; then + touch $LOCK_FILE + success + else + failure + rtrn=1 + fi + fi + echo +} + +stop() +{ + ! status $prog /dev/null 21 return + + echo -n Stopping $desc ($prog): + killproc $prog + RETVAL=$? + rm -f $LOCK_FILE + success + echo +} + +restart() +{ + stop + start +} + +rtrn=0 + +case $1 in +start) + start +;; +restart|reload|force-reload) + restart +;; +condrestart|try-restart) + if status $prog /dev/null 21; then + restart + fi
[Sheepdog] [PATCH] Add sheepdog RPM generation to autotools system
This patch adds the logic necessary to generate an RPM file within the sheepdog working dir by running the command make rpm. Signed-off-by: Steven Dake sd...@redhat.com --- Makefile.am | 39 ++- sheepdog.spec.in | 52 2 files changed, 90 insertions(+), 1 deletions(-) create mode 100644 sheepdog.spec.in diff --git a/Makefile.am b/Makefile.am index 88b174c..7bff145 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,8 @@ -EXTRA_DIST = +SPEC = $(PACKAGE_NAME).spec + +TARFILE= $(PACKAGE_NAME)-$(VERSION).tar.gz + +EXTRA_DIST = autogen.sh AUTOMAKE_OPTIONS = foreign @@ -16,8 +20,41 @@ sheepdogsysconf_DATA = SUBDIRS= lib collie sheep include script install-exec-local: + $(INSTALL) -d $(DESTDIR)/${localstatedir}/lib/sheepdog uninstall-local: + rmdir $(DESTDIR)/${localstatedir}/lib/sheepdog || :; dist-clean-local: rm -f autoconf automake autoheader + +clean-generic: + rm -rf $(SPEC) $(TARFILE) + +$(SPEC): $(SPEC).in + rm -f $...@-t $@ + LC_ALL=C date=$(shell date +%a %b %d %Y) \ + sed \ + -e s...@version@#$(VERSION)#g \ + -e s...@date@#$$date#g \ + $ $...@-t + chmod a-w $...@-t + mv $...@-t $@ + +RPMBUILDOPTS = --define _sourcedir $(abs_builddir) \ + --define _specdir $(abs_builddir) \ + --define _builddir $(abs_builddir) \ + --define _srcrpmdir $(abs_builddir) \ + --define _rpmdir $(abs_builddir) + +$(TARFILE): + $(MAKE) dist + +srpm: clean + $(MAKE) $(SPEC) $(TARFILE) + rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC) + +rpm: clean + $(MAKE) $(SPEC) $(TARFILE) + rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) + diff --git a/sheepdog.spec.in b/sheepdog.spec.in new file mode 100644 index 000..dd9a94e --- /dev/null +++ b/sheepdog.spec.in @@ -0,0 +1,52 @@ +Name: sheepdog +Summary: The Sheepdog Distributed Storage System for KVM/QEMU +Version: @version@ +Release: 1%{?dist} +License: GPL +Group: System Environment/Base +URL: http://www.osrg.net/sheepdog +Source0: http://sourceforge.net/project/sheepdog/files/%{name}-%{version}.tar.gz + +# Runtime bits +Requires: corosync corosynclib + +# Build bits +BuildRequires: autoconf automake +BuildRequires: corosync corosynclib corosynclib-devel + +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XX) + +%prep +%setup -q -n %{name}-%{version} + +%build +./autogen.sh +%{configure} --with-initddir=%{_initrddir} + +make %{_smp_mflags} + +%install +rm -rf %{buildroot} + +make install DESTDIR=%{buildroot} + +## tree fixup +# drop static libs +rm -f %{buildroot}%{_libdir}/*.a + +%clean +rm -rf %{buildroot} + +%description +This package contains the Sheepdog server, and command line tool. + +%files +%defattr(-,root,root,-) +%doc COPYING README +%{_sbindir}/sheep +%{_sbindir}/collie +%dir %{_localstatedir}/lib/sheepdog + +%changelog +* @date@ Autotools generated version nob...@nowhere.org - @vers...@-1.@alphatag@ +- Autotools generated version -- 1.7.2.1 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] create_cluster(1652) Failed to join the sheepdog group, try again
On 08/11/2010 09:10 AM, Narendra Prasad Madanapalli wrote: Hi, I encounter mentioned error when sheep is started. I would appreciate if someone can help me to overcome these issues. Here is the details of corosync sheepdog: OS Distro: FC11 Corosync: corosynclib-devel-1.2.3-1.fc11.i586 corosync-1.2.3-1.fc11.i586 corosynclib-1.2.3-1.fc11.i586 You may have iptables enabled which blocks corosync from executing. Another common problem is selinux is enabled, which only works well on newer fedora versions. Regards -steve Corosync log contents when it is started: Aug 11 09:29:36 corosync [MAIN ] Corosync Cluster Engine ('1.2.3'): started and ready to provide service. Aug 11 09:29:36 corosync [MAIN ] Corosync built-in features: nss rdma Aug 11 09:29:36 corosync [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'. Aug 11 09:29:36 corosync [TOTEM ] Initializing transport (UDP/IP). Aug 11 09:29:36 corosync [TOTEM ] Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0). Aug 11 09:29:36 corosync [TOTEM ] The network interface [192.168.122.1] is now up. Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync extended virtual synchrony service Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync configuration service Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync cluster closed process group service v1.01 Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync cluster config database access v1.01 Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync profile loading service Aug 11 09:29:36 corosync [SERV ] Service engine loaded: corosync cluster quorum service v0.1 Aug 11 09:29:36 corosync [MAIN ] Compatibility mode set to whitetank. Using V1 and V2 of the synchronization engine. corosync.conf: # cat /etc/corosync/corosync.conf # Please read the corosync.conf.5 manual page compatibility: whitetank totem { version: 2 secauth: off threads: 0 interface { ringnumber: 0 bindnetaddr: 192.168.122.1 mcastaddr: 226.94.1.1 mcastport: 5405 } } logging { fileline: off to_stderr: yes to_logfile: yes to_syslog: yes logfile: /tmp/corosync.log debug: off timestamp: on logger_subsys { subsys: AMF debug: off } } amf { mode: disabled } sheepdog.log: Aug 11 09:48:05 worker_routine(215) started this thread 60 Aug 11 09:48:05 worker_routine(215) started this thread 61 Aug 11 09:48:05 worker_routine(215) started this thread 62 Aug 11 09:48:05 worker_routine(215) started this thread 63 Aug 11 09:48:06 create_cluster(1652) Failed to join the sheepdog group, try again Aug 11 09:48:07 create_cluster(1652) Failed to join the sheepdog group, try again Aug 11 09:48:08 create_cluster(1652) Failed to join the sheepdog group, try again Aug 11 09:48:09 create_cluster(1652) Failed to join the sheepdog group, try again Aug 11 09:48:10 create_cluster(1652) Failed to join the sheepdog group, try again Thanks, Narendra. -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH] Build lib files once into an archive instead of twice for sheep/collie
The previous automake setup would build the lib dir files twice. This patch builds a library of files in the lib dir, and then links it with either collie or sheep. Signed-off-by: Steven Dake sd...@redhat.com --- Makefile.am|2 +- collie/Makefile.am |7 +++ lib/Makefile.am|8 ++-- sheep/Makefile.am |6 +++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index fedd5ab..88b174c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ sheepdogsysconfdir= ${SHEEPDOGCONFDIR} sheepdogsysconf_DATA = -SUBDIRS= collie sheep include script lib +SUBDIRS= lib collie sheep include script install-exec-local: diff --git a/collie/Makefile.am b/collie/Makefile.am index 2f629c1..515b97a 100644 --- a/collie/Makefile.am +++ b/collie/Makefile.am @@ -23,10 +23,9 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include sbin_PROGRAMS = collie -collie_SOURCES = collie.c treeview.c ../lib/event.c ../lib/net.c ../lib/logger.c -collie_LDADD = -collie_DEPENDENCIES= - +collie_SOURCES = collie.c treeview.c +collie_LDADD = ../lib/libsheepdog.a +collie_DEPENDENCIES= ../lib/libsheepdog.a noinst_HEADERS = treeview.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 2375b68..cb46c9a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,3 +1,7 @@ -MAINTAINERCLEANFILES= Makefile.in config.h.in +MAINTAINERCLEANFILES= Makefile.in -noinst_HEADERS = event.c logger.c net.c +INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include + +noinst_LIBRARIES = libsheepdog.a + +libsheepdog_a_SOURCES = event.c logger.c net.c diff --git a/sheep/Makefile.am b/sheep/Makefile.am index 4f68683..9efb8c3 100644 --- a/sheep/Makefile.am +++ b/sheep/Makefile.am @@ -23,9 +23,9 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include $(libcpg_CFLAGS) $ sbin_PROGRAMS = sheep -sheep_SOURCES = sheep.c group.c sdnet.c store.c vdi.c work.c ../lib/event.c ../lib/logger.c ../lib/net.c -sheep_LDADD= $(libcpg_LIBS) $(libcfg_LIBS) -sheep_DEPENDENCIES = +sheep_SOURCES = sheep.c group.c sdnet.c store.c vdi.c work.c +sheep_LDADD= $(libcpg_LIBS) $(libcfg_LIBS) ../lib/libsheepdog.a +sheep_DEPENDENCIES = ../lib/libsheepdog.a noinst_HEADERS = work.h sheep_priv.h -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 2/9] const correctness: commands[] change char to const char *
This first parameter is really a (const char *) instead of a (char *). Signed-off-by: Steven Dake sd...@redhat.com --- collie/collie.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collie/collie.c b/collie/collie.c index e778459..2e95b5b 100644 --- a/collie/collie.c +++ b/collie/collie.c @@ -968,7 +968,7 @@ static struct option cluster_long_options[] = }; static struct { - char *name; + const char *name; struct subcommand *sub; struct option *lopts; char *sopts; -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 6/9] shadow problem: time() is shadowed by a local time[]
rename the local variable time to time_str. Signed-off-by: Steven Dake sd...@redhat.com --- collie/collie.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/collie/collie.c b/collie/collie.c index d2bbef9..2195f57 100644 --- a/collie/collie.c +++ b/collie/collie.c @@ -884,7 +884,7 @@ static int cluster_info(int argc, char **argv) int nr_logs; time_t ti; struct tm tm; - char time[128]; + char time_str[128]; fd = connect_to(localhost, sdport); if (fd 0) @@ -919,9 +919,9 @@ static int cluster_info(int argc, char **argv) ti = logs[i].ctime 32; localtime_r(ti, tm); - strftime(time, sizeof(time), %y-%m-%d %H:%M:%S, tm); + strftime(time_str, sizeof(time), %y-%m-%d %H:%M:%S, tm); - printf(%s %6d, time, logs[i].epoch); + printf(%s %6d, time_str, logs[i].epoch); printf( [); for (j = 0; j logs[i].nr_nodes; j++) { entry = logs[i].nodes + j; -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 8/9] sizeof problem: sizeof was applied to a global definition, rather then a local
Have sizeof apply to proper local variable. Signed-off-by: Steven Dake sd...@redhat.com --- collie/collie.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/collie/collie.c b/collie/collie.c index ce3d086..d9f26fc 100644 --- a/collie/collie.c +++ b/collie/collie.c @@ -919,7 +919,7 @@ static int cluster_info(int argc, char **argv) ti = logs[i].ctime 32; localtime_r(ti, tm); - strftime(time_str, sizeof(time), %y-%m-%d %H:%M:%S, tm); + strftime(time_str, sizeof(time_str), %y-%m-%d %H:%M:%S, tm); printf(%s %6d, time_str, logs[i].epoch); printf( [); -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 9/9] shadow problem: info shadowed inside function defining shadow as local
Rename info to info_old for the scope it is accessed in. Signed-off-by: Steven Dake sd...@redhat.com --- collie/collie.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/collie/collie.c b/collie/collie.c index d9f26fc..38eb071 100644 --- a/collie/collie.c +++ b/collie/collie.c @@ -745,25 +745,25 @@ static int vdi_object(int argc, char **argv) vid, nr_nodes); parse_objs(vid_to_vdi_oid(vid), do_print_obj, NULL); } else { - struct get_data_oid_info info; + struct get_data_oid_info old_info; - info.success = 0; - info.idx = idx; + old_info.success = 0; + old_info.idx = idx; if (idx = MAX_DATA_OBJS) { printf(The offset is too large!\n); exit(1); } - parse_objs(vid_to_vdi_oid(vid), get_data_oid, info); + parse_objs(vid_to_vdi_oid(vid), get_data_oid, old_info); - if (info.success) { - if (info.data_oid) { + if (old_info.success) { + if (old_info.data_oid) { printf(Looking for the object 0x% PRIx64 (the inode vid 0x% PRIx32 idx %u) with %d nodes\n\n, - info.data_oid, vid, idx, nr_nodes); + old_info.data_oid, vid, idx, nr_nodes); - parse_objs(info.data_oid, do_print_obj, NULL); + parse_objs(old_info.data_oid, do_print_obj, NULL); } else printf(The inode object 0x% PRIx32 idx %u is not allocated\n, vid, idx); -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 4/5] exit_work_queue is unused and file scope
First make exit_work_queue static so that it's file scope is honored by the compiler (it uses a file scope structure as a parameter). Second compile it out by default unless the compile flag COMPILE_UNUSED_CODE is defined. Signed-off-by: Steven Dake sd...@redhat.com --- sheep/work.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/sheep/work.c b/sheep/work.c index bb67750..8016435 100644 --- a/sheep/work.c +++ b/sheep/work.c @@ -334,7 +334,8 @@ destroy_threads: return -1; } -void exit_work_queue(struct work_queue *q) +#ifdef COMPILE_UNUSED_CODE +static void exit_work_queue(struct work_queue *q) { int i; struct worker_info *wi = container_of(q, struct worker_info, q); @@ -351,3 +352,4 @@ void exit_work_queue(struct work_queue *q) pthread_mutex_destroy(wi-startup_lock); pthread_mutex_destroy(wi-finished_lock); } +#endif -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 3/5] use PRIu/xXX macros for store.c
The C language doesn't handle typing of the print formatter very well. To solve this problem, the PRIx PRIu followed by bitsize macros are typically used. Signed-off-by: Steven Dake sd...@redhat.com --- sheep/store.c | 106 1 files changed, 53 insertions(+), 53 deletions(-) diff --git a/sheep/store.c b/sheep/store.c index 9413eff..da51d55 100644 --- a/sheep/store.c +++ b/sheep/store.c @@ -132,7 +132,7 @@ static int verify_object(int fd, char *buf, size_t len, int set_chksum) } if (checksum != fnv_64a_buf(buf, len, FNV1A_64_INIT)) { - eprintf(invalid checksum, %lx, %lx\n, checksum, + eprintf(invalid checksum, %PRIx64, %PRIx64\n, checksum, fnv_64a_buf(buf, len, FNV1A_64_INIT)); goto err; } @@ -186,13 +186,13 @@ static int get_obj_list(struct request *req, char *buf, int buf_len) res = SD_RES_EIO; goto out; } - dprintf(read objct list from %s, %d\n, path, obj_nr); + dprintf(read objct list from %s, %PRIu32\n, path, obj_nr); obj_nr /= sizeof(uint64_t); objlist = (uint64_t *)buf; for (i = 0; i obj_nr; i++) { if (is_obj_in_range(objlist[i], start_hash, end_hash)) { - dprintf(%u, %016lx, %016lx %016lx\n, epoch, + dprintf(%u, %016PRIx64, %016PRIx64 %016PRIx64\n, epoch, objlist[i], start_hash, end_hash); p[nr++] = objlist[i]; } @@ -205,7 +205,7 @@ static int get_obj_list(struct request *req, char *buf, int buf_len) local: snprintf(path, sizeof(path), %s%08u/, obj_path, hdr-tgt_epoch); - dprintf(%d, %s\n, sys-this_node.port, path); + dprintf(%PRIu32, %s\n, sys-this_node.port, path); dir = opendir(path); if (!dir) { @@ -229,7 +229,7 @@ local: continue; if (is_obj_in_range(oid, start_hash, end_hash)) { - dprintf(%u, %016lx, %016lx %016lx\n, epoch, + dprintf(%u, %016PRIx64, %016PRIx64 %016PRIx64\n, epoch, oid, start_hash, end_hash); p[nr++] = oid; } @@ -238,7 +238,7 @@ local: break; } - eprintf(nr = %d\n, nr); + eprintf(nr = %PRIu32\n, nr); e_nr = epoch_log_read(epoch, buf, buf_len); e_nr /= sizeof(*e); @@ -266,7 +266,7 @@ local: if (start_hash hval || hval = end_hash) rsp-next = hval; - dprintf(%u, %016lx, %016lx %016lx\n, epoch, hval, + dprintf(%u, %016PRIx64, %016PRIx64 %016PRIx64\n, epoch, hval, start_hash, end_hash); } else res = SD_RES_SYSTEM_ERROR; @@ -276,7 +276,7 @@ local: out: rsp-data_length = nr * sizeof(uint64_t); for (i = 0; i nr; i++) { - eprintf(oid %lx, %lx\n, *(p + i), p[i]); + eprintf(oid %PRIx64, %PRIx64\n, *(p + i), p[i]); } return res; } @@ -444,7 +444,7 @@ static int forward_write_obj_req(struct request *req, char *buf) struct pollfd pfds[SD_MAX_REDUNDANCY]; int done, nr_fds, local = 0; - dprintf(%lx\n, oid); + dprintf(%PRIx64\n, oid); e = req-entry; nr = req-nr_nodes; @@ -477,7 +477,7 @@ static int forward_write_obj_req(struct request *req, char *buf) fd = connect_to(name, e[n].port); if (fd 0) { - eprintf(failed to connect to %s:%d\n, name, e[n].port); + eprintf(failed to connect to %s:%PRIu32\n, name, e[n].port); ret = SD_RES_EIO; goto out; } @@ -485,7 +485,7 @@ static int forward_write_obj_req(struct request *req, char *buf) ret = send_req(fd, (struct sd_req *)hdr, req-data, wlen); if (ret) { /* network errors */ ret = SD_RES_EIO; - dprintf(fail %d\n, ret); + dprintf(fail %PRIu32\n, ret); goto out; } @@ -499,12 +499,12 @@ static int forward_write_obj_req(struct request *req, char *buf) rsp-result = ret; if (nr_fds == 0) { - eprintf(exit %d\n, ret); + eprintf(exit %PRIu32\n, ret); goto out; } if (rsp-result != SD_RES_SUCCESS) { - eprintf(fail %d\n, ret); + eprintf(fail %PRIu32\n, ret); goto out; } } @@ -541,7 +541,7 @@ again
[Sheepdog] [PATCH 5/5] Remove unused vosts structure
The vosts structure is unused and not set, resulting in a potential segfault if the eprintf code is executed. Another alternative is to set vosts[x] but I am not certain what it should be set to. Signed-off-by: Steven Dake sd...@redhat.com --- sheep/sdnet.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sheep/sdnet.c b/sheep/sdnet.c index f1ce8ea..79ba3ff 100644 --- a/sheep/sdnet.c +++ b/sheep/sdnet.c @@ -510,7 +510,6 @@ int write_object(struct sheepdog_node_list_entry *e, { struct sd_obj_req hdr; int i, n, fd, ret, success = 0; - uint16_t vosts[3]; char name[128]; for (i = 0; i nr; i++) { @@ -522,7 +521,7 @@ int write_object(struct sheepdog_node_list_entry *e, fd = connect_to(name, e[n].port); if (fd 0) { - eprintf(can't connect to vost %u, %s\n, vosts[i], name); + eprintf(can't connect to vost %s\n, name); continue; } @@ -543,7 +542,7 @@ int write_object(struct sheepdog_node_list_entry *e, ret = exec_req(fd, (struct sd_req *)hdr, data, wlen, rlen); close(fd); if (ret) - eprintf(can't update vost %u, %s\n, vosts[i], name); + eprintf(can't update vost %s\n, name); else success++; } -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH 1/5] use PRIuXX macros in group.c
The C language has problems around typing and format printing. The usual solution to this problem is to use the PRIuXX macro set. Signed-off-by: Steven Dake sd...@redhat.com --- sheep/group.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sheep/group.c b/sheep/group.c index 3313b10..51b3300 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -389,36 +389,36 @@ static int get_cluster_status(struct sheepdog_node_list_entry *from, break; if (ctime != get_cluster_ctime()) { - eprintf(joining node has invalid ctime, %ld\n, from-id); + eprintf(joining node has invalid ctime, %PRIu64\n, from-id); return SD_RES_INVALID_CTIME; } local_epoch = get_latest_epoch(); if (epoch local_epoch) { - eprintf(sheepdog is running with older epoch, %d %d %ld\n, + eprintf(sheepdog is running with older epoch, %PRIu32 %PRIu32 %PRIu64\n, epoch, local_epoch, from-id); return SD_RES_OLD_NODE_VER; } break; case SD_STATUS_WAIT_FOR_FORMAT: if (nr_entries != 0) { - eprintf(joining node is not clean, %ld\n, from-id); + eprintf(joining node is not clean, %PRIu64\n, from-id); return SD_RES_NOT_FORMATTED; } break; case SD_STATUS_WAIT_FOR_JOIN: if (ctime != get_cluster_ctime()) { - eprintf(joining node has invalid ctime, %ld\n, from-id); + eprintf(joining node has invalid ctime, %PRIu64\n, from-id); return SD_RES_INVALID_CTIME; } local_epoch = get_latest_epoch(); if (epoch local_epoch) { - eprintf(sheepdog is waiting with older epoch, %d %d %ld\n, + eprintf(sheepdog is waiting with older epoch, %PRIu32 %PRIu32 %PRIu64\n, epoch, local_epoch, from-id); return SD_RES_OLD_NODE_VER; } else if (epoch local_epoch) { - eprintf(sheepdog is waiting with newer epoch, %d %d %ld\n, + eprintf(sheepdog is waiting with newer epoch, %PRIu32 %PRIu32 %PRIu64\n, epoch, local_epoch, from-id); return SD_RES_NEW_NODE_VER; } @@ -428,13 +428,13 @@ static int get_cluster_status(struct sheepdog_node_list_entry *from, nr_local_entries /= sizeof(local_entries[0]); if (nr_entries != nr_local_entries) { - eprintf(joining node has invalid epoch, %d %ld\n, + eprintf(joining node has invalid epoch, %PRIu32 %PRIu64\n, epoch, from-id); return SD_RES_INVALID_EPOCH; } if (memcmp(entries, local_entries, sizeof(entries[0]) * nr_entries) != 0) { - eprintf(joining node has invalid epoch, %ld\n, from-id); + eprintf(joining node has invalid epoch, %PRIu64\n, from-id); return SD_RES_INVALID_EPOCH; } @@ -1274,7 +1274,7 @@ static void cpg_event_fn(struct work *w, int idx) break; case CPG_EVENT_DELIVER: { - struct work_deliver *w = container_of(cevent, struct work_deliver, cev); + struct work_deliver *w = container_of(cevent, struct work_deliver, cev); vprintf(SDOG_DEBUG %d\n, w-msg-state); __sd_deliver(cevent); break; -- 1.6.2.5 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [Sheepdog] expected bit size of __ffs
On Tue, 2010-05-18 at 08:45 +0900, FUJITA Tomonori wrote: On Mon, 17 May 2010 09:34:37 -0700 Steven Dake sd...@redhat.com wrote: Is __ffs expecting 64 bit parameters? At line 18 of bitops.h, there is a by 32, which with a 32 bit parameter results in the value 0. I think that 'if (BITS_PER_LONG == 64)' trick works on 32-bit archs. That patch looks good. Regards -steve #define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) static inline unsigned long __ffs(unsigned long word) { int num = 0; if (BITS_PER_LONG == 64) { if ((word 0x) == 0) { num += 32; word = 32; } } So we don't hit word = 32 on 32-bit archs. We get a warning like right shift count = width of type on this though. The following patch kills the warning with gcc's built-in ffs(). = From: FUJITA Tomonori fujita.tomon...@lab.ntt.co.jp Subject: [PATCH] use gcc built-in ffs() Signed-off-by: FUJITA Tomonori fujita.tomon...@lab.ntt.co.jp --- include/bitops.h | 34 +- 1 files changed, 1 insertions(+), 33 deletions(-) diff --git a/include/bitops.h b/include/bitops.h index 6c85d5e..0e0f402 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -3,43 +3,11 @@ #define BITS_TO_LONGS(nr)DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] - #define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) +#define __ffs(x) (x ? __builtin_ffsl(x) - 1 : 0) #define ffz(x) __ffs(~(x)) -static inline unsigned long __ffs(unsigned long word) -{ - int num = 0; - - if (BITS_PER_LONG == 64) { - if ((word 0x) == 0) { - num += 32; - word = 32; - } - } - - if ((word 0x) == 0) { - num += 16; - word = 16; - } - if ((word 0xff) == 0) { - num += 8; - word = 8; - } - if ((word 0xf) == 0) { - num += 4; - word = 4; - } - if ((word 0x3) == 0) { - num += 2; - word = 2; - } - if ((word 0x1) == 0) - num += 1; - return num; -} - #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) static inline unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog
[Sheepdog] [PATCH] Autotoolize sheepdog
This patch contains the initial work to autotoolize sheepdog. To generate the configure script, run the autogen.sh script. Then run ./configure followed by make. make install also works properly. Then run configure as normal. The configure.ac supports several options including --enable-profiling and --enable-debug as well as the standard GNU automake setup. The warnings list is a pretty standard list of warning catches, but does generate alot of warning output. One thing that is missing is using the git version field rather then PACKAGE_VERSION generated from configure.ac. Finally, if you want to generate an output tarball, run make dist. make distcheck verifies the make system included all the proper files to support a self-build. Signed-off-by: Steven Dake sd...@redhat.com --- Makefile| 40 Makefile.am | 23 ++ autogen.sh |5 + collie/Makefile | 30 --- configure.ac| 326 ++ include/Makefile.am |3 + lib/Makefile|3 - lib/Makefile.am |3 + script/Makefile.am |3 + sheep/Makefile | 30 --- sheep/Makefile.am | 42 sheep/net.c | 643 --- sheep/sdnet.c | 643 +++ sheep/sheep.c |7 +- sheep/store.c |3 + 15 files changed, 1056 insertions(+), 748 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh delete mode 100644 collie/Makefile create mode 100644 configure.ac create mode 100644 include/Makefile.am delete mode 100644 lib/Makefile create mode 100644 lib/Makefile.am create mode 100644 script/Makefile.am delete mode 100644 sheep/Makefile create mode 100644 sheep/Makefile.am delete mode 100644 sheep/net.c create mode 100644 sheep/sdnet.c diff --git a/Makefile b/Makefile deleted file mode 100644 index 6f4f0c3..000 --- a/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -VERSION ?= $(shell git log -1 --pretty=format:%h-%p || echo unknown-version) - -PREFIX ?= /usr - -CHECK_CC = cgcc -CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)' - -export VERSION PREFIX - -.PHONY:all -all: - $(MAKE) -C sheep - $(MAKE) -C collie - -.PHONY:clean -clean: - $(MAKE) -C sheep clean - $(MAKE) -C collie clean - $(MAKE) -C lib clean - -.PHONY:install -install: - $(MAKE) -C sheep install - $(MAKE) -C collie install - -.PHONY:check -check: ARCH=$(shell sh script/checkarch.sh) -check: - CC=$(CHECK_CC_FLAGS) $(MAKE) all - -.PHONY:check32 -check32: override ARCH=-m32 -check32: - CC=$(CHECK_CC_FLAGS) $(MAKE) all - -.PHONY:check64 -check64: override ARCH=-m64 -check64: - CC=$(CHECK_CC_FLAGS) $(MAKE) all - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000..fedd5ab --- /dev/null +++ b/Makefile.am @@ -0,0 +1,23 @@ +EXTRA_DIST = + +AUTOMAKE_OPTIONS = foreign + +MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \ + config.guess config.sub missing install-sh\ + autoheader automake autoconf config.status\ + config.log + +dist_doc_DATA = + +sheepdogsysconfdir = ${SHEEPDOGCONFDIR} + +sheepdogsysconf_DATA = + +SUBDIRS= collie sheep include script lib + +install-exec-local: + +uninstall-local: + +dist-clean-local: + rm -f autoconf automake autoheader diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 000..83770a1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +echo Building configuration system... +autoreconf -i echo Now run ./configure and make diff --git a/collie/Makefile b/collie/Makefile deleted file mode 100644 index 98ef2b1..000 --- a/collie/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -sbindir ?= $(PREFIX)/sbin - -CFLAGS += -g -O2 -Wall -Wstrict-prototypes -I../include -CFLAGS += -D_GNU_SOURCE -LIBS += -lncurses - -PROGRAMS = collie -COLLIE_OBJS = collie.o treeview.o ../lib/event.o ../lib/net.o ../lib/logger.o -COLLIE_DEP = $(COLLIE_OBJS:.o=.d) - -.PHONY:all -all: $(PROGRAMS) - -collie: $(COLLIE_OBJS) - $(CC) $^ -o $@ $(LIBS) - --include $(COLLIE_DEP) - -%.o: %.c - $(CC) -c $(CFLAGS) $*.c -o $*.o - @$(CC) -MM $(CFLAGS) -MF $*.d -MT $*.o $*.c - -.PHONY:clean -clean: - rm -f *.[od] $(PROGRAMS) - -.PHONY:install -install: $(PROGRAMS) - install -d -m 755 $(DESTDIR)$(sbindir) - install -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir) diff --git a/configure.ac b/configure.ac new file mode 100644 index 000..309ae79 --- /dev/null +++ b/configure.ac @@ -0,0 +1,326 @@ +# +# Copyright 2010 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published