Juju ignores constraints set in the bundle and deploys KVMs with default values

Bug #1626597 reported by Ante Karamatić
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Michael Foord

Bug Description

I have a bundle that, among other things, deploys KVM instance:

    physical-machine:
        series: trusty
        charm: cs:trusty/ubuntu
        num_units: 1
    kvm-machine:
        series: trusty
        charm: cs:trusty/ubuntu
        constraints: "cpu-cores=12 mem=64G root-disk=15G"
        num_units: 1
        to:
            - kvm:physical-machine/0

My KVM machine ends up with 512MB of RAM and 1 CPU core. Expectation was that KVM will be created with 12 cores, 64GB of RAM and 15GB disk.

It looks like constraints are ignored in the bundle if placement is defined.

This is all with MAAS provider and with juju2 b15.

Tags: 4010
Ante Karamatić (ivoks)
description: updated
Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.0.1
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.0.1 → none
Changed in juju:
milestone: none → 2.1.0
assignee: nobody → Richard Harding (rharding)
Revision history for this message
Michael Foord (mfoord) wrote :

Also applies to LXD containers.

Changed in juju:
assignee: Richard Harding (rharding) → Michael Foord (mfoord)
Revision history for this message
Michael Foord (mfoord) wrote :

Note that placement at the command line works fine: juju deploy ubuntu --constraints="mem=4G" --to kvm:0

Placement does not work with constraints with bundles. The example given in this bug report is not quite correct as you can only specify machines with digits as names. Containers are not created as machine definitions. What should work is a constraint at the application level with a placement directive. For example:

series: trusty
applications:
  "ubuntu-kvm":
    charm: "cs:ubuntu-8"
    num_units: 1
    constraints: "mem=4"
    to:
      - "kvm:ubuntu-root/0"
  "ubuntu-root":
    charm: "cs:ubuntu-8"
    num_units: 1
    to:
      - "0"
relations: []
machines:
  "0":
    series: xenial
    constraints: "mem=8"

This doesn't work and I believe it is because the bundlechanges package is ignoring the constraints where there is placement. These constraints do not reach the provisioner.

The bundlechanges entry point is the FromData function, this takes data from charm.ReadBundleData - charm package documents the restriction that constraints are ignored with placement but does return both. So if we fix this in the bundledata package we'd want to also update the comment/documentation in the charm package.

Revision history for this message
Michael Foord (mfoord) wrote :

I have manually verified that this change in bundlechanges fixes the issue for juju and that application constraints in bundles are honoured for KVM placement:

    https://github.com/juju/bundlechanges/pull/29

There are a couple of other *known issues* stopping this for working with lxd, we will address those separately.

Revision history for this message
Michael Foord (mfoord) wrote :

Landed in bundlechanges, PR for juju 2.1:

https://github.com/juju/juju/pull/6723

Michael Foord (mfoord)
Changed in juju:
status: Triaged → Fix Committed
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.1.0 → 2.1-beta3
Curtis Hovey (sinzui)
Changed in juju:
status: Fix Committed → Fix Released
Revision history for this message
Ante Karamatić (ivoks) wrote : Re: [Bug 1626597] Re: Juju ignores constraints set in the bundle and deploys KVMs with default values

I've tested 2.2-alpha1~20170111~4707~ad41e0ea-20170111+4707+ad41e0ea~16.04
and I can confirm this works fine now.

On Fri, Dec 16, 2016 at 1:07 AM Curtis Hovey <email address hidden> wrote:

> ** Changed in: juju
> Milestone: 2.1.0 => 2.1-beta3
>
> ** Changed in: juju
> Status: Fix Committed => Fix Released
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1626597
>
> Title:
> Juju ignores constraints set in the bundle and deploys KVMs with
> default values
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1626597/+subscriptions
>
--
Ante Karamatić
<email address hidden>
Canonical

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.