mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-21 09:52:17 +00:00
test(grub2): the !myipfn! placeholder is not checked on an IPv6-only node
grub2_ipv6.t drove setstate with a command line that has no placeholder, so the lookup that resolves it was never exercised. The new cases assert the placeholder becomes the IPv6 facing address and that the IPv4-only lookup, which reports the node unresolvable, is not used. The IPv4 case beside it holds that path unchanged. An earlier version of the assertion counted IPv6 facing calls, which the tftpserver lookup in the same run already makes, so it passed with the defect in place. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -220,7 +220,8 @@ is_deeply(
|
||||
);
|
||||
|
||||
sub exercise_setstate {
|
||||
my ($node, $mac) = @_;
|
||||
my ($node, $mac, $kcmdline) = @_;
|
||||
$kcmdline //= 'inst.ks=http://example.test/autoinst/node';
|
||||
my $tftpdir = tempdir(CLEANUP => 1);
|
||||
my $bootloader_root = "$tftpdir/boot/grub2";
|
||||
make_path($bootloader_root);
|
||||
@@ -235,7 +236,7 @@ sub exercise_setstate {
|
||||
{
|
||||
kernel => '/install/rhels10/x86_64/vmlinuz',
|
||||
initrd => '/install/rhels10/x86_64/initrd.img',
|
||||
kcmdline => 'inst.ks=http://example.test/autoinst/node',
|
||||
kcmdline => $kcmdline,
|
||||
},
|
||||
],
|
||||
);
|
||||
@@ -316,4 +317,35 @@ ok(
|
||||
'IPv4 node retains its MAC-specific GRUB config alias'
|
||||
);
|
||||
|
||||
# ---- the !myipfn! placeholder on an IPv6-only node ------------------------------------------
|
||||
# debian.pm puts !myipfn! in the command line of a Subiquity install and grub2.pm replaces it
|
||||
# with the address of the management node that faces the node. That lookup was IPv4 only, so an
|
||||
# IPv6-only node was reported unresolvable and nodeset wrote no configuration for it:
|
||||
# Error: The <node> can not be resolved
|
||||
# Error: Failed to generate grub2 configurations for some node(s)
|
||||
{
|
||||
@xCAT::NetworkUtils::legacy_facing_calls = ();
|
||||
@xCAT::NetworkUtils::family_facing_calls = ();
|
||||
my ( $dir, $root, $config, $rc, $message ) =
|
||||
exercise_setstate( 'nodev6', '02:00:00:00:00:61', 'xcatd=!myipfn! quiet' );
|
||||
is( $rc, 0, "an IPv6-only node with !myipfn! gets a configuration: $message" );
|
||||
like( $config, qr/xcatd=2001:db8::1\b/,
|
||||
'... and the placeholder becomes the IPv6 address of the facing management node' );
|
||||
unlike( $config, qr/!myipfn!/, '... with no placeholder left behind' );
|
||||
is_deeply( \@xCAT::NetworkUtils::legacy_facing_calls, [],
|
||||
'... without using the IPv4-only lookup, which reports the node unresolvable' );
|
||||
}
|
||||
|
||||
# An IPv4 node must keep the lookup it had: the IPv6 one would find nothing for it.
|
||||
{
|
||||
@xCAT::NetworkUtils::legacy_facing_calls = ();
|
||||
@xCAT::NetworkUtils::family_facing_calls = ();
|
||||
my ( $dir, $root, $config, $rc, $message ) =
|
||||
exercise_setstate( 'nodev4', '02:00:00:00:00:41', 'xcatd=!myipfn! quiet' );
|
||||
is( $rc, 0, "an IPv4 node with !myipfn! still gets a configuration: $message" );
|
||||
like( $config, qr/xcatd=192\.0\.2\.1\b/, '... and the placeholder becomes its IPv4 address' );
|
||||
is_deeply( \@xCAT::NetworkUtils::family_facing_calls, [],
|
||||
'... without asking for an IPv6 facing address' );
|
||||
}
|
||||
|
||||
done_testing();
|
||||
|
||||
Reference in New Issue
Block a user