Skip to content

Display network information of checkpoints created with Podman#162

Closed
deveshgoyal1000 wants to merge 1 commit intocheckpoint-restore:mainfrom
deveshgoyal1000:podman-network-info
Closed

Display network information of checkpoints created with Podman#162
deveshgoyal1000 wants to merge 1 commit intocheckpoint-restore:mainfrom
deveshgoyal1000:podman-network-info

Conversation

@deveshgoyal1000
Copy link
Copy Markdown
Contributor

This PR implements support for displaying network information (IP and MAC addresses) from Podman container checkpoints, addressing issue.

Currently, checkpointctl shows IP address information for checkpoints created with CRI-O but not with Podman. For Podman checkpoints, this information is stored in network.status in JSON format.

Implementation:

  • Added network.status file parsing functionality
  • Added IP and MAC address display to checkpoint show output
  • Added test coverage for network information parsing

Testing Results:
Before (Original Output) and After (With Network Information output)

Screenshot (1191)

Screenshot (1195)

The implementation successfully displays:

  • Container's IP address
  • MAC address
  • Maintains existing checkpoint information

Fixes #132

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2025

Test Results

61 tests  ±0   61 ✅ ±0   2s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 7669ce5. ± Comparison against base commit 2eec433.

♻️ This comment has been updated with latest results.

@adrianreber
Copy link
Copy Markdown
Member

Please have a look at the CI failures and try to fix them.

Also, please rebase and remove the merge commit.

@adrianreber
Copy link
Copy Markdown
Member

You should also remove the dependabot commit from your PR.

@rst0git
Copy link
Copy Markdown
Member

rst0git commented Apr 5, 2025

@deveshgoyal1000 Thank you for working on this! In addition to Adrian's comments, it would be great if you can add more detailed commit messages. The following contributor guide provides more information: https://github.com/checkpoint-restore/criu/blob/criu-dev/CONTRIBUTING.md#describe-your-changes

@deveshgoyal1000
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I’ll start working on the suggested updates.

Signed-off-by: deveshgoyal1000 <devesh.21bcon427@jecrcu.edu.in>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 6, 2025

Codecov Report

❌ Patch coverage is 74.02597% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.41%. Comparing base (88acd95) to head (7669ce5).
⚠️ Report is 78 commits behind head on main.

Files with missing lines Patch % Lines
internal/podman_network.go 43.75% 9 Missing ⚠️
internal/container.go 88.23% 5 Missing and 1 partial ⚠️
internal/oci_image_build.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
- Coverage   71.43%   71.41%   -0.02%     
==========================================
  Files          13       14       +1     
  Lines        1565     1599      +34     
==========================================
+ Hits         1118     1142      +24     
- Misses        373      384      +11     
+ Partials       74       73       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread internal/container.go
if specDump.Annotations["io.container.manager"] == "libpod" {
// Create temp dir for network status file
tmpDir, err := os.MkdirTemp("", "network-status")
if err == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to return the error here (possible wrapped with some context)

Comment thread internal/container.go

// Extract network.status file
err = UntarFiles(task.CheckpointFilePath, tmpDir, []string{metadata.NetworkStatusFile})
if err == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Comment thread internal/container.go
if err == nil {
networkStatusFile := filepath.Join(tmpDir, metadata.NetworkStatusFile)
ip, mac, err := getPodmanNetworkInfo(networkStatusFile)
if err == nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Comment thread internal/container.go
Comment on lines +111 to +114
if strings.Contains(err.Error(), "unexpected end of JSON input") {
return nil, fmt.Errorf("config.dump: unexpected end of JSON input")
}
return nil, fmt.Errorf("config.dump: %w", err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if strings.Contains(err.Error(), "unexpected end of JSON input") {
return nil, fmt.Errorf("config.dump: unexpected end of JSON input")
}
return nil, fmt.Errorf("config.dump: %w", err)
return nil, fmt.Errorf("config.dump: %w", err)

I don't think we need the special case since we are wrapping with context.

Comment thread internal/container.go
Comment on lines +118 to +124
if os.IsNotExist(err) {
return nil, fmt.Errorf("spec.dump: no such file or directory")
}
if strings.Contains(err.Error(), "unexpected end of JSON input") {
return nil, fmt.Errorf("spec.dump: unexpected end of JSON input")
}
return nil, fmt.Errorf("spec.dump: %w", err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if os.IsNotExist(err) {
return nil, fmt.Errorf("spec.dump: no such file or directory")
}
if strings.Contains(err.Error(), "unexpected end of JSON input") {
return nil, fmt.Errorf("spec.dump: unexpected end of JSON input")
}
return nil, fmt.Errorf("spec.dump: %w", err)
return nil, fmt.Errorf("spec.dump: %w", err)

I don't think we need the special case since we are wrapping with context.

Comment thread internal/container.go
"IP",
"MAC",
"CHKPT Size",
"Root FS Diff Size",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Root FS Diff Size",
"Root FS Diff",

Would it make sense to drop the "size" suffix, since the field ought to make it clear that we are talking about the size?

Comment thread internal/container.go
Comment on lines +158 to +160
if strings.Contains(err.Error(), "Error: ") {
return fmt.Errorf("%s", strings.TrimPrefix(err.Error(), "Error: "))
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unnecessary

}

return "", "", nil
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline at the end of the file :)

if err == nil {
t.Error("getPodmanNetworkInfo should fail with invalid JSON")
}
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline at the end of the file :)

@snprajwal
Copy link
Copy Markdown
Member

Oh also, it looks like you need to format the files correctly

@deveshgoyal1000
Copy link
Copy Markdown
Contributor Author

Yes, I’m working on it. Thanks for the detailed review and suggestions

@deveshgoyal1000
Copy link
Copy Markdown
Contributor Author

Hello :) Sorry for the late message. I’ve already completed about half of the work on this issue, but I noticed someone else has started working on it too. Should I continue working on it or close this PR

@rst0git
Copy link
Copy Markdown
Member

rst0git commented Mar 14, 2026

@deveshgoyal1000 It might be better to close this pull request in favour of #206 and we can add a Co-authored-by: line with your name in the commit message.

@deveshgoyal1000
Copy link
Copy Markdown
Contributor Author

@rst0git Thanks! that sounds good to me. I'll close this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display network information of checkpoints created with Podman

5 participants