On 01/03/2012 12:58 PM, Daniel P. Berrange wrote:
On Sat, Dec 31, 2011 at 01:26:54PM +0100, Wido den Hollander wrote:
> Hi,
>
> I'm working on a storage backend for libvirt which needs credentials
> to access the storage pool. I want to use the build in secret
> manager from libvirt, but it seems I do not have access to the
> secretDriver in a storage backend?
>
> static int virStorageBackendRBDRefreshPool(virConnectPtr conn
> ATTRIBUTE_UNUSED, virStoragePoolObjPtr pool) {
>
> if (pool->def->source.auth.cephx.secret != NULL) {
> virSecretPtr secret;
> secret = conn->secretDriver->lookupByUUID(conn,
> pool->def->source.auth.cephx.secret);
> virSecretFree(secret);
> }
>
> return 0;
> }
>
> It goes wrong at this point:
>
conn->secretDriver->lookupByUUID(conn,pool->def->source.auth.cephx.secret);
>
> "error: dereferencing pointer to incomplete type"
>
> Is the secretDriver available in a storage backend? In
> storage_backend.c I see that it should be available, correct?
Are you missing the '#include "datatypes.h"' header ?
Yes, that was indeed the fix.
Although, in the meantime I found:
virSecretPtr secret;
secret = virSecretLookupByUUIDString(conn,
pool->def->source.auth.cephx.secret);
value = virSecretGetValue(secret, &value_size, 0);
This also works fine, but what do you recommend?
Wido
Daniel