Move name_mode to fence_virtd block

Signed-off-by: Lon Hohberger <lhh@redhat.com>
This commit is contained in:
Lon Hohberger 2009-09-01 15:39:01 -04:00
parent a12da25998
commit ddc8c75e2d
3 changed files with 13 additions and 5 deletions

View File

@ -2,6 +2,7 @@ fence_virtd {
debug ="99";
listener = "multicast";
backend = "libvirt";
name_mode = "name";
}
listeners {
@ -25,4 +26,3 @@ backends {
}
}
name_mode = "name";

View File

@ -336,8 +336,8 @@ libvirt_init(backend_context_t *c, config_object_t *config)
{
virConnectPtr vp;
char value[256];
char *uri = NULL;
struct libvirt_info *info = NULL;
char *uri = NULL;
int use_uuid = 0;
info = malloc(sizeof(*info));
@ -348,12 +348,17 @@ libvirt_init(backend_context_t *c, config_object_t *config)
if (sc_get(config, "backends/libvirt/@uri",
value, sizeof(value)) == 0) {
uri = value;
uri = strdup(value);
if (!uri) {
free(info);
return -1;
}
printf("Using %s\n", uri);
}
/* Naming scheme is a top-level configuration option */
if ((sc_get(config, "@name_mode", value, sizeof(value)-1) == 0)) {
if (sc_get(config, "fence_virtd/@name_mode",
value, sizeof(value)-1) == 0) {
dbg_printf(1, "Got %s for name_mode\n", value);
if (!strcasecmp(value, "uuid")) {
@ -368,9 +373,11 @@ libvirt_init(backend_context_t *c, config_object_t *config)
/* We don't need to store the URI; we only use it once */
vp = virConnectOpen(uri);
if (!vp) {
free(uri);
free(info);
return -1;
}
free(uri);
info->magic = MAGIC;
info->vp = vp;

View File

@ -353,7 +353,8 @@ mcast_config(config_object_t *config, mcast_options *args)
}
}
if (sc_get(config, "@name_mode", value, sizeof(value)-1) == 0) {
if (sc_get(config, "fence_virtd/@name_mode",
value, sizeof(value)-1) == 0) {
/*
* This is just an optimization. If an administrator
* configured something at the top level, we can use it