mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
storage: Sheepdog: Separate creating of the volume from building
Separate the steps to create libvirt's volume metadata from the actual volume building process.
This commit is contained in:
parent
e103acba23
commit
b3c1a25df8
@ -154,15 +154,37 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
virStoragePoolObjPtr pool,
|
virStoragePoolObjPtr pool,
|
||||||
virStorageVolDefPtr vol)
|
virStorageVolDefPtr vol)
|
||||||
{
|
{
|
||||||
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (vol->target.encryption != NULL) {
|
if (vol->target.encryption != NULL) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Sheepdog does not support encrypted volumes"));
|
_("Sheepdog does not support encrypted volumes"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vol->type = VIR_STORAGE_VOL_NETWORK;
|
||||||
|
|
||||||
|
VIR_FREE(vol->key);
|
||||||
|
if (virAsprintf(&vol->key, "%s/%s",
|
||||||
|
pool->def->source.name, vol->name) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
VIR_FREE(vol->target.path);
|
||||||
|
if (VIR_STRDUP(vol->target.path, vol->name) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virStorageBackendSheepdogBuildVol(virConnectPtr conn,
|
||||||
|
virStoragePoolObjPtr pool,
|
||||||
|
virStorageVolDefPtr vol,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "create", vol->name, NULL);
|
virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "create", vol->name, NULL);
|
||||||
virCommandAddArgFormat(cmd, "%llu", vol->capacity);
|
virCommandAddArgFormat(cmd, "%llu", vol->capacity);
|
||||||
virStorageBackendSheepdogAddHostArg(cmd, pool);
|
virStorageBackendSheepdogAddHostArg(cmd, pool);
|
||||||
@ -301,6 +323,7 @@ virStorageBackend virStorageBackendSheepdog = {
|
|||||||
|
|
||||||
.refreshPool = virStorageBackendSheepdogRefreshPool,
|
.refreshPool = virStorageBackendSheepdogRefreshPool,
|
||||||
.createVol = virStorageBackendSheepdogCreateVol,
|
.createVol = virStorageBackendSheepdogCreateVol,
|
||||||
|
.buildVol = virStorageBackendSheepdogBuildVol,
|
||||||
.refreshVol = virStorageBackendSheepdogRefreshVol,
|
.refreshVol = virStorageBackendSheepdogRefreshVol,
|
||||||
.deleteVol = virStorageBackendSheepdogDeleteVol,
|
.deleteVol = virStorageBackendSheepdogDeleteVol,
|
||||||
.resizeVol = virStorageBackendSheepdogResizeVol,
|
.resizeVol = virStorageBackendSheepdogResizeVol,
|
||||||
|
Loading…
Reference in New Issue
Block a user