Skip to content

Conversation

@fnordahl
Copy link
Member

@fnordahl fnordahl commented Mar 18, 2025

Please review/merge commit by commit.

@fnordahl fnordahl force-pushed the lxd-type-and-vm branch 10 times, most recently from f9a647f to 755a0e6 Compare March 19, 2025 16:39
@fnordahl fnordahl force-pushed the lxd-type-and-vm branch 6 times, most recently from e99a31d to 4e3f5a8 Compare March 20, 2025 15:09
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>
@fnordahl fnordahl force-pushed the lxd-type-and-vm branch 3 times, most recently from 29d8d1d to b49eb90 Compare March 20, 2025 16:21
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>
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>
@fnordahl fnordahl marked this pull request as ready for review March 20, 2025 17:16
fnordahl and others added 3 commits March 24, 2025 13:55
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants