lxd: add support for CPU/memory constraints and VMs#221
Open
fnordahl wants to merge 10 commits intocanonical:masterfrom
Open
lxd: add support for CPU/memory constraints and VMs#221fnordahl wants to merge 10 commits intocanonical:masterfrom
fnordahl wants to merge 10 commits intocanonical:masterfrom
Conversation
f9a647f to
755a0e6
Compare
e99a31d to
4e3f5a8
Compare
The provisioned cloud instance has 1 vCPU and 4 GB of memory, which is not a lot. Some tests execute multiple LXD containers in parallel which obviously lead to contention between host operating system, test executor (spread), and container/vm workloads. We're also close to depleting the available storage. Make use of a 'n1-highcpu-4' plan, and bump storage by 5 GB. (n1 is general purpose tier, highcpu gives 2 GB memory per vCPU.) (lack of nested virtualization prevents use of e2 low cost tier.) Fixes: canonical#223 Signed-off-by: Frode Nordahl <[email protected]>
Before this commit Ubuntu 20.04 and 22.04 containers spun up in
CI environment would never complete initialization due to snapd
failing to install the `lxd` snap:
snapd: taskrunner.go:299: Change 8 task (Run install hook of
"lxd" snap if present) failed: run hook "install": cannot
perform operation: mount -t devpts --make-slave --make-private
-o acl,relatime,kernmount,iversion,active,nouser,0xffffffff00000000
devpts /dev/pts: Permission denied
This has been adderessed in more recent LXD versions [0].
0: https://github.com/canonical/lxd/blob/b13c4f528bf7c9703f673eaf15476c11e59a8074/lxd/apparmor/instance_lxc.go#L513
Signed-off-by: Frode Nordahl <[email protected]>
29d8d1d to
b49eb90
Compare
Spread will attempt to start all systems for each defined backend. The number of systems for the tests/lxd/spread.yaml file is problematic with the resources available in the CI environment. Split into multiple backends and run consecutively. Signed-off-by: Frode Nordahl <[email protected]>
Cloud-init is ubiquitous in container and virtual machine images. When present in the image, await completion (with timeout) before returning from Allocate(). This will avoid a class of intermittent failures due to tests running prior to system initialization is fully complete. Fixes: canonical#222 Signed-off-by: Frode Nordahl <[email protected]>
LXD accepts instance type with the -t argument to `lxc launch` command, and applies constraints both to containers and virtual machines. This is useful in its own right for running test cases with specific CPU and memory constraints, and also a prerequisite for consequent patch adding support for launching LXD VMs. Signed-off-by: Frode Nordahl <[email protected]>
b49eb90 to
f09391c
Compare
LXD supports both containers and VMs, let's expose this functionality to consumers of the Spread LXD backend. Signed-off-by: Frode Nordahl <[email protected]>
The lxd test is long running, and spread will start showing its progress as part of its normal operations. Before this change there would be no in-flight output because output was written directly to file. Make use of `tee` instead so we can have both! Signed-off-by: Frode Nordahl <[email protected]>
f09391c to
6fd501d
Compare
Recent versions of LXD will give an exit code of -1, which translates into 255, and a different error message for the case of LXD VM agent not being available. LXD might reboot a guest as part of its bringup, one example being Ubuntu 20.04 (Focal Fossa), attempts to lxc exec at this point in time will result in a temporary "Instance is not running" error. Signed-off-by: Frode Nordahl <[email protected]>
LXD VMs, especially when running in GCP take quite long to have IP addresses assigned to them. Use a longer timeout in this case. Signed-off-by: Maciej Borzecki <[email protected]> (cherry picked from commit e002bc8)
Signed-off-by: Maciej Borzecki <[email protected]> (cherry picked from commit d7ab030)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please review/merge commit by commit.