mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuBlockStorageSourceGetRBDProps: Simplify generation of auth modes
The auth mode array is static, parse it from a JSON string. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
4273b74b82
commit
b58f88a919
@ -881,7 +881,6 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src,
|
|||||||
const char *encformat;
|
const char *encformat;
|
||||||
const char *username = NULL;
|
const char *username = NULL;
|
||||||
g_autoptr(virJSONValue) authmodes = NULL;
|
g_autoptr(virJSONValue) authmodes = NULL;
|
||||||
g_autoptr(virJSONValue) mode = NULL;
|
|
||||||
const char *keysecret = NULL;
|
const char *keysecret = NULL;
|
||||||
|
|
||||||
if (src->nhosts > 0 &&
|
if (src->nhosts > 0 &&
|
||||||
@ -892,14 +891,7 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src,
|
|||||||
username = srcPriv->secinfo->username;
|
username = srcPriv->secinfo->username;
|
||||||
keysecret = srcPriv->secinfo->alias;
|
keysecret = srcPriv->secinfo->alias;
|
||||||
/* the auth modes are modelled after our old command line generator */
|
/* the auth modes are modelled after our old command line generator */
|
||||||
authmodes = virJSONValueNewArray();
|
if (!(authmodes = virJSONValueFromString("[\"cephx\",\"none\"]")))
|
||||||
|
|
||||||
if (!(mode = virJSONValueNewString("cephx")) ||
|
|
||||||
virJSONValueArrayAppend(authmodes, &mode) < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(mode = virJSONValueNewString("none")) ||
|
|
||||||
virJSONValueArrayAppend(authmodes, &mode) < 0)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user