mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
rbd: Return VIR_STORAGE_FILE_RAW as format for RBD volumes
This used to return 'unkown' and that was not correct. A vol-dumpxml now returns: <volume type='network'> <name>image3</name> <key>libvirt/image3</key> <source> </source> <capacity unit='bytes'>10737418240</capacity> <allocation unit='bytes'>10737418240</allocation> <target> <path>libvirt/image3</path> <format type='raw'/> </target> </volume> The RBD driver will now error out if a different format than RAW is provided when creating a volume. Signed-off-by: Wido den Hollander <wido@widodh.nl>
This commit is contained in:
parent
c494db8fd6
commit
688623b5b0
@ -220,7 +220,8 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
|
||||
},
|
||||
.volOptions = {
|
||||
.defaultFormat = VIR_STORAGE_FILE_RAW,
|
||||
.formatToString = virStoragePoolFormatDiskTypeToString,
|
||||
.formatFromString = virStorageVolumeFormatFromString,
|
||||
.formatToString = virStorageFileFormatTypeToString,
|
||||
}
|
||||
},
|
||||
{.poolType = VIR_STORAGE_POOL_SHEEPDOG,
|
||||
|
@ -306,6 +306,7 @@ static int volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
|
||||
vol->target.capacity = info.size;
|
||||
vol->target.allocation = info.obj_size * info.num_objs;
|
||||
vol->type = VIR_STORAGE_VOL_NETWORK;
|
||||
vol->target.format = VIR_STORAGE_FILE_RAW;
|
||||
|
||||
VIR_FREE(vol->target.path);
|
||||
if (virAsprintf(&vol->target.path, "%s/%s",
|
||||
@ -557,6 +558,12 @@ virStorageBackendRBDCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
{
|
||||
vol->type = VIR_STORAGE_VOL_NETWORK;
|
||||
|
||||
if (vol->target.format != VIR_STORAGE_FILE_RAW) {
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("only RAW volumes are supported by this storage pool"));
|
||||
return -VIR_ERR_NO_SUPPORT;
|
||||
}
|
||||
|
||||
VIR_FREE(vol->target.path);
|
||||
if (virAsprintf(&vol->target.path, "%s/%s",
|
||||
pool->def->source.name,
|
||||
@ -603,6 +610,12 @@ virStorageBackendRBDBuildVol(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (vol->target.format != VIR_STORAGE_FILE_RAW) {
|
||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("only RAW volumes are supported by this storage pool"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user