storage: Implement CreateVolFrom for logical and disk backend.

With the previous refactoring, this is a simple process, since the global
'CreateBlockFrom' in storage_backend does all the work.
This commit is contained in:
Cole Robinson 2009-07-09 19:17:31 -04:00
parent f23814e0cd
commit fd06fd1442
2 changed files with 32 additions and 0 deletions

View File

@ -592,6 +592,20 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
return 0;
}
static int
virStorageBackendDiskBuildVolFrom(virConnectPtr conn,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
unsigned int flags)
{
virStorageBackendBuildVolFrom build_func;
build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
if (!build_func)
return -1;
return build_func(conn, vol, inputvol, flags);
}
static int
virStorageBackendDiskDeleteVol(virConnectPtr conn,
@ -660,4 +674,5 @@ virStorageBackend virStorageBackendDisk = {
.createVol = virStorageBackendDiskCreateVol,
.deleteVol = virStorageBackendDiskDeleteVol,
.buildVolFrom = virStorageBackendDiskBuildVolFrom,
};

View File

@ -653,6 +653,21 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
return -1;
}
static int
virStorageBackendLogicalBuildVolFrom(virConnectPtr conn,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
unsigned int flags)
{
virStorageBackendBuildVolFrom build_func;
build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
if (!build_func)
return -1;
return build_func(conn, vol, inputvol, flags);
}
static int
virStorageBackendLogicalDeleteVol(virConnectPtr conn,
virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
@ -679,6 +694,8 @@ virStorageBackend virStorageBackendLogical = {
.refreshPool = virStorageBackendLogicalRefreshPool,
.stopPool = virStorageBackendLogicalStopPool,
.deletePool = virStorageBackendLogicalDeletePool,
.buildVol = NULL,
.buildVolFrom = virStorageBackendLogicalBuildVolFrom,
.createVol = virStorageBackendLogicalCreateVol,
.deleteVol = virStorageBackendLogicalDeleteVol,
};