qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSource *src)
{
/* no need to check in backing chain since only RAW storage supports this */
- return src->format == VIR_STORAGE_FILE_RAW;
+ return qemuBlockStorageSourceIsRaw(src);
}
case VIR_STORAGE_FILE_FAT:
/* The fat layer is emulated by the storage access layer, so we need to
* put a raw layer on top */
+ if (qemuBlockStorageSourceGetFormatRawProps(src, props) < 0)
+ return NULL;
+ break;
+
case VIR_STORAGE_FILE_RAW:
- if (src->encryption &&
- src->encryption->engine == VIR_STORAGE_ENCRYPTION_ENGINE_QEMU &&
- src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
+ if (qemuBlockStorageSourceIsLUKS(src)) {
if (qemuBlockStorageSourceGetFormatLUKSProps(src, props) < 0)
return NULL;
} else {
return 0;
if (format) {
- if (backing->format == VIR_STORAGE_FILE_RAW &&
- backing->encryption &&
- backing->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS)
+ if (qemuBlockStorageSourceIsLUKS(backing))
backingFormatStr = "luks";
else
backingFormatStr = virStorageFileFormatTypeToString(backing->format);
{
switch ((virStorageFileFormat) src->format) {
case VIR_STORAGE_FILE_RAW:
- if (!src->encryption ||
- src->encryption->format != VIR_STORAGE_ENCRYPTION_FORMAT_LUKS)
+ if (!qemuBlockStorageSourceIsLUKS(src))
return 0;
return qemuBlockStorageSourceCreateGetFormatPropsLUKS(src, props);
g_autoptr(virJSONValue) createformatprops = NULL;
int ret;
- if (src->format == VIR_STORAGE_FILE_RAW &&
- !src->encryption)
+ /* we don't bother creating only a true 'raw' image */
+ if (qemuBlockStorageSourceIsRaw(src))
return 0;
if (qemuBlockStorageSourceCreateGetFormatProps(src, backingStore,
}
}
- if (src->format == VIR_STORAGE_FILE_RAW) {
+ if (qemuBlockStorageSourceIsRaw(src)) {
src->physical = entry->capacity;
} else {
src->physical = entry->physical;
if (!src->sliceStorage)
return false;
- if (src->format != VIR_STORAGE_FILE_RAW)
- return true;
-
- if (src->encryption &&
- src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS)
- return true;
-
- return false;
+ return !qemuBlockStorageSourceIsRaw(src);
}
goto cleanup;
}
- if (disk->src->format != VIR_STORAGE_FILE_RAW) {
+ if (qemuBlockStorageSourceIsRaw(disk->src)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("peeking is only supported for disk with 'raw' format not '%1$s'"),
virStorageFileFormatTypeToString(disk->src->format));
* query the highest allocated extent from QEMU
*/
if (virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_BLOCK &&
- src->format != VIR_STORAGE_FILE_RAW &&
+ !qemuBlockStorageSourceIsRaw(src) &&
S_ISBLK(sb.st_mode))
src->allocation = 0;