xenParseXLVnuma(virConf *conf,
virDomainDef *def)
{
- int ret = -1;
size_t vcpus = 0;
size_t nr_nodes = 0;
size_t vnodeCnt = 0;
}
if (!virDomainNumaSetNodeCount(numa, nr_nodes))
- goto cleanup;
+ return -1;
cpu = virCPUDefNew();
virReportError(VIR_ERR_INTERNAL_ERROR,
_("vnuma vnode invalid format '%s'"),
str);
- goto cleanup;
+ return -1;
}
data++;
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma vnode %zu contains invalid pnode value '%s'"),
vnodeCnt, data);
- goto cleanup;
+ return -1;
}
pnode = cellid;
} else if (STRPREFIX(str, "size")) {
if (virStrToLong_ull(data, NULL, 10, &kbsize) < 0)
- goto cleanup;
+ return -1;
virDomainNumaSetNodeMemorySize(numa, vnodeCnt, (kbsize * 1024));
} else if (STRPREFIX(str, "vcpus")) {
if (virBitmapParse(data, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
+ return -1;
virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask);
vcpus += virBitmapCountBits(cpumask);
unsigned int value;
if (!(token = g_strsplit(data, ",", 0)))
- goto cleanup;
+ return -1;
ndistances = g_strv_length(token);
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma pnode %d configured '%s' (count %zu) doesn't fit the number of specified vnodes %zu"),
pnode, str, ndistances, nr_nodes);
- goto cleanup;
+ return -1;
}
if (virDomainNumaSetNodeDistanceCount(numa, vnodeCnt, ndistances) != ndistances)
- goto cleanup;
+ return -1;
for (i = 0; i < ndistances; i++) {
if ((virStrToLong_ui(token[i], NULL, 10, &value) < 0) ||
(virDomainNumaSetNodeDistance(numa, vnodeCnt, i, value) != value))
- goto cleanup;
+ return -1;
}
} else {
virReportError(VIR_ERR_CONF_SYNTAX,
_("Invalid vnuma configuration for vnode %zu"),
vnodeCnt);
- goto cleanup;
+ return -1;
}
}
vnode = vnode->next;
virReportError(VIR_ERR_CONF_SYNTAX,
_("Incomplete vnuma configuration for vnode %zu"),
vnodeCnt);
- goto cleanup;
+ return -1;
}
list = list->next;
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vnuma configuration contains %zu vcpus, which is greater than %zu maxvcpus"),
vcpus, def->maxvcpus);
- goto cleanup;
+ return -1;
}
cpu->type = VIR_CPU_TYPE_GUEST;
def->cpu = g_steal_pointer(&cpu);
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
static int
static int
xenParseXLDiskSrc(virDomainDiskDef *disk, char *srcstr)
{
- int ret = -1;
-
/* A NULL source is valid, e.g. an empty CDROM */
if (srcstr == NULL)
return 0;
g_autofree char *tmpstr = NULL;
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
- goto cleanup;
+ return -1;
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
- ret = virStorageSourceParseRBDColonString(tmpstr, disk->src);
- } else {
- virDomainDiskSetSource(disk, srcstr);
-
- ret = 0;
+ return virStorageSourceParseRBDColonString(tmpstr, disk->src);
}
- cleanup:
- return ret;
+ virDomainDiskSetSource(disk, srcstr);
+
+ return 0;
}
nr_nodes = virDomainNumaGetNodeCount(numa);
for (i = 0; i < nr_nodes; i++) {
if (xenFormatXLVnuma(vnumaVal, numa, i, nr_nodes) < 0)
- goto cleanup;
+ return -1;
}
if (vnumaVal->list != NULL &&
return -1;
return 0;
-
- cleanup:
- return -1;
}
static int
continue;
if (xenFormatXLDisk(diskVal, def->disks[i]) < 0)
- goto cleanup;
+ return -1;
}
if (diskVal->list != NULL &&
return -1;
return 0;
-
- cleanup:
- return -1;
}
for (i = 0; i < def->ninputs; i++) {
if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
if (xenConfigSetInt(conf, "usb", 1) < 0)
- goto error;
+ return -1;
switch (def->inputs[i]->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
/* for compatibility with Xen <= 4.2, use old syntax when
* only one device present */
if (xenConfigSetString(conf, "usbdevice", usbdevices->list->str) < 0)
- goto error;
+ return -1;
} else {
if (virConfSetValue(conf, "usbdevice", &usbdevices) < 0)
- goto error;
+ return -1;
}
}
}
return 0;
- error:
- return -1;
}
static int
break;
default:
- goto error;
+ return -1;
}
}
return -1;
return 0;
-
- error:
- return -1;
}
continue;
if (xenFormatXLChannel(channelVal, def->channels[i]) < 0)
- goto cleanup;
+ return -1;
}
if (channelVal->list != NULL &&
virConfSetValue(conf, "channel", &channelVal) < 0)
- goto cleanup;
+ return -1;
return 0;
-
- cleanup:
- return -1;
}
static int
if (args->list != NULL &&
virConfSetValue(conf, "device_model_args", &args) < 0)
- goto error;
+ return -1;
return 0;
-
- error:
- return -1;
}
virConf *