Skip to content

Conversation

ydirson
Copy link
Contributor

@ydirson ydirson commented May 28, 2025

Based on top of #311

@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.

@ydirson ydirson force-pushed the installer-features/ipv6 branch from 2037907 to 5c6f3fe Compare June 3, 2025 16:08
ydirson added 10 commits June 11, 2025 13:26
This will detect any lack of parameter value more rapidly.

Signed-off-by: Yann Dirson <[email protected]>
- 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]>
@ydirson ydirson force-pushed the installer-features/ipv6 branch from 5c6f3fe to 9feb6ee Compare June 11, 2025 11:40
ydirson added 14 commits June 11, 2025 18:35
PEP585 implemented in python 3.9 allows to subscript `list` and
`dict`, and doing so even with 3.8 is not flagged by checkers, so devs
end up using it and get flagged by the CI.

Since 3.7 `from __future__ import annotations` allows to defer
evaluation of annotations, so any use of collection subscripting in an
annotation gets not checked by the interpreter any more, and we can
use the more comfortable syntax.

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]>
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]>
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]>
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]>
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
- silently requires netcat-openbsd, just fails with netcat-traditional
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
- ...
ydirson added 3 commits June 11, 2025 18:54
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
@ydirson ydirson force-pushed the installer-features/ipv6 branch from 9feb6ee to 7001fdf Compare June 11, 2025 16:54
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