/*
* Convenience method to grab a long int from the config file object
*/
-static int
+int
xenConfigGetBool(virConfPtr conf,
const char *name,
int *value,
/*
* Convenience method to grab a int from the config file object
*/
-static int
+int
xenConfigGetULong(virConfPtr conf,
const char *name,
unsigned long *value,
}
-static int
+int
xenConfigCopyStringOpt(virConfPtr conf, const char *name, char **value)
{
return xenConfigCopyStringInternal(conf, name, value, 1);
}
-static int
-xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l)
+int
+xenConfigSetInt(virConfPtr conf, const char *setting, long long l)
{
virConfValuePtr value = NULL;
}
-static int
-xenXMConfigSetString(virConfPtr conf, const char *setting, const char *str)
+int
+xenConfigSetString(virConfPtr conf, const char *setting, const char *str)
{
virConfValuePtr value = NULL;
{
char uuid[VIR_UUID_STRING_BUFLEN];
- if (xenXMConfigSetString(conf, "name", def->name) < 0)
+ if (xenConfigSetString(conf, "name", def->name) < 0)
return -1;
virUUIDFormat(def->uuid, uuid);
- if (xenXMConfigSetString(conf, "uuid", uuid) < 0)
+ if (xenConfigSetString(conf, "uuid", uuid) < 0)
return -1;
return 0;
static int
xenFormatMem(virConfPtr conf, virDomainDefPtr def)
{
- if (xenXMConfigSetInt(conf, "maxmem",
- VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
+ if (xenConfigSetInt(conf, "maxmem",
+ VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "memory",
- VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
+ if (xenConfigSetInt(conf, "memory",
+ VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
return -1;
return 0;
virDomainClockOffsetTypeToString(def->clock.offset));
return -1;
}
- if (xenXMConfigSetInt(conf, "rtc_timeoffset", rtc_timeoffset) < 0)
+ if (xenConfigSetInt(conf, "rtc_timeoffset", rtc_timeoffset) < 0)
return -1;
} else {
} /* !hvm */
}
- if (xenXMConfigSetInt(conf, "localtime", vmlocaltime) < 0)
+ if (xenConfigSetInt(conf, "localtime", vmlocaltime) < 0)
return -1;
return 0;
_("unexpected lifecycle action %d"), def->onPoweroff);
return -1;
}
- if (xenXMConfigSetString(conf, "on_poweroff", lifecycle) < 0)
+ if (xenConfigSetString(conf, "on_poweroff", lifecycle) < 0)
return -1;
_("unexpected lifecycle action %d"), def->onReboot);
return -1;
}
- if (xenXMConfigSetString(conf, "on_reboot", lifecycle) < 0)
+ if (xenConfigSetString(conf, "on_reboot", lifecycle) < 0)
return -1;
_("unexpected lifecycle action %d"), def->onCrash);
return -1;
}
- if (xenXMConfigSetString(conf, "on_crash", lifecycle) < 0)
+ if (xenConfigSetString(conf, "on_crash", lifecycle) < 0)
return -1;
return 0;
ret = xenFormatSxprChr(def->parallels[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
- ret = xenXMConfigSetString(conf, "parallel", str);
+ ret = xenConfigSetString(conf, "parallel", str);
VIR_FREE(str);
if (ret < 0)
return -1;
} else {
- if (xenXMConfigSetString(conf, "parallel", "none") < 0)
+ if (xenConfigSetString(conf, "parallel", "none") < 0)
return -1;
}
ret = xenFormatSxprChr(def->serials[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
- ret = xenXMConfigSetString(conf, "serial", str);
+ ret = xenConfigSetString(conf, "serial", str);
VIR_FREE(str);
if (ret < 0)
return -1;
VIR_FREE(serialVal);
}
} else {
- if (xenXMConfigSetString(conf, "serial", "none") < 0)
+ if (xenConfigSetString(conf, "serial", "none") < 0)
return -1;
}
}
int ret = -1;
char *cpus = NULL;
- if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
+ if (xenConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
goto cleanup;
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough. */
if (def->vcpus < def->maxvcpus &&
- xenXMConfigSetInt(conf, "vcpu_avail", (1UL << def->vcpus) - 1) < 0)
+ xenConfigSetInt(conf, "vcpu_avail", (1UL << def->vcpus) - 1) < 0)
goto cleanup;
if ((def->cpumask != NULL) &&
}
if (cpus &&
- xenXMConfigSetString(conf, "cpus", cpus) < 0)
+ xenConfigSetString(conf, "cpus", cpus) < 0)
goto cleanup;
ret = 0;
size_t i;
if (STREQ(def->os.type, "hvm")) {
- if (xenXMConfigSetInt(conf, "pae",
- (def->features[VIR_DOMAIN_FEATURE_PAE] ==
- VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
+ if (xenConfigSetInt(conf, "pae",
+ (def->features[VIR_DOMAIN_FEATURE_PAE] ==
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "acpi",
- (def->features[VIR_DOMAIN_FEATURE_ACPI] ==
- VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
+ if (xenConfigSetInt(conf, "acpi",
+ (def->features[VIR_DOMAIN_FEATURE_ACPI] ==
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "apic",
- (def->features[VIR_DOMAIN_FEATURE_APIC] ==
- VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
+ if (xenConfigSetInt(conf, "apic",
+ (def->features[VIR_DOMAIN_FEATURE_APIC] ==
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4) {
- if (xenXMConfigSetInt(conf, "hap",
- (def->features[VIR_DOMAIN_FEATURE_HAP] ==
- VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
+ if (xenConfigSetInt(conf, "hap",
+ (def->features[VIR_DOMAIN_FEATURE_HAP] ==
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "viridian",
- (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
- VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
+ if (xenConfigSetInt(conf, "viridian",
+ (def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
+ VIR_TRISTATE_SWITCH_ON) ? 1 : 0) < 0)
return -1;
}
for (i = 0; i < def->clock.ntimers; i++) {
if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET &&
def->clock.timers[i]->present != -1 &&
- xenXMConfigSetInt(conf, "hpet", def->clock.timers[i]->present) < 0)
+ xenConfigSetInt(conf, "hpet", def->clock.timers[i]->present) < 0)
return -1;
}
}
xenFormatEmulator(virConfPtr conf, virDomainDefPtr def)
{
if (def->emulator &&
- xenXMConfigSetString(conf, "device_model", def->emulator) < 0)
+ xenConfigSetString(conf, "device_model", def->emulator) < 0)
return -1;
return 0;
def->disks[i]->dst &&
STREQ(def->disks[i]->dst, "hdc") &&
virDomainDiskGetSource(def->disks[i])) {
- if (xenXMConfigSetString(conf, "cdrom",
- virDomainDiskGetSource(def->disks[i])) < 0)
+ if (xenConfigSetString(conf, "cdrom",
+ virDomainDiskGetSource(def->disks[i])) < 0)
return -1;
break;
}
if (STREQ(def->os.type, "hvm")) {
char boot[VIR_DOMAIN_BOOT_LAST+1];
- if (xenXMConfigSetString(conf, "builder", "hvm") < 0)
+ if (xenConfigSetString(conf, "builder", "hvm") < 0)
return -1;
if (def->os.loader && def->os.loader->path &&
- xenXMConfigSetString(conf, "kernel", def->os.loader->path) < 0)
+ xenConfigSetString(conf, "kernel", def->os.loader->path) < 0)
return -1;
for (i = 0; i < def->os.nBootDevs; i++) {
boot[def->os.nBootDevs] = '\0';
}
- if (xenXMConfigSetString(conf, "boot", boot) < 0)
+ if (xenConfigSetString(conf, "boot", boot) < 0)
return -1;
/* XXX floppy disks */
} else {
if (def->os.bootloader &&
- xenXMConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
+ xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
return -1;
if (def->os.bootloaderArgs &&
- xenXMConfigSetString(conf, "bootargs", def->os.bootloaderArgs) < 0)
+ xenConfigSetString(conf, "bootargs", def->os.bootloaderArgs) < 0)
return -1;
if (def->os.kernel &&
- xenXMConfigSetString(conf, "kernel", def->os.kernel) < 0)
+ xenConfigSetString(conf, "kernel", def->os.kernel) < 0)
return -1;
if (def->os.initrd &&
- xenXMConfigSetString(conf, "ramdisk", def->os.initrd) < 0)
+ xenConfigSetString(conf, "ramdisk", def->os.initrd) < 0)
return -1;
if (def->os.cmdline &&
- xenXMConfigSetString(conf, "extra", def->os.cmdline) < 0)
+ xenConfigSetString(conf, "extra", def->os.cmdline) < 0)
return -1;
} /* !hvm */
if (def->ngraphics == 1) {
if (hvm || (xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)) {
if (def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
- if (xenXMConfigSetInt(conf, "sdl", 1) < 0)
+ if (xenConfigSetInt(conf, "sdl", 1) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "vnc", 0) < 0)
+ if (xenConfigSetInt(conf, "vnc", 0) < 0)
return -1;
if (def->graphics[0]->data.sdl.display &&
- xenXMConfigSetString(conf, "display",
- def->graphics[0]->data.sdl.display) < 0)
+ xenConfigSetString(conf, "display",
+ def->graphics[0]->data.sdl.display) < 0)
return -1;
if (def->graphics[0]->data.sdl.xauth &&
- xenXMConfigSetString(conf, "xauthority",
- def->graphics[0]->data.sdl.xauth) < 0)
+ xenConfigSetString(conf, "xauthority",
+ def->graphics[0]->data.sdl.xauth) < 0)
return -1;
} else {
const char *listenAddr;
- if (xenXMConfigSetInt(conf, "sdl", 0) < 0)
+ if (xenConfigSetInt(conf, "sdl", 0) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "vnc", 1) < 0)
+ if (xenConfigSetInt(conf, "vnc", 1) < 0)
return -1;
- if (xenXMConfigSetInt(conf, "vncunused",
+ if (xenConfigSetInt(conf, "vncunused",
def->graphics[0]->data.vnc.autoport ? 1 : 0) < 0)
return -1;
if (!def->graphics[0]->data.vnc.autoport &&
- xenXMConfigSetInt(conf, "vncdisplay",
- def->graphics[0]->data.vnc.port - 5900) < 0)
+ xenConfigSetInt(conf, "vncdisplay",
+ def->graphics[0]->data.vnc.port - 5900) < 0)
return -1;
listenAddr = virDomainGraphicsListenGetAddress(def->graphics[0], 0);
if (listenAddr &&
- xenXMConfigSetString(conf, "vnclisten", listenAddr) < 0)
+ xenConfigSetString(conf, "vnclisten", listenAddr) < 0)
return -1;
if (def->graphics[0]->data.vnc.auth.passwd &&
- xenXMConfigSetString(conf, "vncpasswd",
- def->graphics[0]->data.vnc.auth.passwd) < 0)
+ xenConfigSetString(conf, "vncpasswd",
+ def->graphics[0]->data.vnc.auth.passwd) < 0)
return -1;
if (def->graphics[0]->data.vnc.keymap &&
- xenXMConfigSetString(conf, "keymap",
- def->graphics[0]->data.vnc.keymap) < 0)
+ xenConfigSetString(conf, "keymap",
+ def->graphics[0]->data.vnc.keymap) < 0)
return -1;
}
} else {
str = virBufferContentAndReset(&buf);
if (ret == 0)
- ret = xenXMConfigSetString(conf, "soundhw", str);
+ ret = xenConfigSetString(conf, "soundhw", str);
VIR_FREE(str);
if (ret < 0)
if (STREQ(def->os.type, "hvm")) {
for (i = 0; i < def->ninputs; i++) {
if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
- if (xenXMConfigSetInt(conf, "usb", 1) < 0)
+ if (xenConfigSetInt(conf, "usb", 1) < 0)
return -1;
switch (def->inputs[i]->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
- if (xenXMConfigSetString(conf, "usbdevice", "mouse") < 0)
+ if (xenConfigSetString(conf, "usbdevice", "mouse") < 0)
return -1;
break;
case VIR_DOMAIN_INPUT_TYPE_TABLET:
- if (xenXMConfigSetString(conf, "usbdevice", "tablet") < 0)
+ if (xenConfigSetString(conf, "usbdevice", "tablet") < 0)
return -1;
break;
case VIR_DOMAIN_INPUT_TYPE_KBD:
- if (xenXMConfigSetString(conf, "usbdevice", "keyboard") < 0)
+ if (xenConfigSetString(conf, "usbdevice", "keyboard") < 0)
return -1;
break;