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; char *slash;
int found; int found;
if (!config)
return 1;
ptr = (char *)key; ptr = (char *)key;
while ((slash = strchr(ptr, '/'))) { while ((slash = strchr(ptr, '/'))) {
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
@ -281,23 +284,23 @@ _sc_parse(const char *filename, config_info_t **config)
if (filename) { if (filename) {
fp = fopen(filename, "r"); fp = fopen(filename, "r");
yyin = fp; yyin = fp;
if (!fp) if (fp)
return -1; ret = yyparse();
else
ret = 1;
} else {
ret = 1;
} }
ret = yyparse(); c = malloc(sizeof(*c));
if (!c)
if (!ret) { return -1;
c = malloc(sizeof(*c)); c->node_list = node_list;
if (!c) c->val_list = val_list;
return -1; c->next = NULL;
c->node_list = node_list; val_list = NULL;
c->val_list = val_list; node_list = NULL;
c->next = NULL; *config = (config_info_t *)c;
val_list = NULL;
node_list = NULL;
*config = (config_info_t *)c;
}
if (fp) if (fp)
fclose(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); 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", if (sc_get(config, "fence_virtd/@name_mode",
value, sizeof(value)-1) == 0) { 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) { if (cpg_start(PACKAGE_NAME, do_real_work) < 0) {
return -1; return -1;
} }