1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-27 07:22:07 +03:00

libxl: eliminate unnecessary labels

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2020-07-02 23:19:45 -04:00
parent cf01360489
commit 6351c85762
4 changed files with 19 additions and 40 deletions

View File

@ -910,7 +910,6 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
const char *username,
const char *secret)
{
char *ret = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
@ -931,14 +930,14 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
virReportError(VIR_ERR_NO_SUPPORT,
_("Unsupported network block protocol '%s'"),
virStorageNetProtocolTypeToString(src->protocol));
goto cleanup;
return NULL;
case VIR_STORAGE_NET_PROTOCOL_RBD:
if (strchr(src->path, ':')) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("':' not allowed in RBD source volume name '%s'"),
src->path);
goto cleanup;
return NULL;
}
virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL);
@ -973,12 +972,10 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
if (src->configFile)
virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile);
ret = virBufferContentAndReset(&buf);
break;
return virBufferContentAndReset(&buf);
}
cleanup:
return ret;
return NULL;
}
static int

View File

@ -1640,13 +1640,13 @@ xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial)
if (serial) {
ret = xenFormatSxprChr(serial, &buf);
if (ret < 0)
goto cleanup;
return -1;
} else {
virBufferAddLit(&buf, "none");
}
if (VIR_ALLOC(val) < 0)
goto cleanup;
return -1;
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
@ -1659,9 +1659,6 @@ xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial)
list->list = val;
return 0;
cleanup:
return -1;
}
char *
@ -1781,12 +1778,12 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_USER:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"),
virDomainNetTypeToString(net->type));
goto cleanup;
return -1;
case VIR_DOMAIN_NET_TYPE_LAST:
default:
virReportEnumRangeError(virDomainNetType, net->type);
goto cleanup;
return -1;
}
if (virDomainNetGetModelString(net)) {
@ -1810,7 +1807,7 @@ xenFormatNet(virConnectPtr conn,
virBufferAsprintf(&buf, ",rate=%lluKB/s", net->bandwidth->out->average);
if (VIR_ALLOC(val) < 0)
goto cleanup;
return -1;
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
@ -1823,9 +1820,6 @@ xenFormatNet(virConnectPtr conn,
list->list = val;
return 0;
cleanup:
return -1;
}

View File

@ -1412,11 +1412,10 @@ static int
xenFormatXLVnode(virConfValuePtr list,
virBufferPtr buf)
{
int ret = -1;
virConfValuePtr numaPnode, tmp;
if (VIR_ALLOC(numaPnode) < 0)
goto cleanup;
return -1;
/* Place VNODE directive */
numaPnode->type = VIR_CONF_STRING;
@ -1429,10 +1428,8 @@ xenFormatXLVnode(virConfValuePtr list,
tmp->next = numaPnode;
else
list->list = numaPnode;
ret = 0;
cleanup:
return ret;
return 0;
}
static int
@ -1563,7 +1560,6 @@ xenFormatXLXenbusLimits(virConfPtr conf, virDomainDefPtr def)
static char *
xenFormatXLDiskSrcNet(virStorageSourcePtr src)
{
char *ret = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
@ -1584,14 +1580,14 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
virReportError(VIR_ERR_NO_SUPPORT,
_("Unsupported network block protocol '%s'"),
virStorageNetProtocolTypeToString(src->protocol));
goto cleanup;
return NULL;
case VIR_STORAGE_NET_PROTOCOL_RBD:
if (strchr(src->path, ':')) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("':' not allowed in RBD source volume name '%s'"),
src->path);
goto cleanup;
return NULL;
}
virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL);
@ -1616,12 +1612,10 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
}
}
ret = virBufferContentAndReset(&buf);
break;
return virBufferContentAndReset(&buf);
}
cleanup:
return ret;
return NULL;
}
@ -2113,14 +2107,14 @@ xenFormatXLChannel(virConfValuePtr list, virDomainChrDefPtr channel)
channel->source->data.nix.path);
break;
default:
goto cleanup;
return -1;
}
/* name */
virBufferAsprintf(&buf, "name=%s", channel->target.name);
if (VIR_ALLOC(val) < 0)
goto cleanup;
return -1;
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
@ -2132,9 +2126,6 @@ xenFormatXLChannel(virConfValuePtr list, virDomainChrDefPtr channel)
else
list->list = val;
return 0;
cleanup:
return -1;
}
static int

View File

@ -322,7 +322,7 @@ xenFormatXMDisk(virConfValuePtr list,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type %s"),
virStorageTypeToString(virDomainDiskGetType(disk)));
goto cleanup;
return -1;
}
}
virBufferAdd(&buf, src, -1);
@ -346,7 +346,7 @@ xenFormatXMDisk(virConfValuePtr list,
}
if (VIR_ALLOC(val) < 0)
goto cleanup;
return -1;
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
@ -359,9 +359,6 @@ xenFormatXMDisk(virConfValuePtr list,
list->list = val;
return 0;
cleanup:
return -1;
}