Merge lp:~fwereade/juju-core/force-dead-machine-for-1.16 into lp:juju-core/1.16
Proposed by
William Reade
Status: | Merged |
---|---|
Approved by: | William Reade |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1999 |
Proposed branch: | lp:~fwereade/juju-core/force-dead-machine-for-1.16 |
Merge into: | lp:juju-core/1.16 |
Diff against target: |
133 lines (+33/-19) 4 files modified
cmd/juju/destroymachine_test.go (+4/-2) state/apiserver/client/client_test.go (+2/-2) state/cleanup.go (+15/-5) state/cleanup_test.go (+12/-10) |
To merge this branch: | bzr merge lp:~fwereade/juju-core/force-dead-machine-for-1.16 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+198361@code.launchpad.net |
Commit message
state: don't remove force-destroyed machines
fixes lp:1259473
Description of the change
state: don't remove force-destroyed machines
fixes lp:1259473
To post a comment you must log in.
Reviewers: mp+198361_ code.launchpad. net,
Message:
Please take a look.
Description:
state: don't remove force-destroyed machines
fixes lp:1259473
https:/ /code.launchpad .net/~fwereade/ juju-core/ force-dead- machine- for-1.16/ +merge/ 198361
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/37610044/
Affected files (+35, -19 lines): destroymachine_ test.go /client/ client_ test.go test.go
A [revision details]
M cmd/juju/
M state/apiserver
M state/cleanup.go
M state/cleanup_
Index: [revision details] 20131209105211- 4qnv0z07ivx7t9i g
=== 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/cleanup.go EnsureDead( ); err != nil { EnsureDead( ) safe-mode.
=== modified file 'state/cleanup.go'
--- state/cleanup.go 2013-11-13 08:59:24 +0000
+++ state/cleanup.go 2013-12-10 09:52:04 +0000
@@ -151,14 +151,15 @@
// again -- which it *probably* will anyway -- the issue can be resolved
by
// force-destroying the machine again; that's better than adding layer
// upon layer of complication here.
- if err := machine.
- return err
- }
- return machine.Remove()
+ return machine.
+
+ // Note that we do *not* remove the machine entirely: we leave it for the
+ // provisioner to clean up, so that we don't end up with an unreferenced
+ // instance that would otherwise be ignored when in provisioner-
}
// cleanupContainers recursively calls cleanupMachine on the supplied rs(machine *Machine) error { Containers( ) IsNotFoundError (err) { ne(containerId) ; err != nil { containerId) IsNotFoundError (err) {
-// machine's containers.
+// machine's containers, and removes them from state entirely.
func (st *State) cleanupContaine
containerIds, err := machine.
if errors.
@@ -170,6 +171,15 @@
if err := st.cleanupMachi
return err
}
+ container, err := st.Machine(
+ if errors.
+ return nil
+ } else if err != nil {
+ return err
+ }
+ if err := container.Remove(); err != nil {
+ return err
+ }
}
return nil
}
Index: state/cleanup_ test.go cleanup_ test.go' test.go 2013-11-13 09:07:28 +0000 test.go 2013-12-10 09:52:04 +0000 sCleanup( c)
=== modified file 'state/
--- state/cleanup_
+++ state/cleanup_
@@ -128,17 +128,17 @@
c.Assert(err, gc.IsNil)
s.assertNeed
- // Clean up, and check that the machine has been removed... nupRuns( c) NotNeedCleanup( c) IsNotFoundError )
+ // Clean up, and check that the unit has been removed...
s.assertClea
s.assertDoes
- err = machine.Refresh()
- c.Assert(err, jc.Satisfies, errors.
-
- // ...and so has the unit...
assertRemoved(c, pr.u0)
- // ...and the unit has departed relation scope. cope(c, pr.ru0)
+ // ...and the unit has departed relation scope...
assertNotInS
+
+ // ...but that the machine remains, and is Dead, ready for removal by the
+ // provisioner.
+ assertLife(c, machine, state.Dead)
}
func (s *CleanupSuite) TestCleanupForc eDestroyedMachi neWithContainer (c sCl...
*gc.C) {
@@ -184,11 +184,9 @@
c.Assert(err, gc.IsNil)
s.assertNeed