On 01/12/2010 07:36 AM, Daniel P. Berrange wrote:
On Mon, Jan 11, 2010 at 12:46:12AM -0500, Laine Stump wrote:
[snip]
> @@ -840,7 +833,15 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
> static int
> virStorageBackendFileSystemVolBuild(virConnectPtr conn,
> virStorageVolDefPtr vol) {
> - return _virStorageBackendFileSystemVolBuild(conn, vol, NULL);
> + return _virStorageBackendFileSystemVolBuild(conn, vol, NULL, 0);
> +}
> +
> +/* version for vols created in netfs-based pools */
> +static int
> +virStorageBackendFileSystemNetVolBuild(virConnectPtr conn,
> + virStorageVolDefPtr vol) {
> + return _virStorageBackendFileSystemVolBuild(conn, vol, NULL,
> + VIR_STORAGE_BUILD_NETFS);
> }
>
> /*
> @@ -851,9 +852,20 @@ virStorageBackendFileSystemVolBuildFrom(virConnectPtr conn,
> virStorageVolDefPtr vol,
> virStorageVolDefPtr inputvol,
> unsigned int flags ATTRIBUTE_UNUSED) {
> - return _virStorageBackendFileSystemVolBuild(conn, vol, inputvol);
> + return _virStorageBackendFileSystemVolBuild(conn, vol, inputvol, 0);
> +}
> +
> +/* version for vols created in netfs-based pools */
> +static int
> +virStorageBackendFileSystemNetVolBuildFrom(virConnectPtr conn,
> + virStorageVolDefPtr vol,
> + virStorageVolDefPtr inputvol,
> + unsigned int flags ATTRIBUTE_UNUSED) {
> + return _virStorageBackendFileSystemVolBuild(conn, vol, inputvol,
> + VIR_STORAGE_BUILD_NETFS);
> }
I think I'd be inclined to edit storage_backend.h and change the
typedef int (*virStorageBackendBuildVol)(virConnectPtr conn, virStorageVolDefPtr vol);
to
typedef int (*virStorageBackendBuildVol)(virConnectPtr conn, virStoragePoolObjPtr pool,
virStorageVolDefPtr vol);
so that the build method has direct access to the pool type. Likewise
for the BuildFrom method prototype. Once that change ripples through
all the code, the place where you need to distinguish local vs net
filesytem will have access to the pool object it wants
This is a possibly problematic, since BuildVol is intended to be called
with the pool lock dropped. So maybe BuildVol should have an extra 'int
pool_type' argument rather than the whole pool object.
- Cole