Skip to content

Commit 2037907

Browse files
committed
WIP install: new variant to select ipv4 or ipv6 for the installer
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
1 parent 156bbf1 commit 2037907

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

tests/install/conftest.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ def system_disks_names(request):
121121
# in contexts where the same IP is reused by successively different MACs
122122
# (when cloning VMs from cache)
123123
@pytest.fixture(scope='function')
124-
def remastered_iso(installer_iso, answerfile):
124+
def remastered_iso(request, installer_iso, answerfile):
125125
iso_file = installer_iso['iso']
126126
unsigned = installer_iso['unsigned']
127127

128+
install_iface = request.getfixturevalue("install_iface")
129+
128130
assert "iso-remaster" in TOOLS
129131
iso_remaster = TOOLS["iso-remaster"]
130132
assert os.access(iso_remaster, os.X_OK)
@@ -161,6 +163,9 @@ def remastered_iso(installer_iso, answerfile):
161163
test ! -e "{answerfile_xml}" ||
162164
cp "{answerfile_xml}" "$INSTALLIMG/root/answerfile.xml"
163165
166+
HOSTINSTALLER=$HOME/src/xs/host-installer
167+
make -C "$HOSTINSTALLER" DESTDIR="$INSTALLIMG" XS_MPATH_CONF="$HOME/src/xapi/sm/multipath/multipath.conf"
168+
164169
mkdir -p "$INSTALLIMG/usr/local/sbin"
165170
cat > "$INSTALLIMG/usr/local/sbin/test-pingpxe.sh" << 'EOF'
166171
#! /bin/bash
@@ -187,8 +192,8 @@ def remastered_iso(installer_iso, answerfile):
187192
PINGARGS="-c1"
188193
fi
189194
190-
# detect lack of ipv4 in installed host
191-
if grep -q "^MODE='none'\\$" /etc/firstboot.d/data/management.conf; then
195+
# detect lack of ipv4 both in installer and in installed host
196+
if grep -q -w network_config=none /proc/cmdline || grep -q "^MODE='none'\\$" /etc/firstboot.d/data/management.conf; then
192197
PINGARGS+=" -6"
193198
fi
194199
@@ -252,6 +257,11 @@ def remastered_iso(installer_iso, answerfile):
252257
set -ex
253258
ISODIR="$1"
254259
SED_COMMANDS=(-e "s@/vmlinuz@/vmlinuz network_device=all sshpassword={passwd} atexit=shell@")
260+
case "{install_iface}" in
261+
ipv4dhcp) ;;
262+
ipv6dhcp) SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz network_config=none network_config6=dhcp@") ;;
263+
*) echo >&2 "ERROR unhandled install_iface '{install_iface}'"; exit 1 ;;
264+
esac
255265
test ! -e "{answerfile_xml}" ||
256266
SED_COMMANDS+=(-e "s@/vmlinuz@/vmlinuz install answerfile=file:///root/answerfile.xml@")
257267
# assuming *gpgcheck only appear within unsigned ISO

tests/install/test.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class TestNested:
4747
@pytest.mark.parametrize("local_sr", ("nosr", "ext", "lvm"))
4848
@pytest.mark.parametrize("package_source", ("iso", "net"))
4949
@pytest.mark.parametrize("system_disk_config", ("disk", "raid1"))
50+
@pytest.mark.parametrize("install_iface", ("ipv4dhcp", "ipv6dhcp"))
5051
@pytest.mark.parametrize("iso_version", (
5152
"83nightly", "830net",
5253
"830",
@@ -136,7 +137,7 @@ class TestNested:
136137
else ValueError(f"system_disk_config {system_disk_config!r}"),
137138
))
138139
def test_install(self, vm_booted_with_installer, system_disks_names,
139-
firmware, iso_version, package_source, system_disk_config, local_sr, admin_iface):
140+
firmware, iso_version, install_iface, package_source, system_disk_config, local_sr, admin_iface):
140141
host_vm = vm_booted_with_installer
141142
installer.monitor_install(ip=host_vm.ip)
142143

@@ -146,6 +147,7 @@ def test_install(self, vm_booted_with_installer, system_disks_names,
146147
@pytest.mark.parametrize("package_source", ("iso", "net"))
147148
@pytest.mark.parametrize("system_disk_config", ("disk", "raid1"))
148149
@pytest.mark.parametrize("machine", ("host1", "host2"))
150+
@pytest.mark.parametrize("install_iface", ("ipv4dhcp", "ipv6dhcp"))
149151
@pytest.mark.parametrize("version", (
150152
"83nightly", "830net",
151153
"830",
@@ -158,12 +160,12 @@ def test_install(self, vm_booted_with_installer, system_disks_names,
158160
))
159161
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
160162
@pytest.mark.continuation_of(
161-
lambda version, firmware, local_sr, admin_iface, package_source, system_disk_config: [dict(
163+
lambda version, firmware, install_iface, local_sr, admin_iface, package_source, system_disk_config: [dict(
162164
vm="vm1",
163-
image_test=(f"TestNested::test_install[{firmware}-{version}-{system_disk_config}"
165+
image_test=(f"TestNested::test_install[{firmware}-{version}-{install_iface}-{system_disk_config}"
164166
f"-{package_source}-{local_sr}-{admin_iface}]"))])
165167
def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
166-
firmware, version, machine, local_sr, admin_iface, package_source, system_disk_config):
168+
firmware, version, install_iface, machine, local_sr, admin_iface, package_source, system_disk_config):
167169
helper_vm = helper_vm_with_plugged_disk
168170

169171
if system_disk_config == "disk":
@@ -374,6 +376,7 @@ def _test_firstboot(self, create_vms, mode, admin_iface, *, machine='DEFAULT', i
374376
@pytest.mark.parametrize("package_source", ("iso", "net"))
375377
@pytest.mark.parametrize("system_disk_config", ("disk", "raid1"))
376378
@pytest.mark.parametrize("machine", ("host1", "host2"))
379+
@pytest.mark.parametrize("install_iface", ("ipv4dhcp", "ipv6dhcp"))
377380
@pytest.mark.parametrize("version", (
378381
"83nightly", "830net",
379382
"830",
@@ -386,13 +389,13 @@ def _test_firstboot(self, create_vms, mode, admin_iface, *, machine='DEFAULT', i
386389
))
387390
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
388391
@pytest.mark.continuation_of(
389-
lambda firmware, version, machine, local_sr, admin_iface, package_source, system_disk_config: [
392+
lambda firmware, version, install_iface, machine, local_sr, admin_iface, package_source, system_disk_config: [
390393
dict(vm="vm1",
391394
image_test=("TestNested::test_tune_firstboot"
392-
f"[None-{firmware}-{version}-{machine}-{system_disk_config}"
395+
f"[None-{firmware}-{version}-{install_iface}-{machine}-{system_disk_config}"
393396
f"-{package_source}-{local_sr}-{admin_iface}]"))])
394397
def test_boot_inst(self, create_vms,
395-
firmware, version, machine, package_source, system_disk_config, local_sr, admin_iface):
398+
firmware, version, install_iface, machine, package_source, system_disk_config, local_sr, admin_iface):
396399
self._test_firstboot(create_vms, version, admin_iface, machine=machine)
397400

398401
@pytest.mark.usefixtures("xcpng_chained")

0 commit comments

Comments
 (0)