-
Notifications
You must be signed in to change notification settings - Fork 73
lxd: add support for CPU/memory constraints and VMs #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fnordahl
wants to merge
10
commits into
canonical:master
Choose a base branch
from
fnordahl:lxd-type-and-vm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <fnordahl@ubuntu.com>
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 <maciej.borzecki@canonical.com> (cherry picked from commit e002bc8)
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com> (cherry picked from commit d7ab030)
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.