static int
virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src,
- virJSONValuePtr json);
+ virJSONValuePtr json,
+ const char *jsonstr);
static int
virStorageSourceParseBackingJSONPath(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int type)
{
const char *path;
static int
virStorageSourceParseBackingJSONUri(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int protocol)
{
const char *uri;
static int
virStorageSourceParseBackingJSONGluster(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *uri = virJSONValueObjectGetString(json, "filename");
static int
virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *transport = virJSONValueObjectGetString(json, "transport");
static int
virStorageSourceParseBackingJSONNbd(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *path = virJSONValueObjectGetString(json, "path");
static int
virStorageSourceParseBackingJSONSheepdog(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *filename;
static int
virStorageSourceParseBackingJSONSSH(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *path = virJSONValueObjectGetString(json, "path");
static int
virStorageSourceParseBackingJSONRBD(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *filename;
static int
virStorageSourceParseBackingJSONRaw(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr,
int opaque G_GNUC_UNUSED)
{
/* There are no interesting attributes in raw driver.
* Treat it as pass-through.
*/
- return virStorageSourceParseBackingJSONInternal(src, json);
+ return virStorageSourceParseBackingJSONInternal(src, json, jsonstr);
}
static int
virStorageSourceParseBackingJSONVxHS(virStorageSourcePtr src,
virJSONValuePtr json,
+ const char *jsonstr G_GNUC_UNUSED,
int opaque G_GNUC_UNUSED)
{
const char *vdisk_id = virJSONValueObjectGetString(json, "vdisk-id");
* can't be converted to libvirt's configuration (e.g. inline authentication
* credentials are present).
*/
- int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque);
+ int (*func)(virStorageSourcePtr src, virJSONValuePtr json, const char *jsonstr, int opaque);
int opaque;
};
static int
virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src,
- virJSONValuePtr json)
+ virJSONValuePtr json,
+ const char *jsonstr)
{
g_autoptr(virJSONValue) deflattened = NULL;
virJSONValuePtr file;
const char *drvname;
size_t i;
- g_autofree char *str = NULL;
if (!(deflattened = virJSONValueObjectDeflatten(json)))
return -1;
if (!(file = virJSONValueObjectGetObject(deflattened, "file"))) {
- str = virJSONValueToString(json, false);
virReportError(VIR_ERR_INVALID_ARG,
_("JSON backing volume definition '%s' lacks 'file' object"),
- NULLSTR(str));
+ jsonstr);
return -1;
}
if (!(drvname = virJSONValueObjectGetString(file, "driver"))) {
- str = virJSONValueToString(json, false);
virReportError(VIR_ERR_INVALID_ARG,
_("JSON backing volume definition '%s' lacks driver name"),
- NULLSTR(str));
+ jsonstr);
return -1;
}
for (i = 0; i < G_N_ELEMENTS(jsonParsers); i++) {
if (STREQ(drvname, jsonParsers[i].drvname))
- return jsonParsers[i].func(src, file, jsonParsers[i].opaque);
+ return jsonParsers[i].func(src, file, jsonstr, jsonParsers[i].opaque);
}
virReportError(VIR_ERR_INTERNAL_ERROR,
if (!(root = virJSONValueFromString(json)))
return -1;
- return virStorageSourceParseBackingJSONInternal(src, root);
+ return virStorageSourceParseBackingJSONInternal(src, root, json);
}