Move VM naming scheme to top level of config

Signed-off-by: Lon Hohberger <lhh@redhat.com>
This commit is contained in:
Lon Hohberger 2009-09-01 15:31:24 -04:00
parent c09c3e4551
commit 0e30b2fa86
2 changed files with 16 additions and 12 deletions

View File

@ -352,19 +352,20 @@ libvirt_init(backend_context_t *c, config_object_t *config)
printf("Using %s\n", uri);
}
if (sc_get(config, "backends/libvirt/@use_uuid",
value, sizeof(value)) == 0) {
use_uuid = atoi(value);
if (use_uuid == 0) {
if (!strcasecmp(value, "true") ||
!strcasecmp(value, "yes")) {
use_uuid = 1;
}
} else if (use_uuid < 0) {
/* Naming scheme is a top-level configuration option */
if ((sc_get(config, "@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);
}
}
/* We don't need to store the URI; we only use it once */
vp = virConnectOpen(uri);
if (!vp) {
free(info);

View File

@ -353,9 +353,12 @@ mcast_config(config_object_t *config, mcast_options *args)
}
}
args->flags = 0;
if (sc_get(config, "listeners/multicast/@name_mode",
value, sizeof(value)-1) == 0) {
if (sc_get(config, "@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
* to explicitly ignore UUID vs. name
*/
dbg_printf(1, "Got %s for name_mode\n", value);
if (!strcasecmp(value, "uuid")) {
args->flags |= RF_UUID;