Skip to content

Commit

Permalink
tarfs: fix error when export block data for layer block
Browse files Browse the repository at this point in the history
When the layer_block mode is enabled, the remote snapshot does not contain the
`containerd.io/snapshot/nydus-layer-block` label, which prevents the creation of
a kata volume. Therefore, we need to add the `containerd.io/snapshot/nydus-layer-block`
label to the remote snapshot.

Signed-off-by: ChengyuZhu6 <[email protected]>
  • Loading branch information
ChengyuZhu6 committed Dec 7, 2023
1 parent 49f347e commit 685b708
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/tarfs/tarfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,17 @@ func (t *Manager) ExportBlockData(s storage.Snapshot, perLayer bool, labels map[
updateFields := []string{}

wholeImage, exportDisk, withVerity := config.GetTarfsExportFlags()

log.L.Debugf("ExportBlockData wholeImage = %v, exportDisk = %v, withVerity = %v, perLayer = %v", wholeImage, exportDisk, withVerity, perLayer)
// Nothing to do for this case, all needed datum are ready.
if !exportDisk && !withVerity {
return updateFields, nil
} else if !wholeImage != perLayer {
// Special handling for `layer_block` mode
if exportDisk && !withVerity && !perLayer {
labels[label.NydusLayerBlockInfo] = ""
updateFields = append(updateFields, "labels."+label.NydusLayerBlockInfo)
}
return updateFields, nil
}

Expand Down

0 comments on commit 685b708

Please sign in to comment.