OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package environs | 4 package environs |
5 | 5 |
6 import ( | 6 import ( |
7 "launchpad.net/juju-core/constraints" | 7 "launchpad.net/juju-core/constraints" |
8 "launchpad.net/juju-core/environs/cloudinit" | 8 "launchpad.net/juju-core/environs/cloudinit" |
9 "launchpad.net/juju-core/instance" | 9 "launchpad.net/juju-core/instance" |
10 "launchpad.net/juju-core/tools" | 10 "launchpad.net/juju-core/tools" |
11 ) | 11 ) |
12 | 12 |
13 // StartInstanceParams holds parameters for the | 13 // StartInstanceParams holds parameters for the |
14 // InstanceBroker.StartInstace method. | 14 // InstanceBroker.StartInstance method. |
15 type StartInstanceParams struct { | 15 type StartInstanceParams struct { |
16 // Constraints is a set of constraints on | 16 // Constraints is a set of constraints on |
17 // the kind of instance to create. | 17 // the kind of instance to create. |
18 Constraints constraints.Value | 18 Constraints constraints.Value |
19 | 19 |
20 // Tools is a list of tools that may be used | 20 // Tools is a list of tools that may be used |
21 // to start a Juju agent on the machine. | 21 // to start a Juju agent on the machine. |
22 Tools tools.List | 22 Tools tools.List |
23 | 23 |
24 // MachineConfig describes the machine's configuration. | 24 // MachineConfig describes the machine's configuration. |
25 MachineConfig *cloudinit.MachineConfig | 25 MachineConfig *cloudinit.MachineConfig |
| 26 |
| 27 // DistributionGroup, if non-nil, is a function |
| 28 // that returns a slice of instance.Ids that belong |
| 29 // to the same distribution group as the machine |
| 30 // being provisioned. The InstanceBroker may use |
| 31 // this information to distribute instances for |
| 32 // high availability. |
| 33 DistributionGroup func() ([]instance.Id, error) |
26 } | 34 } |
27 | 35 |
28 // TODO(wallyworld) - we want this in the environs/instance package but import l
oops | 36 // TODO(wallyworld) - we want this in the environs/instance package but import l
oops |
29 // stop that from being possible right now. | 37 // stop that from being possible right now. |
30 type InstanceBroker interface { | 38 type InstanceBroker interface { |
31 // StartInstance asks for a new instance to be created, associated with | 39 // StartInstance asks for a new instance to be created, associated with |
32 // the provided config in machineConfig. The given config describes the
juju | 40 // the provided config in machineConfig. The given config describes the
juju |
33 // state for the new instance to connect to. The config MachineNonce, wh
ich must be | 41 // state for the new instance to connect to. The config MachineNonce, wh
ich must be |
34 // unique within an environment, is used by juju to protect against the | 42 // unique within an environment, is used by juju to protect against the |
35 // consequences of multiple instances being started with the same machin
e | 43 // consequences of multiple instances being started with the same machin
e |
36 // id. | 44 // id. |
37 StartInstance(args StartInstanceParams) (instance.Instance, *instance.Ha
rdwareCharacteristics, error) | 45 StartInstance(args StartInstanceParams) (instance.Instance, *instance.Ha
rdwareCharacteristics, error) |
38 | 46 |
39 // StopInstances shuts down the given instances. | 47 // StopInstances shuts down the given instances. |
40 StopInstances([]instance.Instance) error | 48 StopInstances([]instance.Instance) error |
41 | 49 |
42 // AllInstances returns all instances currently known to the broker. | 50 // AllInstances returns all instances currently known to the broker. |
43 AllInstances() ([]instance.Instance, error) | 51 AllInstances() ([]instance.Instance, error) |
44 } | 52 } |
OLD | NEW |