Skip to content

Fix implicit DeviceMapper selection - #14292

Merged
icecrime merged 1 commit into
moby:masterfrom
calavera:fix_driver_detection
Jul 2, 2015
Merged

icecrime merged 1 commit into
moby:masterfrom
calavera:fix_driver_detection

Conversation

@calavera

Copy link
Copy Markdown
Contributor

DeviceMapper must be explicitly selected because the Docker binary might not be linked to the right devmapper library.

With this change, Docker fails fast if the driver detection finds the devicemapper directory but the driver is not the default option.
It also makes Docker to fail fast if it detects two driver root directories.
The option override_udev_sync_check doesn't make sense anymore, since the user must be explicit to select devicemapper, so it's being removed.

Fixes #14035

Signed-off-by: David Calavera [email protected]

@calavera calavera added this to the 1.7.1 milestone Jun 30, 2015
@calavera
calavera force-pushed the fix_driver_detection branch 3 times, most recently from 1623512 to 5f8aa57 Compare June 30, 2015 19:01
Comment thread daemon/graphdriver/driver.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure it's true in all cases: if you are on a RedHat system with a dynamically linked binary, I think it's fine having an automatic election of devicemapper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed it to fail only if the binary was statically compiled.

@calavera
calavera force-pushed the fix_driver_detection branch from 5f8aa57 to 4c4c7ea Compare July 1, 2015 00:06
Comment thread daemon/graphdriver/driver.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't len(DefaultDriver) == 0 necessarily true in this code path? It seems that if it wasn't, we would have returned above in line 113, no? So maybe that can be simplified as if _, ok := priorDrivers["devicemapper"]; ok && dockerversion.IAMSTATIC == "true" {.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh, that's correct. Fixing.

@calavera
calavera force-pushed the fix_driver_detection branch 2 times, most recently from f0a26c7 to 069db00 Compare July 1, 2015 16:04
@thaJeztah

Copy link
Copy Markdown
Member

ping @vbatts and @rhvgoyal (I think) :-)

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

I am not sure what's the purpose of this patch. For dynamic binary case, a user should not have to select devicemapper explicitly.

Those who are complaining about docker not starting over upgrade, that was deliberate. People have been using static binaries with devicemapper driver and it was broken. Docker 1.6 allowed it and @vbatts and others wanted users to move away from it.

That's the reason in 1.7, docker will fail (instead of continuing) by default. And that's what everybody is running into. This is by design and not an error.

Those who are running into issues, solution is not to downgrade to 1.6. But one of the following.

  • Now you know that static binary will not work reliably with devicemapper driver. So save your work,
    and switch to a different driver.
  • If you can live with devicemapper unreliability with static binary and just want your working setup as
    you had in 1.6, simply specify --storage-opt dm.override_udev_sync_check=true and restart docker daemon.

Note: IIRC, I had opposed failing by default because that would break existing users over upgrade. And that's what precisely is happening. But people had argued that we don't want people to continue to use already broken setups hence we want to break these systems over upgrade and let users opt-in for a broken system or switch to a different driver.

So all this is intentional folks.

@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

@rhvgoyal The intention here is to be more clear about why docker is failing to start. This is what's going to happen with this change:

1 - Case where you're running a dynamic binary, you have the devicemapper directory and you don't select the driver: Everything is okay, we select devicemapper and move forward.
2 - Case where you're running a static binary, you have the devicemapper directory and you don't select a driver: Not cool, we fail and ask the user to select devicemapper explicitly. NOTE the error message is not good enough, will fix.
3 - Case where you're running a static binary and you select the driver explicitly: Your problem, since you're explicitly selecting the driver. We only log a message in the daemon log.

So instead of asking people to set another flag --storage-opt dm.override_udev_sync_check=true, we just let them go for it when they set the storage driver explicitly.

Is this clear enough @icecrime?

@calavera
calavera force-pushed the fix_driver_detection branch from 069db00 to a6f3bc4 Compare July 1, 2015 17:46
@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

I added using a statically linked binary to the beginning of the error message to be more clear about the issue.

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

Please read through this conversation when udev sync flag patch was merged.

#11412

I think it is pretty clear that what's the intention and what's the behavior. User either needs to pass a flag to continue with old broken behavior or move to a different driver.

What's not clear here?

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

Users need to set --storage-opt dm.override_udev_sync_check=true only in two cases, when using static docker binary.

  • Either they have selected devicemapper storage driver specifically.
  • Or, they had been using devicemapper storage driver and have upgraded to 1.7.

