The only way we had to pass -nic options to QEMU was to specify the
number of networks using the --nets option. Depending on its value, the
option would instruct QEMU to:
* instantiate *n* user host networks if --nets >= 1
* instantiate no network if --nets is 0
* instantiate a "dead" network if --nets < 0
To simulate more advanced networks (such as networks where HTTP proxy is
needed), we want to add the possibility to use TAP network interfaces.
This patch adds the ability to pass custom -nic options to QEMU.
Three new options are available:
* The --nic option passes the argument as-is to QEMU -nic option
* The --nic-user option passes a user host network -nic option to QEMU
- with SSH forwarding enabled. This is just like we do when using the
--nets >= 1 option)
* The --net-tap takes the name of an existing tap interface and
generates the following -nic argument:
tap,id={ifname},ifname={ifname},script=no,downscript=no,model=e1000
In the example below:
* the first network uses the tap0 interface.
* the second network uses the tap1 interface (it is syntactically
equivalent to the first one)
* the third network uses a user host network (with SSH forwarding)
$ kvm-test.py \
--nic tap,id=tap0,ifname=tap0,script=no,downscript=no,model=e1000 \
--nic-tap tap1 \
--nic-user
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Before, we would not run answers for the source controller if only one
source was specified. The controller would automatically get marked
configured.
Since we're adding a new "search drivers" option in this screen, we need
to make it interactive in integration tests now.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In order we place:
* the arguments that are for client & server
* the arguments for the client only
* the arguments for the server only
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The trap on ERR doesn't trigger in all the cases that we want.
The EXIT trap seems to be more robust, albeit with the requirement to
actually check the result code.
Move from using .subiquity as output-base to a tmpdir. This solves
several practical problems, like accidentally running the tests while
dryrun is open in another terminal or any other case where the server
process that is connected to is not the one that is expected.
Also makes cleanup nicer.
On failure, it will show which temporary directory was used to allow for
easy log examination.
The script can be used to validate autoinstall user data against the
schema. By default, it expects a #cloud-config header and the user-data
to be under the autoinstall: key.
By passing the --no-expect-cloudconfig, it validates the data directly.
We can use this option to validate the YAML files under
examples/autoinstall-*.yaml
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Passing --use-fuse to scripts/kvm-test.py allows to run as non-root.
It requires installation of the package fuseiso so the switch is
disabled by default.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Since 06ac3f92, we invoke kvm directly through subprocess.run.
Therefore, we must not add extra quotes around the -append options,
otherwise they persist and are passed in the kernel command line:
$ cat /proc/cmdline
"autoinstall subiquity-channel=stable" initrd=initrd
Later on, we fail to parse "autoinstall" and "subiquity-channel=stable"
as two distinct options.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The function drive() used to return a string in the following format:
"-drive file=/path/to/iso,..."
However, qemu/kvm expects "-drive" to be an argument and
"file=/path/to/iso,..." to be another argument.
The command was constructed as below since the beginning:
kvm = [
"kvm",
"-cdrom", "custom.iso", # <- OK
"-drive file=/path/to/iso,...", # <- NOK
]
Before 06ac3f92, we would join all the arguments using spaces before
executing the kvm command. Therefore we would luckily end up with a
correct command:
" ".join(kvm) -> "kvm -cdrom custom.iso -drive file=/path/to/iso,..."
However, now that we supply the command to subprocess.run directly, the
problem shows up.
Fixed by returning a tuple("-drive", "file=/path/to/iso,...") from
the drive() function.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The autoinstall schema for "apt" now supports the "preferences"
configuration. Each preference element should contain the properties
described below, that 1:1 map with the keywords from apt_preferences(5):
* package <-> Package:
* pin <-> Pin:
* pin-priority <-> Pin-Priority:
These preferences are forwarded to curtin through
subiquity-curtin-apt.conf. Support for these rules must be added to
curtin as well.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When running integration tests, the LANG variable in
.subiquity/etc/default/locale is unquoted. The pattern that we use
expects quotes so it does not match.
Fixed by making the test work with or without quotes.
In case quotes are not present, the final part of the pipeline will fail
to find a delimiter so it will print the line unchanged
excerpt from cut(1)
-f, --fields=LIST
select only these fields; also print any line that contains
no delimiter character, unless the -s option is specified
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Looking at the logs, we can observe that the below command does
not do what it is intended to do:
if [ -z "$( ls .subiquity/var/cache/apt/archives/) | grep $lang" ] ; then
++ ls .subiquity/var/cache/apt/archives/
+ '[' -z 'language-pack-en:amd64
wamerican:amd64
wbritish:amd64 | grep ' ']'
The "| grep $lang" part does not execute because it is outside the $()
construct. Therefore, the -z check is always false.
We can fix it by moving the "| grep $lang" part inside the subshell
construct but I took the opportunity to drop the use of the subshell.
Also added --fixed-strings and --quiet options to grep.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
* The mixture of storage for disable_components in and out of the config
dict was confusing and caused bugs, depending on the flow
* disable_components now solely lives in the dict, like other items
* fix several syntax errors
* missing 'this' item was renamed to 'iso'
* change the simulated 'bash -x' output to stderr
* use shlex functions for join/split
Although the script is running with -e, having two distinct invocations
of a subshell in the same instruction masks failures in the first
subshell invocation. It is similar in essence to what the pipefail
option controls.
As a consequence, the following instruction does not fail if distro-info
is not installed:
isoname=$(distro-info -d)-live-server-$(dpkg --print-architecture).iso
And therefore, we end up with something like:
isoname=-live-server-amd64.iso
Fixed by first assigning the value of $(distro-info -d) to a variable.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
- This is a cleanup for SystemSetup per DEENG-134 and DEENG-139
- Default user should be set by the WSL launcher.
- Shutdown/reboot actions also.
- Added a structured form of communication between OOBE and launcher.
- /run/launcher-command
- Useful for develop env.
- Mimics the CI while avoiding downloading images all the time.
- Instance names change from 'tester' to the Ubuntu release adjective.
- lxc will only download if there is no local instance with that name.
- Useful for preserving matrix build instances.
pytest-3 lets us set exclude directories, which is helpful with the
desired API testing to seperate them from 'unittest discover' so that we
can keep unit test runtime short.
The behaviour of python regarding asynchronous packages changed between
18.04 and 20.04+. OOBE is only supported on 20.04 and higher and there
is no point in making the WSL specific code compatible with ealier
releases than 20.04
Co-authored-by: Didier Roche <didrocks@ubuntu.com>
It also adds an argument --ignore-tz to the schema comparison test to
not fail on system where the schema has no TZ like WSL.
Co-authored-by: Didier Roche <didrocks@ubuntu.com>
Adding "--quiet" as additional option to "lszdev" - here more for the reason of completeness and for consistency reasons.
The relevant change for solving LP#1944516 is the change in subiquity/server/controllers/zdev.py
* remove a stray space
* remove an extra call to check-yaml-fields.py, which can accept a list
of directives
* remove an entire redundant autoinstall run that I added as part of
bitlocker work but isn't actually verified in any way other than not
timing out
a while ago I rewrote inject-subiquity-snap in python, generalized it
and put it at https://github.com/mwhudson/livefs-editor. TBH, it's
always been better than the shell version but now there's a reason to
switch to it: the impish live server ISO use layers, which the current
shell scripts do not support and livefs-editor now does.
* Add new schema comparison, robust to timezone changes
Improve the schema comparison - mostly I'm worried about the
non-timezone items, spot check the timezone list for a few that should
be there.
* Incorporate feedback - pop
Impish is adding more timezones, which is cool, but breaks my schema
check, so disable this there for now and come back later with a better
answer.
Also schema check seems to need curtin.
* TimeZone: autoinstall and API
Add support for Get/Set timezone methods. Get means that we inquire
with GeoIP as to which timezone is suggested. Non-availability of
GeoIP, or a previous explicit Set, means that we return the system
timezone. Set of timezone by Post results in set of the live system
timzeone, and queuing a set of the target system by way of cloud-init.
* Add clarifying comment about _request.