Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(403)

Issue 13380043: upgrader: add Upgrader.DesiredVersion

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by jameinel
Modified:
10 years, 8 months ago
Reviewers:
mp+182857, rog
Visibility:
Public.

Description

upgrader: add Upgrader.DesiredVersion The initial implementation of the API version of the Upgrader had a single API endpoint Tools() that it used to find both the desired agent version to run, and the URL to download tools matching that version. This was simple, but caused bug #1218256. Specifically, it means that the API Server needs to have provider (eg ec2) credentials in order to answer the Tools request. (So it can search the storage and see what the URL for downloading the tools is.) As such after bootstrap (before the first connect), the Upgrader would keep bouncing as it got an error trying to determine what agent version it should run as. This adds one more api: Upgrader.DesiredVersion(). This only returns the agent version string. Which can be served directly from the DB after bootstrap, without having to look at the provider at all. And even beyond the first bootstrap, the current implementation of WatchAPIVersion is very naive and will trigger a probe on any change to EnvironConfig. At present that means it also triggers a listing of all Storage buckets to find the tools that will match for that agent. With the new implementation, it only provokes a DesiredVersion() call which is relatively small and doesn't talk to a 3rd party data source. This isn't strictly backwards compatible. If we upgrade a machine-1 agent before upgrading the machine-0 agent, machine-1 will keep bouncing until machine-0 has finished upgrading and has the new API available. That was already true of upgrading from 1.12 to 1.13.x, so we haven't made the upgrade-to-1.14 story any worse. (Agents will still notice they have to upgrade, and start trying to upgrade, they will just keep bouncing after the upgrade until machine-0 finishes its upgrade.) We *could* do something where if DesiredVersion can't be called, we fall back to Tools and if that fails we fall back to direct DB access. But I don't think it is worth spending the time on that code path right now. https://code.launchpad.net/~jameinel/juju-core/upgrader-split-api-1218256/+merge/182857 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 16

Patch Set 2 : upgrader: add Upgrader.DesiredVersion #

Patch Set 3 : upgrader: add Upgrader.DesiredVersion #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+152 lines, -11 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/internal.go View 2 chunks +13 lines, -0 lines 0 comments Download
M state/api/upgrader/upgrader.go View 1 2 chunks +26 lines, -0 lines 0 comments Download
M state/api/upgrader/upgrader_test.go View 1 1 chunk +12 lines, -0 lines 0 comments Download
M state/apiserver/upgrader/upgrader.go View 1 2 2 chunks +37 lines, -7 lines 1 comment Download
M state/apiserver/upgrader/upgrader_test.go View 1 1 chunk +52 lines, -0 lines 0 comments Download
M worker/upgrader/upgrader.go View 1 1 chunk +10 lines, -4 lines 0 comments Download

Messages

Total messages: 8
jameinel
Please take a look.
10 years, 8 months ago (2013-08-29 10:22:42 UTC) #1
jameinel
I should add: I was not able to think of a way to properly test ...
10 years, 8 months ago (2013-08-29 10:28:59 UTC) #2
rog
This is generally really nice, but I have a few thoughts below. https://codereview.appspot.com/13380043/diff/1/state/api/upgrader/upgrader.go File state/api/upgrader/upgrader.go ...
10 years, 8 months ago (2013-08-29 10:49:30 UTC) #3
rog
This is generally really nice, but I have a few thoughts below. https://codereview.appspot.com/13380043/diff/1/state/api/upgrader/upgrader.go File state/api/upgrader/upgrader.go ...
10 years, 8 months ago (2013-08-29 10:49:31 UTC) #4
jameinel
Please take a look. https://codereview.appspot.com/13380043/diff/1/state/api/upgrader/upgrader.go File state/api/upgrader/upgrader.go (right): https://codereview.appspot.com/13380043/diff/1/state/api/upgrader/upgrader.go#newcode47 state/api/upgrader/upgrader.go:47: func (st *State) DesiredVersion(tag string) ...
10 years, 8 months ago (2013-08-29 11:50:05 UTC) #5
rog
LGTM modulo the below suggestion. https://codereview.appspot.com/13380043/diff/1/state/apiserver/upgrader/upgrader.go File state/apiserver/upgrader/upgrader.go (right): https://codereview.appspot.com/13380043/diff/1/state/apiserver/upgrader/upgrader.go#newcode98 state/apiserver/upgrader/upgrader.go:98: // For now, all ...
10 years, 8 months ago (2013-08-29 12:18:01 UTC) #6
jameinel
Please take a look. https://codereview.appspot.com/13380043/diff/1/state/apiserver/upgrader/upgrader.go File state/apiserver/upgrader/upgrader.go (right): https://codereview.appspot.com/13380043/diff/1/state/apiserver/upgrader/upgrader.go#newcode98 state/apiserver/upgrader/upgrader.go:98: // For now, all agents ...
10 years, 8 months ago (2013-08-29 12:31:45 UTC) #7
rog
10 years, 8 months ago (2013-08-29 14:48:50 UTC) #8
LGTM

https://codereview.appspot.com/13380043/diff/13001/state/apiserver/upgrader/u...
File state/apiserver/upgrader/upgrader.go (right):

https://codereview.appspot.com/13380043/diff/13001/state/apiserver/upgrader/u...
state/apiserver/upgrader/upgrader.go:93: func (u *UpgraderAPI)
getGlobalAgentVersion() (version.Number, *config.Config, error) {
Thanks for doing this - even though the values needed are slightly different
in both cases, I think it looks nicer with it factored out.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b