struct virStorageSourceJSONDriverParser {
const char *drvname;
+ /**
+ * The callback gets a pre-allocated storage source @src and the JSON
+ * object to parse. The callback shall return -1 on error and report error
+ * 0 on success and 1 in cases when the configuration itself is valid, but
+ * can't be converted to libvirt's configuration (e.g. inline authentication
+ * credentials are present).
+ */
int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque);
int opaque;
};
* @path: string representing absolute location of a storage source
* @src: filled with virStorageSource object representing @path
*
- * Returns 0 on success and fills @src or -1 on error and reports appropriate
- * error.
+ * Returns 0 on success, 1 if we could parse all location data but @path
+ * specified other data unrepresentable by libvirt (e.g. inline authentication).
+ * In both cases @src is filled. On error -1 is returned @src is NULL and an
+ * error is reported.
*/
int
virStorageSourceNewFromBackingAbsolute(const char *path,
virStorageSourcePtr *src)
{
const char *json;
- int rc;
+ int rc = 0;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL;
*src = NULL;
}
VIR_STEAL_PTR(*src, def);
- return 0;
+ return rc;
}
* and other data. Note that for local storage this function accesses the file
* to update the actual type of the backing store.
*
- * Returns 0 and fills @backing, or -1 on error (with appropriate error reported).
+ * Returns 0 on success, 1 if we could parse all location data but the backinig
+ * store specification contained other data unrepresentable by libvirt (e.g.
+ * inline authentication).
+ * In both cases @src is filled. On error -1 is returned @src is NULL and an
+ * error is reported.
*/
int
virStorageSourceNewFromBacking(virStorageSourcePtr parent,
{
struct stat st;
VIR_AUTOUNREF(virStorageSourcePtr) def = NULL;
+ int rc = 0;
*backing = NULL;
parent->backingStoreRaw)))
return -1;
} else {
- if (virStorageSourceNewFromBackingAbsolute(parent->backingStoreRaw,
- &def) < 0)
+ if ((rc = virStorageSourceNewFromBackingAbsolute(parent->backingStoreRaw,
+ &def)) < 0)
return -1;
}
def->detected = true;
VIR_STEAL_PTR(*backing, def);
- return 0;
+ return rc;
}