Repository navigation
devicemapper: Compare uuid of base device on startup - #13896
Conversation
|
@vbatts What do you think about this one. I think with this we should be able to catch lot of errors early and tell users that there was most likely a configuration issue. |
6c071df to
6e82131
Compare
|
I haven't reviewed the actual code, but it sounds like the right thing to do. |
|
so, this is one check. I don't think this will go the full way for a configuration/state comparison. This kind of check may be nicer to make a part of a generic call around It seems like a generic case like this, for all drivers, could allow for catching odd changes with config, or switched pool devices or similar. Thoughts? Otherwise, this PR is simple and overall LGTM. I'll walk through the code more in a minute. |
|
Right now validation is practically in Init(). Just 2 levels down. And Init() is right place to do such kind of checks for every graph driver. What other cases of error do you want to detect/cover? For devicemapper, I think it should cover |
|
agreed |
|
This can all stay in Init(), it seems like the pattern for "what is involved in Init of a storage driver?" is what i'm looking at. |
|
I suspect that block size will be stored in pool metadata and if you try to create same pool with different block size this time, pool creation should fail. Otherwise all the metadata thin pool has already created will not work. I think every target will have separate sanity checks based on kind of tunables they offer and they all need to come up with their own checks to make sure they have right configuration. But I am open to any suggestions to improve it. |
|
right on. For now we'll review this PR as is, and let the rest evolve. |
There was a problem hiding this comment.
is there simple way to do this without shelling out?
There was a problem hiding this comment.
I am not aware of any other easy way to do it. blkid comes from util-linux package and mkfs comes from util-linux too. As we are already using mkfs, I think it is safe to assume that blkid is available too on machines running docker.
There was a problem hiding this comment.
there is a header and way to link to libbklid, but that seems too much. Please would require additional build time packages, where blkid is provided by util-linux which is on every major distro (even debian minbase).
|
LGTM |
|
@tiborvass care to review? |
There was a problem hiding this comment.
is the error returned by saveBaseDeviceUUID ignored here on purpose? should we return it? or log like we do in line 728?
There was a problem hiding this comment.
Not critical, but wouldn't hurt
On Jun 16, 2015 17:40, "David Calavera" [email protected] wrote:
In daemon/graphdriver/devmapper/deviceset.go
#13896 (comment):@@ -721,6 +783,7 @@ func (devices *DeviceSet) setupBaseImage() error {
return err
}
- devices.saveBaseDeviceUUID(info)
is the error returned by saveBaseDeviceUUID ignored here on purpose?
should we return it?—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/13896/files#r32574282.
There was a problem hiding this comment.
Ok I added the error check and pushed the patch again. PTAL.
It is easy for one to use docker for a while, shut it down and restart docker with different set of storage options for device mapper driver which will effectively change the thin pool. That means any of the metadata stored in /var/lib/docker/devicemapper/metadata/ is not valid for the new pool and user will run into various kind of issues like container not found in the pool etc. Users think that their images or containers are lost but it might just be the case of configuration issue. People might use wrong metadata with wrong pool. To detect such situations, save UUID of base image and once docker starts later, query and compare the UUID of base image with the stored one. If they don't match, fail the initialization with the error that UUID failed to match. That way user will be forced to cleanup /var/lib/docker/ directory and start docker again. Signed-off-by: Vivek Goyal <[email protected]>
6e82131 to
c06b05b
Compare
|
LGTM. Merging 🎊 |
devicemapper: Compare uuid of base device on startup
The ability to save and verify base device UUID (moby#13896) introduced a situation where the initialization would panic when removing the device returns EBUSY. Functions `verifyBaseDeviceUUID` and `saveBaseDeviceUUID` now take the lock on the `DeviceSet`, which solves the problem as `removeDevice` assumes it owns the lock. Signed-off-by: Arnaud Porterie <[email protected]>
The ability to save and verify base device UUID (moby#13896) introduced a situation where the initialization would panic when removing the device returns EBUSY. Functions `verifyBaseDeviceUUID` and `saveBaseDeviceUUID` now take the lock on the `DeviceSet`, which solves the problem as `removeDevice` assumes it owns the lock. Signed-off-by: Arnaud Porterie <[email protected]>
The ability to save and verify base device UUID (moby#13896) introduced a situation where the initialization would panic when removing the device returns EBUSY. Functions `verifyBaseDeviceUUID` and `saveBaseDeviceUUID` now take the lock on the `DeviceSet`, which solves the problem as `removeDevice` assumes it owns the lock. Signed-off-by: Arnaud Porterie <[email protected]>
Fixes issue #13894
It is easy for one to use docker for a while, shut it down and restart
docker with different set of storage options for device mapper driver
which will effectively change the thin pool. That means any of the
metadata stored in /var/lib/docker/devicemapper/metadata/ is not valid
for the new pool and user will run into various kind of issues like
container not found in the pool etc.
Users think that their images or containers are lost but it might just
be the case of configuration issue. People might use wrong metadata
with wrong pool.
To detect such situations, save UUID of base image and once docker
starts later, query and compare the UUID of base image with the
stored one. If they don't match, fail the initialization with the
error that UUID failed to match.
That way user will be forced to cleanup /var/lib/docker/ directory
and start docker again.
Signed-off-by: Vivek Goyal [email protected]