-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly export the root file-system changes #4643
Conversation
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I prefer one more pair of eyes to run over
@adrianreber when a folder inside the container is removed it looks like the complete root file-system becomes part of the checkpoint
|
I cannot reproduce that:
Looks like your Podman binary has not the changes from this pull request. Can you double check? |
Yes, I updated the Podman binary with the changes from this pull request. diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 25688db5..709e3655 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -622,26 +622,27 @@ func (c *Container) exportCheckpoint(dest string, ignoreRootfs bool) (err error)
}
}
- rootfsTar, err := archive.TarWithOptions(c.state.Mountpoint, &archive.TarOptions{
- Compression: archive.Uncompressed,
- IncludeSourceDir: true,
- IncludeFiles: rootfsIncludeFiles,
- })
- if err != nil {
- return errors.Wrapf(err, "error exporting root file-system diff to %q", rootfsDiffPath)
- }
- rootfsDiffFile, err := os.Create(rootfsDiffPath)
- if err != nil {
- return errors.Wrapf(err, "error creating root file-system diff file %q", rootfsDiffPath)
- }
- defer rootfsDiffFile.Close()
- _, err = io.Copy(rootfsDiffFile, rootfsTar)
- if err != nil {
- return err
+ if len(rootfsIncludeFiles) > 0 {
+ rootfsTar, err := archive.TarWithOptions(c.state.Mountpoint, &archive.TarOptions{
+ Compression: archive.Uncompressed,
+ IncludeSourceDir: true,
+ IncludeFiles: rootfsIncludeFiles,
+ })
+ if err != nil {
+ return errors.Wrapf(err, "error exporting root file-system diff to %q", rootfsDiffPath)
+ }
+ rootfsDiffFile, err := os.Create(rootfsDiffPath)
+ if err != nil {
+ return errors.Wrapf(err, "error creating root file-system diff file %q", rootfsDiffPath)
+ }
+ defer rootfsDiffFile.Close()
+ _, err = io.Copy(rootfsDiffFile, rootfsTar)
+ if err != nil {
+ return err
+ }
+ includeFiles = append(includeFiles, "rootfs-diff.tar")
}
- includeFiles = append(includeFiles, "rootfs-diff.tar")
-
if len(deletedFiles) > 0 {
formatJSON, err := json.MarshalIndent(deletedFiles, "", " ")
if err != nil { |
@rst0git Right. Only deleting files is not working. Thanks. Will fix it. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianreber, baude, rst0git The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When doing a checkpoint with --export the root file-system diff was not working as expected. Instead of getting the changes from the running container to the highest storage layer it got the changes from the highest layer to that parent's layer. For a one layer container this could mean that the complete root file-system is part of the checkpoint. With this commit this changes to use the same functionality as 'podman diff'. This actually enables to correctly diff the root file-system including tracking deleted files. This also removes the non-working helper functions from libpod/diff.go. Signed-off-by: Adrian Reber <areber@redhat.com>
Can this be merged? |
/lgtm |
/hold
I suggest you remove that requirement... it's duplicated from |
/lgtm |
Github appears to have stopped complaining, I have a manual merge option now. I'm going to remove the hold and see if branch protection kicks in. /hold cancel |
Still seems stuck. I'm going to merge manually. |
Oh, nevermind, it went. |
When doing a checkpoint with
--export
the root file-system diff was not working as expected. Instead of getting the changes from the running container to the highest storage layer it got the changes from the highest layer to that parent's layer. For a one layer container this could mean that the complete root file-system is part of the checkpoint.With this commit this changes to use the same functionality as
podman diff
. This actually enables to correctly diff the root file-system including tracking deleted files.This also removes the non-working helper functions from
libpod/diff.go
.Fixes: #4606