Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the last remaining bits to ensure that spaces are properly supported when using lxd as the substrate.
First, the PR corrects an issue with the lxd-specific subnet discovery logic that got introduced via a set of prior PRs (#11788, #11831, #11831). Note that this work is a 2.9 feature and has not been yet released. More specifically:
When we use lxd as a substrate (vs deploying an lxd workload on a machine managed by another substrate), Subnets() output should only include networks that are able to be bridged.
Given that an lxd server may be either local or remote, we cannot guarantee that we will be able to create bridges for regular NICs (as we do in the containerizer's bridge policy logic). Therefore, by ensuring that all reported subnets can be bridged, we allow users to define spaces and guarantee that the lxd provider will always be able to use the bridge NICs as parents of devices that get injected into the container specs constructed by StartInstance.
The second half of this PR completes the work for supporting spaces on lxd by:
AvailabilityZones
field with the lxd server's name when discovering subnets. This is a prerequisite for the provisioner to be able to resolve space constraints into a set of (provider) subnet IDs prior to invoking the provider'sStartInstance
method.StartInstance
. The implementation includes de-dupping logic to avoid creating NICs that are bridged to the same host bridge.QA steps
NOTE: Subnet discovery is disabled on lxd < 3.0 (xenial) so none of this code is invoked. However, the subnet discovery logic is slightly different on bionic and focal so they must both be tested. While testing I used a bionic instance on MAAS as a remote lxd cloud.
Example for focal:
Documentation changes
We should tick the supports spaces box (with a on 2.9+ )