Skip to content
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

checkpoint restore: fix --ignore-static-ip/mac #16800

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Dec 9, 2022

With the 4.0 network rewrite I introduced a regression in 094e1d7. It only covered the case where a checkpoint is restored via --import. The normal restore path was not covered since the static ip/mac are now part in an extra db bucket. This commit fixes that by changing the config in the db.

Note that there were no test for --ignore-static-ip/mac so I added a big system test which should cover all cases (even the ones that already work). This is not exactly pretty but I don't have to enough time to come up with something better at the moment.

Fixes #16666

Does this PR introduce a user-facing change?

Fix `podman container restore --ignore-static-ip` and `--ignore-static-mac` options when restoring a normal container, i.e without `--import`. 

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 9, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2022
Comment on lines 1271 to 1273
// TODO: we should properly make this in one db call instead to prevent partial states on interupt
if err := c.runtime.state.NetworkDisconnect(c, net); err != nil {
return nil, 0, fmt.Errorf("failed to rewrite network config: %w", err)
}
if err := c.runtime.state.NetworkConnect(c, net, opts); err != nil {
return nil, 0, fmt.Errorf("failed to rewrite network config: %w", err)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@mheon PTAL, should I create a function to make this in a single db call?

Copy link
Member

Choose a reason for hiding this comment

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

Is the intent here just to mutate the options of the given network? If so, a NetworkModify call could be added. I can't think of any adverse side effects for doing so...

That said, is there a reason this has to be done here, instead of setting the options correctly when we first restore the container / add it to the DB?

Copy link
Member Author

Choose a reason for hiding this comment

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

That said, is there a reason this has to be done here, instead of setting the options correctly when we first restore the container / add it to the DB?

podman container checkpoint/restore keeps the cotnainer in the db, so we have to change the db content
If you look at the code I removed, the restore --import path already ignores the mac/ip correctly, moving it here makes sure all cases work as expected.

With the 4.0 network rewrite I introduced a regression in 094e1d7.
It only covered the case where a checkpoint is restored via --import.
The normal restore path was not covered since the static ip/mac are now
part in an extra db bucket. This commit fixes that by changing the config
in the db.

Note that there were no test for --ignore-static-ip/mac so I added a big
system test which should cover all cases (even the ones that already
work). This is not exactly pretty but I don't have to enough time to
come up with something better at the moment.

Fixes containers#16666

Signed-off-by: Paul Holzinger <[email protected]>
@Luap99
Copy link
Member Author

Luap99 commented Dec 16, 2022

@mheon @vrothberg @rhatdan @adrianreber PTAL

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
Nice test!

@mheon
Copy link
Member

mheon commented Dec 16, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2022
@openshift-merge-robot openshift-merge-robot merged commit f21c640 into containers:main Dec 16, 2022
@Luap99 Luap99 deleted the restore-static-ip branch December 16, 2022 16:09
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman checkpoint restore --ignore-static-mac does not change mac address
4 participants