[Sheepdog] correct procedure to shutdown and restart the cluster against the recent next branch

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Wed Mar 31 06:27:59 CEST 2010


On Thu, 18 Mar 2010 09:33:28 +0900
MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> wrote:

> Hi,
> 
> On Tue, Mar 16, 2010 at 8:22 PM, Piavlo <piavka at cs.bgu.ac.il> wrote:
> > Hi,
> >
> > Now that there is preliminary support for shutdown and restart of sheepdog
> > cluster,
> > i'm wondering what is the correct procedure to restart a cluster after i
> > execute "shepered shutdown"?
> > Do i need to stop  collies on all nodes first with stop-sheepdog and then
> > start then again, or there is a command to activate the cluster
> > without stopping collies first?
> >
> 
> After `shepherd shutdown`, you need to stop all collie processes.

I think that it's more handy if 'shepherd shutdown' stops all the
operations on collie daemons and then kills the daemons.

Here's a patch. It depends on the two patches that I sent recently.

git://git.kernel.org/pub/scm/linux/kernel/git/tomo/sheepdog.git pending

=
From: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
Subject: [PATCH] collie: shutdown command kills the daemon

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 collie/collie.c |    7 ++++++-
 lib/event.c     |    3 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/collie/collie.c b/collie/collie.c
index 669e894..8367487 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -119,7 +119,12 @@ int main(int argc, char **argv)
 
 	vprintf(SDOG_NOTICE "Sheepdog daemon (version %s) started\n", SD_VERSION);
 
-	event_loop(-1);
+	while (sys->status != SD_STATUS_SHUTDOWN)
+		event_loop(-1);
+
+	vprintf(SDOG_INFO "shutdown\n");
+
+	log_close();
 
 	return 0;
 }
diff --git a/lib/event.c b/lib/event.c
index 38e5d43..e8cd359 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -167,7 +167,6 @@ void event_loop(int timeout)
 	int i, nr;
 	struct epoll_event events[128];
 
-retry:
 	nr = epoll_wait(efd, events, ARRAY_SIZE(events), TICK * 1000);
 	if (nr < 0) {
 		eprintf("epoll_wait failed, %m\n");
@@ -181,6 +180,4 @@ retry:
 		}
 	} else
 		do_timer();
-
-	goto retry;
 }
-- 
1.7.0




More information about the sheepdog mailing list