And in both the cases, it is reasonable to ask user to acknowledge that their current setup is broken and still they want to continue to use it and hence they need to opt-in using this flag.

@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

I think it is pretty clear that what's the intention and what's the behavior. User either needs to pass a flag to continue with old broken behavior or move to a different driver.

No, the intention is not clear, neither the behavior, and that's the main problem that people have.

Requiring people to use docker -d --storage-opt dm.override_udev_sync_check=true is confusing because that storage option is specific to a driver that they didn't select. Requiring people to use docker -d --storage-diver devicemapper is understandable because they make a explicit decision to use a driver.

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

People are forced to use it only if they had been using devicemapper previously. As docker selected it. and it is a broken configuraiton.

If you are starting docker fresh, devicemapper might not be selected at all as it is so low in priority table. Even if it is selected, initialization will fail and docker will move on to overlay.

So people need to specify udev sync flag, only if they decide to use devicemapper. And that's happening only in upgrade case where docker is imposing devicemapper as that's the prior used driver.

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

IOW, docker -d --storage-opt dm.override_udev_sync_check=true is corner case. Where user has not selected a graph driver but docker is forcing devicemapper as that's the one which was being used before upgrade. And hence user needs to specify this.

That's the whole intention of this flag. Try to bring broken configurations to user's notice. Otherwise a user will complain, hey I did not specify a graph driver and docker imposed a broken driver on me. Despite the fact that docker knows configuration is broken, it simply put a log in journal and moved on.

Those who are not upgrading should not be running into this issue.

@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

@rhvgoyal I understand that. Users don't. It's easier to explain that they need to set the driver than to explain that the need to set an option for a driver they didn't select.

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@calavera

Ok, after your patch, what's going to change? If 1.6 was using devicemapper and a user upgrades to 1.7.1, what will he/she see? Lets discuss the semantics first. I don't even fully understand what your patch is doing.

@thaJeztah

Copy link
Copy Markdown
Member

My initial stance at this;

  • IIRC, the dm.override_udev_sync_check is only a temporary flag, giving users a "grace period"; a chance to either switch drivers, or install a non-statically built docker to keep using devicemapper. Plans were to remove that flag (in 1.8) and no longer allowing users to use devicemapper at all without udev sync (@vbatts please confirm if I'm right here)
  • The flag "sucks", and it should be, because running without Udev sync can (if I understand correctly) lead to nasty things, including data-corruption, which sucks even more :-) After all, I don't think anyone would expect (e.g.) their anti-virus software issuing a message "Virus detected in xxx press OK to continue", just because that's the easy way.
  • Not requiring the flag, would put switching to a malfunctioning driver at the same "level" as Docker not being able to automatically decide which driver to use (if multiple graph dirs were found); I don't think that's correct; it's a different "level" and should be a very deliberate choice to pick that driver (given that it is flawed without udev sync)

What I do agree on with @calavera is that;

  • We should have been more communicative on this change; there should be a big warning and clear(er) instructions in the release notes and documentation, explaining what this (error) means, and how to migrate or upgrade Docker in such case (we can still add this?), also giving a clear notice that such setup will not be supported in 1.8
  • We should make it easier to obtain dynamically linked Docker builds; if I'm not mistaken, the only way currently is to build yourself. That's bad, I don't think we can expect people using Docker to also be able to build it themselves.

Just my opinion :-)

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@thaJeztah

RedHat is shipping dynamically built docker in fedora, rhel, atomic, centos. So distributions should be able to ship dynamically built docker for their users.

@rhvgoyal

rhvgoyal commented Jul 1, 2015

Copy link
Copy Markdown
Contributor

@thaJeztah

I agree that better documentation and communication is the key whenever we decide to break existing working setup.

@thaJeztah

Copy link
Copy Markdown
Member

@rhvgoyal

RedHat is shipping dynamically built docker in fedora, rhel, atomic, centos. So distributions should be able to ship dynamically built docker for their users.

