Skip to content

Test installer's IPv6 features #316

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

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft

Conversation

ydirson
Copy link
Contributor

@ydirson ydirson commented May 28, 2025

Based on top of #311

ydirson added 26 commits May 26, 2025 10:38
- adding it behind the scene makes it more difficult to write tests for IPv6
- only needed for install, not upgrade or restore

Signed-off-by: Yann Dirson <[email protected]>
Signed-off-by: Yann Dirson <[email protected]>
This is useful for a lambda passed to @pytest.mark.answerfile, where in
some variants of a test we want to add an element, but nothing in other
variants (eg. a <raid> block)

Signed-off-by: Yann Dirson <[email protected]>
This is a preparation for type hint addition, where we cannot mutate
in-place a variable to another type: we have to build an object of the
correct return type incrementally.

Signed-off-by: Yann Dirson <[email protected]>
Issue raised by type checkers.

Signed-off-by: Yann Dirson <[email protected]>
Type checkers today are unable to determine that `defn` does not contain
an `attrib` member, this prevents them from checking our dict would
provide compatible data (which is does not).

Signed-off-by: Yann Dirson <[email protected]>
Note the `type: ignore[call-arg]` in test_fixtures is here to overcome a
bug/limitation in mypy 1.15.0: in callable_marker() it seems to consider
that `value(**params)` produces at least one argument.

Signed-off-by: Yann Dirson <[email protected]>
Signed-off-by: Yann Dirson <[email protected]>
Signed-off-by: Yann Dirson <[email protected]>
The helper_vm_with_plugged_disk fixture for tune_firstboot was only able
to attach a single disk.  For RAID support we need several disks, and that
fixture would fail.

Signed-off-by: Yann Dirson <[email protected]>
Using a temporary variable is unnecessary and hurts readability.

Also use logger formatting as designed.

Signed-off-by: Yann Dirson <[email protected]>
Code will be more readable when we start manipulating other info about
system disks.

Signed-off-by: Yann Dirson <[email protected]>
Adds a new system_disk test parameter to distinguish raid1 setup from
(pre-existing) single-disk one.  Adds Alpine-specific setup for
tune_firstboot to manually assemble the RAID.

Signed-off-by: Yann Dirson <[email protected]>
Well, it was indeed working "by chance", as calling readlink on a non-link
returns empty, which instead of getting [ to return non-zero because
empty string is not "busybox" got it to return non-zero because the
comparison operator had no first operand.

Signed-off-by: Yann Dirson <[email protected]>
More parameter values will come in a later commit.

Signed-off-by: Yann Dirson <[email protected]>
… ipv4dhcp

Note that I absolutely hate this lack of indentation, but pycodestyle and
emacs' python-mode are comploting for this
FIXME:
- pycodestyle disagrees
- mypy disagrees
FIXME:
- uses IPv4 at install time
  - requires different ARP_SERVER for install and test_boot, since DNS is
    not set in xcpng using autoconf and we cannot use a name
- ipv6 dhcp is currently known broken in xcpng
- ipv6 autoconf is currently broken if also using IPv6 at install time?
- only install is handled
- ...
This allows the test to get the IPv6 address from the host even if it
starts with an IPv4 first (in which case the transient IPv4 would be use,
rapidly causing issues).

Signed-off-by: Yann Dirson <[email protected]>
This allows upgrading installer with network_config6 support with
patches from https://github.com/xcp-ng/host-installer/commits/ipv6/
(assumes you have that in ~/src/xs/host-installer)

* just using network_config=none to try beneficiating from default
  ipv6 autoconf bombs out because of lack of v6 config
* network_config6=autoconf currently gets no DNS configuration, so only
  works if not using the network for installation AND numeric IP address
  for ARP_SERVER, so is left out for now

FIXME:
- this uses an unreleased installer patch
- should support upg and rst
@ydirson ydirson requested review from glehmann and stormi May 28, 2025 09:58
@@ -84,7 +84,8 @@ class TestNested:
vifs=[dict(index=0, network_name=NETWORKS["MGMT"])],
))
@pytest.mark.answerfile(
lambda system_disks_names, local_sr, package_source, system_disk_config, iso_version, admin_iface: AnswerFile("INSTALL")
lambda system_disks_names, local_sr, package_source, system_disk_config, iso_version,
admin_iface: AnswerFile("INSTALL")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do

        lambda system_disks_names, local_sr, package_source, system_disk_config, iso_version, admin_iface:
            AnswerFile("INSTALL")
            .top_setattr({} if local_sr == "nosr" else {"sr-type": local_sr})
…

without even a \ because the lambda is in between parentheses.

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