Comment 0 for bug 1609343

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

Steps to reproduce (currently on rev# e2dec28):

1. Multiple VPCs and subnets should exist in some (or all) AZs, so there is a mix of subnets from different VPCs in a given AZ.
2. Bootstrap on AWS with --config vpc-id=vpc-a1b2c3d4 (a non-default VPC ID).
3. Add a model with the same VPC ID (juju add-model hosted ... --config vpc-id=vpc-a1b2c3d4)
4. Add a space (juju add-space mytest)
4. Add one or more subnets to that space, from same VPC the controller runs in (juju add-subnet xxx mytest ..)
5. Deploy with spaces, possibly multiple units to up the chance of picking "empty" AZ with multiple different VPC subnets (juju deploy ubuntu --num-units 4 --constraints spaces=mytest)

Expected: Success; all units come up as expected in different AZ (verifying the auto-AZ distributuon worked), but in subnets of the controller VPC.

Actual: Provisioning fails with an error (visible in juju status --format yaml) like this:
...
"1":
    juju-status:
      current: error
      message: 'cannot run instances: Security group sg-7d3cd107 and subnet subnet-bf1a3cc8
        belong to different networks. (InvalidParameter)'
      since: 02 Aug 2016 10:28:06-07:00
    instance-id: pending
...

(subnet-bf1a3cc8 is from a different VPC, sg-7d3cd107 is from the specified controller and hosted model VPC)

In StartInstance() of the EC2 provider, Juju should filter all subnets in SubnetsToZones argument, in the chosen AZ to exclude those not part of the model's vpcID setting (if populated).