tests: fix assertion disk handling for nested UC systems (#8902)
The system-user assertion is missing the account and account-key assertions, add them
the existing system-user assertion was expired and needed to be resigned by Sergio
In order to run test nested tests locally with qemu, we need to increase the RAM to at least that which is used for the guest VM, which was 4G. Rather than suddenly make everyone who needs to run a spread test locally use 8G per system, add a new backend with 4G of RAM and make qemu-nested nested VM's use 2G instead of google-nested nested VM's which use 4G.
Use a vfat USB partition for the assertion disk, the ext4 debugfs doesn't work for some reason anymore (and add a TODO to fix this at some point)
Use -serial file:... when booting qemu to get the boot log from failed nested VM tests, this helps debugging quite a bit when ew fail to reconnect to the system
Note we still need a bit more before this works sufficiently, namely we need:
We need to fix creating a nested UC16 and UC18 systems with BUILD_SNAPD_FROM_CURRENT=true, this currently is unsupported in the nested.sh setup
Add a test which specifically disables cloud-init to actually exercise BUILD_SNAPD_FROM_CURRENT=true with USE_CLOUD_INIT=false
Those will be handled in followups PR's.
* tests/lib/assertions/auto-import.assert: add account, account-key asserts
These were missing from the auto-import.assert, and hence snapd would not
actually resolve the keys in the system-user-assertion, thus leading to
no import of the system-user-assertion.
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh: use vfat usb drive in qemu for assertion disk
The current implementation of automatically importing the system-user assertion
did not work at all, as snap auto-import failed with "no medium found" when
attempting to mount the drive. It's unclear how to make that work with debugfs
and an ext4 formatted drive that does not use partitions, but this method does
work instead.
Signed-off-by: Ian Johnson <email address hidden>
* spread.yaml: add qemu-nested backend with 8G mem, add to nested suites
The memory for the qemu backend needs to be at least 5G because the nested VM's
are created with 4G of memory, so just re-using the current 2G of memory
specified for the qemu backend will lead to the VM's not being able to be
booted. It's also unreasonable to expect that folks just wanting to run 2 qemu
spread tests locally need 16G+ of memory, so we define a new backend just
specifying 8G of memory.
Also add 16.04 and 18.04 to the nested manual suites.
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh: add -serial option to get boot log from nested VM
This is helpful when debugging why a nested VM fails to boot or otherwise fails
to complete a test successfully.
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh, spread.yaml: add is_nested_system, use in debug-each
This is useful for when a nested VM test fails, we can see the status of the VM
as reported by the nested-vm systemd unit we create the VM with, and also see
the boot log of the VM using the serial-log that qemu uses now.
Signed-off-by: Ian Johnson <email address hidden>
* Updating the user assertion with new end date
* tests/lib/assertions/auto-import.assert: re-add the account, account-key asserts
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh, spread.yaml: use backend specific opts for RAM, machine
For qemu-nested, we can't use acceleration because it doesn't support nesting,
so we omit that option when using qemu-nested.
Additionally, since qemu-nested is likely to be run on developer machines that
may not have a significant amount of RAM, we reduce the amount of RAM for the
guest VM to 2GB, and the RAM for the host VM to 4G.
Finally, the -usb option to qemu was included in the PARAM_MONITOR, but it
doesn't really have anything to do with monitoring, so move it to it's own
parameter variable.
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh: add TODO about debugfs way of importing sys user asserts
Signed-off-by: Ian Johnson <email address hidden>
* tests/lib/nested.sh: wait for the loop device to show up before partitioning
There is a race here, losetup can report the loop device before it shows up in
/dev.
Signed-off-by: Ian Johnson <email address hidden>
Co-authored-by: Sergio Cazzolato <email address hidden>