Re: [RFC] Private data pointer for virStoragePool and virStorageVol structs

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

 



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 :|

--
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]