Clean up some configuration plugin information

Signed-off-by: Lon Hohberger <lon@users.sourceforge.net>
This commit is contained in:
Lon Hohberger 2010-01-04 14:12:21 -05:00
parent 0ddf6b7fa6
commit 22a2dd65f3
2 changed files with 35 additions and 16 deletions

View File

@ -159,6 +159,9 @@ _sc_get(config_info_t *config, const char *key, char *value, size_t valuesz)
char *slash;
int found;
if (!config)
return 1;
ptr = (char *)key;
while ((slash = strchr(ptr, '/'))) {
memset(buf, 0, sizeof(buf));
@ -281,23 +284,23 @@ _sc_parse(const char *filename, config_info_t **config)
if (filename) {
fp = fopen(filename, "r");
yyin = fp;
if (!fp)
return -1;
if (fp)
ret = yyparse();
else
ret = 1;
} else {
ret = 1;
}
ret = yyparse();
if (!ret) {
c = malloc(sizeof(*c));
if (!c)
return -1;
c->node_list = node_list;
c->val_list = val_list;
c->next = NULL;
val_list = NULL;
node_list = NULL;
*config = (config_info_t *)c;
}
c = malloc(sizeof(*c));
if (!c)
return -1;
c->node_list = node_list;
c->val_list = val_list;
c->next = NULL;
val_list = NULL;
node_list = NULL;
*config = (config_info_t *)c;
if (fp)
fclose(fp);

View File

@ -695,7 +695,10 @@ checkpoint_init(backend_context_t *c, config_object_t *config)
dbg_printf(1, "Using %s\n", uri);
}
/* Naming scheme is a top-level configuration option */
/* Naming scheme is no longer a top-level config option.
* However, we retain it here for configuration compatibility with
* versions 0.1.3 and previous.
*/
if (sc_get(config, "fence_virtd/@name_mode",
value, sizeof(value)-1) == 0) {
@ -709,6 +712,19 @@ checkpoint_init(backend_context_t *c, config_object_t *config)
}
}
if (sc_get(config, "backends/checkpoint/@name_mode",
value, sizeof(value)-1) == 0) {
dbg_printf(1, "Got %s for name_mode\n", value);
if (!strcasecmp(value, "uuid")) {
use_uuid = 1;
} else if (!strcasecmp(value, "name")) {
use_uuid = 0;
} else {
dbg_printf(1, "Unsupported name_mode: %s\n", value);
}
}
if (cpg_start(PACKAGE_NAME, do_real_work) < 0) {
return -1;
}