const char *username,
const char *secret)
{
- char *ret = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
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);
if (src->configFile)
virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile);
- ret = virBufferContentAndReset(&buf);
- break;
+ return virBufferContentAndReset(&buf);
}
- cleanup:
- return ret;
+ return NULL;
}
static int
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);
list->list = val;
return 0;
-
- cleanup:
- return -1;
}
char *
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)) {
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);
list->list = val;
return 0;
-
- cleanup:
- return -1;
}
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;
tmp->next = numaPnode;
else
list->list = numaPnode;
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
static int
static char *
xenFormatXLDiskSrcNet(virStorageSourcePtr src)
{
- char *ret = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t i;
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);
}
}
- ret = virBufferContentAndReset(&buf);
- break;
+ return virBufferContentAndReset(&buf);
}
- cleanup:
- return ret;
+ return NULL;
}
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);
else
list->list = val;
return 0;
-
- cleanup:
- return -1;
}
static int
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type %s"),
virStorageTypeToString(virDomainDiskGetType(disk)));
- goto cleanup;
+ return -1;
}
}
virBufferAdd(&buf, src, -1);
}
if (VIR_ALLOC(val) < 0)
- goto cleanup;
+ return -1;
val->type = VIR_CONF_STRING;
val->str = virBufferContentAndReset(&buf);
list->list = val;
return 0;
-
- cleanup:
- return -1;
}