{
if (hvm) {
if (sexpr_node_copy(node, "domain/image/hvm/loader", &def->os.loader) < 0)
- goto no_memory;
+ goto error;
if (def->os.loader == NULL) {
if (sexpr_node_copy(node, "domain/image/hvm/kernel", &def->os.loader) < 0)
- goto no_memory;
+ goto error;
if (def->os.loader == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
}
} else {
if (sexpr_node_copy(node, "domain/image/hvm/kernel", &def->os.kernel) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/hvm/ramdisk", &def->os.initrd) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/hvm/args", &def->os.cmdline) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/hvm/root", &def->os.root) < 0)
- goto no_memory;
+ goto error;
}
} else {
if (sexpr_node_copy(node, "domain/image/linux/kernel", &def->os.kernel) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/linux/ramdisk", &def->os.initrd) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/linux/args", &def->os.cmdline) < 0)
- goto no_memory;
+ goto error;
if (sexpr_node_copy(node, "domain/image/linux/root", &def->os.root) < 0)
- goto no_memory;
+ goto error;
}
/* If HVM kenrel == loader, then old xend, so kill off kernel */
return 0;
-no_memory:
- virReportOOMError();
+error:
return -1;
}
}
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto error;
if (dst == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
goto error;
} else {
if (VIR_ALLOC_N(disk->driverName, (offset-src)+1) < 0)
- goto no_memory;
+ goto error;
if (virStrncpy(disk->driverName, src, offset-src,
(offset-src)+1) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
disk->shared = true;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
- goto no_memory;
+ goto error;
/* re-order disks if there is a bootable device */
if (STREQ_NULLABLE(bootable, "1")) {
return 0;
-no_memory:
- virReportOOMError();
-
error:
virDomainDiskDefFree(disk);
return -1;
type = sexpr_node(node, "device/vif/type");
if (VIR_ALLOC(net) < 0)
- goto no_memory;
+ goto cleanup;
if (tmp != NULL ||
(tmp2 != NULL && STREQ(tmp2, DEFAULT_VIF_SCRIPT))) {
goto cleanup;
} else if (def->id != -1) {
if (virAsprintf(&net->ifname, "vif%d.%d", def->id, vif_index) < 0)
- goto no_memory;
+ goto cleanup;
}
tmp = sexpr_node(node, "device/vif/mac");
goto cleanup;
if (VIR_REALLOC_N(def->nets, def->nnets + 1) < 0)
- goto no_memory;
+ goto cleanup;
def->nets[def->nnets++] = net;
vif_index++;
return 0;
-no_memory:
- virReportOOMError();
cleanup:
virDomainNetDefFree(net);
return -1;
if (VIR_ALLOC_N(def->sounds,
VIR_DOMAIN_SOUND_MODEL_ES1370 + 1) < 0)
- goto no_memory;
+ goto error;
for (i = 0; i < (VIR_DOMAIN_SOUND_MODEL_ES1370 + 1); i++) {
virDomainSoundDefPtr sound;
if (VIR_ALLOC(sound) < 0)
- goto no_memory;
+ goto error;
sound->model = i;
def->sounds[def->nsounds++] = sound;
}
}
if (VIR_ALLOC(sound) < 0)
- goto no_memory;
+ goto error;
if ((sound->model = virDomainSoundModelTypeFromString(model)) < 0) {
VIR_FREE(sound);
if (VIR_REALLOC_N(def->sounds, def->nsounds+1) < 0) {
virDomainSoundDefFree(sound);
- goto no_memory;
+ goto error;
}
def->sounds[def->nsounds++] = sound;
return 0;
-no_memory:
- virReportOOMError();
error:
return -1;
}
STREQ(tmp, "mouse")) {
virDomainInputDefPtr input;
if (VIR_ALLOC(input) < 0)
- goto no_memory;
+ goto error;
input->bus = VIR_DOMAIN_INPUT_BUS_USB;
if (STREQ(tmp, "tablet"))
input->type = VIR_DOMAIN_INPUT_TYPE_TABLET;
if (VIR_REALLOC_N(def->inputs, def->ninputs+1) < 0) {
VIR_FREE(input);
- goto no_memory;
+ goto error;
}
def->inputs[def->ninputs++] = input;
} else {
}
return 0;
-no_memory:
- virReportOOMError();
+error:
return -1;
}
port = vncport;
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto error;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
/* For Xen >= 3.0.3, don't generate a fixed port mapping
goto error;
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto error;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
const char *xauth = sexpr_fmt_node(root, "domain/image/%s/xauthority", hvm ? "hvm" : "linux");
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto error;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
if (VIR_STRDUP(graphics->data.sdl.display, display) < 0)
goto error;
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto error;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
return 0;
-no_memory:
- virReportOOMError();
error:
virDomainGraphicsDefFree(graphics);
return -1;
}
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto error;
if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
}
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto error;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
return 0;
-no_memory:
- virReportOOMError();
error:
virDomainGraphicsDefFree(graphics);
return -1;
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
virDomainHostdevDefFree(dev);
- goto no_memory;
+ goto error;
}
def->hostdevs[def->nhostdevs++] = dev;
return 0;
-no_memory:
- virReportOOMError();
-
error:
virDomainHostdevDefFree(dev);
return -1;
int hvm = 0, vmlocaltime;
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto error;
tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */
def->id = -1;
if (sexpr_node_copy(root, "domain/name", &def->name) < 0)
- goto no_memory;
+ goto error;
if (def->name == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing name"));
goto error;
if (sexpr_node_copy(root, "domain/description", &def->description) < 0)
- goto no_memory;
+ goto error;
hvm = sexpr_lookup(root, "domain/image/hvm") ? 1 : 0;
if (!hvm) {
if (sexpr_node_copy(root, "domain/bootloader",
&def->os.bootloader) < 0)
- goto no_memory;
+ goto error;
if (!def->os.bootloader &&
sexpr_has(root, "domain/bootloader") &&
if (def->os.bootloader &&
sexpr_node_copy(root, "domain/bootloader_args",
&def->os.bootloaderArgs) < 0)
- goto no_memory;
+ goto error;
}
if (VIR_STRDUP(def->os.type, hvm ? "hvm" : "linux") < 0)
virDomainTimerDefPtr timer;
if (VIR_ALLOC_N(def->clock.timers, 1) < 0 ||
- VIR_ALLOC(timer) < 0) {
- virReportOOMError();
+ VIR_ALLOC(timer) < 0)
goto error;
- }
timer->name = VIR_DOMAIN_TIMER_NAME_HPET;
timer->present = sexpr_int(root, "domain/image/hvm/hpet");
"domain/image/hvm/device_model" :
"domain/image/linux/device_model",
&def->emulator) < 0)
- goto no_memory;
+ goto error;
/* append block devices */
if (xenParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
if ((tmp != NULL) && (tmp[0] != 0)) {
virDomainDiskDefPtr disk;
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto error;
if (VIR_STRDUP(disk->src, tmp) < 0) {
virDomainDiskDefFree(disk);
goto error;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
virDomainDiskDefFree(disk);
- goto no_memory;
+ goto error;
}
def->disks[def->ndisks++] = disk;
}
if ((tmp != NULL) && (tmp[0] != 0)) {
virDomainDiskDefPtr disk;
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto error;
if (VIR_STRDUP(disk->src, tmp) < 0) {
VIR_FREE(disk);
goto error;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
virDomainDiskDefFree(disk);
- goto no_memory;
+ goto error;
}
def->disks[def->ndisks++] = disk;
}
goto error;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
virDomainChrDefFree(chr);
- goto no_memory;
+ goto error;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = def->nserials + ports_skipped;
goto error;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
virDomainChrDefFree(chr);
- goto no_memory;
+ goto error;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = 0;
goto error;
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
virDomainChrDefFree(chr);
- goto no_memory;
+ goto error;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
chr->target.port = 0;
} else if (def->id != 0) {
def->nconsoles = 1;
if (VIR_ALLOC_N(def->consoles, 1) < 0)
- goto no_memory;
+ goto error;
/* Fake a paravirt console, since that's not in the sexpr */
if (!(def->consoles[0] = xenParseSxprChar("pty", tty)))
goto error;
return def;
-no_memory:
- virReportOOMError();
error:
VIR_FREE(tty);
virDomainDefFree(def);
char *script = NULL;
char *listenAddr = NULL;
- if (VIR_ALLOC(def) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(def) < 0)
return NULL;
- }
def->virtType = VIR_DOMAIN_VIRT_XEN;
def->id = -1;
virDomainTimerDefPtr timer;
if (VIR_ALLOC_N(def->clock.timers, 1) < 0 ||
- VIR_ALLOC(timer) < 0) {
- virReportOOMError();
+ VIR_ALLOC(timer) < 0)
goto cleanup;
- }
timer->name = VIR_DOMAIN_TIMER_NAME_HPET;
timer->present = val;
head = list->str;
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto cleanup;
/*
* Disks have 3 components, SOURCE,DEST-DEVICE,MODE
disk->src = NULL; /* No source file given, eg CDROM with no media */
} else {
if (VIR_ALLOC_N(disk->src, (offset - head) + 1) < 0)
- goto no_memory;
+ goto cleanup;
if (virStrncpy(disk->src, head, offset - head,
(offset - head) + 1) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
if (!(offset = strchr(head, ',')))
goto skipdisk;
if (VIR_ALLOC_N(disk->dst, (offset - head) + 1) < 0)
- goto no_memory;
+ goto cleanup;
if (virStrncpy(disk->dst, head, offset - head,
(offset - head) + 1) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
/* The main type phy:, file:, tap: ... */
if ((tmp = strchr(disk->src, ':')) != NULL) {
if (VIR_ALLOC_N(disk->driverName, (tmp - disk->src) + 1) < 0)
- goto no_memory;
+ goto cleanup;
if (virStrncpy(disk->driverName, disk->src,
(tmp - disk->src),
(tmp - disk->src) + 1) == NULL) {
/* Maintain list in sorted order according to target device name */
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
- goto no_memory;
+ goto cleanup;
def->disks[def->ndisks++] = disk;
disk = NULL;
goto cleanup;
if (str) {
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto cleanup;
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
disk->readonly = true;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
- goto no_memory;
+ goto cleanup;
def->disks[def->ndisks++] = disk;
disk = NULL;
}
}
if (VIR_ALLOC(net) < 0)
- goto no_memory;
+ goto cleanup;
if (mac[0]) {
if (virMacAddrParse(mac, &net->mac) < 0) {
if (model[0] &&
VIR_STRDUP(net->model, model) < 0)
- goto no_memory;
+ goto cleanup;
if (!model[0] && type[0] && STREQ(type, "netfront") &&
VIR_STRDUP(net->model, "netfront") < 0)
goto cleanup;
if (VIR_REALLOC_N(def->nets, def->nnets+1) < 0)
- goto no_memory;
+ goto cleanup;
def->nets[def->nnets++] = net;
net = NULL;
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
virDomainHostdevDefFree(hostdev);
- goto no_memory;
+ goto cleanup;
}
def->hostdevs[def->nhostdevs++] = hostdev;
hostdev = NULL;
STREQ(str, "mouse"))) {
virDomainInputDefPtr input;
if (VIR_ALLOC(input) < 0)
- goto no_memory;
+ goto cleanup;
input->bus = VIR_DOMAIN_INPUT_BUS_USB;
input->type = STREQ(str, "tablet") ?
VIR_DOMAIN_INPUT_TYPE_TABLET :
VIR_DOMAIN_INPUT_TYPE_MOUSE;
if (VIR_ALLOC_N(def->inputs, 1) < 0) {
virDomainInputDefFree(input);
- goto no_memory;
+ goto cleanup;
}
def->inputs[0] = input;
def->ninputs = 1;
if (val) {
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto cleanup;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
if (xenXMConfigGetBool(conf, "vncunused", &val, 1) < 0)
goto cleanup;
goto cleanup;
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto cleanup;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
goto cleanup;
if (val) {
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto cleanup;
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
if (xenXMConfigCopyStringOpt(conf, "display", &graphics->data.sdl.display) < 0)
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "xauthority", &graphics->data.sdl.xauth) < 0)
goto cleanup;
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto cleanup;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
}
if (VIR_ALLOC(graphics) < 0)
- goto no_memory;
+ goto cleanup;
if (strstr(key, "type=sdl"))
graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
key = nextkey;
}
if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto no_memory;
+ goto cleanup;
def->graphics[0] = graphics;
def->ngraphics = 1;
graphics = NULL;
if (chr) {
if (VIR_ALLOC_N(def->parallels, 1) < 0) {
virDomainChrDefFree(chr);
- goto no_memory;
+ goto cleanup;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
chr->target.port = 0;
goto cleanup;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0)
- goto no_memory;
+ goto cleanup;
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = portnum;
if (chr) {
if (VIR_ALLOC_N(def->serials, 1) < 0) {
virDomainChrDefFree(chr);
- goto no_memory;
+ goto cleanup;
}
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = 0;
} else {
def->nconsoles = 1;
if (VIR_ALLOC_N(def->consoles, 1) < 0)
- goto no_memory;
+ goto cleanup;
if (!(def->consoles[0] = xenParseSxprChar("pty", NULL)))
goto cleanup;
def->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
VIR_FREE(script);
return def;
-no_memory:
- virReportOOMError();
- /* fallthrough */
cleanup:
virDomainGraphicsDefFree(graphics);
virDomainNetDefFree(net);
l, setting);
return -1;
}
- if (VIR_ALLOC(value) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(value) < 0)
return -1;
- }
value->type = VIR_CONF_LONG;
value->next = NULL;
int xenXMConfigSetString(virConfPtr conf, const char *setting, const char *str) {
virConfValuePtr value = NULL;
- if (VIR_ALLOC(value) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(value) < 0)
return -1;
- }
value->type = VIR_CONF_STRING;
value->next = NULL;
goto cleanup;
}
- if (VIR_ALLOC(val) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(val) < 0)
goto cleanup;
- }
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
if (serial) {
ret = xenFormatSxprChr(serial, &buf);
- if (ret < 0) {
- virReportOOMError();
+ if (ret < 0)
goto cleanup;
- }
} else {
virBufferAddLit(&buf, "none");
}
goto cleanup;
}
- if (VIR_ALLOC(val) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(val) < 0)
goto cleanup;
- }
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
goto cleanup;
}
- if (VIR_ALLOC(val) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(val) < 0)
goto cleanup;
- }
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
if (!hasPCI)
return 0;
- if (VIR_ALLOC(pciVal) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(pciVal) < 0)
return -1;
- }
pciVal->type = VIR_CONF_LIST;
pciVal->list = NULL;
def->hostdevs[i]->source.subsys.u.pci.addr.domain,
def->hostdevs[i]->source.subsys.u.pci.addr.bus,
def->hostdevs[i]->source.subsys.u.pci.addr.slot,
- def->hostdevs[i]->source.subsys.u.pci.addr.function) < 0) {
- virReportOOMError();
+ def->hostdevs[i]->source.subsys.u.pci.addr.function) < 0)
goto error;
- }
if (VIR_ALLOC(val) < 0) {
VIR_FREE(buf);
- virReportOOMError();
goto error;
}
val->type = VIR_CONF_STRING;
if (xenXMConfigSetString(conf, "name", def->name) < 0)
- goto no_memory;
+ goto cleanup;
virUUIDFormat(def->uuid, uuid);
if (xenXMConfigSetString(conf, "uuid", uuid) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "maxmem",
VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "memory",
VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
- goto no_memory;
+ 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)
- goto no_memory;
+ goto cleanup;
if ((def->cpumask != NULL) &&
((cpus = virBitmapFormat(def->cpumask)) == NULL)) {
if (cpus &&
xenXMConfigSetString(conf, "cpus", cpus) < 0)
- goto no_memory;
+ goto cleanup;
VIR_FREE(cpus);
hvm = STREQ(def->os.type, "hvm") ? 1 : 0;
if (hvm) {
char boot[VIR_DOMAIN_BOOT_LAST+1];
if (xenXMConfigSetString(conf, "builder", "hvm") < 0)
- goto no_memory;
+ goto cleanup;
if (def->os.loader &&
xenXMConfigSetString(conf, "kernel", def->os.loader) < 0)
- goto no_memory;
+ goto cleanup;
for (i = 0; i < def->os.nBootDevs; i++) {
switch (def->os.bootDevs[i]) {
}
if (xenXMConfigSetString(conf, "boot", boot) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "pae",
(def->features &
(1 << VIR_DOMAIN_FEATURE_PAE)) ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "acpi",
(def->features &
(1 << VIR_DOMAIN_FEATURE_ACPI)) ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "apic",
(def->features &
(1 << VIR_DOMAIN_FEATURE_APIC)) ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4) {
if (xenXMConfigSetInt(conf, "hap",
(def->features &
(1 << VIR_DOMAIN_FEATURE_HAP)) ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "viridian",
(def->features &
(1 << VIR_DOMAIN_FEATURE_VIRIDIAN)) ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
}
for (i = 0; i < def->clock.ntimers; i++) {
def->disks[i]->src) {
if (xenXMConfigSetString(conf, "cdrom",
def->disks[i]->src) < 0)
- goto no_memory;
+ goto cleanup;
break;
}
}
} else {
if (def->os.bootloader &&
xenXMConfigSetString(conf, "bootloader", def->os.bootloader) < 0)
- goto no_memory;
+ goto cleanup;
if (def->os.bootloaderArgs &&
xenXMConfigSetString(conf, "bootargs", def->os.bootloaderArgs) < 0)
- goto no_memory;
+ goto cleanup;
if (def->os.kernel &&
xenXMConfigSetString(conf, "kernel", def->os.kernel) < 0)
- goto no_memory;
+ goto cleanup;
if (def->os.initrd &&
xenXMConfigSetString(conf, "ramdisk", def->os.initrd) < 0)
- goto no_memory;
+ goto cleanup;
if (def->os.cmdline &&
xenXMConfigSetString(conf, "extra", def->os.cmdline) < 0)
- goto no_memory;
+ goto cleanup;
} /* !hvm */
goto cleanup;
}
if (xenXMConfigSetInt(conf, "rtc_timeoffset", rtc_timeoffset) < 0)
- goto no_memory;
+ goto cleanup;
} else {
/* >=3.1 PV: UTC and LOCALTIME */
switch (def->clock.offset) {
} /* !hvm */
}
if (xenXMConfigSetInt(conf, "localtime", vmlocaltime) < 0)
- goto no_memory;
+ goto cleanup;
if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) {
goto cleanup;
}
if (xenXMConfigSetString(conf, "on_poweroff", lifecycle) < 0)
- goto no_memory;
+ goto cleanup;
if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) {
goto cleanup;
}
if (xenXMConfigSetString(conf, "on_reboot", lifecycle) < 0)
- goto no_memory;
+ goto cleanup;
if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) {
goto cleanup;
}
if (xenXMConfigSetString(conf, "on_crash", lifecycle) < 0)
- goto no_memory;
+ goto cleanup;
if (hvm) {
if (def->emulator &&
xenXMConfigSetString(conf, "device_model", def->emulator) < 0)
- goto no_memory;
+ goto cleanup;
for (i = 0; i < def->ninputs; i++) {
if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
if (xenXMConfigSetInt(conf, "usb", 1) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetString(conf, "usbdevice",
def->inputs[i]->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ?
"mouse" : "tablet") < 0)
- goto no_memory;
+ goto cleanup;
break;
}
}
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)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "vnc", 0) < 0)
- goto no_memory;
+ goto cleanup;
if (def->graphics[0]->data.sdl.display &&
xenXMConfigSetString(conf, "display",
def->graphics[0]->data.sdl.display) < 0)
- goto no_memory;
+ goto cleanup;
if (def->graphics[0]->data.sdl.xauth &&
xenXMConfigSetString(conf, "xauthority",
def->graphics[0]->data.sdl.xauth) < 0)
- goto no_memory;
+ goto cleanup;
} else {
const char *listenAddr;
if (xenXMConfigSetInt(conf, "sdl", 0) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "vnc", 1) < 0)
- goto no_memory;
+ goto cleanup;
if (xenXMConfigSetInt(conf, "vncunused",
def->graphics[0]->data.vnc.autoport ? 1 : 0) < 0)
- goto no_memory;
+ goto cleanup;
if (!def->graphics[0]->data.vnc.autoport &&
xenXMConfigSetInt(conf, "vncdisplay",
def->graphics[0]->data.vnc.port - 5900) < 0)
- goto no_memory;
+ goto cleanup;
listenAddr = virDomainGraphicsListenGetAddress(def->graphics[0], 0);
if (listenAddr &&
xenXMConfigSetString(conf, "vnclisten", listenAddr) < 0)
- goto no_memory;
+ goto cleanup;
if (def->graphics[0]->data.vnc.auth.passwd &&
xenXMConfigSetString(conf, "vncpasswd",
def->graphics[0]->data.vnc.auth.passwd) < 0)
- goto no_memory;
+ goto cleanup;
if (def->graphics[0]->data.vnc.keymap &&
xenXMConfigSetString(conf, "keymap",
def->graphics[0]->data.vnc.keymap) < 0)
- goto no_memory;
+ goto cleanup;
}
} else {
virConfValuePtr vfb, disp;
}
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
- goto no_memory;
+ virReportOOMError();
+ goto cleanup;
}
vfbstr = virBufferContentAndReset(&buf);
if (VIR_ALLOC(vfb) < 0) {
VIR_FREE(vfbstr);
- goto no_memory;
+ goto cleanup;
}
if (VIR_ALLOC(disp) < 0) {
VIR_FREE(vfb);
VIR_FREE(vfbstr);
- goto no_memory;
+ goto cleanup;
}
vfb->type = VIR_CONF_LIST;
disp->str = vfbstr;
if (virConfSetValue(conf, "vfb", vfb) < 0)
- goto no_memory;
+ goto cleanup;
}
}
/* analyze of the devices */
if (VIR_ALLOC(diskVal) < 0)
- goto no_memory;
+ goto cleanup;
diskVal->type = VIR_CONF_LIST;
diskVal->list = NULL;
int ret = virConfSetValue(conf, "disk", diskVal);
diskVal = NULL;
if (ret < 0)
- goto no_memory;
+ goto cleanup;
}
VIR_FREE(diskVal);
if (VIR_ALLOC(netVal) < 0)
- goto no_memory;
+ goto cleanup;
netVal->type = VIR_CONF_LIST;
netVal->list = NULL;
int ret = virConfSetValue(conf, "vif", netVal);
netVal = NULL;
if (ret < 0)
- goto no_memory;
+ goto cleanup;
}
VIR_FREE(netVal);
ret = xenXMConfigSetString(conf, "parallel", str);
VIR_FREE(str);
if (ret < 0)
- goto no_memory;
+ goto cleanup;
} else {
if (xenXMConfigSetString(conf, "parallel", "none") < 0)
- goto no_memory;
+ goto cleanup;
}
if (def->nserials) {
ret = xenXMConfigSetString(conf, "serial", str);
VIR_FREE(str);
if (ret < 0)
- goto no_memory;
+ goto cleanup;
} else {
int j = 0;
int maxport = -1;
virConfValuePtr serialVal = NULL;
if (VIR_ALLOC(serialVal) < 0)
- goto no_memory;
+ goto cleanup;
serialVal->type = VIR_CONF_LIST;
serialVal->list = NULL;
int ret = virConfSetValue(conf, "serial", serialVal);
serialVal = NULL;
if (ret < 0)
- goto no_memory;
+ goto cleanup;
}
VIR_FREE(serialVal);
}
} else {
if (xenXMConfigSetString(conf, "serial", "none") < 0)
- goto no_memory;
+ goto cleanup;
}
VIR_FREE(str);
if (ret < 0)
- goto no_memory;
+ goto cleanup;
}
}
return conf;
-no_memory:
- virReportOOMError();
-
cleanup:
virConfFreeValue(diskVal);
virConfFreeValue(netVal);