Skip to content

Commit

Permalink
Merge pull request #70 from ExternalReality/bug#1709995
Browse files Browse the repository at this point in the history
Add  as a potential placement directive constraint.
  • Loading branch information
jujubot authored Nov 2, 2017
2 parents 38cd919 + 259eb79 commit 91b8ec5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ func (a *InterfaceSpec) String() string {
// AllocateMachineArgs is an argument struct for passing args into Machine.Allocate.
type AllocateMachineArgs struct {
Hostname string
SystemId string
Architecture string
MinCPUCount int
// MinMemory represented in MB.
Expand Down Expand Up @@ -525,6 +526,7 @@ func (c *controller) AllocateMachine(args AllocateMachineArgs) (Machine, Constra
var matches ConstraintMatches
params := NewURLParams()
params.MaybeAdd("name", args.Hostname)
params.MaybeAdd("system_id", args.SystemId)
params.MaybeAdd("arch", args.Architecture)
params.MaybeAddInt("cpu_count", args.MinCPUCount)
params.MaybeAddInt("mem", args.MinMemory)
Expand Down
3 changes: 2 additions & 1 deletion controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ func (s *controllerSuite) TestAllocateMachineArgsForm(c *gc.C) {
// Create an arg structure that sets all the values.
args := AllocateMachineArgs{
Hostname: "foobar",
SystemId: "some_id",
Architecture: "amd64",
MinCPUCount: 42,
MinMemory: 20000,
Expand All @@ -683,7 +684,7 @@ func (s *controllerSuite) TestAllocateMachineArgsForm(c *gc.C) {
request := s.server.LastRequest()
// There should be one entry in the form values for each of the args.
form := request.PostForm
c.Assert(form, gc.HasLen, 14)
c.Assert(form, gc.HasLen, 15)
// Positive space check.
c.Assert(form.Get("interfaces"), gc.Equals, "default:space=magic")
// Negative space check.
Expand Down

0 comments on commit 91b8ec5

Please sign in to comment.