[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] [PATCH] rgmanager: Allow exit while waiting for cman



Yes please!!! good to go.

On Mon, 2009-03-30 at 17:14 -0400, Lon Hohberger wrote:
> If cman isn't running, you can now kill rgmanager
> with SIGINT (e.g. ctrl-C) or SIGTERM to make it
> quit before initialization is complete.
> 
> Signed-off-by: Lon Hohberger <lhh redhat com>
> ---
>  rgmanager/src/daemons/main.c |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
> index 7fc322c..9823111 100644
> --- a/rgmanager/src/daemons/main.c
> +++ b/rgmanager/src/daemons/main.c
> @@ -894,8 +894,8 @@ configure_rgmanager(int ccsfd, int dbg)
>  }
>  
> 
> -void
> -clu_initialize(cman_handle_t *ch)
> +int
> +cman_connect(cman_handle_t *ch)
>  {
>  	if (!ch)
>  		exit(1);
> @@ -906,6 +906,8 @@ clu_initialize(cman_handle_t *ch)
>  
>  		while (!(*ch = cman_init(NULL))) {
>  			sleep(1);
> +			if (shutdown_pending)
> +				return 1;
>  		}
>  	}
>  
> @@ -920,10 +922,13 @@ clu_initialize(cman_handle_t *ch)
>  
>  		while (cman_is_quorate(*ch) == 0) {
>  			sleep(1);
> +			if (shutdown_pending)
> +				return 1;
>  		}
>  		logt_print(LOG_NOTICE, "Quorum formed\n");
>  	}
>  
> +	return 0;
>  }
>  
> 
> @@ -1022,7 +1027,9 @@ main(int argc, char **argv)
>  	}
>  
>  	init_logging(NULL, foreground, (debug? LOG_DEBUG : SYSLOGLEVEL));
> -	clu_initialize(&clu);
> +	if (cman_connect(&clu) != 0)
> +		goto out;	/* Clean exit if sigint/sigterm here */
> +
>  	if (cman_init_subsys(clu) < 0) {
>  		perror("cman_init_subsys");
>  		return -1;
> @@ -1118,8 +1125,10 @@ main(int argc, char **argv)
>  
>  	if (rg_initialized())
>  		cleanup(cluster_ctx);
> -	logt_print(LOG_NOTICE, "Shutdown complete, exiting\n");
>  	clu_lock_finished(rgmanager_lsname);
> +
> +out:
> +	logt_print(LOG_NOTICE, "Shutdown complete, exiting\n");
>  	cman_finish(clu);
>  	
>  	close_logging();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]