Fix issue backporting mount spec to pre-1.13 obj#32821
Conversation
d649909 to
47999e9
Compare
|
@cpuguy83 tests are failing, and looks related |
7bc5580 to
6c4ec35
Compare
|
All green |
|
ping @cpuguy83 looks like it needs a rebase 😢 |
6c4ec35 to
10ae0e7
Compare
|
rebased |
daemon/volumes.go
Outdated
There was a problem hiding this comment.
Looks like we should continue here, as we still try to use fromC even if we got an error
There was a problem hiding this comment.
Yes need continue (or something), nice catch.
Logged errors are typically capitalized.
There was a problem hiding this comment.
In that case, capitalize the error at line 298 👍
daemon/volumes.go
Outdated
There was a problem hiding this comment.
perhaps remove the updated variable here, as it's easily mistaken for the updated output variable?
if daemon.backportMountSpec(fromC) {
fromC.ToDisk()
}Also, wondering if we should
- log errors resulting from
fromC.ToDisk()here, like we to here https://github.com/moby/moby/pull/32821/files#diff-1a1f3e7ad9b1d7584e2d3e7d0c4c3db9R201 - if the locking and
ToDisk()should be done inside thebackportMountSpecfunction? Looks like we always Lock, and write to Disk when calling this function, and ifupdatedis true?
daemon/volumes.go
Outdated
There was a problem hiding this comment.
"probably specified view the hostconfig.Mounts" - sorry, couldn't "grasp" what you tried to say there
daemon/volumes.go
Outdated
There was a problem hiding this comment.
Will this be an issue if both the container itself, and the --volumes-from container specify a volume for the same destination? (and the --volumes-from needs updating)
There was a problem hiding this comment.
-volumes-from is lowest precedence.
Can't have two mountpoints with the same destination.
10ae0e7 to
f482626
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
found a typo, and some questions 😅
daemon/volumes.go
Outdated
There was a problem hiding this comment.
typo s/unepxected/unexpected/
daemon/volumes.go
Outdated
There was a problem hiding this comment.
Wondering in what situation this would need an update; cm.Destination is only added to volumesFrom if we entered the for _, fromSpec := range container.HostConfig.VolumesFrom { loop below, in which case the needsUpdate() check is already performed.
Should this just be continue?
There was a problem hiding this comment.
Let me just move this stuff up to make the code simpler.
I was trying to save some time and not process volumes-from if not-neccessary, but the code is very messy.
daemon/volumes.go
Outdated
There was a problem hiding this comment.
We no longer write updated mount-specs to disk for volumes-from containers, only in-memory, correct?
There was a problem hiding this comment.
In this function yes, they are persisted to disk in the caller.
I can add a note to that in the docstring.
In some cases a mount spec would not be properly backported which could lead to accidental removal of the underlying volume on container remove (which should never happen with named volumes). Adds unit tests for this as well. Unfortunately I had to add a daemon depdency for the backport function due to looking up `VolumesFrom` specs. Signed-off-by: Brian Goff <[email protected]>
f482626 to
3cf1859
Compare
|
This is updated and green. |
|
All green! Checked with @vdemeester earlier, and this still looked good to him |
| for _, fromSpec := range container.HostConfig.VolumesFrom { | ||
| from, _, err := volume.ParseVolumesFrom(fromSpec) | ||
| if err != nil { | ||
| logrus.WithError(err).WithField("id", container.ID).Error("Error reading volumes-from spec during mount spec backport") |
There was a problem hiding this comment.
Missed this in my review; needs a continue (see #33207 (comment))
|
cherry-picked for 17.03.2 in #33207 |
Reuse existing structures and rely on json serialization to deep copy Container objects. Also consolidate all "save" operations on container.CheckpointTo, which now both saves a serialized json to disk, and replicates state to the ACID in-memory store. Signed-off-by: Fabio Kung <[email protected]> (cherry picked from commit edad527) Signed-off-by: Kir Kolyshkin <[email protected]> Conflicts: - daemon/container_operations.go: missing moby#30117 - daemon/daemon.go: missing moby#32821 - daemon/list.go: missing moby#27557, moby#33241 etc.
In some cases a mount spec would not be properly backported which could
lead to accidental removal of the underlying volume on container remove
(which should never happen with named volumes).
Adds unit tests for this as well. Unfortunately I had to add a daemon
depdency for the backport function due to looking up
VolumesFromspecs.
Fixes #32613