Skip to content

Commit 76e1f49

Browse files
committed
WIP installation on a disk with a Dell utility partition
1 parent 6970c79 commit 76e1f49

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

tests/install/conftest.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,19 @@ def installer_iso(request):
112112
@pytest.fixture(scope='function')
113113
def install_disk(request):
114114
firmware = request.getfixturevalue("firmware")
115-
yield {"uefi": "nvme0n1", "bios": "sda"}[firmware]
115+
if firmware.startswith("uefi"):
116+
yield "nvme0n1"
117+
elif firmware.startswith("bios"):
118+
yield "sda"
119+
else:
120+
assert False, f"unknown firmware {firmware!r}"
121+
122+
@pytest.fixture(scope='function')
123+
def answerfile_maybe_tweak_parttable(request, answerfile):
124+
firmware = request.getfixturevalue("firmware")
125+
if firmware.endswith("+dell"):
126+
answerfile.top_append(dict(TAG="script", stage="installation-start",
127+
type="url", CONTENTS="file:///root/preinstall-utilitypart.sh"))
116128

117129
# Remasters the ISO sepecified by `installer_iso` mark, with:
118130
# - network and ssh support activated, and .ssh/authorized_key so tests can
@@ -127,7 +139,7 @@ def install_disk(request):
127139
# in contexts where the same IP is reused by successively different MACs
128140
# (when cloning VMs from cache)
129141
@pytest.fixture(scope='function')
130-
def remastered_iso(installer_iso, answerfile):
142+
def remastered_iso(installer_iso, answerfile, install_disk):
131143
iso_file = installer_iso['iso']
132144
unsigned = installer_iso['unsigned']
133145

@@ -223,6 +235,18 @@ def remastered_iso(installer_iso, answerfile):
223235
chmod +x "$INSTALLIMG/etc/init.d/S12test-pingpxe"
224236
fi
225237
238+
cat > "$INSTALLIMG/root/preinstall-utilitypart.sh" <<'EOF'
239+
#!/bin/sh
240+
set -ex
241+
242+
# Dell utility partition
243+
sgdisk --zap-all /dev/{install_disk}
244+
sfdisk /dev/{install_disk} << 'EOP'
245+
unit: sectors
246+
p1 : start= 2048, size= 32768, Id=de
247+
EOP
248+
EOF
249+
226250
cat > "$INSTALLIMG/root/postinstall.sh" <<'EOF'
227251
#!/bin/sh
228252
set -ex

tests/install/test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TestNested:
3232
"xs8", "ch821.1",
3333
"xs70",
3434
))
35-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
35+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
3636
@pytest.mark.vm_definitions(
3737
lambda firmware: dict(
3838
name="vm1",
@@ -52,6 +52,7 @@ class TestNested:
5252
dict(param_name="platform", key="device-model", value="qemu-upstream-uefi"),
5353
),
5454
"bios": (),
55+
"bios+dell": (),
5556
}[firmware],
5657
vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")],
5758
cd_vbd=dict(device="xvdd", userdevice="3"),
@@ -69,7 +70,8 @@ class TestNested:
6970
"guest-storage": "no" if local_sr == "nosr" else "yes",
7071
"CONTENTS": install_disk},
7172
))
72-
def test_install(self, vm_booted_with_installer, install_disk,
73+
def test_install(self, answerfile_maybe_tweak_parttable,
74+
vm_booted_with_installer, install_disk,
7375
firmware, iso_version, source_type, local_sr):
7476
host_vm = vm_booted_with_installer
7577
installer.monitor_install(ip=host_vm.ip)
@@ -107,7 +109,7 @@ def helper_vm_with_plugged_disk(running_vm, create_vms):
107109
"ch821.1", "xs8",
108110
"xs70",
109111
))
110-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
112+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
111113
@pytest.mark.continuation_of(
112114
lambda version, firmware, local_sr, source_type: [dict(
113115
vm="vm1",
@@ -117,7 +119,9 @@ def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
117119
firmware, version, machine, local_sr, source_type):
118120
helper_vm = helper_vm_with_plugged_disk
119121

120-
helper_vm.ssh(["mount /dev/xvdb1 /mnt"])
122+
main_part = "/dev/xvdb2" if firmware.endswith("+dell") else "/dev/xvdb1"
123+
124+
helper_vm.ssh(["mount", main_part, "/mnt"])
121125
try:
122126
# hostname
123127
logging.info("Setting hostname to %r", machine)
@@ -138,7 +142,7 @@ def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
138142
'/mnt/etc/xensource-inventory'])
139143
helper_vm.ssh(["grep UUID /mnt/etc/xensource-inventory"])
140144
finally:
141-
helper_vm.ssh(["umount /dev/xvdb1"])
145+
helper_vm.ssh(["umount", main_part])
142146

143147
def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'):
144148
host_vm = create_vms[0]
@@ -298,7 +302,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'):
298302
"ch821.1", "xs8",
299303
"xs70",
300304
))
301-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
305+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
302306
@pytest.mark.continuation_of(
303307
lambda firmware, version, machine, local_sr, source_type: [
304308
dict(vm="vm1",
@@ -327,7 +331,7 @@ def test_boot_inst(self, create_vms,
327331
("821.1", "821.1"),
328332
("75", "821.1"),
329333
])
330-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
334+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
331335
@pytest.mark.continuation_of(
332336
lambda firmware, orig_version, machine, source_type, local_sr: [dict(
333337
vm="vm1",
@@ -362,7 +366,7 @@ def test_upgrade(self, vm_booted_with_installer, install_disk,
362366
"821.1-821.1",
363367
"75-821.1",
364368
))
365-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
369+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
366370
@pytest.mark.continuation_of(
367371
lambda firmware, mode, machine, source_type, local_sr: [dict(
368372
vm="vm1",
@@ -387,7 +391,7 @@ def test_boot_upg(self, create_vms,
387391
("83rcnet-83rcnet", "83rcnet"), # FIXME
388392
("821.1-821.1", "821.1"),
389393
])
390-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
394+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
391395
@pytest.mark.continuation_of(
392396
lambda firmware, orig_version, local_sr, source_type: [dict(
393397
vm="vm1",
@@ -418,7 +422,7 @@ def test_restore(self, vm_booted_with_installer, install_disk,
418422
"83rcnet-83rcnet", "83rcnet-83rcnet-83rcnet", # FIXME
419423
"821.1-821.1-821.1",
420424
))
421-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
425+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
422426
@pytest.mark.continuation_of(
423427
lambda firmware, mode, source_type, local_sr: [dict(
424428
vm="vm1",

0 commit comments

Comments
 (0)