[Pacemaker] [PATCH] Allow the user to insert a startup configuration

Andrew Beekhof andrew at beekhof.net
Tue Dec 15 05:37:48 EST 2009


Anyone else interested in this feature being added?

On Dec 10, 2009, at 9:53 PM, frank.dimeo at bigbandnet.com wrote:

> # HG changeset patch
> # User Frank DiMeo <frank.dimeo at bigbandnet.com>
> # Date 1260478129 18000
> # Branch stable-1.0
> # Node ID e7067734add7f3b148cb534b85b5af256db9fad7
> # Parent  381160def02a34ae554637e0a26efda850ccc015
> initial load of static configuration file
>
> diff -r 381160def02a -r e7067734add7 cib/io.c
> --- a/cib/io.c	Thu Dec 10 09:07:45 2009 -0500
> +++ b/cib/io.c	Thu Dec 10 15:48:49 2009 -0500
> @@ -261,7 +261,7 @@
> 	crm_err("%s exists but does NOT contain valid XML. ", filename);
> 	crm_warn("Continuing but %s will NOT used.", filename);
> 	
> -    } else if(validate_cib_digest(root, sigfile) == FALSE) {
> +    } else if(sigfile && ( validate_cib_digest(root, sigfile) ==  
> FALSE )) {
> 	crm_err("Checksum of %s failed!  Configuration contents ignored!",  
> filename);
> 	crm_err("Usually this is caused by manual changes, "
> 		"please refer to http://clusterlabs.org/wiki/FAQ#cib_changes_detected 
> ");
> @@ -282,11 +282,12 @@
> readCibXmlFile(const char *dir, const char *file, gboolean  
> discard_status)
> {
> 	int seq = 0;
> -	char *filename = NULL, *sigfile = NULL;
> +	char *filename = NULL, *sigfile = NULL, *static_config_file = NULL;
> 	const char *name = NULL;
> 	const char *value = NULL;
> 	const char *validation = NULL;
> 	const char *use_valgrind = getenv("HA_VALGRIND_ENABLED");
> +   struct stat buf;
> 	
> 	xmlNode *root = NULL;
> 	xmlNode *status = NULL;
> @@ -300,7 +301,23 @@
> 	sigfile  = crm_concat(filename, "sig", '.');
>
> 	cib_status = cib_ok;
> -	root = retrieveCib(filename, sigfile, TRUE);
> +
> +   /*
> +   ** we might drop a static config file in there as a known  
> startup point
> +   ** if we do, use it.  Its called <file>.xml.static_init
> +   */
> +   static_config_file = crm_concat(filename, "static_init", '.');
> +
> +   crm_info("Looking for static initialization file : %s",  
> static_config_file);
> +
> +   if(stat(static_config_file, &buf) == 0) {
> +      crm_info("Using initial configuration file : %s",  
> static_config_file);
> +      root = retrieveCib(static_config_file, NULL, TRUE);
> +   }
> +   else {
> +      crm_info("Using found configuration file : %s", filename);
> +      root = retrieveCib(filename, sigfile, TRUE);
> +   }
>
> 	if(root == NULL) {
> 	    crm_warn("Primary configuration corrupt or unusable, trying  
> backup...");
> @@ -308,7 +325,6 @@
> 	}
> 	
> 	while(root == NULL) {
> -	    struct stat buf;
> 	    char *backup_file = NULL;
> 	    crm_free(sigfile);
>
> @@ -409,6 +425,7 @@
> 	    }
> 	}
>
> +	crm_free(static_config_file);
> 	crm_free(filename);
> 	crm_free(sigfile);
> 	return root;

-- Andrew






More information about the Pacemaker mailing list