Skip to content

Commit 053dc03

Browse files
committed
mantle/kola/testiso: support testing coreos.liveiso.fromram installs
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
1 parent 1c8827e commit 053dc03

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

mantle/cmd/kola/testiso.go

+38-5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var (
6464
enableUefi bool
6565
enableUefiSecure bool
6666
isOffline bool
67+
isISOFromRAM bool
6768

6869
// The iso-as-disk tests are only supported in x86_64 because other
6970
// architectures don't have the required hybrid partition table.
@@ -79,7 +80,7 @@ var (
7980
"iso-live-login.4k.uefi",
8081
"iso-offline-install.bios",
8182
"iso-offline-install.mpath.bios",
82-
"iso-offline-install.4k.uefi",
83+
"iso-offline-install-fromram.4k.uefi",
8384
"miniso-install.bios",
8485
"miniso-install.nm.bios",
8586
"miniso-install.4k.uefi",
@@ -101,7 +102,7 @@ var (
101102
}
102103
tests_ppc64le = []string{
103104
"iso-live-login.ppcfw",
104-
"iso-offline-install.ppcfw",
105+
"iso-offline-install-fromram.ppcfw",
105106
"iso-offline-install.mpath.ppcfw",
106107
"iso-offline-install.4k.ppcfw",
107108
"miniso-install.ppcfw",
@@ -114,7 +115,7 @@ var (
114115
tests_aarch64 = []string{
115116
"iso-live-login.uefi",
116117
"iso-live-login.4k.uefi",
117-
"iso-offline-install.uefi",
118+
"iso-offline-install-fromram.uefi",
118119
"iso-offline-install.mpath.uefi",
119120
"iso-offline-install.4k.uefi",
120121
"miniso-install.uefi",
@@ -130,6 +131,8 @@ var (
130131

131132
const (
132133
installTimeout = 10 * time.Minute
134+
// https://github.com/coreos/fedora-coreos-config/pull/2544
135+
liveISOFromRAMKarg = "coreos.liveiso.fromram"
133136
)
134137

135138
var liveOKSignal = "live-test-OK"
@@ -236,6 +239,24 @@ RequiredBy=coreos-installer.target
236239
# for iso-as-disk
237240
RequiredBy=multi-user.target`
238241

242+
// Unit to check that /run/media/iso is not mounted when
243+
// coreos.liveiso.fromram kernel argument is passed
244+
var isoNotMountedUnit = `[Unit]
245+
Description=Verify ISO is not mounted when coreos.liveiso.fromram
246+
OnFailure=emergency.target
247+
OnFailureJobMode=isolate
248+
ConditionKernelCommandLine=coreos.liveiso.fromram
249+
[Service]
250+
Type=oneshot
251+
StandardOutput=kmsg+console
252+
StandardError=kmsg+console
253+
RemainAfterExit=yes
254+
# Would like to use SuccessExitStatus but it doesn't support what
255+
# we want: https://github.com/systemd/systemd/issues/10297#issuecomment-1672002635
256+
ExecStart=bash -c "if mountpoint /run/media/iso 2>/dev/null; then exit 1; fi"
257+
[Install]
258+
RequiredBy=coreos-installer.target`
259+
239260
var nmConnectionId = "CoreOS DHCP"
240261
var nmConnectionFile = "coreos-dhcp.nmconnection"
241262
var nmConnection = fmt.Sprintf(`[connection]
@@ -519,6 +540,12 @@ func runTestIso(cmd *cobra.Command, args []string) error {
519540
if kola.HasString("offline", strings.Split(components[0], "-")) {
520541
isOffline = true
521542
}
543+
// For fromram it is a part of the first component. i.e. for
544+
// iso-offline-install-fromram.uefi we need to search for 'fromram' in
545+
// iso-offline-install-fromram, which is currently in components[0].
546+
if kola.HasString("fromram", strings.Split(components[0], "-")) {
547+
isISOFromRAM = true
548+
}
522549

523550
switch components[0] {
524551
case "pxe-offline-install", "pxe-online-install":
@@ -527,7 +554,7 @@ func runTestIso(cmd *cobra.Command, args []string) error {
527554
duration, err = testAsDisk(ctx, filepath.Join(outputDir, test))
528555
case "iso-live-login":
529556
duration, err = testLiveLogin(ctx, filepath.Join(outputDir, test))
530-
case "iso-install", "iso-offline-install":
557+
case "iso-install", "iso-offline-install", "iso-offline-install-fromram":
531558
duration, err = testLiveIso(ctx, inst, filepath.Join(outputDir, test), false)
532559
case "miniso-install":
533560
duration, err = testLiveIso(ctx, inst, filepath.Join(outputDir, test), true)
@@ -711,13 +738,15 @@ func testLiveIso(ctx context.Context, inst platform.Install, outdir string, mini
711738
return 0, err
712739
}
713740

741+
var isoKernelArgs []string
714742
var keys []string
715743
keys = append(keys, strings.TrimSpace(string(sshPubKeyBuf)))
716744
virtioJournalConfig.AddAuthorizedKeys("core", keys)
717745

718746
liveConfig := *virtioJournalConfig
719747
liveConfig.AddSystemdUnit("live-signal-ok.service", liveSignalOKUnit, conf.Enable)
720748
liveConfig.AddSystemdUnit("verify-no-efi-boot-entry.service", verifyNoEFIBootEntry, conf.Enable)
749+
liveConfig.AddSystemdUnit("iso-not-mounted-when-fromram.service", isoNotMountedUnit, conf.Enable)
721750
liveConfig.AddSystemdUnit("coreos-test-entered-emergency-target.service", signalFailureUnit, conf.Enable)
722751

723752
targetConfig := *virtioJournalConfig
@@ -738,7 +767,11 @@ func testLiveIso(ctx context.Context, inst platform.Install, outdir string, mini
738767
liveConfig.AddFile(nmstateConfigFile, nmstateConfig, 0644)
739768
}
740769

741-
mach, err := inst.InstallViaISOEmbed(nil, liveConfig, targetConfig, outdir, isOffline, minimal)
770+
if isISOFromRAM {
771+
isoKernelArgs = append(isoKernelArgs, liveISOFromRAMKarg)
772+
}
773+
774+
mach, err := inst.InstallViaISOEmbed(isoKernelArgs, liveConfig, targetConfig, outdir, isOffline, minimal)
742775
if err != nil {
743776
return 0, errors.Wrapf(err, "running iso install")
744777
}

0 commit comments

Comments
 (0)