Fix image layer format version matching

This commit is contained in:
Konstantin Knizhnik
2024-03-13 21:10:12 +02:00
parent 485ecbaf8f
commit 0b57e0b8f2

View File

@@ -396,7 +396,12 @@ impl ImageLayerInner {
let actual_summary =
Summary::des_prefix(summary_blk.as_ref()).context("deserialize first block")?;
if actual_summary.format_version > STORAGE_FORMAT_VERSION {
bail!("Forward compatibility of storage is not supported: current format version is {}, format version of layer {} is {}", STORAGE_FORMAT_VERSION, path, actual_summary.format_version);
}
if let Some(mut expected_summary) = summary {
// assume backward compatibility
expected_summary.format_version = actual_summary.format_version;
// production code path
expected_summary.index_start_blk = actual_summary.index_start_blk;
expected_summary.index_root_blk = actual_summary.index_root_blk;