Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm_ostree/installation.py: fix image deployment on s390x #6148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions pyanaconda/modules/payloads/payload/rpm_ostree/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
import glob
import os
from subprocess import CalledProcessError

import blivet.util
import gi
from blivet import arch

from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.core.configuration.anaconda import conf
Expand Down Expand Up @@ -584,6 +586,41 @@ def _set_kargs(self):

safe_exec_with_redirect("ostree", set_kargs_args, root=self._sysroot)

if arch.is_s390():
# Deployment was done. Enable ostree's zipl support; this is how things are currently done in e.g.
# https://github.com/coreos/coreos-assembler/blob/7d6fa376fc9f73625487adbb9386785bb09f1bb2/src/osbuild-manifests/coreos.osbuild.s390x.mpp.yaml#L261
safe_exec_with_redirect(
"ostree",
["config",
"--repo=" + self._sysroot + "/ostree/repo",
"set", "sysroot.bootloader", "zipl"]
)

for bls_path in sorted(glob.glob(self._sysroot + "/boot/loader/entries/*.conf")):
log.info("found %s", bls_path)
with open(bls_path, "r") as bls:
for line in bls.readlines():
if line.startswith("options "):
cmdline = line.split()[1]
if line.startswith("linux"):
kernel = self._sysroot + "/boot" + line.split()[1]
if line.startswith("initrd"):
initrd = self._sysroot + "/boot" + line.split()[1]
break

# pylint: disable=possibly-used-before-assignment
safe_exec_with_redirect(
"zipl",
["-V",
"-i",
kernel,
"-r",
initrd,
"-P",
f"\"{cmdline}\"",
"-t",
self._sysroot + "/boot"])


class DeployOSTreeTask(Task):
"""Task to deploy OSTree."""
Expand All @@ -608,6 +645,16 @@ def run(self):

self.report_progress(_("Deployment starting: {}").format(ref))

if arch.is_s390():
# Disable ostree's builtin zipl support; this is how things are currently done in e.g.
# https://github.com/coreos/coreos-assembler/blob/7d6fa376fc9f73625487adbb9386785bb09f1bb2/src/osbuild-manifests/coreos.osbuild.s390x.mpp.yaml#L168
safe_exec_with_redirect(
"ostree",
["config",
"--repo=" + self._physroot + "/ostree/repo",
"set", "sysroot.bootloader", "none"]
)

safe_exec_with_redirect(
"ostree",
["admin",
Expand Down
Loading