Fix bug in is_swap_device if a device was smaller than page_size.
If is_swap_device was called on a device (or file) that was smaller than
a page size of the current kernel, then it would raise an OSError.
The change here just makes it check the size of the file before
attempting to read.
A test is added, and the other tests updated to rely less on mock.
unittest: change directory to tmpdir for testing relative files.
Previous commit 104331c3318 changed the behavior of the test
test_relative_file_url
to test with an absolute path, when the point of the test was to
test relative.
The fix here does what was originally intended, testing that relative
file paths work and utilizing the tmp dir.
Curtin's meta-simple which is used when deploying dd-images can
clear disks with a simple wipe but does not handle cases where
disks may be part of a layered stack like lvm, raid or bcache.
Allow meta-simple and meta-custom to use a common method for running
clear-holders to ensure devices used are free.
vmtests: check install log for Out of memory kernel messages and fail
During proposed testing, we observed in the Cosmic test which installed
the lxd snap, core snap and a linux kernel, 1G of ram was insufficient
and would trigger linux OOM and sometimes fail the install. Add a
test for the Out of memory string in our install log check and fail
vmtest installs if we find an OOM occurred during installation.
This unittest was not correctly setting the path for creating
a temporary file. The result was an extra file, my.img, was created
each time a user ran tox.
block_meta: use wipe config when clearing partitions
The partition handler in block_meta would wipe in "superblock" mode
before creating a partition but this only clears 1MB at the start
of the partition. Curtin needs to respect the wipe mode which may
wipe the location of the device differently.
Also:
- Document pre-partitioning superblock wiping
- Add PReP GPT config to basic/basic_scsi test
- Sync basic and basic_scsi partition config
- collect ls -al on /dev/disk/by-partuuid
tests: fix vmtests for apt perserve_source_list changes
Commit 40e6cc3 changed behavior for curtin to emit only the new format apt
config "apt: preserve_sources_list" instead of the old format
"apt_preserve_sources_list". Vmtests needed updating on Xenial and later
to check only for the new format.