mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: storage: Add json pseudo protocol support for iSCSI volumes
iSCSI is a bit odd in this aspect since it only supports URIs but using the 'filename' property and does not have any alternative syntax.
This commit is contained in:
parent
2ed772cd63
commit
3236bb2370
@ -2682,6 +2682,26 @@ virStorageSourceParseBackingJSONGluster(virStorageSourcePtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src,
|
||||||
|
virJSONValuePtr json,
|
||||||
|
int opaque ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
const char *uri;
|
||||||
|
|
||||||
|
/* legacy URI based syntax passed via 'filename' option */
|
||||||
|
if ((uri = virJSONValueObjectGetString(json, "filename")))
|
||||||
|
return virStorageSourceParseBackingJSONUriStr(src, uri,
|
||||||
|
VIR_STORAGE_NET_PROTOCOL_ISCSI);
|
||||||
|
|
||||||
|
/* iSCSI currently supports only URI syntax passed in as filename */
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
_("missing iSCSI URI in JSON backing volume definition"));
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct virStorageSourceJSONDriverParser {
|
struct virStorageSourceJSONDriverParser {
|
||||||
const char *drvname;
|
const char *drvname;
|
||||||
int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque);
|
int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque);
|
||||||
@ -2698,6 +2718,7 @@ static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
|
|||||||
{"ftps", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTPS},
|
{"ftps", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTPS},
|
||||||
{"tftp", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_TFTP},
|
{"tftp", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_TFTP},
|
||||||
{"gluster", virStorageSourceParseBackingJSONGluster, 0},
|
{"gluster", virStorageSourceParseBackingJSONGluster, 0},
|
||||||
|
{"iscsi", virStorageSourceParseBackingJSONiSCSI, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user