Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Uniter solver #3072
Merged
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
f3fda60
worker/uniter/remotestate: add package
axw 0e0e3a9
worker/uniter: add solverWorker
axw 92c30d4
Add top-level solver
axw 5789767
Add top-level, leadership Solvers
axw 0548fba
worker/uniter: onIdle without timeout
axw ae237da
Merge branch 'uniter-remote-state' into uniter-solver
axw 1d1c048
Handle ResolvedMode/retry failed hooks
axw 79a5a71
worker/uniter/remotestate: watch relation units
axw f96407f
remotestate: mockable State interfaces
axw e25a117
worker/uniter/remotestate: add tests
axw c1560de
uniter: removing metrics timers
mattyw 9af53ae
uniter: Removed UpdateStatusSignal and test
mattyw d83df26
Add more support for storage hooks and general cleanup
wallyworld 43880ca
Merge pull request #29 from mattyw/uniter-solver-unit-tests
wallyworld cb1faa7
Remove old code
wallyworld 38bfaef
worker/uniter: add relations solver
axw f51981d
Tidy up
wallyworld 29b0cf5
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw 97b1e53
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld 9cccb4c
Removed op_plumbing.go
alesstimec 10bcbc2
worker/uniter: move relation solver, rm dead code
axw 7cf90a0
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw af7c88a
Fix storage event processing
wallyworld 338d837
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld f6907e8
Merge pull request #30 from alesstimec/remove-op-plumbing
wallyworld 7c92b63
Fire leader settings changed event when needed
wallyworld 58532d4
uniter/upgrade: Added steps for setting installed
mattyw 9c73e23
Various storage, leadership, install hook fixes
axw ee5f95c
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw 56fa973
Merge branch 'uniter-solver' into filter-helpers
wallyworld 345c851
Uniter export_test and metrics cleanup.
alesstimec ecba353
Merge pull request #33 from alesstimec/remove-manual-ticker
wallyworld fa9a347
Remove unneeded variable
wallyworld 1b8bd07
Merge branch 'uniter-solver' into filter-helpers
wallyworld 6c6cf22
Merge pull request #31 from mattyw/install-bool-upgrade-step
wallyworld 6075116
Disable tests
wallyworld aca5235
Merge pull request #32 from wallyworld/filter-helpers
wallyworld 75aafd0
uniter: Added an observer to UnitParams to replace the setting in exp…
mattyw b516566
Merge pull request #34 from mattyw/fix-all-problems
wallyworld a84f50a
Remove filter and mode code
wallyworld eb7ac70
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld 391a85f
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld 2a9af97
go fmt
wallyworld 86ebc7e
Merge maltese-falcon branch
wallyworld eb3863b
Move leadership watching to remotestate
axw 169850a
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw 3667fbb
Hook up uniter execution observer
axw 0412dfd
worker/uniter/remotestate: test leadership.Tracker
axw ebba444
Fix unit test
wallyworld 404dcd2
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld 6c515ad
Fix tests
wallyworld ed99194
Rename solver to resolver and fix tests
wallyworld d3a9658
worker/uniter/remotestate: update storage watcher
axw 782887c
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw b494495
Initial conflict handling
wallyworld 033b80f
Merge branch 'uniter-solver' of https://github.com/wallyworld/juju in…
wallyworld 4caea76
Add reboot error handling
wallyworld 5cfb5df
Skip failing tests
wallyworld ae5db93
worker/uniter: upgrade charm WIP
axw 81611e8
Merge branch 'uniter-solver' of github.com:wallyworld/juju into unite…
axw 96888ac
Skip more tests
wallyworld a8b077e
worker/uniter: destroy subordinates on dying
axw ac0821a
Skip tests TBD.
cmars c8357a0
Merge branch 'uniter-solver' into cmars-026-uniter-solver
cmars
Jump to file or symbol
Failed to load files and symbols.
| @@ -0,0 +1,28 @@ | ||
| +// Copyright 2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package upgrades | ||
| + | ||
| +import ( | ||
| + "github.com/juju/juju/worker/uniter" | ||
| + "github.com/juju/names" | ||
| +) | ||
| + | ||
| +// stepsFor126 returns upgrade steps for Juju 1.26. | ||
| +func stepsFor126() []Step { | ||
| + return []Step{ | ||
| + &upgradeStep{ | ||
| + description: "installed boolean needs to be set in the uniter local state", | ||
| + targets: []Target{AllMachines}, | ||
| + run: func(context Context) error { | ||
| + config := context.AgentConfig() | ||
| + tag, ok := config.Tag().(names.UnitTag) | ||
| + if !ok { | ||
| + // not a Unit; skipping | ||
| + return nil | ||
| + } | ||
| + return uniter.AddInstalledToUniterState(tag, config.DataDir()) | ||
| + }, | ||
| + }, | ||
| + } | ||
| +} |
| @@ -0,0 +1,24 @@ | ||
| +// Copyright 2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package upgrades_test | ||
| + | ||
| +import ( | ||
| + gc "gopkg.in/check.v1" | ||
| + | ||
| + "github.com/juju/juju/testing" | ||
| + "github.com/juju/juju/version" | ||
| +) | ||
| + | ||
| +type steps126Suite struct { | ||
| + testing.BaseSuite | ||
| +} | ||
| + | ||
| +var _ = gc.Suite(&steps126Suite{}) | ||
| + | ||
| +func (s *steps126Suite) TestStepsFor126(c *gc.C) { | ||
| + expected := []string{ | ||
| + "installed boolean needs to be set in the uniter local state", | ||
| + } | ||
| + assertSteps(c, version.MustParse("1.26.0"), expected) | ||
| +} |
| @@ -0,0 +1,34 @@ | ||
| +// Copyright 2012-2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package uniter | ||
| + | ||
| +import ( | ||
| + "github.com/juju/juju/apiserver/params" | ||
| +) | ||
| + | ||
| +// setAgentStatus sets the unit's status if it has changed since last time this method was called. | ||
| +func setAgentStatus(u *Uniter, status params.Status, info string, data map[string]interface{}) error { | ||
| + u.setStatusMutex.Lock() | ||
| + defer u.setStatusMutex.Unlock() | ||
| + if u.lastReportedStatus == status && u.lastReportedMessage == info { | ||
| + return nil | ||
| + } | ||
| + u.lastReportedStatus = status | ||
| + u.lastReportedMessage = info | ||
| + logger.Debugf("[AGENT-STATUS] %s: %s", status, info) | ||
| + return u.unit.SetAgentStatus(status, info, data) | ||
| +} | ||
| + | ||
| +// reportAgentError reports if there was an error performing an agent operation. | ||
| +func reportAgentError(u *Uniter, userMessage string, err error) { | ||
| + // If a non-nil error is reported (e.g. due to an operation failing), | ||
| + // set the agent status to Failed. | ||
| + if err == nil { | ||
| + return | ||
| + } | ||
| + err2 := setAgentStatus(u, params.StatusFailed, userMessage, nil) | ||
| + if err2 != nil { | ||
| + logger.Errorf("updating agent status: %v", err2) | ||
| + } | ||
| +} |
| @@ -1,64 +0,0 @@ | ||
| -// Copyright 2013, 2014 Canonical Ltd. | ||
| -// Licensed under the AGPLv3, see LICENCE file for details. | ||
| - | ||
| -package uniter | ||
| - | ||
| -import ( | ||
| - "fmt" | ||
| - "time" | ||
| - | ||
| - "github.com/juju/juju/testing" | ||
| -) | ||
| - | ||
| -func SetUniterObserver(u *Uniter, observer UniterExecutionObserver) { | ||
| - u.observer = observer | ||
| -} | ||
| - | ||
| -var ( | ||
| - ActiveCollectMetricsTimer = &activeCollectMetricsTimer | ||
| - ActiveSendMetricsTimer = &activeSendMetricsTimer | ||
| - IdleWaitTime = &idleWaitTime | ||
| - LeadershipGuarantee = &leadershipGuarantee | ||
| -) | ||
| - | ||
| -// manualTicker will be used to generate collect-metrics events | ||
| -// in a time-independent manner for testing. | ||
| -type ManualTicker struct { | ||
| - c chan time.Time | ||
| -} | ||
| - | ||
| -// Tick sends a signal on the ticker channel. | ||
| -func (t *ManualTicker) Tick() error { | ||
| - select { | ||
| - case t.c <- time.Now(): | ||
| - case <-time.After(testing.LongWait): | ||
| - return fmt.Errorf("ticker channel blocked") | ||
| - } | ||
| - return nil | ||
| -} | ||
| - | ||
| -// ReturnTimer can be used to replace the metrics signal generator. | ||
| -func (t *ManualTicker) ReturnTimer(now, lastRun time.Time, interval time.Duration) <-chan time.Time { | ||
| - return t.c | ||
| -} | ||
| - | ||
| -func NewManualTicker() *ManualTicker { | ||
| - return &ManualTicker{ | ||
| - c: make(chan time.Time), | ||
| - } | ||
| -} | ||
| - | ||
| -func NewTestingMetricsTimerChooser(collector TimedSignal) *timerChooser { | ||
| - return &timerChooser{ | ||
| - collector: collector, | ||
| - inactive: inactiveMetricsTimer, | ||
| - } | ||
| -} | ||
| - | ||
| -func UpdateStatusSignal(now, lastSignal time.Time, interval time.Duration) <-chan time.Time { | ||
| - return updateStatusSignal(now, lastSignal, interval) | ||
| -} | ||
| - | ||
| -func ActiveCollectMetricsSignal(now, lastSignal time.Time, interval time.Duration) <-chan time.Time { | ||
| - return activeCollectMetricsTimer(now, lastSignal, interval) | ||
| -} |
| @@ -1,10 +0,0 @@ | ||
| -// Copyright 2015 Canonical Ltd. | ||
| -// Licensed under the AGPLv3, see LICENCE file for details. | ||
| - | ||
| -package filter | ||
| - | ||
| -func DummyFilter() Filter { | ||
| - // This should, obviously, not be used except for type tests that don't | ||
| - // try to do anything with it (eg TestOutput*). | ||
| - return &filter{} | ||
| -} |
Oops, something went wrong.