Skip to content

graphdriver: prefer prior driver state - #11999

Merged
jessfraz merged 1 commit into
moby:masterfrom
vbatts:vbatts-decide_storage
Apr 14, 2015
Merged

jessfraz merged 1 commit into
moby:masterfrom
vbatts:vbatts-decide_storage

Conversation

@vbatts

@vbatts vbatts commented Apr 1, 2015

Copy link
Copy Markdown
Contributor

Before this, a storage driver would be defaulted to based on the
priority list, and only print a warning if there is state from other
drivers.

This meant a reordering of priority list would "break" users in an
upgrade of docker, such that there images in the prior driver's state
were now invisible.

With this change, prior state is scanned, and if present that driver is
preferred.

As such, we can reorder the priority list, and after an upgrade,
existing installs with prior drivers can have a contiguous experience,
while fresh installs may default to a driver in the new priority list.

Ref: #11962 (comment)

Upgrade overlayfs to first place, now that this will not break driver
usage on existing installs. See #12354 for overlay promotion.

/cc @jfrazelle @crosbymichael @tianon @unclejack

Comment thread daemon/graphdriver/driver.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this be a map[string]struct{} instead so we don't have to double-loop above?

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.

let me look at that

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 don't think I'll do a map here, because that would be unordered and still require the comparison. Perhaps I can just revisit the double iteration

Comment thread daemon/graphdriver/driver.go Outdated

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.

@tianon @thaJeztah right here, you're saying that unlike below, in this scan for prior, if it is found and is not supported/compatible/prereq then it should fail. Right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO yeah

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since then the user gets to make the choice of either fix their system to get support back, or to switch Docker's backend explicitly.

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.

understood.

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.

also, are we saying as well, if len(priorDrivers) > 1 bail as well?

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.

because that could seem problematic ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Hmf GitHub cache (only noticed the comments above))

Yes, I think if there's any doubt; ask the user.

Users searching for "my images disappeared" problems cluttering the issue tracker (or worse; blogging about it first) isn't the best user experience.

A clear error (if possible) with clear instructions seems the better choice.

@tianon tianon Apr 1, 2015 via email

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from dfa69eb to 75aec33 Compare April 1, 2015 19:58
@vbatts

vbatts commented Apr 1, 2015

Copy link
Copy Markdown
Contributor Author

Updated. PTAL

@vbatts

vbatts commented Apr 1, 2015

Copy link
Copy Markdown
Contributor Author

I'll paste output from the use cases once I get my laptop on the www

Comment thread daemon/graphdriver/driver.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/beacause/because/

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.

Hahaha
On Apr 1, 2015 5:59 PM, "Sebastiaan van Stijn" [email protected]
wrote:

