Skip to content

Conversation

@runcom
Copy link
Member

@runcom runcom commented May 28, 2019

Deploying an MC changing a file and later deleting it causes the file to
be deleted (it could have been already on disk i.e. shipped by an RPM).
Following Colin's suggestion, this patch adds a backup mechanism which,
when deleting an MC, causes the old file to be restored.
Added an e2e test as well.

closes #782

Signed-off-by: Antonio Murdaca runcom@linux.com

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 28, 2019
@runcom
Copy link
Member Author

runcom commented May 28, 2019

Thinking of any way this could break upgrades/backwards compatibily now lol

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2019
@cgwalters
Copy link
Member

@runcom Are you going to get back to this PR? Pretty important bug I think, also I realized in later discussion that this would help us support the Ignition append mode.

@runcom
Copy link
Member Author

runcom commented Jun 11, 2019

@runcom Are you going to get back to this PR? Pretty important bug I think, also I realized in later discussion that this would help us support the Ignition append mode.

yep, been dragged and buried into something else (mainly bugzillas and next features), I'll get back on this shortly.

@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 12, 2019
@runcom
Copy link
Member Author

runcom commented Jun 12, 2019

Updated and ready for another round of reviews now

Deploying an MC changing a file and later deleting it causes the file to
be deleted (it could have been already on disk i.e. shipped by an RPM).
Following Colin's suggestion, this patch adds a backup mechanism which,
when deleting an MC, causes the old file to be restored.
Added an e2e test as well.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
@knobunc
Copy link
Contributor

knobunc commented Jun 13, 2019

Image build failing: https://openshift-gce-devel.appspot.com/build/origin-ci-test/pr-logs/pull/openshift_machine-config-operator/797/pull-ci-openshift-machine-config-operator-master-images/2698

could not wait for build: the build machine-config-daemon failed after 45s with reason DockerBuildFailed: Docker build strategy has failed.

Using version from git...
Building github.com/openshift/machine-config-operator/cmd/...-gcfa394e4-dirty, cfa394e44bc9f4f52330fdedc599eaacdab0102f)
# github.com/openshift/machine-config-operator/pkg/daemon
pkg/daemon/update.go:8:2: imported and not used: "io"
error: build error: running 'WHAT=machine-config-daemon ./hack/build-go.sh' failed with exit code 2

@runcom
Copy link
Member Author

runcom commented Jun 13, 2019

@cgwalters
Copy link
Member

A brief search turns up https://github.com/docker/docker-ce/blob/9f7430572607260b058cc69c03da91278beac746/components/engine/daemon/graphdriver/copy/copy.go#L30 which looks reasonable if we ever want to copy some code to do this in-process.

Rust also recently gained a good implementation of this FWIW.

@runcom
Copy link
Member Author

runcom commented Jun 13, 2019

A brief search turns up https://github.com/docker/docker-ce/blob/9f7430572607260b058cc69c03da91278beac746/components/engine/daemon/graphdriver/copy/copy.go#L30 which looks reasonable if we ever want to copy some code to do this in-process.

I'm familiar with that piece of code, also willing to use that, I'm just worried about the maintenance status of anything within Docker/Moby.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

/lgtm

// the orig file is already there and we avoid creating a new one to preserve the real default
return nil
}
if out, err := exec.Command("cp", "-a", "--reflink=auto", fpath, origFileName(fpath)).CombinedOutput(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Of course if this is interrupted in the middle we'll end up with an incomplete backup but...let's just get this in!

Copy link
Member

Choose a reason for hiding this comment

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

The libglnx code I wrote for this properly clones to an O_TMPFILE which also makes it superior to what the Rust libstd is doing. It's a bit surprising actually cp doesn't have a --tmpfile flag or something, would probably be easy to implement.

If only calling C from golang wasn't unspeakably awful...

Anyways we can circle back to polishing this bit later.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 13, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, runcom

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

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

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

after replacing default config file, removing the MC causes the config file to disappear

6 participants