mirror of https://gitee.com/openkylin/libvirt.git
conf: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
26791f39c0
commit
3814e767d5
|
@ -1789,7 +1789,6 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
|
|||
virDomainDeviceVirtioSerialAddress *addr,
|
||||
bool allowZero)
|
||||
{
|
||||
int ret = -1;
|
||||
ssize_t port, startPort = 0;
|
||||
ssize_t i;
|
||||
unsigned int controller;
|
||||
|
@ -1801,7 +1800,7 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
|
|||
if (addrs->ncontrollers == 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("no virtio-serial controllers are available"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < addrs->ncontrollers; i++) {
|
||||
|
@ -1818,7 +1817,7 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
|
|||
|
||||
if (idx == -1) {
|
||||
if (virDomainVirtioSerialAddrSetAutoaddController(def, addrs, i) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
controller = i;
|
||||
port = startPort + 1;
|
||||
goto success;
|
||||
|
@ -1829,8 +1828,7 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
|
|||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Unable to find a free virtio-serial port"));
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return -1;
|
||||
|
||||
success:
|
||||
addr->bus = 0;
|
||||
|
@ -1838,8 +1836,7 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
|
|||
addr->controller = controller;
|
||||
VIR_DEBUG("Found free virtio serial controller %u port %u", addr->controller,
|
||||
addr->port);
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1880,7 +1877,6 @@ virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
|||
bool allowZero,
|
||||
bool portOnly)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainDeviceInfo nfo = { 0 };
|
||||
virDomainDeviceInfoPtr ptr = allowZero ? &nfo : info;
|
||||
|
||||
|
@ -1889,20 +1885,17 @@ virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
|||
if (portOnly) {
|
||||
if (virDomainVirtioSerialAddrNextFromController(addrs,
|
||||
&ptr->addr.vioserial) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
} else {
|
||||
if (virDomainVirtioSerialAddrNext(def, addrs, &ptr->addr.vioserial,
|
||||
allowZero) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainVirtioSerialAddrReserve(NULL, NULL, ptr, addrs) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* virDomainVirtioSerialAddrAutoAssign
|
||||
|
|
|
@ -288,7 +288,6 @@ virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
|||
size_t nvalues,
|
||||
unsigned int *values)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nvalues; i++) {
|
||||
|
@ -300,15 +299,13 @@ virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
|||
_("integer overflow on %s. Please contact the "
|
||||
"libvirt development team at libvir-list@redhat.com"),
|
||||
capsEnumName);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
capsEnum->values |= val;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,19 +322,15 @@ virDomainCapsEnumFormat(virBufferPtr buf,
|
|||
const char *capsEnumName,
|
||||
virDomainCapsValToStr valToStr)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
if (!capsEnum->report) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!capsEnum->report)
|
||||
return 0;
|
||||
|
||||
virBufferAsprintf(buf, "<enum name='%s'", capsEnumName);
|
||||
if (!capsEnum->values) {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
return 0;
|
||||
}
|
||||
virBufferAddLit(buf, ">\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
|
@ -354,9 +347,7 @@ virDomainCapsEnumFormat(virBufferPtr buf,
|
|||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</enum>\n");
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7111,7 +7111,6 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
|||
{
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) {
|
||||
virBufferAsprintf(buf, "<boot order='%u'", info->bootIndex);
|
||||
|
@ -7154,11 +7153,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
|||
}
|
||||
|
||||
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
|
||||
info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||
info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
/* We're done here */
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
return 0;
|
||||
|
||||
virBufferAsprintf(&attrBuf, " type='%s'",
|
||||
virDomainDeviceAddressTypeToString(info->type));
|
||||
|
@ -7254,10 +7251,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
|||
|
||||
virXMLFormatElement(buf, "address", &attrBuf, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -8432,10 +8426,10 @@ virDomainNetDefCoalesceParseXML(xmlNodePtr node,
|
|||
|
||||
str = virXPathString("string(./rx/frames/@max)", ctxt);
|
||||
if (!str)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if (VIR_ALLOC(ret) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if (virStrToLong_ullp(str, NULL, 10, &tmp) < 0) {
|
||||
virReportError(VIR_ERR_XML_DETAIL,
|
||||
|
@ -8453,12 +8447,11 @@ virDomainNetDefCoalesceParseXML(xmlNodePtr node,
|
|||
}
|
||||
ret->rx_max_coalesced_frames = tmp;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
|
||||
error:
|
||||
VIR_FREE(ret);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -9871,7 +9864,6 @@ virDomainDiskDefParsePrivateData(xmlXPathContextPtr ctxt,
|
|||
{
|
||||
xmlNodePtr private_node = virXPathNode("./privateData", ctxt);
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
int ret = -1;
|
||||
|
||||
if (!xmlopt ||
|
||||
!xmlopt->privateData.diskParse ||
|
||||
|
@ -9881,12 +9873,9 @@ virDomainDiskDefParsePrivateData(xmlXPathContextPtr ctxt,
|
|||
ctxt->node = private_node;
|
||||
|
||||
if (xmlopt->privateData.diskParse(ctxt, disk) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11340,7 +11329,6 @@ virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
|
|||
xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
int ret = -1;
|
||||
int tmpVal;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
xmlNodePtr cur;
|
||||
|
@ -11354,7 +11342,7 @@ virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
|
|||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("invalid reconnect enabled value: '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
def->enabled = tmpVal;
|
||||
VIR_FREE(tmp);
|
||||
|
@ -11366,20 +11354,18 @@ virDomainChrSourceReconnectDefParseXML(virDomainChrSourceReconnectDefPtr def,
|
|||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("invalid reconnect timeout value: '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("missing timeout for chardev with "
|
||||
"reconnect enabled"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -12601,7 +12587,6 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
|
|||
virSecurityLabelDefPtr* vmSeclabels,
|
||||
int nvmSeclabels)
|
||||
{
|
||||
int ret = -1;
|
||||
bool logParsed = false;
|
||||
bool protocolParsed = false;
|
||||
int sourceParsed = 0;
|
||||
|
@ -12716,13 +12701,11 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
|
|||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
virDomainChrSourceDefClear(def);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13917,7 +13900,6 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
|||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
int enableVal;
|
||||
xmlNodePtr glNode;
|
||||
int ret = -1;
|
||||
g_autofree char *fullscreen = virXMLPropString(node, "fullscreen");
|
||||
g_autofree char *enable = NULL;
|
||||
|
||||
|
@ -13927,7 +13909,7 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
|||
if (virStringParseYesNo(fullscreen, &def->data.sdl.fullscreen) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown fullscreen value '%s'"), fullscreen);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
def->data.sdl.fullscreen = false;
|
||||
|
@ -13942,21 +13924,19 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
|
|||
if (!enable) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("sdl gl element missing enable"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
enableVal = virTristateBoolTypeFromString(enable);
|
||||
if (enableVal < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown enable value '%s'"), enable);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
def->data.sdl.gl = enableVal;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -14992,7 +14972,6 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
|
|||
virSysinfoBaseBoardDefPtr *baseBoard,
|
||||
size_t *nbaseBoard)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i, nboards = 0;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
int n;
|
||||
|
@ -15000,10 +14979,10 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
|
|||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
if ((n = virXPathNodeSet("./baseBoard", ctxt, &nodes)) < 0)
|
||||
return ret;
|
||||
return -1;
|
||||
|
||||
if (n && VIR_ALLOC_N(boards, n) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
virSysinfoBaseBoardDefPtr def = boards + nboards;
|
||||
|
@ -15033,9 +15012,8 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
|
|||
|
||||
*baseBoard = g_steal_pointer(&boards);
|
||||
*nbaseBoard = nboards;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -15972,7 +15950,6 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
|
|||
xmlXPathContextPtr ctxt,
|
||||
virDomainMemoryDefPtr def)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
ctxt->node = node;
|
||||
g_autofree char *nodemask = NULL;
|
||||
|
@ -15981,17 +15958,17 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
|
|||
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
|
||||
if (virDomainParseMemory("./pagesize", "./pagesize/@unit", ctxt,
|
||||
&def->pagesize, false, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if ((nodemask = virXPathString("string(./nodemask)", ctxt))) {
|
||||
if (virBitmapParse(nodemask, &def->sourceNodes,
|
||||
VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virBitmapIsAllClear(def->sourceNodes)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Invalid value of 'nodemask': %s"), nodemask);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -16000,12 +15977,12 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
|
|||
if (!(def->nvdimmPath = virXPathString("string(./path)", ctxt))) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("path is required for model 'nvdimm'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainParseMemory("./alignsize", "./alignsize/@unit", ctxt,
|
||||
&def->alignsize, false, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virXPathBoolean("boolean(./pmem)", ctxt))
|
||||
def->nvdimmPmem = true;
|
||||
|
@ -16017,10 +15994,7 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
|
|||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -16029,7 +16003,6 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
|
|||
xmlXPathContextPtr ctxt,
|
||||
virDomainMemoryDefPtr def)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
ctxt->node = node;
|
||||
int rv;
|
||||
|
@ -16041,38 +16014,35 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
|
|||
(rv == 0 && def->targetNode < 0)) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("invalid value of memory device node"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainParseMemory("./size", "./size/@unit", ctxt,
|
||||
&def->size, true, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (def->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM) {
|
||||
if (virDomainParseMemory("./label/size", "./label/size/@unit", ctxt,
|
||||
&def->labelsize, false, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (def->labelsize && def->labelsize < 128) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("nvdimm label must be at least 128KiB"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->labelsize >= def->size) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("label size must be smaller than NVDIMM size"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virXPathBoolean("boolean(./readonly)", ctxt))
|
||||
def->readonly = true;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -16223,7 +16193,6 @@ static virDomainIOMMUDefPtr
|
|||
virDomainIOMMUDefParseXML(xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
virDomainIOMMUDefPtr ret = NULL;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
xmlNodePtr driver;
|
||||
int val;
|
||||
|
@ -16233,17 +16202,17 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
ctxt->node = node;
|
||||
|
||||
if (VIR_ALLOC(iommu) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if (!(tmp = virXMLPropString(node, "model"))) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("missing model for IOMMU device"));
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((val = virDomainIOMMUModelTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown IOMMU model: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
iommu->model = val;
|
||||
|
@ -16253,7 +16222,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
if ((tmp = virXMLPropString(driver, "intremap"))) {
|
||||
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
iommu->intremap = val;
|
||||
}
|
||||
|
@ -16262,7 +16231,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
if ((tmp = virXMLPropString(driver, "caching_mode"))) {
|
||||
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
iommu->caching_mode = val;
|
||||
}
|
||||
|
@ -16270,7 +16239,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
if ((tmp = virXMLPropString(driver, "iotlb"))) {
|
||||
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown iotlb value: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
iommu->iotlb = val;
|
||||
}
|
||||
|
@ -16279,16 +16248,13 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||
if ((tmp = virXMLPropString(driver, "eim"))) {
|
||||
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
iommu->eim = val;
|
||||
}
|
||||
}
|
||||
|
||||
ret = g_steal_pointer(&iommu);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return g_steal_pointer(&iommu);
|
||||
}
|
||||
|
||||
|
||||
|
@ -16298,7 +16264,6 @@ virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
xmlXPathContextPtr ctxt,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainVsockDefPtr ret = NULL;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
xmlNodePtr cid;
|
||||
int val;
|
||||
|
@ -16308,12 +16273,12 @@ virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
ctxt->node = node;
|
||||
|
||||
if (!(vsock = virDomainVsockDefNew(xmlopt)))
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if ((tmp = virXMLPropString(node, "model"))) {
|
||||
if ((val = virDomainVsockModelTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, _("unknown vsock model: %s"), tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
vsock->model = val;
|
||||
}
|
||||
|
@ -16328,7 +16293,7 @@ virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
virReportError(VIR_ERR_XML_DETAIL,
|
||||
_("'cid' attribute must be a positive number: %s"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16339,19 +16304,16 @@ virDomainVsockDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||
virReportError(VIR_ERR_XML_DETAIL,
|
||||
_("'auto' attribute can be 'yes' or 'no': %s"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
vsock->auto_cid = val;
|
||||
}
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(xmlopt, node, &vsock->info, flags) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
ret = g_steal_pointer(&vsock);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return g_steal_pointer(&vsock);
|
||||
}
|
||||
|
||||
virDomainDeviceDefPtr
|
||||
|
@ -18509,7 +18471,6 @@ virDomainHugepagesParseXML(xmlNodePtr node,
|
|||
xmlXPathContextPtr ctxt,
|
||||
virDomainHugePagePtr hugepage)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
g_autofree char *nodeset = NULL;
|
||||
|
||||
|
@ -18517,29 +18478,27 @@ virDomainHugepagesParseXML(xmlNodePtr node,
|
|||
|
||||
if (virDomainParseMemory("./@size", "./@unit", ctxt,
|
||||
&hugepage->size, true, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (!hugepage->size) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("hugepage size can't be zero"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((nodeset = virXMLPropString(node, "nodeset"))) {
|
||||
if (virBitmapParse(nodeset, &hugepage->nodemask,
|
||||
VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virBitmapIsAllClear(hugepage->nodemask)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Invalid value of 'nodeset': %s"), nodeset);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19188,7 +19147,6 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
|
|||
unsigned int cache;
|
||||
int type;
|
||||
unsigned long long size;
|
||||
int ret = -1;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
@ -19197,13 +19155,13 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
|
|||
if (!tmp) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing cachetune attribute 'id'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virStrToLong_uip(tmp, NULL, 10, &cache) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid cachetune attribute 'id' value '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
|
@ -19211,13 +19169,13 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
|
|||
if (!tmp) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing cachetune attribute 'level'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virStrToLong_uip(tmp, NULL, 10, &level) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid cachetune attribute 'level' value '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
|
@ -19225,27 +19183,25 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
|
|||
if (!tmp) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing cachetune attribute 'type'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
type = virCacheTypeFromString(tmp);
|
||||
if (type < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid cachetune attribute 'type' value '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainParseScaledValue("./@size", "./@unit",
|
||||
ctxt, &size, 1024,
|
||||
ULLONG_MAX, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virResctrlAllocSetCacheSize(alloc, level, type, cache, size) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19638,7 +19594,6 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt,
|
|||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
unsigned int id;
|
||||
unsigned int bandwidth;
|
||||
int ret = -1;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
@ -19647,13 +19602,13 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt,
|
|||
if (!tmp) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing memorytune attribute 'id'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virStrToLong_uip(tmp, NULL, 10, &id) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid memorytune attribute 'id' value '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
|
@ -19661,20 +19616,18 @@ virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt,
|
|||
if (!tmp) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing memorytune attribute 'bandwidth'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virStrToLong_uip(tmp, NULL, 10, &bandwidth) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid memorytune attribute 'bandwidth' value '%s'"),
|
||||
tmp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virResctrlAllocSetMemoryBandwidth(alloc, id, bandwidth) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24099,7 +24052,6 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr buf,
|
|||
virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_STATUS) ||
|
||||
!xmlopt || !xmlopt->privateData.storageFormat)
|
||||
|
@ -24108,14 +24060,10 @@ virDomainDiskSourceFormatPrivateData(virBufferPtr buf,
|
|||
virBufferSetChildIndent(&childBuf, buf);
|
||||
|
||||
if (xmlopt->privateData.storageFormat(src, &childBuf) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virXMLFormatElement(buf, "privateData", NULL, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24803,18 +24751,17 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||
const char *wrpolicy = virDomainFSWrpolicyTypeToString(def->wrpolicy);
|
||||
const char *src = def->src->path;
|
||||
g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
if (!type) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected filesystem type %d"), def->type);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!accessmode) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected accessmode %d"), def->accessmode);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferAsprintf(buf,
|
||||
|
@ -24890,7 +24837,7 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||
virBufferAddLit(buf, "<readonly/>\n");
|
||||
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (def->space_hard_limit)
|
||||
virBufferAsprintf(buf, "<space_hard_limit unit='bytes'>"
|
||||
|
@ -24902,10 +24849,7 @@ virDomainFSDefFormat(virBufferPtr buf,
|
|||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</filesystem>\n");
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26016,14 +25960,13 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
|
|||
const char *mode = virDomainSmartcardTypeToString(def->type);
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
virBufferSetChildIndent(&childBuf, buf);
|
||||
|
||||
if (!mode) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected smartcard type %d"), def->type);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (def->type) {
|
||||
|
@ -26041,21 +25984,21 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
|
|||
|
||||
case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
|
||||
if (virDomainChrSourceDefFormat(&childBuf, def->data.passthru, flags) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected smartcard type %d"), def->type);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, "<smartcard mode='%s'", mode);
|
||||
if (def->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH &&
|
||||
virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virBufferUse(&childBuf)) {
|
||||
|
@ -26066,10 +26009,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
|
|||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -26146,21 +26086,20 @@ virDomainSoundDefFormat(virBufferPtr buf,
|
|||
const char *model = virDomainSoundModelTypeToString(def->model);
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
virBufferSetChildIndent(&childBuf, buf);
|
||||
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected sound model %d"), def->model);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < def->ncodecs; i++)
|
||||
virDomainSoundCodecDefFormat(&childBuf, def->codecs[i]);
|
||||
|
||||
if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, "<sound model='%s'", model);
|
||||
if (virBufferUse(&childBuf)) {
|
||||
|
@ -26171,10 +26110,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
|
|||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26539,12 +26475,11 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|||
{
|
||||
const char *model = virDomainVideoTypeToString(def->type);
|
||||
g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected video model %d"), def->type);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferAddLit(buf, "<video>\n");
|
||||
|
@ -26591,15 +26526,12 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|||
}
|
||||
|
||||
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</video>\n");
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -27614,37 +27546,34 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
|
|||
{
|
||||
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i = 0;
|
||||
int ret = -1;
|
||||
g_autofree char *vcpus = NULL;
|
||||
|
||||
virBufferSetChildIndent(&childrenBuf, buf);
|
||||
if (virResctrlAllocForeachCache(resctrl->alloc,
|
||||
virDomainCachetuneDefFormatHelper,
|
||||
&childrenBuf) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < resctrl->nmonitors; i++) {
|
||||
if (virDomainResctrlMonDefFormatHelper(resctrl->monitors[i],
|
||||
VIR_RESCTRL_MONITOR_TYPE_CACHE,
|
||||
&childrenBuf) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!virBufferUse(&childrenBuf)) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!virBufferUse(&childrenBuf))
|
||||
return 0;
|
||||
|
||||
vcpus = virBitmapFormat(resctrl->vcpus);
|
||||
if (!vcpus)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, "<cachetune vcpus='%s'", vcpus);
|
||||
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
|
||||
const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
|
||||
if (!alloc_id)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, " id='%s'", alloc_id);
|
||||
}
|
||||
|
@ -27653,9 +27582,7 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
|
|||
virBufferAddBuffer(buf, &childrenBuf);
|
||||
virBufferAddLit(buf, "</cachetune>\n");
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27679,30 +27606,28 @@ virDomainMemorytuneDefFormat(virBufferPtr buf,
|
|||
unsigned int flags)
|
||||
{
|
||||
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
g_autofree char *vcpus = NULL;
|
||||
|
||||
virBufferSetChildIndent(&childrenBuf, buf);
|
||||
if (virResctrlAllocForeachMemory(resctrl->alloc,
|
||||
virDomainMemorytuneDefFormatHelper,
|
||||
&childrenBuf) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (!virBufferUse(&childrenBuf)) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virBufferUse(&childrenBuf))
|
||||
return 0;
|
||||
|
||||
vcpus = virBitmapFormat(resctrl->vcpus);
|
||||
if (!vcpus)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, "<memorytune vcpus='%s'", vcpus);
|
||||
|
||||
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
|
||||
const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
|
||||
if (!alloc_id)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(buf, " id='%s'", alloc_id);
|
||||
}
|
||||
|
@ -27711,9 +27636,7 @@ virDomainMemorytuneDefFormat(virBufferPtr buf,
|
|||
virBufferAddBuffer(buf, &childrenBuf);
|
||||
virBufferAddLit(buf, "</memorytune>\n");
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -27723,7 +27646,6 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||
{
|
||||
size_t i;
|
||||
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
virBufferSetChildIndent(&childrenBuf, buf);
|
||||
|
||||
|
@ -27771,7 +27693,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||
continue;
|
||||
|
||||
if (!(cpumask = virBitmapFormat(vcpu->cpumask)))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(&childrenBuf,
|
||||
"<vcpupin vcpu='%zu' cpuset='%s'/>\n", i, cpumask);
|
||||
|
@ -27784,7 +27706,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||
virBufferAddLit(&childrenBuf, "<emulatorpin ");
|
||||
|
||||
if (!(cpumask = virBitmapFormat(def->cputune.emulatorpin)))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(&childrenBuf, "cpuset='%s'/>\n", cpumask);
|
||||
VIR_FREE(cpumask);
|
||||
|
@ -27801,7 +27723,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||
def->iothreadids[i]->iothread_id);
|
||||
|
||||
if (!(cpumask = virBitmapFormat(def->iothreadids[i]->cpumask)))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virBufferAsprintf(&childrenBuf, "cpuset='%s'/>\n", cpumask);
|
||||
VIR_FREE(cpumask);
|
||||
|
@ -27836,10 +27758,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||
virBufferAddLit(buf, "</cputune>\n");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27910,7 +27829,6 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
virBufferSetChildIndent(&childBuf, buf);
|
||||
|
||||
|
@ -27938,9 +27856,7 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|||
|
||||
virXMLFormatElement(buf, "iommu", &attrBuf, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28014,7 +27930,6 @@ virDomainVsockDefFormat(virBufferPtr buf,
|
|||
g_auto(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) cidAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||
int ret = -1;
|
||||
|
||||
if (vsock->model) {
|
||||
virBufferAsprintf(&attrBuf, " model='%s'",
|
||||
|
@ -28032,14 +27947,11 @@ virDomainVsockDefFormat(virBufferPtr buf,
|
|||
virXMLFormatElement(&childBuf, "cid", &cidAttrBuf, NULL);
|
||||
|
||||
if (virDomainDeviceInfoFormat(&childBuf, &vsock->info, 0) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virXMLFormatElement(buf, "vsock", &attrBuf, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -264,15 +264,11 @@ virNetDevBandwidthFormat(virNetDevBandwidthPtr def,
|
|||
unsigned int class_id,
|
||||
virBufferPtr buf)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (!buf)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (!def) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!def)
|
||||
return 0;
|
||||
|
||||
virBufferAddLit(buf, "<bandwidth");
|
||||
if (class_id)
|
||||
|
@ -281,14 +277,11 @@ virNetDevBandwidthFormat(virNetDevBandwidthPtr def,
|
|||
virBufferAdjustIndent(buf, 2);
|
||||
if (virNetDevBandwidthRateFormat(def->in, buf, "inbound") < 0 ||
|
||||
virNetDevBandwidthRateFormat(def->out, buf, "outbound") < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</bandwidth>\n");
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3059,18 +3059,17 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
unsigned int fflags G_GNUC_UNUSED)
|
||||
{
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
virNetworkIPDefPtr ipdef = virNetworkIPDefByIndex(def, parentIndex);
|
||||
virSocketAddrRange range;
|
||||
|
||||
memset(&range, 0, sizeof(range));
|
||||
|
||||
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "range") < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* ipdef is the ip element that needs its range array updated */
|
||||
if (!ipdef)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* parse the xml into a virSocketAddrRange */
|
||||
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
|
||||
|
@ -3078,18 +3077,18 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("dhcp ranges cannot be modified, "
|
||||
"only added or deleted"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virSocketAddrRangeParseXML(def->name, ipdef, ctxt->node, &range) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (VIR_SOCKET_ADDR_FAMILY(&ipdef->address)
|
||||
!= VIR_SOCKET_ADDR_FAMILY(&range.start)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("the address family of a dhcp range must match "
|
||||
"the address family of the dhcp element's parent"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check if an entry with same name/address/ip already exists */
|
||||
|
@ -3104,7 +3103,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
(command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
|
||||
|
||||
if (virNetworkDefUpdateCheckMultiDHCP(def, ipdef) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (i < ipdef->nranges) {
|
||||
char *startip = virSocketAddrFormat(&range.start);
|
||||
|
@ -3119,7 +3118,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
endip ? endip : "unknown");
|
||||
VIR_FREE(startip);
|
||||
VIR_FREE(endip);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* add to beginning/end of list */
|
||||
|
@ -3127,14 +3126,14 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST
|
||||
? 0 : ipdef->nranges,
|
||||
ipdef->nranges, range) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
|
||||
|
||||
if (i == ipdef->nranges) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("couldn't locate a matching dhcp range entry "
|
||||
"in network '%s'"), def->name);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* remove it */
|
||||
|
@ -3143,12 +3142,10 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
|
|||
|
||||
} else {
|
||||
virNetworkDefUpdateUnknownCommand(command);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2112,7 +2112,6 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
|
|||
char **wwpn)
|
||||
{
|
||||
virNodeDevCapsDefPtr cap = NULL;
|
||||
int ret = -1;
|
||||
|
||||
cap = def->caps;
|
||||
while (cap != NULL) {
|
||||
|
@ -2129,12 +2128,10 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
|
|||
if (cap == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Device is not a fibre channel HBA"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2501,7 +2498,7 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
|
|||
ret = virPCIGetPhysicalFunction(sysfsPath,
|
||||
&pci_dev->physical_function);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
return ret;
|
||||
|
||||
if (pci_dev->physical_function)
|
||||
pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
|
||||
|
@ -2510,13 +2507,12 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
|
|||
&pci_dev->num_virtual_functions,
|
||||
&pci_dev->max_virtual_functions);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
return ret;
|
||||
|
||||
if (pci_dev->num_virtual_functions > 0 ||
|
||||
pci_dev->max_virtual_functions > 0)
|
||||
pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2525,7 +2521,7 @@ static int
|
|||
virNodeDeviceGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
|
||||
{
|
||||
size_t i;
|
||||
int tmpGroup, ret = -1;
|
||||
int tmpGroup;
|
||||
virPCIDeviceAddress addr;
|
||||
|
||||
/* this could be a refresh, so clear out the old data */
|
||||
|
@ -2542,23 +2538,19 @@ virNodeDeviceGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
|
|||
tmpGroup = virPCIDeviceAddressGetIOMMUGroupNum(&addr);
|
||||
if (tmpGroup == -1) {
|
||||
/* error was already reported */
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (tmpGroup == -2) {
|
||||
if (tmpGroup == -2)
|
||||
/* -2 return means there is no iommu_group data */
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
return 0;
|
||||
if (tmpGroup >= 0) {
|
||||
if (virPCIDeviceAddressGetIOMMUGroupAddresses(&addr, &pci_dev->iommuGroupDevices,
|
||||
&pci_dev->nIommuGroupDevices) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
pci_dev->iommuGroupNumber = tmpGroup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -390,24 +390,22 @@ int virDomainNumatuneGetMode(virDomainNumaPtr numatune,
|
|||
int cellid,
|
||||
virDomainNumatuneMemMode *mode)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainNumatuneMemMode tmp_mode;
|
||||
|
||||
if (!numatune)
|
||||
return ret;
|
||||
return -1;
|
||||
|
||||
if (virDomainNumatuneNodeSpecified(numatune, cellid))
|
||||
tmp_mode = numatune->mem_nodes[cellid].mode;
|
||||
else if (numatune->memory.specified)
|
||||
tmp_mode = numatune->memory.mode;
|
||||
else
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (mode)
|
||||
*mode = tmp_mode;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
virBitmapPtr
|
||||
|
@ -498,8 +496,6 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
int mode,
|
||||
virBitmapPtr nodeset)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
/* No need to do anything in this case */
|
||||
if (mode == -1 && placement == -1 && !nodeset)
|
||||
return 0;
|
||||
|
@ -517,7 +513,7 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unsupported numatune mode '%d'"),
|
||||
mode);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (placement != -1 &&
|
||||
|
@ -525,7 +521,7 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unsupported numatune placement '%d'"),
|
||||
mode);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mode != -1)
|
||||
|
@ -534,7 +530,7 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
if (nodeset) {
|
||||
virBitmapFree(numa->memory.nodeset);
|
||||
if (!(numa->memory.nodeset = virBitmapNewCopy(nodeset)))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
if (placement == -1)
|
||||
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
|
||||
}
|
||||
|
@ -551,7 +547,7 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("nodeset for NUMA memory tuning must be set "
|
||||
"if 'placement' is 'static'"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* setting nodeset when placement auto is invalid */
|
||||
|
@ -566,10 +562,7 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
|
|||
|
||||
numa->memory.specified = true;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -2085,13 +2085,11 @@ virNWFilterIncludeParse(xmlNodePtr cur)
|
|||
if (!ret->params)
|
||||
goto err_exit;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
|
||||
err_exit:
|
||||
virNWFilterIncludeDefFree(ret);
|
||||
ret = NULL;
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -343,17 +343,14 @@ int
|
|||
virStoragePoolOptionsPoolTypeSetXMLNamespace(int type,
|
||||
virXMLNamespacePtr ns)
|
||||
{
|
||||
int ret = -1;
|
||||
virStoragePoolTypeInfoPtr backend = virStoragePoolTypeInfoLookup(type);
|
||||
|
||||
if (!backend)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
backend->poolOptions.ns = *ns;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -766,14 +766,13 @@ virNetworkObjConfigChangeSetup(virNetworkObjPtr obj,
|
|||
unsigned int flags)
|
||||
{
|
||||
bool isActive;
|
||||
int ret = -1;
|
||||
|
||||
isActive = virNetworkObjIsActive(obj);
|
||||
|
||||
if (!isActive && (flags & VIR_NETWORK_UPDATE_AFFECT_LIVE)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("network is not running"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (flags & VIR_NETWORK_UPDATE_AFFECT_CONFIG) {
|
||||
|
@ -781,18 +780,16 @@ virNetworkObjConfigChangeSetup(virNetworkObjPtr obj,
|
|||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot change persistent config of a "
|
||||
"transient network"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
/* this should already have been done by the driver, but do it
|
||||
* anyway just in case.
|
||||
*/
|
||||
if (isActive && (virNetworkObjSetDefTransient(obj, false, xmlopt) < 0))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1673,10 +1670,9 @@ virNetworkObjLookupPort(virNetworkObjPtr net,
|
|||
virReportError(VIR_ERR_NO_NETWORK_PORT,
|
||||
_("Network port with UUID %s does not exist"),
|
||||
uuidstr);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -732,14 +732,13 @@ virSecretObjGetValue(virSecretObjPtr obj)
|
|||
virUUIDFormat(def->uuid, uuidstr);
|
||||
virReportError(VIR_ERR_NO_SECRET,
|
||||
_("secret '%s' does not have a value"), uuidstr);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC_N(ret, obj->value_size) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
memcpy(ret, obj->value, obj->value_size);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue