mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 15:45:28 +00:00
util: storage: make virStorageSourceParseBackingJSONGlusterHost universal
The same json strucutre is used for NBD and sheepdog volumes for specifying of the host. Rename the function and fix up error messages to be more universal.
This commit is contained in:
parent
506b80c84e
commit
6402f402d4
@ -2795,7 +2795,7 @@ virStorageSourceParseBackingJSONUri(virStorageSourcePtr src,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
|
virStorageSourceParseBackingJSONSocketAddress(virStorageNetHostDefPtr host,
|
||||||
virJSONValuePtr json)
|
virJSONValuePtr json)
|
||||||
{
|
{
|
||||||
const char *type = virJSONValueObjectGetString(json, "type");
|
const char *type = virJSONValueObjectGetString(json, "type");
|
||||||
@ -2817,7 +2817,7 @@ virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
|
|||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("missing hostname for tcp backing server in "
|
_("missing hostname for tcp backing server in "
|
||||||
"JSON backing definition for gluster volume"));
|
"JSON backing volume definition"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2830,7 +2830,7 @@ virStorageSourceParseBackingJSONGlusterHost(virStorageNetHostDefPtr host,
|
|||||||
if (!socket) {
|
if (!socket) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("missing socket path for udp backing server in "
|
_("missing socket path for udp backing server in "
|
||||||
"JSON backing definition for gluster volume"));
|
"JSON backing volume definition"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2897,7 +2897,7 @@ virStorageSourceParseBackingJSONGluster(virStorageSourcePtr src,
|
|||||||
src->nhosts = nservers;
|
src->nhosts = nservers;
|
||||||
|
|
||||||
for (i = 0; i < nservers; i++) {
|
for (i = 0; i < nservers; i++) {
|
||||||
if (virStorageSourceParseBackingJSONGlusterHost(src->hosts + i,
|
if (virStorageSourceParseBackingJSONSocketAddress(src->hosts + i,
|
||||||
virJSONValueArrayGet(server, i)) < 0)
|
virJSONValueArrayGet(server, i)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user