Merge lp:~jameinel/juju-core/desiredversion-not-newer-1304340 into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2592 |
Proposed branch: | lp:~jameinel/juju-core/desiredversion-not-newer-1304340 |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
156 lines (+87/-2) 3 files modified
state/apiserver/upgrader/upgrader.go (+28/-1) state/apiserver/upgrader/upgrader_test.go (+56/-0) worker/upgrader/upgrader_test.go (+3/-1) |
To merge this branch: | bzr merge lp:~jameinel/juju-core/desiredversion-not-newer-1304340 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+214743@code.launchpad.net |
Commit message
state/apiserver
This addresses bug #1304340. It gives us a step along the path of having
Manager nodes (API Servers) upgrade themselves before we have all the
other machine agents upgrade (before we have the Unit agents upgrade).
We already had the last two steps. This isn't 100% reliable in HA
circumstances, because we aren't waiting for *all* nodes to be upgraded.
We could potentially change the check so it was just if DesiredVersion
!= CurrentVersion (rather than >= CurrentVersion). It also doesn't probe
the database unless there is an upgrade pending, so DesiredVersion
should still be cheap. This doesn't change FindTools, but it doesn't
seem like it needs to. (All places that call FindTools first call
DesiredVersion, because we broke stuff in the past when we didn't have
API Credentials in time.)
Also, this falls back to returning version.Current rather than returning
the version of the machine/unit/etc had recorded in State. I'm not sure
if that is worth implementing, but when we do the DB lookup to find out
if this entity.IsManager() we could grab its current version.
Description of the change
state/apiserver
This addresses bug #1304340. It gives us a step along the path of having
Manager nodes (API Servers) upgrade themselves before we have all the
other machine agents upgrade (before we have the Unit agents upgrade).
We already had the last two steps. This isn't 100% reliable in HA
circumstances, because we aren't waiting for *all* nodes to be upgraded.
We could potentially change the check so it was just if DesiredVersion
!= CurrentVersion (rather than >= CurrentVersion). It also doesn't probe
the database unless there is an upgrade pending, so DesiredVersion
should still be cheap. This doesn't change FindTools, but it doesn't
seem like it needs to. (All places that call FindTools first call
DesiredVersion, because we broke stuff in the past when we didn't have
API Credentials in time.)
Also, this falls back to returning version.Current rather than returning
the version of the machine/unit/etc had recorded in State. I'm not sure
if that is worth implementing, but when we do the DB lookup to find out
if this entity.IsManager() we could grab its current version.
Reviewers: mp+214743_ code.launchpad. net,
Message:
Please take a look.
Description: /upgrader: Managers upgrade first
state/apiserver
This addresses bug #1304340. It gives us a step along the path of having
Manager nodes (API Servers) upgrade themselves before we have all the
other machine agents upgrade (before we have the Unit agents upgrade).
We already had the last two steps. This isn't 100% reliable in HA
circumstances, because we aren't waiting for *all* nodes to be upgraded.
We could potentially change the check so it was just if DesiredVersion
!= CurrentVersion (rather than >= CurrentVersion). It also doesn't probe
the database unless there is an upgrade pending, so DesiredVersion
should still be cheap. This doesn't change FindTools, but it doesn't
seem like it needs to. (All places that call FindTools first call
DesiredVersion, because we broke stuff in the past when we didn't have
API Credentials in time.)
Also, this falls back to returning version.Current rather than returning
the version of the machine/unit/etc had recorded in State. I'm not sure
if that is worth implementing, but when we do the DB lookup to find out
if this entity.IsManager() we could grab its current version.
https:/ /code.launchpad .net/~jameinel/ juju-core/ desiredversion- not-newer- 1304340/ +merge/ 214743
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/85450043/
Affected files (+86, -1 lines): /upgrader/ upgrader. go /upgrader/ upgrader_ test.go
A [revision details]
M state/apiserver
M state/apiserver
Index: [revision details] 20140408095416- cm5185gdi4wm6d6 n
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: state/apiserver /upgrader/ upgrader. go apiserver/ upgrader/ upgrader. go' /upgrader/ upgrader. go 2014-02-18 00:15:30 +0000 /upgrader/ upgrader. go 2014-04-08 12:50:26 +0000
=== modified file 'state/
--- state/apiserver
+++ state/apiserver
@@ -6,6 +6,8 @@
import (
"errors"
+ "github. com/juju/ loggo" net/juju- core/environs/ config" net/juju- core/state" net/juju- core/state/ api/params" net/juju- core/version"
+
"launchpad.
"launchpad.
"launchpad.
@@ -14,6 +16,8 @@
"launchpad.
)
+var logger = loggo.GetLogger ("juju. state.apiserver .upgrader" ) ion(args params.Entities) (params. NotifyWatchResu lts, error) on(args params.Entities) (params. VersionResults, error)
+
type Upgrader interface {
WatchAPIVers
DesiredVersi
@@ -91,6 +95,22 @@
return agentVersion, cfg, nil
}
+type hasIsManager interface { (tag) (hasIsManager) ; !ok { VersionResults, error) { params. VersionResult, len(args.Entities))
+ IsManager() bool
+}
+
+func (u *UpgraderAPI) entityIsManager(tag string) bool {
+ entity, err := u.st.FindEntity
+ if err != nil {
+ return false
+ }
+ if m, ok := entity.
+ return false
+ } else {
+ return m.IsManager()
+ }
+}
+
// DesiredVersion reports the Agent Version that we want that agent to be
running
func (u *UpgraderAPI) DesiredVersion(args params.Entities)
(params.
results := make([]
@@ -101...