[libvirt] [RFC] Private data pointer for virStoragePool and virStorageVol structs

Matthias Bolte matthias.bolte at googlemail.com
Sat Oct 6 15:15:55 UTC 2012


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?

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list