
Hi Everyone, I'm looking at implementing some functionality in libvirt that would allow it to call functions in an unpublished iSCSI library. Some of the functionality I wish to implement is not currently part of the libvirt storage API. I wanted to suggest the following additions to the storage API: grow volumes, show whether thin provisioning is enabled, enable thin provisioning, disable thin provisioning, create snapshots, and delete snapshots. I've added a patch at the end of the mail showing how I think these functions should be implemented. Note that I have not included details about the virStorageSnapshotDefPtr yet, that's the next step. Perhaps this should be in a separate mail for better threading, but it seems a bit strange to me that the storage interface isn't pluggable in the traditional sense. In order to add a backend to libvirt, one has to make modifications all over the place, for example: virt-inst, the Makefile.am, the configure.ac, storage_backend.h, and several other places. It would make sense to me to make this pluggable such that someone could just load in a library that implements the required functions and some identifying information (eg type of storage, description, etc). A list of supported backends could be stored in empty files in a directory somewhere, or some similar hack. This way someone could write a plugin for tgtd for example, or in my case the library I'm working with. I think this would also help others with writing plugins for more storage backends. How difficult do you think this would be? I'm willing to do a reasonable amount of work to get this implemented, but I want to know what the experts think! Best, Patrick Dignan --- libvirt-0.8.2.orig/src/storage/storage_backend.h 2010-06-16 17:27:22.000000000 -0500 +++ libvirt-0.8.2.work/src/storage/storage_backend.h 2010-07-27 16:36:08.321439851 -0500 @@ -43,6 +43,13 @@ typedef int (*virStorageBackendBuildVolFrom)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr origvol, virStorageVolDefPtr newvol, unsigned int flags); +typedef int (*virStorageBackendGrowVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, unsigned long long newsize); +typedef bool (*virStorageBackendThinProvisionShow)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol); +typedef int (*virStorageBackendThinProvisionEnable)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol); +typedef int (*virStorageBackendThinProvisionDisable)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol); + +typedef int (virStorageBackendCreateSnapshot)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, virStorageSnapshotDefPtr snapshot); +typedef int (virStorageBackendDeleteSnapshot)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, virStorageSnapshotDefPtr snapshot); /* File creation/cloning functions used for cloning between backends */ int virStorageBackendCreateRaw(virConnectPtr conn, @@ -76,6 +83,12 @@ virStorageBackendCreateVol createVol; virStorageBackendRefreshVol refreshVol; virStorageBackendDeleteVol deleteVol; + virStorageBackendGrowVol growVol; + virStorageBackendThinProvisionShow thinProvisionShow; + virStorageBackendThinProvisionEnable thinProvisionEnable; + virStorageBackendThinProvisionDisable thinProvisionDisable; + virStorageBackendCreateSnapshot createSnapshot; + virStorageBackendDeleteSnapshot deleteSnapshot; }; virStorageBackendPtr virStorageBackendForType(int type);