Skip to content

Commit bd8be1f

Browse files
committed
WIP installation on a disk with a Dell utility partition
1 parent 658bc0c commit bd8be1f

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
@@ -111,7 +111,19 @@ def installer_iso(request):
111111
@pytest.fixture(scope='function')
112112
def install_disk(request):
113113
firmware = request.getfixturevalue("firmware")
114-
yield {"uefi": "nvme0n1", "bios": "sda"}[firmware]
114+
if firmware.startswith("uefi"):
115+
yield "nvme0n1"
116+
elif firmware.startswith("bios"):
117+
yield "sda"
118+
else:
119+
assert False, f"unknown firmware {firmware!r}"
120+
121+
@pytest.fixture(scope='function')
122+
def answerfile_maybe_tweak_parttable(request, answerfile):
123+
firmware = request.getfixturevalue("firmware")
124+
if firmware.endswith("+dell"):
125+
answerfile.top_append(dict(TAG="script", stage="installation-start",
126+
type="url", CONTENTS="file:///root/preinstall-utilitypart.sh"))
115127

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

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

tests/install/test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TestNested:
5252
"xs8", "ch821.1",
5353
"xs70",
5454
))
55-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
55+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
5656
@pytest.mark.vm_definitions(
5757
lambda firmware: dict(
5858
name="vm1",
@@ -73,6 +73,7 @@ class TestNested:
7373
dict(param_name="platform", key="device-model", value="qemu-upstream-uefi"),
7474
),
7575
"bios": (),
76+
"bios+dell": (),
7677
}[firmware],
7778
vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")],
7879
cd_vbd=dict(device="xvdd", userdevice="3"),
@@ -90,7 +91,8 @@ class TestNested:
9091
"guest-storage": "no" if local_sr == "nosr" else "yes",
9192
"CONTENTS": install_disk},
9293
))
93-
def test_install(self, vm_booted_with_installer, install_disk,
94+
def test_install(self, answerfile_maybe_tweak_parttable,
95+
vm_booted_with_installer, install_disk,
9496
firmware, iso_version, package_source, local_sr):
9597
host_vm = vm_booted_with_installer
9698
installer.monitor_install(ip=host_vm.ip)
@@ -109,7 +111,7 @@ def test_install(self, vm_booted_with_installer, install_disk,
109111
"xs8", "ch821.1",
110112
"xs70",
111113
))
112-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
114+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
113115
@pytest.mark.continuation_of(
114116
lambda version, firmware, local_sr, package_source: [dict(
115117
vm="vm1",
@@ -119,7 +121,9 @@ def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
119121
firmware, version, machine, local_sr, package_source):
120122
helper_vm = helper_vm_with_plugged_disk
121123

122-
helper_vm.ssh(["mount /dev/xvdb1 /mnt"])
124+
main_part = "/dev/xvdb2" if firmware.endswith("+dell") else "/dev/xvdb1"
125+
126+
helper_vm.ssh(["mount", main_part, "/mnt"])
123127
try:
124128
# hostname
125129
logging.info("Setting hostname to %r", machine)
@@ -140,7 +144,7 @@ def test_tune_firstboot(self, create_vms, helper_vm_with_plugged_disk,
140144
'/mnt/etc/xensource-inventory'])
141145
helper_vm.ssh(["grep UUID /mnt/etc/xensource-inventory"])
142146
finally:
143-
helper_vm.ssh(["umount /dev/xvdb1"])
147+
helper_vm.ssh(["umount", main_part])
144148

145149
def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=False):
146150
host_vm = create_vms[0]
@@ -302,7 +306,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
302306
"xs8", "ch821.1",
303307
"xs70",
304308
))
305-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
309+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
306310
@pytest.mark.continuation_of(
307311
lambda firmware, version, machine, local_sr, package_source: [
308312
dict(vm="vm1",
@@ -331,7 +335,7 @@ def test_boot_inst(self, create_vms,
331335
("821.1", "821.1"),
332336
("75", "821.1"),
333337
])
334-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
338+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
335339
@pytest.mark.continuation_of(
336340
lambda firmware, orig_version, machine, package_source, local_sr: [dict(
337341
vm="vm1",
@@ -369,7 +373,7 @@ def test_upgrade(self, vm_booted_with_installer, install_disk,
369373
"821.1-821.1",
370374
"75-821.1",
371375
))
372-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
376+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
373377
@pytest.mark.continuation_of(
374378
lambda firmware, mode, machine, package_source, local_sr: [dict(
375379
vm="vm1",
@@ -394,7 +398,7 @@ def test_boot_upg(self, create_vms,
394398
("821.1-82nightly", "82nightly"),
395399
("821.1-821.1", "821.1"),
396400
])
397-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
401+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
398402
@pytest.mark.continuation_of(
399403
lambda firmware, orig_version, local_sr, package_source: [dict(
400404
vm="vm1",
@@ -425,7 +429,7 @@ def test_restore(self, vm_booted_with_installer, install_disk,
425429
"821.1-82nightly-82nightly",
426430
"821.1-821.1-821.1",
427431
))
428-
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
432+
@pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell"))
429433
@pytest.mark.continuation_of(
430434
lambda firmware, mode, package_source, local_sr: [dict(
431435
vm="vm1",

0 commit comments

Comments
 (0)