True, problem is that;

  • Other distros don't (or might not)
  • We give instructions for installing the docker maintained versions (and don't provide dynamically built vanilla docker). I'm not sure Docker should be pointing people to RedHat maintained versions, because we cannot provide support for those (willing to exchange thoughts on that)

@calavera
calavera force-pushed the fix_driver_detection branch from a6f3bc4 to 0fbc972 Compare July 1, 2015 19:46
@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

Make sure above message is displayed both for the case of fresh install and prior driver selection.

agreed

If we are enforcing that there is only one prior driver directory, then there is no need to though priority list after scanning for prior drivers. Anywhere there is one. Use it.

we've been doing this for a really long time, but the code is a mess.

@calavera
calavera force-pushed the fix_driver_detection branch from 0fbc972 to e34ad0f Compare July 1, 2015 22:08
@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

I made the changes suggested by @icecrime and @rhvgoyal

@icecrime

icecrime commented Jul 1, 2015

Copy link
Copy Markdown
Contributor
--- FAIL: TestDevmapperSetup (0.00s)
    graphtest.go:76: graphdriver: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
    graphtest.go:80: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
--- FAIL: TestDevmapperCreateEmpty (0.00s)
    graphtest.go:76: graphdriver: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
    graphtest.go:80: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
--- FAIL: TestDevmapperCreateBase (0.00s)
    graphtest.go:76: graphdriver: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
    graphtest.go:80: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
--- FAIL: TestDevmapperCreateSnap (0.00s)
    graphtest.go:76: graphdriver: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper
    graphtest.go:80: devicemapper storage driver cannot reliably be used with a statically linked docker binary: please either pick a different storage driver, install a dynamically linked docker binary, or force this unreliable setup anyway by specifying --storage-driver=devicemapper

@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

@icecrime dunno why they fail, that's correct :trollface:

@calavera
calavera force-pushed the fix_driver_detection branch from e34ad0f to 1f3e2e2 Compare July 1, 2015 22:44
@calavera

calavera commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

@icecrime they should be fixed now.

@calavera
calavera force-pushed the fix_driver_detection branch from 1f3e2e2 to 0a37629 Compare July 2, 2015 16:20
@calavera

calavera commented Jul 2, 2015

Copy link
Copy Markdown
Contributor Author

@rhvgoyal I made those changes. Thanks for the feedback!

DeviceMapper must be explicitly selected because the Docker binary might not be linked to the right devmapper library.

With this change, Docker fails fast if the driver detection finds the devicemapper directory but the driver is not the default option.
The option `override_udev_sync_check` doesn't make sense anymore, since the user must be explicit to select devicemapper, so it's being removed.
Docker fails to use devicemapper only if Docker has been built statically unless the option was explicit.

Signed-off-by: David Calavera <[email protected]>
@LK4D4

LK4D4 commented Jul 2, 2015

Copy link
Copy Markdown
Contributor

LGTM

@icecrime

icecrime commented Jul 2, 2015

Copy link
Copy Markdown
Contributor

Tested locally, I think the output makes sense (I hope it will be clearer to the users at least...).

Thanks, LGTM.

@icecrime

icecrime commented Jul 2, 2015

Copy link
Copy Markdown
Contributor

Overriding docs review as I believe this is essentially a rollback of a previously added parameter.

icecrime pushed a commit that referenced this pull request Jul 2, 2015
Fix implicit DeviceMapper selection
@icecrime
icecrime merged commit f0ed68f into moby:master Jul 2, 2015
@calavera

calavera commented Jul 2, 2015

Copy link
Copy Markdown
Contributor Author

Cherry picked into #14264

@calavera
calavera deleted the fix_driver_detection branch July 2, 2015 19:47
@thaJeztah

Copy link
Copy Markdown
Member

@icecrime is the plan to keep "allowing" running without udev sync support, or will it be a hard failure in a future version? If so, should that be announced / part of the roadmap?

@icecrime

icecrime commented Jul 2, 2015

Copy link
Copy Markdown
Contributor

@thaJeztah Honestly, I'm inclined to think this is a good final situation: it's breaking enough, and explicit enough.

@rhvgoyal

rhvgoyal commented Jul 2, 2015

Copy link
Copy Markdown
Contributor

Right now following is the behavior.

  • If you are starting static docker fresh, then it will choose overlay. There should not be any error message about devicemapper. It will simply skip devicemapper.
  • If devicemapper was being used as prior driver then over upgrade it will fail to start and will ask user to explicitly specify devicemapper driver.

Either way, if user forces use of devicemapper with static binary, it is running without udev sync support. libdm needs static libudev for it to work but systemd project does not allow static libudev.

@thaJeztah

Copy link
Copy Markdown
Member

@icecrime alright, let's see how this works out then; we can always evaluate if too many people run into problems

@rhvgoyal

rhvgoyal commented Jul 6, 2015

Copy link
Copy Markdown
Contributor

So after this change, how does devicemapper testing on docker work? If I generate PR, do we make sure it works with devicemapper backend otherwise CI fails?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants