Merge lp:~fwereade/pyjuju/go-environ-placement-policy into lp:pyjuju/go

Proposed by William Reade
Status: Merged
Approved by: Gustavo Niemeyer
Approved revision: 196
Merged at revision: 205
Proposed branch: lp:~fwereade/pyjuju/go-environ-placement-policy
Merge into: lp:pyjuju/go
Prerequisite: lp:~fwereade/pyjuju/go-place-unit
Diff against target: 0 lines
To merge this branch: bzr merge lp:~fwereade/pyjuju/go-environ-placement-policy
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+108303@code.launchpad.net

Description of the change

add AssignmentPolicy to Environ

This is very likely to migrate to a Settings type at some stage, but I don't
think that's justified yet.

https://codereview.appspot.com/6259062/

To post a comment you must log in.
Revision history for this message
William Reade (fwereade) wrote :

Reviewers: mp+108303_code.launchpad.net,

Message:
Please take a look.

Description:
add PlacementPolicy to Environ

This is very likely to migrate to a Settings type at some stage, but I
don't
think that's justified yet.

https://code.launchpad.net/~fwereade/juju/go-environ-placement-policy/+merge/108303

Requires:
https://code.launchpad.net/~fwereade/juju/go-place-unit/+merge/108158

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6259062/

Affected files:
   A [revision details]
   M environs/dummy/environs.go
   M environs/ec2/ec2.go
   M environs/ec2/local_test.go
   M environs/interface.go

Index: [revision details]
=== 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: <email address hidden>
+New revision: <email address hidden>

Index: environs/interface.go
=== modified file 'environs/interface.go'
--- environs/interface.go 2012-05-26 05:51:58 +0000
+++ environs/interface.go 2012-05-31 14:23:53 +0000
@@ -143,4 +143,7 @@
   // yet be visible in the environment, so this method
   // can wait until they are.
   Destroy(insts []Instance) error
+
+ // PlacementPolicy returns the environment's unit placement policy.
+ PlacementPolicy() state.PlacementPolicy
  }

Index: environs/dummy/environs.go
=== modified file 'environs/dummy/environs.go'
--- environs/dummy/environs.go 2012-05-31 07:35:44 +0000
+++ environs/dummy/environs.go 2012-05-31 14:23:53 +0000
@@ -310,6 +310,10 @@
   return nil, errors.New("no state info available for this environ")
  }

+func (e *environ) PlacementPolicy() state.PlacementPolicy {
+ return state.PlaceUnassigned
+}
+
  func (e *environ) SetConfig(cfg environs.EnvironConfig) {
   config := cfg.(*environConfig)
   e.configMutex.Lock()

Index: environs/ec2/ec2.go
=== modified file 'environs/ec2/ec2.go'
--- environs/ec2/ec2.go 2012-05-28 21:18:21 +0000
+++ environs/ec2/ec2.go 2012-05-31 14:23:53 +0000
@@ -231,6 +231,12 @@
   }, nil
  }

+// PlacementPolicy for EC2 is to deploy units only on machines without
other
+// units already assigned.
+func (e *environ) PlacementPolicy() state.PlacementPolicy {
+ return state.PlaceUnassigned
+}
+
  func (e *environ) StartInstance(machineId int, info *state.Info)
(environs.Instance, error) {
   log.Printf("environs/ec2: starting machine %d in %q", machineId, e.name)
   return e.startInstance(machineId, info, false)

Index: environs/ec2/local_test.go
=== modified file 'environs/ec2/local_test.go'
--- environs/ec2/local_test.go 2012-05-28 07:46:06 +0000
+++ environs/ec2/local_test.go 2012-05-31 15:30:20 +0000
@@ -188,6 +188,9 @@
  }

  func (t *localServerSuite) TestBootstrapInstanceUserDataAndState(c *C) {
+ policy := t.env.PlacementPolicy()
+ c.Assert(policy, Equals, state.PlaceUnassigned)
+
   err := t.env.Bootstrap(true)
   c.Assert(err, IsNil)

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :
197. By William Reade

merge parent

198. By William Reade

merge parent

Revision history for this message
William Reade (fwereade) wrote :

*** Submitted:

add AssignmentPolicy to Environ

This is very likely to migrate to a Settings type at some stage, but I
don't
think that's justified yet.

R=niemeyer
CC=
https://codereview.appspot.com/6259062

https://codereview.appspot.com/6259062/

Preview Diff

Empty

Subscribers

People subscribed via source and target branches