In daemon/graphdriver/driver.go
#11999 (comment):

  •   }
    
  •   for _, prior := range priorDrivers {
    
  •       // of the state found from prior drivers, check in order of our priority
    
  •       // which we would prefer
    
  •       if prior == name {
    
  •           driver, err = GetDriver(name, root, options)
    
  •           if err != nil {
    
  •               // unlike below, we will return error here, because there is prior
    
  •               // state, and now it is no longer supported/prereq/compatible, so
    
  •               // something changed and needs attention. Otherwise the daemon's
    
  •               // images would just "disappear".
    
  •               logrus.Errorf("[graphdriver] prior storage driver %q failed: %s", name, err)
    
  •               return nil, err
    
  •           }
    
  •           logrus.Infof("[graphdriver] using prior storage driver %q", name)
    
  •           checkPriorDriver(name, root) // print out beacause there may be multiple
    

s/beacause/because/

—
Reply to this email directly or view it on GitHub
https://github.com/docker/docker/pull/11999/files#r27616218.

@thaJeztah

Copy link
Copy Markdown
Member

Thanks so much, @vbatts for picking this up. Hope the maintainers can agree on this approach.

Only thing I think might be needed, is some basic instructions/pointers to the user how to solve the issue, but perhaps this can be added after is clear if this direction can be agreed upon.

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 75aec33 to 5b901d5 Compare April 2, 2015 13:46
@vbatts

vbatts commented Apr 2, 2015

Copy link
Copy Markdown
Contributor Author
## start from a clean slate
vbatts@noyee ~ (master) $ sudo rm -rf /home/docker/
## initialize a devicemapper driver
vbatts@noyee ~ (master) $ sudo /home/vbatts/src/docker/docker/bundles/1.5.0-dev/dynbinary/docker-1.5.0-dev -d -g /home/docker -p /home/docker.pid -H unix:///home/docker.sock -s devicemapper
INFO[0000] +job serveapi(unix:///home/docker.sock)      
INFO[0000] Listening for HTTP on unix (/home/docker.sock) 
INFO[0000] [graphdriver] trying provided driver "devicemapper" 
INFO[0002] +job init_networkdriver()                    
INFO[0002] -job init_networkdriver() OK                 
INFO[0003] Loading containers: start.                   

INFO[0003] Loading containers: done.                    
INFO[0003] docker daemon: 1.5.0-dev 75aec33; execdriver: native-0.2; graphdriver: devicemapper 
INFO[0003] +job acceptconnections()                     
INFO[0003] -job acceptconnections() OK                  
INFO[0003] Daemon has completed initialization          
^CINFO[0006] Received signal 'interrupt', starting shutdown of docker... 
INFO[0006] -job serveapi(unix:///home/docker.sock) OK
## make another driver directory that won't work on fedora
vbatts@noyee ~ (master) $ sudo mkdir /home/docker/aufs
## start the daemon again. Since AUFS is higher priority, won't work here, but appears to be a prior driver, it should fail the whole daemon
vbatts@noyee ~ (master) $ sudo /home/vbatts/src/docker/docker/bundles/1.5.0-dev/dynbinary/docker-1.5.0-dev -d -g /home/docker -p /home/docker.pid -H unix:///home/docker.sock 
ERRO[0000] [graphdriver] prior storage driver "aufs" failed: driver not supported 
INFO[0000] +job serveapi(unix:///home/docker.sock)      
INFO[0000] Listening for HTTP on unix (/home/docker.sock) 
FATA[0000] Shutting down daemon due to errors: error intializing graphdriver: driver not supported
## and it does


## now restart but _specifying_ overlay. it should work
vbatts@noyee ~ (master) $ sudo /home/vbatts/src/docker/docker/bundles/1.5.0-dev/dynbinary/docker-1.5.0-dev -d -g /home/docker -p /home/docker.pid -H unix:///home/docker.sock -s overlay
INFO[0000] [graphdriver] trying provided driver "overlay" 
INFO[0000] +job init_networkdriver()                    
INFO[0000] +job serveapi(unix:///home/docker.sock)      
INFO[0000] Listening for HTTP on unix (/home/docker.sock) 
INFO[0000] -job init_networkdriver() OK                 
INFO[0000] Loading containers: start.                   

INFO[0000] Loading containers: done.                    
INFO[0000] docker daemon: 1.5.0-dev 75aec33; execdriver: native-0.2; graphdriver: overlay 
INFO[0000] +job acceptconnections()                     
INFO[0000] -job acceptconnections() OK                  
INFO[0000] Daemon has completed initialization          
^CINFO[0002] Received signal 'interrupt', starting shutdown of docker... 
INFO[0002] -job serveapi(unix:///home/docker.sock) OK   
## works fine. now run again, but with no specificication. And since one of the scanned prior devices is present _and_ supported, it should work _and_ log that there were others found
vbatts@noyee ~ (master) $ sudo /home/vbatts/src/docker/docker/bundles/1.5.0-dev/dynbinary/docker-1.5.0-dev -d -g /home/docker -p /home/docker.pid -H unix:///home/docker.sock 
INFO[0000] [graphdriver] using prior storage driver "overlay" 
WARN[0000] Graphdriver overlay selected. Your graphdriver directory /home/docker already contains data managed by other graphdrivers: aufs,devicemapper 
INFO[0000] +job init_networkdriver()                    
INFO[0000] +job serveapi(unix:///home/docker.sock)      
INFO[0000] Listening for HTTP on unix (/home/docker.sock) 
INFO[0000] -job init_networkdriver() OK                 
INFO[0000] Loading containers: start.                   

INFO[0000] Loading containers: done.                    
INFO[0000] docker daemon: 1.5.0-dev 75aec33; execdriver: native-0.2; graphdriver: overlay 
INFO[0000] +job acceptconnections()                     
INFO[0000] -job acceptconnections() OK                  
INFO[0000] Daemon has completed initialization
## Which it does.

## :-)

@vbatts

vbatts commented Apr 2, 2015

Copy link
Copy Markdown
Contributor Author

@jfrazelle @crosbymichael @unclejack @tiborvass there's been discussion here and it's ready for your review. LMKWYT

@jessfraz

jessfraz commented Apr 3, 2015

Copy link
Copy Markdown
Contributor

LGTM

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 don't understand the point in keeping this, am i missing something, its just iterating the range again

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.

for the sake of a print out. At this point you would get an output of the chosen driver, then if there were more than 1 prior drivers (not including vfs) then you'll see output that there is additional state present.

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.

@jfrazelle like the WARN from the last section of #11999 (comment)

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 assume this is related to the comment to the right: it's being used to print out the (existing) log message that roughly says "hey, we're using driver XYZ, but you have data managed by {list of prior drivers}". Given you already know if "len(priorDrivers) > 0" you could add the message directly here, but given the list is short (and I assume it has little room to grow by any large measure), it isn't much of a hit to scan the list again.

I think the function might just be more clearly renamed as "logPriorDrivers()"?

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.

fair. and since we're now acting on the prior drivers, the call to checkPriorDriver() in the subsequent loops will not even be needed. This output would only ever be needed at this very spot. I'll fix that.

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 5b901d5 to 50616a5 Compare April 6, 2015 14:12
@vbatts

vbatts commented Apr 6, 2015

Copy link
Copy Markdown
Contributor Author

rebased on master, for good measure

@estesp

estesp commented Apr 6, 2015

Copy link
Copy Markdown
Contributor

I think you found the wrath of docker-py in the latest janky run, but other than that need for re-run, I like this. Especially if we want more use of overlay, I don't see how we get that until it becomes a default for new uses, and this allows that and keeps from frustrating upgraders from aufs.

@vbatts

vbatts commented Apr 6, 2015

Copy link
Copy Markdown
Contributor Author

@estesp yep. That's the plan.

@tianon

tianon commented Apr 6, 2015

Copy link
Copy Markdown
Member

IMO,

WARN[0000] Graphdriver overlay selected. Your graphdriver directory /home/docker already contains data managed by other graphdrivers: aufs,devicemapper 

should be fatal. If there's any ambiguity, then just guessing isn't going to help the user out very much, and will instead just hide the problem and they'll never know. I'm fully +1 to forcing the user to disambiguate manually via -s or nuking their data directory to go back to automatic behavior.

@vbatts

vbatts commented Apr 6, 2015

Copy link
Copy Markdown
Contributor Author

@crosbymichael @jfrazelle @tiborvass @unclejack ^^ thoughts?

@jessfraz

jessfraz commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

im with @tianon no sense in guessing

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 50616a5 to 5ade252 Compare April 7, 2015 21:04
@vbatts

vbatts commented Apr 7, 2015

Copy link
Copy Markdown
Contributor Author

alrighty. Updated PTAL @jfrazelle @tianon
Here's the output that users would see in a "guess" scenario with multiple drivers present http://pastebin.com/qr9GgsVe

@thaJeztah

Copy link
Copy Markdown
Member

Nice! That literal error should probably be added to the docs somewhere so that people can Goooogle it. (guess #11999 (comment) would be too verbose for a daemon error)

Comment thread daemon/graphdriver/driver.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd get rid of what driver is selected and just say why it's bailing out.
Also should include something like you must explicitly set a storage driver

@vbatts

vbatts commented Apr 8, 2015

Copy link
Copy Markdown
Contributor Author

@thaJeztah I'll truncate that down as much as possible. I don't much care for newlines in the log lines.
Also, perhaps the docs reference is interesting, but if this is clear enough, it may not be required.

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 5ade252 to 2819972 Compare April 8, 2015 14:04
@crosbymichael

Copy link
Copy Markdown
Contributor

LGTM

anyone else want to review before merge?

@jessfraz

Copy link
Copy Markdown
Contributor

LGTM

@LK4D4

LK4D4 commented Apr 13, 2015

Copy link
Copy Markdown
Contributor

#12327
#12080
Regressions in overlay, first is pretty nasty.

@vbatts

vbatts commented Apr 13, 2015

Copy link
Copy Markdown
Contributor Author

ick. Should i split the overlay promotion into its own PR, since the
driver-guess logic does not affect that and is itself ready for merge?
On Apr 13, 2015 6:18 PM, "Alexander Morozov" [email protected]
wrote:

#12327 #12327
#12080 #12080
Regressions in overlay, first is pretty nasty.

—
Reply to this email directly or view it on GitHub
#11999 (comment).

@thaJeztah

Copy link
Copy Markdown
Member

ick. Should i split the overlay promotion into its own PR

sgtm (but not my say :))

@jessfraz

Copy link
Copy Markdown
Contributor

sgtm, and idk if regressions necessarily because they fail on 1.5.0 too

On Mon, Apr 13, 2015 at 3:54 PM, Sebastiaan van Stijn <
[email protected]> wrote:

ick. Should i split the overlay promotion into its own PR

sgtm (but not my say :))

—
Reply to this email directly or view it on GitHub
#11999 (comment).

@jessfraz

Copy link
Copy Markdown
Contributor

but we should definitely fix before promoting to no.1

On Mon, Apr 13, 2015 at 3:55 PM, Jessica Frazelle [email protected] wrote:

sgtm, and idk if regressions necessarily because they fail on 1.5.0 too

On Mon, Apr 13, 2015 at 3:54 PM, Sebastiaan van Stijn <
[email protected]> wrote:

ick. Should i split the overlay promotion into its own PR

sgtm (but not my say :))

—
Reply to this email directly or view it on GitHub
#11999 (comment).

@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 2819972 to 4c29682 Compare April 14, 2015 01:27
@vbatts vbatts changed the title graphdriver: prefer prior driver state and promote overlay to first place graphdriver: prefer prior driver state Apr 14, 2015
@vbatts
vbatts force-pushed the vbatts-decide_storage branch from 4c29682 to deec690 Compare April 14, 2015 01:32
Before this, a storage driver would be defaulted to based on the
priority list, and only print a warning if there is state from other
drivers.

This meant a reordering of priority list would "break" users in an
upgrade of docker, such that there images in the prior driver's state
were now invisible.

With this change, prior state is scanned, and if present that driver is
preferred.

As such, we can reorder the priority list, and after an upgrade,
existing installs with prior drivers can have a contiguous experience,
while fresh installs may default to a driver in the new priority list.

Ref: moby#11962 (comment)

Signed-off-by: Vincent Batts <[email protected]>
@vbatts
vbatts force-pushed the vbatts-decide_storage branch from deec690 to b68e161 Compare April 14, 2015 01:38
@vbatts

vbatts commented Apr 14, 2015

Copy link
Copy Markdown
Contributor Author

updated to only be the prior-driver priority selection.

overlay promotion is now #12354

PTAL

@thaJeztah

Copy link
Copy Markdown
Member

Don't see any downsides, so LGTM :)

@jessfraz

Copy link
Copy Markdown
Contributor

LGTM

jessfraz pushed a commit that referenced this pull request Apr 14, 2015
graphdriver: prefer prior driver state
@jessfraz
jessfraz merged commit 74f4a88 into moby:master Apr 14, 2015
@thaJeztah

Copy link
Copy Markdown
Member

@jfrazelle I think this didn't make it in 1.6?

@jessfraz

Copy link
Copy Markdown
Contributor

ya it didnt need to

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.

10 participants