Re: Access to the secretDriver in a storage backend?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 03, 2012 at 03:00:49PM +0100, Wido den Hollander wrote:
> 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?

Either is fine. Perhaps a slight preference to use the
style you were trying out originally.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]