mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
There's plenty of existing documentation [1] which shows as example a name which contains a space and a dot ('client.admin secret') as ceph usage name. Use a more relaxed type in the RNG schema since the usage name is actually just a string used to look up the secret. [1]: https://docs.ceph.com/en/latest/rbd/libvirt/#configuring-the-vm https://documentation.suse.com/ses/6/html/ses-all/cha-ceph-libvirt.html#ceph-libvirt-cfg-vm Libvirt docs were correct though: https://libvirt.org/formatsecret.html#CephUsageType Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689168 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
86 lines
1.8 KiB
C
86 lines
1.8 KiB
C
#include <config.h>
|
|
|
|
|
|
#include "internal.h"
|
|
#include "testutils.h"
|
|
#include "secret_conf.h"
|
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
static int
|
|
testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
|
|
{
|
|
char *actual = NULL;
|
|
int ret = -1;
|
|
virSecretDefPtr secret = NULL;
|
|
|
|
if (!(secret = virSecretDefParseFile(inxml)))
|
|
goto fail;
|
|
|
|
if (!(actual = virSecretDefFormat(secret)))
|
|
goto fail;
|
|
|
|
if (virTestCompareToFile(actual, outxml) < 0)
|
|
goto fail;
|
|
|
|
ret = 0;
|
|
|
|
fail:
|
|
VIR_FREE(actual);
|
|
virSecretDefFree(secret);
|
|
return ret;
|
|
}
|
|
|
|
struct testInfo {
|
|
const char *name;
|
|
bool different;
|
|
};
|
|
|
|
static int
|
|
testCompareXMLToXMLHelper(const void *data)
|
|
{
|
|
int result = -1;
|
|
char *inxml = NULL;
|
|
char *outxml = NULL;
|
|
const struct testInfo *info = data;
|
|
|
|
inxml = g_strdup_printf("%s/secretxml2xmlin/%s.xml", abs_srcdir, info->name);
|
|
outxml = g_strdup_printf("%s/secretxml2xml%s/%s.xml",
|
|
abs_srcdir,
|
|
info->different ? "out" : "in",
|
|
info->name);
|
|
|
|
result = testCompareXMLToXMLFiles(inxml, outxml);
|
|
|
|
VIR_FREE(inxml);
|
|
VIR_FREE(outxml);
|
|
|
|
return result;
|
|
}
|
|
|
|
static int
|
|
mymain(void)
|
|
{
|
|
int ret = 0;
|
|
|
|
#define DO_TEST(name) \
|
|
do { \
|
|
const struct testInfo info = {name, false}; \
|
|
if (virTestRun("Secret XML->XML " name, \
|
|
testCompareXMLToXMLHelper, &info) < 0) \
|
|
ret = -1; \
|
|
} while (0)
|
|
|
|
DO_TEST("ephemeral-usage-volume");
|
|
DO_TEST("usage-volume");
|
|
DO_TEST("usage-ceph");
|
|
DO_TEST("usage-ceph-space");
|
|
DO_TEST("usage-iscsi");
|
|
DO_TEST("usage-tls");
|
|
DO_TEST("usage-vtpm");
|
|
|
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
}
|
|
|
|
VIR_TEST_MAIN(mymain)
|