Hi All,
I just want to go over the design that I am working on to incorporate iSCSI support to libvirt ESX storage driver. The highlights are:
Current Implementation
At present esx_storage_driver supports only VMFS type datastore and does not provide much leeway to enhance or add other supported storage pools such as iSCSI.
Proposal
My proposal is:
1. Split the current code such as esx_storage_driver becomes more like a facade; this driver will use "backend" drivers to perform the request task (such as: esx_storage_backend_iscsi and esx_storage_backend_vmfs)
2. Based on the pool type (lookup can determine storage pool type), the base driver then invoke the appropriate backend driver routine to get the job done.
3. Backend driver shall implement same routines exposed by esx_storage_driver if needed, but the implementation will be pertinent to its specific type.
The main intention is get early feedback w.r.t the above proposed design. This allows me to make changes quickly before I present the code for review and am sure will help expedite the overall review process as well.
Thanks for your suggestions/comments.
Thanks & Regards,
Ata E Husain Bohra
Appendex:
Sample code to implement .lookupByName for esx storage driver
static virStoragePoolPtr
esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
{
esxPrivate *priv = conn->storagePrivateData;
virStoragePoolPtr pool = NULL;
int i = 0;
if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL;
}
for (i = 0; i < MAX_BACKEND_DRIVER; ++i) {
pool = backendDrv[i]->poolLookupByName(conn, name); // backendDrv are pointer to backend storage drivers.
if (pool != NULL) {
break;
}
}
return pool;
}