Put application constraints on container addMachine changes #29

Merged
merged 4 commits into from Dec 15, 2016

Conversation

Projects
None yet
4 participants
Contributor

voidspace commented Dec 15, 2016

Fixes bug #1626597 in Juju. Application constraints are added to the add machine changes for containers.

There was an existing test asserting that this was not done as that was the previous specification. This is a specification change, so I have changed the existing test rather than needing to add a new one.

Member

jujugui commented Dec 15, 2016

Refer to this link for build results (access rights to CI server needed):
http://ci-cge.jujugui.org:8080//job/bundlechanges/97/

Owner

jameinel commented Dec 15, 2016

LGTM. passing through the application so that the constraints gets passed through seems good, but I'll happily defer to an expert.

This looks good, thanks for fixing that bug! So I guess the bug was not considering that the machine is created before the unit is added in the case the location is explicit, which means application defined constraints must be propagated.

@@ -390,12 +390,14 @@ var fromDataTests = []struct {
ContainerType: "lxc",
Series: "trusty",
ParentId: "$addMachines-6",
+ Constraints: "cpu-cores=4 cpu-power=42",
@frankban

frankban Dec 15, 2016

Member

We could a test for when constraints are specified on the application and the unit is located to "new".

@voidspace

voidspace Dec 15, 2016

Contributor

Done

handlers.go
@@ -181,7 +181,7 @@ func handleUnits(add func(Change), services map[string]*charm.ApplicationSpec, a
}
// Generate the changes required in order to place this unit, and
// retrieve the identifier of the parent change.
- parentId := unitParent(add, p, records, addedMachines, servicePlacedUnits, getSeries(application, defaultSeries))
+ parentId := unitParent(add, p, records, addedMachines, servicePlacedUnits, getSeries(application, defaultSeries), application)
@frankban

frankban Dec 15, 2016

Member

Here, and in all subsequent calls, we could just pass application.Constraints directly rather than the whole spec. [shrug]

@voidspace

voidspace Dec 15, 2016

Contributor

Done

Member

jujugui commented Dec 15, 2016

Refer to this link for build results (access rights to CI server needed):
http://ci-cge.jujugui.org:8080//job/bundlechanges/98/

Contributor

voidspace commented Dec 15, 2016

$$merge$$

Contributor

voidspace commented Dec 15, 2016

:shipit:

Member

jujugui commented Dec 15, 2016

Status: merge request accepted. Url: http://ci-gce.jujugui.org:8080/job/bundlechanges-merge

@jujugui jujugui merged commit 7725027 into juju:master Dec 15, 2016

1 check passed

default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment