[libvirt] [RFC] Private data pointer for virStoragePool and virStorageVol structs
Daniel P. Berrange
berrange at redhat.com
Mon Oct 8 09:10:35 UTC 2012
On Sat, Oct 06, 2012 at 05:15:55PM +0200, Matthias Bolte wrote:
> Ata Bohra proposed a backend concept for the ESX storage driver to
> simplify the addition of iSCSI support to the ESX storage driver.
>
> The problem here is that most of the storage driver functions need to
> determine the backend to be used from the pool name.
>
> This overhead can be avoided by adding a private data pointer to the
> virStoragePool and virStorageVol structs that the ESX storage driver
> can use to store a pointer to the correct backend.
>
> struct _virStoragePool {
> virObject object;
> virConnectPtr conn;
> char *name;
> unsigned char uuid[VIR_UUID_BUFLEN];
>
> void *privateData;
> virFreeCallback privateDataFreeFunc;
> };
>
> struct _virStorageVol {
> virObject object;
> virConnectPtr conn;
> char *pool;
> char *name;
> char *key;
>
> void *privateData;
> virFreeCallback privateDataFreeFunc;
> };
>
> virGetStoragePool and virGetStorageVol would set privateData and
> privateDataFreeFunc as given by the caller. virStoragePoolDispose and
> virStorageVolDispose would call privateDataFreeFunc if set.
>
> Comments?
The only other option I see would to have a hash table or similar
in the esxPrivate struct, and do a lookup in that from the pool
or volume name/uuid. I guess having privateData directly in the
virStorage{Vol,Pool} structs might make your life easier though.
Since this is ultimately an internal impl detail we can change
later, I don't have a strong opinion on it either way.
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 :|
More information about the libvir-list
mailing list