From b12140c3aa03907ddd3a1931e69f80f5f711591316a8afb70d629a239fc601c1 Mon Sep 17 00:00:00 2001 From: Mark Post Date: Thu, 7 Dec 2017 23:24:33 +0000 Subject: [PATCH] Accepting request 555141 from home:markkp:branches:Base:System - Added the following two patches (bsc#1071166): s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch OBS-URL: https://build.opensuse.org/request/show/555141 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=41 --- ...ing-chzdev-from-unknown-root-devices.patch | 53 ++++++++++++++++++ ...acut-module-aborting-on-unknown-root.patch | 54 +++++++++++++++++++ s390-tools.changes | 7 +++ s390-tools.spec | 4 ++ 4 files changed, 118 insertions(+) create mode 100644 s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch create mode 100644 s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch diff --git a/s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch b/s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch new file mode 100644 index 0000000..936ed2a --- /dev/null +++ b/s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch @@ -0,0 +1,53 @@ +From 2a6a28023bdfe127be68ac605f9a026a82884c80 Mon Sep 17 00:00:00 2001 +From: Peter Oberparleiter +Date: Tue, 5 Dec 2017 15:40:23 +0100 +Subject: [PATCH 1/4] zdev: Enable running chzdev from unknown root devices + +When a persistent device configuration is changed, chzdev tries to +find out if it needs to perform additional steps to make this change +persistent. If this check fails, for example because the root device +is located on a RAM-disk, or on a device type not managed by chzdev, +the tool reports an error and exits with non-zero exit code: + + chzdev: Could not determine device that provides / + +or + + chzdev: Could not determine device that provides loop0 + +This behavior unnecessarily restricts chzdev from being used in +scripted environments like an installation initial RAM-disk. + +Fix this by removing the non-zero exit code and moving the message to +verbose output mode only. + +Signed-off-by: Peter Oberparleiter +Signed-off-by: Michael Holzheu +--- + zdev/src/root.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/zdev/src/root.c b/zdev/src/root.c +index 7f0d39f..668bdbd 100644 +--- a/zdev/src/root.c ++++ b/zdev/src/root.c +@@ -35,9 +35,14 @@ exit_code_t root_check(void) + /* Get list of devices that provide the root device. */ + selected = selected_dev_list_new(); + rc = select_by_path(NULL, selected, config_active, scope_mandatory, +- NULL, NULL, PATH_ROOT, err_print); +- if (rc) ++ NULL, NULL, PATH_ROOT, err_ignore); ++ if (rc) { ++ /* Running from an unknown root device is not an error. */ ++ verb("Note: Could not determine if root device configuration " ++ "needs to be updated\n"); ++ rc = 0; + goto out; ++ } + + /* Determine if any of the devices or device types has been modified. */ + mod = strlist_new(); +-- +2.13.6 + diff --git a/s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch b/s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch new file mode 100644 index 0000000..355926f --- /dev/null +++ b/s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch @@ -0,0 +1,54 @@ +From 0348a8443e5f15636f86ef2533a7d6e8fa5d936d Mon Sep 17 00:00:00 2001 +From: Peter Oberparleiter +Date: Thu, 7 Dec 2017 17:21:11 +0100 +Subject: [PATCH 4/4] zdev: Fix zdev dracut module aborting on unknown root + device + +Running dracut when the root device is not known to zdev (for example +because it is located on a virtio block device) will cause the zdev +dracut module to incorrectly return an error in the installkernel() +function. As a result dracut aborts with an error. + +Fix this by ensuring that the non-zero exit code resulting from lszdev +not being able to determine the root device is not passed on to the +calling function. Also remove unnecessary error output in this case +by leaving the install() function early when the root device is not +known to zdev. + +Signed-off-by: Peter Oberparleiter +Signed-off-by: Michael Holzheu +--- + zdev/dracut/95zdev/module-setup.sh | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/zdev/dracut/95zdev/module-setup.sh b/zdev/dracut/95zdev/module-setup.sh +index 7c67cd7..4c13a65 100644 +--- a/zdev/dracut/95zdev/module-setup.sh ++++ b/zdev/dracut/95zdev/module-setup.sh +@@ -29,13 +29,21 @@ depends() { + } + + installkernel() { +- local _modules=$(lszdev --by-path / --columns MODULES --no-headings) ++ local _modules=$(lszdev --by-path / --columns MODULES --no-headings 2>/dev/null) + ++ [ -z "$_modules" ] && return 0 + [ ! -z "$_modules" ] && instmods $_modules + } + + install() { +- local _tempfile=$(mktemp --tmpdir dracut-zdev.XXXXXX) ++ local _tempfile ++ ++ # Exit early if root device type is unknown ++ if ! lszdev --by-path / >/dev/null 2>&1 ; then ++ return 0 ++ fi ++ ++ _tempfile=$(mktemp --tmpdir dracut-zdev.XXXXXX) + + if chzdev --export - --persistent --by-path / >/dev/null 2>&1 ; then + # Use persistent configuration +-- +2.13.6 + diff --git a/s390-tools.changes b/s390-tools.changes index e9cd935..eeb763b 100644 --- a/s390-tools.changes +++ b/s390-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Dec 7 23:08:31 UTC 2017 - mpost@suse.com + +- Added the following two patches (bsc#1071166): + s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch + s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch + ------------------------------------------------------------------- Tue Dec 5 17:49:35 UTC 2017 - mpost@suse.com diff --git a/s390-tools.spec b/s390-tools.spec index 05c5d60..3888f57 100644 --- a/s390-tools.spec +++ b/s390-tools.spec @@ -135,6 +135,8 @@ Patch27: s390-tools-sles15-lsluns-clarify-discovery-use-case-relation-to- Patch28: s390-tools-sles15-lsluns-point-out-IBM-Storwize-configuration-requirem.patch Patch29: s390-tools-sles15-lsluns-document-restriction-to-zfcp-only-systems.patch Patch30: s390-tools-sles15-lsluns-complement-alternative-tools-with-lszdev.patch +Patch31: s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch +Patch32: s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: s390 s390x @@ -221,6 +223,8 @@ to list files and directories. %patch28 -p1 %patch29 -p1 %patch30 -p1 +%patch31 -p1 +%patch32 -p1 cp -vi %{S:22} CAUTION