~rogpeppe/juju-core/azure

« back to all changes in this revision

Viewing changes to juju/conn.go

[r=wallyworld] New assignment policy is AssignCleanEmpty

Add container support to AssignClean(Empty) policies and make
the default policy AssignCleanEmpty. This allows manual deployment
of charms into existing clean and empty containers/instances, with
the fallback that a new container/instance is created if none are
available. The system behaves the same as previously if a simple
bootstrap and deploy is performed, but if add-machine is used to
create some containers/instances, then those are no longer ignored.

https://codereview.appspot.com/11019044/

Show diffs side-by-side

added added

removed removed

Lines of Context:
304
304
// to them as necessary.
305
305
func (conn *Conn) AddUnits(svc *state.Service, n int, mid string) ([]*state.Unit, error) {
306
306
        units := make([]*state.Unit, n)
307
 
        // Hard code for now till we implement a constraints based approach.
308
 
        // We currently only support AssignNew.
309
 
        policy := state.AssignNew
 
307
        // Hard code for now till we implement a different approach.
 
308
        policy := state.AssignCleanEmpty
310
309
        // TODO what do we do if we fail half-way through this process?
311
310
        for i := 0; i < n; i++ {
312
311
                unit, err := svc.AddUnit()