s390-tools/mkdump.pl.suse

667 lines
16 KiB
Plaintext
Raw Normal View History

#!/usr/bin/perl
########################################################################
#
# mkdump.pl - Preparing disks for use as S/390 dump device
#
# Copyright (c) 2011 Tim Hardeck, SUSE LINUX Products GmbH
Accepting request 531958 from home:markkp:branches:Base:System - Modified mkdump perl script to work with the updated version of the IBM tools dasdview, zipl and zgetdump. (bsc#1020336). - Upgraded to version 2.1.0 (Fate#323291). Changes from 2.0.0 to 2.1.0 * Added the following tools: netboot: Scripts for building a PXE-style netboot image for KVM 90-cpi.rules/cpictl: New udev rule to update CPI when KVM is used * Modified lsqeth/zdev to add VNIC Characteristics support Bug fixes * chzcrypt: Corrected handling of insufficient permissions * cpacfstats: Add size setting to perf event * fdasd: Skip partition check with the force option * ttyrun: Fix deprecated BindTo usage in ttyrun-getty@.service.in * lszcrypt: Fix core dump caused by stack overwrite * lszcrypt: Fix random domain printout when no config available * zdev: Fix segfault with unknown qeth attribute * zdev: Fix IPv6 NDP proxy description * zdev: Fix zdev dracut module temp file location * zkey: Correctly detect abbreviated commands * zkey: Validate XTS key: ignore domain and card * zkey: Use octal values instead of S_IRWX* constants * zkey: Properly set umask to prohibit permissions to group and others * zkey: Add -ldl to LDLIBS (not LDFLAGS) * znetconf: Re-add missing line in lsznet.raw * Fix several gcc 7 warnings - Modified s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch to apply cleanly to this version. - Removed the following obsolete patches: * s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch * s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch * s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch * s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch * s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Added the following patches (bsc#1056498) - s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch - s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch - s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch - s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch - s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Upgraded to version 2.0.0 (Fate#323291). - Changes from 1.34.0 to 1.35.0 - cpuplugd: Make default config file location more distribution agnostic Add systemd service unit to start/stop the cpuplug daemon Add force-reload action to init script for LSB-compliance - mon_statd: Add force-reload action to init script for LSB-compliance - chiucvallow: corrected verification return code - lczdev/chzdev: Add support for resolving iSCSI block devices Bug fixes - chzdev, lszdev: Fix incorrect zfcp module parameter name - chreipl: Fix chreipl node for virtio devices - libus2s: Fix busid parsing - zipl/boot: Fix failed start subchannel in FBA loader - Changes from 1.35.0 to 1.36.0 - chzdev/lszdev: Add device resolution for vlan and bonding devices - dasdfmt: Add quick format support - lsdasd/fdasd/dasdfmt/zdsfs: Add query host access to volume support - zfcpdbf: Make timestamp the first field in record output Exclude Payload hex field from log message record output Add Area field to record output Add missing header fields to area record output Print the Record id field for Area area class records Mark oldest and newest trace area records Mark oldest and newest def_err pseudo area records Mark oldest and newest foreign area records Mark oldest and newest log message records Add a warning about low resolution timestamps Add Trace Area Statistics table to script output Add time zone command line option Add collection of domain xml files Bug fixes - zfcpdbf: Move and fix CPU id field output to print_header function Include microseconds in warning threshold calculation Fix parsing of precise syslog timestamps Fix labels for REC ERP action status and ERP step fields - Changes from 1.36.0 to 1.36.1 - zfcpdbf: Support basic HBA record type without warning Restore tracing of handle for port and LUN with HBA records Print full payload for all SAN traces (req, resp, iels) Print payload length everywhere applicable Disambiguate printing of payload record content Bug fixes - fdasd: Prevent buffer overflow - znetconf: Fix detection of chpids as OSX instead of OSM - Changes from 1.36.1 to 1.37.0 - Added dump2tar: sysfs collection helper for dbginfo.sh - qethconf: Remove check for OSN-device - znetconf: Remove OSN-support - lsdasd/tunedasd: Add channel path aware erp - zcrypt: Add multi domain support for zcrypt device driver - scm: Reimplement lsscm in C - chp: Reimplement chchp and lschp in C - dbginfo.sh: Make use of sysinfo collection helper Bug fixes - zfcpdbf: Only cap SAN short payload if pl_len exists - chzdev: Fix bug when configuring QETH devices - libu2s: Prevent buffer overflow - ziomon: No blktrace kill which can corrupt kernel blktrace state - Changes from 1.37.0 to 1.37.1 - dbginfo.sh: Add Docker debug data Bug fixes - lsdasd: Replace continue with return - lscss: Allow to specify devices from subchannel set 3 - mon_fsstatd: Only use physical filesystems Fix double free in error path - mon_procd: Fix segmentation fault - Changes from 1.37.1 to 1.38.0 - systemd: Add new units for cpi, dumpconf, mon_fsstatd, and mon_procd - fdasd: Add new command action 'l' to list known partition types - chmem: Try to online memory to zone movable Starting with kernel 4.13 (commit f1dd2cd1), the default zone for hotplug memory is changed from zone movable to zone normal. In order to preserve the previous default behaviour, chmem will now always try to set memory online to the zone movable, before trying to set it online to the default zone. - zfcpdbf: Print high part of "new" 64 bit SCSI LUN Print payload with full FCP_RSP IU in SCSI trace records - util_opt: Add command specific command line parsing - util_rec: Implement util_rec_iterate() function - util_rec: Record field values can be stored and processed in argz format Bug fixes - zipl/zgetdump: Add missing SCSI multipath dump information to man pages - lsqeth: Fix attributes name: ipa -> ipa_takeover and parp -> rxip Fix lsqeth output of ipa/vipa/rxip addresses of interfaces - zfcpdbf: Fix payload length for zfcp_dbf_hba_bit_err - chzdev: Add implicit qeth layer settings handling - qethqoat: Fix OSA 6S detection - Changes from 1.38.0 to 2.0.0 (also known as 1.39.0) - IBM changed the license to MIT. - Added zkey: Generate, re-encipher, and validate secure AES keys - cpumf: Add hardware counters for z13 and z13s - lscss: Reimplement lscss script in C - lsqeth: Reimplement lsqeth script in C Bug fixes - lscpumf: Fix Perl warnings - Removed the following obsolete patches: s390-tools-sles12sp2-chiucvallow-verify.patch s390-tools-sles12sp2-chreipl-virtio.patch s390-tools-sles12sp2-chzdev-disable-root-update.patch s390-tools-sles12sp2-lscss-allow-to-specify-devices-from-ssid-3.patch s390-tools-sles12sp2-zipl-fix-failed-start-subchannel.patch s390-tools-sles12sp3-chmem-try-to-online-zone-movable.patch s390-tools-sles12sp3-dasdfmt-01-Fix-behaviour-of-t-combined-with-y.patch s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch s390-tools-sles12sp3-dasdfmt-03-Apply-coding-convention.patch s390-tools-sles12sp3-dasdfmt-04-Use-enhanced-DASD-information.patch s390-tools-sles12sp3-dasdfmt-05-Refactor-do_format_dasd.patch s390-tools-sles12sp3-dasdfmt-06-Make-the-IOCTL-BLKSSZGET-reusable.patch s390-tools-sles12sp3-dasdfmt-07-Add-quick-format-support.patch s390-tools-sles12sp3-dasdfmt-08-Make-progress-output-reusable-and-add-ETR.patch s390-tools-sles12sp3-dasdfmt-09-Add-command-line-argument-check.patch s390-tools-sles12sp3-dasdfmt-10-Add-expand-format-mode.patch s390-tools-sles12sp3-dbginfo-01-libutil-Add-utility-functions.patch s390-tools-sles12sp3-dbginfo-02-dump2tar-Add-sysfs-collection-helper-for-dbginfo.sh-v2.patch s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch s390-tools-sles12sp3-dbginfo-Collect-docker-debug-data.patch s390-tools-sles12sp3-lsdasd-tunedasd-Add-channel-path-aware-erp.patch s390-tools-sles12sp3-mon_fsstatd-fix-double-free-in-error-path-and-skip-virtual-fs.patch s390-tools-sles12sp3-util_proc-fix-memory-allocation-error-messages.patch s390-tools-sles12sp3-ziomon-no-blktrace-kill-which-can-corrupt-kernel-blk.patch - Added s390-tools-sles15-add--ldl-to-LDLIBS.patch to fix a problem with zkey/Makefile. OBS-URL: https://build.opensuse.org/request/show/531958 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=19
2017-10-06 00:49:30 +02:00
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Based on mkdump.sh (c) 2004 Hannes Reinecke, SuSE AG
#
# License:
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
#
########################################################################
use strict;
use warnings;
use Fcntl;
use Getopt::Long;
my $VERSION = "2.0.4";
Accepting request 1041153 from home:markkp:branches:Base:System - Made extensive changes to the spec file to accomodate building this package on both openSUSE, which has implemented the "usrmerge" project, and SLES, which has not. This was accomplished by checking the usrmerged variable, and setting the value of the _mysbindir variable, accordingly. The files identified in the two versions. One for SLES, and one for openSUSE, with either ".suse" or ".opensuse" appended to the file name. The appropriate SOURCE variable is selected based on the usrmerged variable, and installed with the ".suse" or ".opensuse" suffix stripped from the name. * 59-graf.rules * dasd_configure * dasd_reload * detach_disks.sh * iucv_configure * killcdl * mkdump.pl * README.SUSE * s390-tools-sles12-update-by_id-links-on-change-and-add-action.patch * virtsetup.sh * vmlogrdr.service - Updated to version 2.24.0 (jsc#PED-627) * __v2.24.0 (2022-11-09)__ For Linux kernel version: 6.0 Add new tools / libraries: - Provide config files for checkpatch, codespell, and clang-format Changes of existing tools: - dbginfo.sh: Collect log from various distro tools (YaST, DNF, Anaconda) - dbginfo.sh: add Kubernetes data collection - libutil: Introduce util_lockfile - zdev: Add site-aware device configuration - zdump: Add support to read Protected Virtualization dumps - zipl/boot: Add secure boot trailer Bug Fixes: - ap_tools/ap-check: Reject start for control domains without usage - cpumf/lshwc: Fix incremented counter output - cpumf/pai: Fix core dump when summary flag set - dbginfo.sh: Ensure compatibility with /bin/dash shell - dbginfo.sh: Save dbginfo.sh version to dbginfo.log - zipl/src/zipl_helper.device-mapper: Fix bug in error path * __v2.23.0 (2022-08-18)__ For Linux kernel version: 5.19 Changes of existing tools: - Makefile: use common Make definition for DRACUTDIR - Makefile: use common Make definition for UDEVDIR and UDEVRULESDIR - cpacfstats: Add PAI and hotplug support - cpumf/pai: Omit file write progress information - dbginfo.sh: Get more details on lspci command - dumpconf: Prevent running the service in containers - libcpumf: Detect PMU named pai_ext - pvattest: Improve error reporting and logging - zdev: Add some --type ap examples to manpages - zkey: Use default benchmarked Argon2i with LUKS2 Bug Fixes: - dbginfo.sh: Fix accidental ftrace buffer shrinkage/free - genprotimg: Fix BIO_reset() returncode handling - libpv: Fix dependency checking - pvattest: Fix dependency checking - zipl: Fix segmentation fault when no parmline is provided * __v2.22.0 (2022-06-20)__ For Linux kernel version: 5.18 Add new tools / libraries: - ap_tools: Introduce ap_tools and the ap-check tool - cpumf/pai: Add Processor Activity Instrumentation tool - libpv: New library for PV tools - pvattest: Add new tool to create, perform, and verify attestation measurements - zipl/zdump: Add Next Gen Dump (NGDump) support Changes of existing tools: - Move man pages to System commands section (lscpumf, lshwc, pai, dbginfo.sh, zfcpdbf, zipl-switch-to-blscfg) - README.md: Add 70-chreipl-fcp-mpath.rules to the list of udev rule descriptions - Remove SysV related daemon scripts (cpacfstatsd, cpuplugd, mon_statd) - genprotimg: Move man page to section 1 for user commands - hyptop: increase initial update interval - libseckey: Adapt keymgmt_match() implementation to OpenSSL - libutil: Add util_exit_code - libutil: Introduce util_udev - zdev: Introduce the ap device type - zipl-editenv: Add zIPL multienvironment support - zipl: Implement sorting BLS entries by versions - zkey: Add initramfs hook Bug Fixes: - cmsfs-fuse: Fix enabling of hard_remove option - s390-tools: Fix typos that were detected by lintian as 'typo-in-manual-page' - zkey-kmip: Fix possible use after free - zkey: Fix EP11 host library version checking - zkey_kmip: Setup ext-lib once the APQNs have been configured * __v2.21.0 (2022-04-20)__ For Linux kernel version: 5.17 Add new tools / libraries: - libcpumf: Create library libcpumf for CPU Measurement functions Changes of existing tools: - chreipl-fcp-mpath: bundle a pre-cooked version of the manpage for build environments without access to `pandoc` - dbginfo.sh: Add multipath info to map paths to FC addressing and prio group - dbginfo.sh: Collect config files of systemd-modules-load.service - dbginfo.sh: Sort list of environment variables for readability - dbginfo.sh: Replace "which" by builtin command "type" - dbginfo.sh: Rework script formatting (indents, order) - dbginfo.sh: Update sysfs collection (excludes, messages) - genprotimg: Add Protected Virtualization (PV) dump support - genprotimg: Remove DigiCert root CA pinning - lszcrypt: Add CEX8S support - zcryptctl: Add control domain handling - zcryptstats: Add CEX8 support - zipl: Allow optional entries that are left out when files are missing - zipl: make IPL sections defined with BLS to inherit a target field - zpcictl: Add option to trigger firmware reset Bug Fixes: - cpictl: Handle excessive kernel version numbers - dbginfo.sh: Collect all places where modprobe.d config files could exist - fdasd: Fix endless menu loop on EOF - zdump/dfi: Fix segfault due to double free - zdump: Fix /dev/mem reading - zpcictl: Fix race of SCLP reset and Linux recovery * __v2.20.0 (2022-02-04)__ For Linux kernel version: 5.16 Add new tools / libraries: - Add EditorConfig configuration Changes of existing tools: - s390-tools switches to Fuse 3 as Fuse 2 is deprecated. Affected tools: cmsfs, hmcdrvfs, hsavmcore, zdsfs, zdump - chreipl-fcp-mpath: don't compress the manpage before installing it - cpictl: Report extended version information - genprotimg: Add extended kernel command line support - zdev: modify the lsblk output parser in lszdev - zipl: Add support for longer kernel command lines (now supports up to 64k length) Bug Fixes: - cpictl: Suppress messages for unwritable sysfs files - dbginfo.sh: Fix missing syslog for step create_package - lshwc: Fix CPU list parameter setup for device driver - zdev: Check for errors when removing a devtype setting - zdev: Fix path resolution for multi-mount point file systems - Updated s390-tools-sles15sp3-remove-no-pie-link-arguments.patch to fit the new version, and renamed it to s390-tools-sles15sp5-remove-no-pie-link-arguments.patch. - Added s390-tools-sles15sp5-util_lockfile-fix-includes.patch to fix a compilation problem. One source file was missing an include statement for unistd.h. - Added s390-tools-sles15sp5-ap_tools-ap-check-use-new-mdevctl-install-location.patch An executable binary was being installed under /etc, which is an FHS violation. - Modified spec file to * Change BuildRequires for fuse-devel to fuse3-devel. * Remove obsolete BuildRequires for libpfm-devel * Add a BuildRequires for mdevctl and systemd-devel * Added a %files entry for dir %{_prefix}/lib/dracut/modules.d/99ngdump * Added %config(noreplace) for the new file %{_sysconfdir}/ziplenv * Uncomment the %files entry for %{_mandir}/man7/chreipl-fcp-mpath.7%{?ext_man} Specifying ENABLE_DOC=1 is no longer needed for it to be generated. * Add %dir entries for %{_prefix}/lib/mdevctl, %{_prefix}/lib/mdevctl/scripts.d, and %{_prefix}/lib/mdevctl/scripts.d/callouts NOTE that these directories do not belong to this package, but the mdevctl package has yet to be updated to claim them. So, until that happens, we have to temporarily claim ownership of them for the s390-tools package to build. - Updated the s390-tools-rpmlintrc file to suppress two warnings about the /boot/zipl/active_devices.txt file. - Removed the following obsolete patches: * s390-tools-sles15sp4-chreipl-fcp-mpath-don-t-compress-the-manpage-before-.patch * s390-tools-sles15sp4-chreipl-fcp-mpath-remove-shebang-from-chreipl-fcp-mp.patch * s390-tools-sles15sp4-zdev-modify-the-lsblk-output-parser-in-lszdev.patch * s390-tools-sles15sp4-zdev-Fix-path-resolution-for-multi-mount-point-file-.patch * s390-tools-sles15sp4-01-genprotimg-remove-DigiCert-root-CA-pinning.patch * s390-tools-sles15sp4-02-genprotimg-check_hostkeydoc-relax-default-issuer-che.patch * s390-tools-sles15sp4-libseckey-Fix-re-enciphering-of-EP11-secure-key.patch * s390-tools-sles15sp4-zdump-fix-segfault-due-to-double-free.patch * s390-tools-sles15sp4-libseckey-Adapt-keymgmt_match-implementation-to-Open.patch * s390-tools-sles15sp4-genprotimg-boot-disable-Warray-bounds-for-now.patch * s390-tools-sles15sp4-hyptop-increase-initial-update-interval.patch * s390-tools-sles15sp4-zipl-boot-add-secure-boot-trailer.patch - Added s390-tools-sles15sp5-zipl-boot-disable-Warray-bounds-for-now.patch With this version, the same false positive of "array subscript 0 is outside array bounds" that was previously seen in the genprotimage/boot directory is now happening in zipl/boot. - Added s390-tools-sles15sp5-fix-chown-commands-syntax.patch to eliminate a bunch of warnings. The new version of chown complains if the deprecated 'owner.group' syntax is used instead of the 'owner:group' syntax. - Added s390-tools-sles15sp4-zipl-boot-add-secure-boot-trailer.patch for bsc#1204965. New IBM Z firmware requires all signed boot images to contain a trailing data block with a specific format. - Added s390-tools-sles15sp4-hyptop-increase-initial-update-interval.patch for bsc#1201412. Initial iteration of hyptop can produce bloated values independent from the update delay set by the user. - Added s390-tools-sles15sp4-genprotimg-boot-disable-Warray-bounds-for-now.patch to fix a build failure with gcc12. With gcc12, a "false positive" of "array subscript 0 is outside array bounds" is seen in genprotimg/boot/stage3a.c (bsc#1200131). OBS-URL: https://build.opensuse.org/request/show/1041153 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=139
2022-12-07 16:36:05 +01:00
my $BLKID = "/sbin/blkid";
my $PARTED = "/usr/sbin/parted";
Accepting request 1041153 from home:markkp:branches:Base:System - Made extensive changes to the spec file to accomodate building this package on both openSUSE, which has implemented the "usrmerge" project, and SLES, which has not. This was accomplished by checking the usrmerged variable, and setting the value of the _mysbindir variable, accordingly. The files identified in the two versions. One for SLES, and one for openSUSE, with either ".suse" or ".opensuse" appended to the file name. The appropriate SOURCE variable is selected based on the usrmerged variable, and installed with the ".suse" or ".opensuse" suffix stripped from the name. * 59-graf.rules * dasd_configure * dasd_reload * detach_disks.sh * iucv_configure * killcdl * mkdump.pl * README.SUSE * s390-tools-sles12-update-by_id-links-on-change-and-add-action.patch * virtsetup.sh * vmlogrdr.service - Updated to version 2.24.0 (jsc#PED-627) * __v2.24.0 (2022-11-09)__ For Linux kernel version: 6.0 Add new tools / libraries: - Provide config files for checkpatch, codespell, and clang-format Changes of existing tools: - dbginfo.sh: Collect log from various distro tools (YaST, DNF, Anaconda) - dbginfo.sh: add Kubernetes data collection - libutil: Introduce util_lockfile - zdev: Add site-aware device configuration - zdump: Add support to read Protected Virtualization dumps - zipl/boot: Add secure boot trailer Bug Fixes: - ap_tools/ap-check: Reject start for control domains without usage - cpumf/lshwc: Fix incremented counter output - cpumf/pai: Fix core dump when summary flag set - dbginfo.sh: Ensure compatibility with /bin/dash shell - dbginfo.sh: Save dbginfo.sh version to dbginfo.log - zipl/src/zipl_helper.device-mapper: Fix bug in error path * __v2.23.0 (2022-08-18)__ For Linux kernel version: 5.19 Changes of existing tools: - Makefile: use common Make definition for DRACUTDIR - Makefile: use common Make definition for UDEVDIR and UDEVRULESDIR - cpacfstats: Add PAI and hotplug support - cpumf/pai: Omit file write progress information - dbginfo.sh: Get more details on lspci command - dumpconf: Prevent running the service in containers - libcpumf: Detect PMU named pai_ext - pvattest: Improve error reporting and logging - zdev: Add some --type ap examples to manpages - zkey: Use default benchmarked Argon2i with LUKS2 Bug Fixes: - dbginfo.sh: Fix accidental ftrace buffer shrinkage/free - genprotimg: Fix BIO_reset() returncode handling - libpv: Fix dependency checking - pvattest: Fix dependency checking - zipl: Fix segmentation fault when no parmline is provided * __v2.22.0 (2022-06-20)__ For Linux kernel version: 5.18 Add new tools / libraries: - ap_tools: Introduce ap_tools and the ap-check tool - cpumf/pai: Add Processor Activity Instrumentation tool - libpv: New library for PV tools - pvattest: Add new tool to create, perform, and verify attestation measurements - zipl/zdump: Add Next Gen Dump (NGDump) support Changes of existing tools: - Move man pages to System commands section (lscpumf, lshwc, pai, dbginfo.sh, zfcpdbf, zipl-switch-to-blscfg) - README.md: Add 70-chreipl-fcp-mpath.rules to the list of udev rule descriptions - Remove SysV related daemon scripts (cpacfstatsd, cpuplugd, mon_statd) - genprotimg: Move man page to section 1 for user commands - hyptop: increase initial update interval - libseckey: Adapt keymgmt_match() implementation to OpenSSL - libutil: Add util_exit_code - libutil: Introduce util_udev - zdev: Introduce the ap device type - zipl-editenv: Add zIPL multienvironment support - zipl: Implement sorting BLS entries by versions - zkey: Add initramfs hook Bug Fixes: - cmsfs-fuse: Fix enabling of hard_remove option - s390-tools: Fix typos that were detected by lintian as 'typo-in-manual-page' - zkey-kmip: Fix possible use after free - zkey: Fix EP11 host library version checking - zkey_kmip: Setup ext-lib once the APQNs have been configured * __v2.21.0 (2022-04-20)__ For Linux kernel version: 5.17 Add new tools / libraries: - libcpumf: Create library libcpumf for CPU Measurement functions Changes of existing tools: - chreipl-fcp-mpath: bundle a pre-cooked version of the manpage for build environments without access to `pandoc` - dbginfo.sh: Add multipath info to map paths to FC addressing and prio group - dbginfo.sh: Collect config files of systemd-modules-load.service - dbginfo.sh: Sort list of environment variables for readability - dbginfo.sh: Replace "which" by builtin command "type" - dbginfo.sh: Rework script formatting (indents, order) - dbginfo.sh: Update sysfs collection (excludes, messages) - genprotimg: Add Protected Virtualization (PV) dump support - genprotimg: Remove DigiCert root CA pinning - lszcrypt: Add CEX8S support - zcryptctl: Add control domain handling - zcryptstats: Add CEX8 support - zipl: Allow optional entries that are left out when files are missing - zipl: make IPL sections defined with BLS to inherit a target field - zpcictl: Add option to trigger firmware reset Bug Fixes: - cpictl: Handle excessive kernel version numbers - dbginfo.sh: Collect all places where modprobe.d config files could exist - fdasd: Fix endless menu loop on EOF - zdump/dfi: Fix segfault due to double free - zdump: Fix /dev/mem reading - zpcictl: Fix race of SCLP reset and Linux recovery * __v2.20.0 (2022-02-04)__ For Linux kernel version: 5.16 Add new tools / libraries: - Add EditorConfig configuration Changes of existing tools: - s390-tools switches to Fuse 3 as Fuse 2 is deprecated. Affected tools: cmsfs, hmcdrvfs, hsavmcore, zdsfs, zdump - chreipl-fcp-mpath: don't compress the manpage before installing it - cpictl: Report extended version information - genprotimg: Add extended kernel command line support - zdev: modify the lsblk output parser in lszdev - zipl: Add support for longer kernel command lines (now supports up to 64k length) Bug Fixes: - cpictl: Suppress messages for unwritable sysfs files - dbginfo.sh: Fix missing syslog for step create_package - lshwc: Fix CPU list parameter setup for device driver - zdev: Check for errors when removing a devtype setting - zdev: Fix path resolution for multi-mount point file systems - Updated s390-tools-sles15sp3-remove-no-pie-link-arguments.patch to fit the new version, and renamed it to s390-tools-sles15sp5-remove-no-pie-link-arguments.patch. - Added s390-tools-sles15sp5-util_lockfile-fix-includes.patch to fix a compilation problem. One source file was missing an include statement for unistd.h. - Added s390-tools-sles15sp5-ap_tools-ap-check-use-new-mdevctl-install-location.patch An executable binary was being installed under /etc, which is an FHS violation. - Modified spec file to * Change BuildRequires for fuse-devel to fuse3-devel. * Remove obsolete BuildRequires for libpfm-devel * Add a BuildRequires for mdevctl and systemd-devel * Added a %files entry for dir %{_prefix}/lib/dracut/modules.d/99ngdump * Added %config(noreplace) for the new file %{_sysconfdir}/ziplenv * Uncomment the %files entry for %{_mandir}/man7/chreipl-fcp-mpath.7%{?ext_man} Specifying ENABLE_DOC=1 is no longer needed for it to be generated. * Add %dir entries for %{_prefix}/lib/mdevctl, %{_prefix}/lib/mdevctl/scripts.d, and %{_prefix}/lib/mdevctl/scripts.d/callouts NOTE that these directories do not belong to this package, but the mdevctl package has yet to be updated to claim them. So, until that happens, we have to temporarily claim ownership of them for the s390-tools package to build. - Updated the s390-tools-rpmlintrc file to suppress two warnings about the /boot/zipl/active_devices.txt file. - Removed the following obsolete patches: * s390-tools-sles15sp4-chreipl-fcp-mpath-don-t-compress-the-manpage-before-.patch * s390-tools-sles15sp4-chreipl-fcp-mpath-remove-shebang-from-chreipl-fcp-mp.patch * s390-tools-sles15sp4-zdev-modify-the-lsblk-output-parser-in-lszdev.patch * s390-tools-sles15sp4-zdev-Fix-path-resolution-for-multi-mount-point-file-.patch * s390-tools-sles15sp4-01-genprotimg-remove-DigiCert-root-CA-pinning.patch * s390-tools-sles15sp4-02-genprotimg-check_hostkeydoc-relax-default-issuer-che.patch * s390-tools-sles15sp4-libseckey-Fix-re-enciphering-of-EP11-secure-key.patch * s390-tools-sles15sp4-zdump-fix-segfault-due-to-double-free.patch * s390-tools-sles15sp4-libseckey-Adapt-keymgmt_match-implementation-to-Open.patch * s390-tools-sles15sp4-genprotimg-boot-disable-Warray-bounds-for-now.patch * s390-tools-sles15sp4-hyptop-increase-initial-update-interval.patch * s390-tools-sles15sp4-zipl-boot-add-secure-boot-trailer.patch - Added s390-tools-sles15sp5-zipl-boot-disable-Warray-bounds-for-now.patch With this version, the same false positive of "array subscript 0 is outside array bounds" that was previously seen in the genprotimage/boot directory is now happening in zipl/boot. - Added s390-tools-sles15sp5-fix-chown-commands-syntax.patch to eliminate a bunch of warnings. The new version of chown complains if the deprecated 'owner.group' syntax is used instead of the 'owner:group' syntax. - Added s390-tools-sles15sp4-zipl-boot-add-secure-boot-trailer.patch for bsc#1204965. New IBM Z firmware requires all signed boot images to contain a trailing data block with a specific format. - Added s390-tools-sles15sp4-hyptop-increase-initial-update-interval.patch for bsc#1201412. Initial iteration of hyptop can produce bloated values independent from the update delay set by the user. - Added s390-tools-sles15sp4-genprotimg-boot-disable-Warray-bounds-for-now.patch to fix a build failure with gcc12. With gcc12, a "false positive" of "array subscript 0 is outside array bounds" is seen in genprotimg/boot/stage3a.c (bsc#1200131). OBS-URL: https://build.opensuse.org/request/show/1041153 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=139
2022-12-07 16:36:05 +01:00
my $FDASD = "/sbin/fdasd";
my $DASDVIEW = "/sbin/dasdview";
my $DASDFMT = "/sbin/dasdfmt";
my $ZIPL = "/sbin/zipl";
my $UDEVADM = "/sbin/udevadm";
my $ZGETDUMP = "/sbin/zgetdump";
# temporary DASD device configuration file for Zipl
my $MDPATH = "/tmp/mvdump.conf.".`mcookie`;
chomp($MDPATH);
my $OPT_DEBUG = 0;
my $OPT_FORCE = 0;
my $OPT_VERBOSE = 0;
sub cleanup
{
# DASD
if (-e $MDPATH) {
system("rm -f $MDPATH");
}
}
sub exit_with
{
my $message = shift();
my $exitcode = shift();
print STDERR "$message Exiting...\n";
cleanup();
# fdasd isn't able to create volume label interactively
# could be fixed with a reformat
if ($exitcode == 65280) {
$exitcode = 12;
}
# bigger exit codes are not supported
if ($exitcode > 255) {
$exitcode = 255;
}
exit($exitcode);
}
sub run_cmd
{
my $cmd = shift();
my $output = "";
if (! $OPT_DEBUG) {
my ($app) = $cmd =~ /\/(\w+) /;
# run command
$output = `$cmd`;
my $exit_code = $?;
# wait for udev to finish processing
system("$UDEVADM settle");
# only print output in case of an error or in verbose mode
if ($output and ($exit_code != 0 or $OPT_VERBOSE)) {
print("$output\n");
}
if ($exit_code != 0) {
exit_with("$app failed with exit code $exit_code", $exit_code);
}
} else {
# only print the command in debug mode
print("\`$cmd\`\n");
}
return($output);
}
sub check_paths
{
for my $path ($BLKID, $PARTED, $FDASD, $DASDVIEW, $DASDFMT, $ZIPL, $UDEVADM, $ZGETDUMP) {
unless ( -x $path) {
exit_with("Command $path is not available.", 13);
}
}
}
sub read_file
{
my $path = shift();
open(my $file, "<", "$path") or exit_with("Unable to access $path: $!.", 15);
my @content = <$file>;
close($file);
# no need for arrays in case of single lines
if (@content > 1) {
return @content;
} else {
chomp($content[0]);
return($content[0]);
}
}
sub is_dasd
{
# remove leading /dev/
my $device = substr(shift(), 5);
if (-r "/sys/block/$device/device/discipline") {
return(1);
} else {
return(0);
}
}
sub has_free_single_kpartx
{
my $device = substr(shift(), 5);
return(0) unless ($device =~ /^dm-[0-9]+$/);
my $blockpath = "/sys/block/$device";
my @holders = glob("$blockpath/holders/*");
return(0) unless (@holders == 1);
my $dmuuid = read_file("$holders[0]/dm/uuid");
return(0) unless ($dmuuid =~ /^part1-mpath-/);
my @holderparts = split(/\//, $holders[0]);
my $holder = "/dev/" . $holderparts[-1];
if(-b $holder and sysopen(my $blockdev, $holder, O_RDWR|O_EXCL)) {
close($blockdev);
return(1);
}
return(0);
}
sub is_zfcp
{
# remove leading /dev/
my $device = substr(shift(), 5);
my $blockpath = "/sys/block/$device";
my $dmname = undef;
# if user passed a device name on cmdline that we listed before
# convert to a dm-[0-9]+ kernel device name
if ($device =~ /^mapper\//) {
$device = substr(readlink("/dev/" . $device), 3);
$blockpath = "/sys/block/" . $device;
}
# check if dm-multipath and get one path member
if ($device =~ /^dm-[0-9]+$/) {
my $dmuuid = read_file("$blockpath/dm/uuid");
return(undef) unless $dmuuid =~ /^mpath-/;
$dmname = read_file("$blockpath/dm/name");
opendir(DIR, "$blockpath/slaves/") or return(undef);
while (defined(my $pathmember = readdir(DIR))) {
# skip ".", "..", or other non scsi disk entries
next unless $pathmember =~ /^sd[a-z]+$/;
$device = $pathmember;
last;
}
closedir(DIR);
}
my $devpath = "/sys/block/$device/device";
unless (-r "$devpath/hba_id" or -r "$devpath/type") {
return(undef);
}
my $devtype = read_file("$devpath/type");
# SCSI type '0' means disk
if ($devtype == 0) {
if (defined $dmname) {
return("/dev/mapper/$dmname");
} else {
return("/dev/$device");
}
} else {
return(undef);
}
}
sub get_partition_num
{
# remove leading /dev/
my $device = substr(shift, 5);
my $part_num = grep(/\s+$device\d+/, read_file("/proc/partitions"));
return($part_num);
}
sub print_device
{
my $device = shift();
my $only_dump_disks = shift();
my $devpath;
if ($device =~ /^\/dev\/mapper\//) {
$devpath = "/sys/block/" . substr(readlink($device), 3);
} else {
$devpath = "/sys/block/" . substr($device, 5);
}
my $output = $device;
my $dump_device = 0;
my $size = int(read_file("$devpath/size") / 2048); # 512 Byte blocks
# size can't be read this way in case of unformatted devices
if ($size != 0) {
$output .= "\t${size}MB";
} else {
$output .= "\tunknown";
}
if (is_dasd($device)) {
my ($busid) = readlink("$devpath/device") =~ /(\w\.\w\.\w{4})/;
$output .= "\t$busid";
# check for dump record and list multi volumes
my $zgetdump_output = `$ZGETDUMP -d $device 2>&1`;
my @dump_devs = $zgetdump_output =~ /(\w\.\w\.\w{4})/g;
if (@dump_devs) {
$dump_device = 1;
$output .= "\tdumpdevice";
# no need to output the dump ids for a single device
if (@dump_devs > 1) {
for my $id (@dump_devs) {
$output .= "|$id";
}
}
} else {
# check for single volume dump devices
if ($zgetdump_output =~ /Single-volume DASD dump tool/) {
$dump_device = 1;
$output .= "\tdumpdevice";
}
}
} else {
# get one path member to fill path info for "yast onpanic"
if ($device =~ /^\/dev\/mapper\//) {
my $blockdev = substr(readlink($device), 3);
my $blockpath = "/sys/block/" . $blockdev;
opendir(DIR, "$blockpath/slaves/") or return(undef);
while (defined(my $pathmember = readdir(DIR))) {
# skip ".", "..", or other non scsi disk entries
next unless $pathmember =~ /^sd[a-z]+$/;
$devpath = "/sys/block/" . $pathmember;
last;
}
closedir(DIR);
}
my $adapter = read_file("$devpath/device/hba_id");
my $wwpn = read_file("$devpath/device/wwpn");
my $lun = read_file("$devpath/device/fcp_lun");
$output .= "\t$adapter\t$wwpn\t$lun";
# check for dump record
my $zgetdump = `$ZGETDUMP -d $device 2>&1`;
if ($? == 0) {
my ($dsize) = ($zgetdump =~ /Maximum dump size\.:\s+([0-9]+) MB/m);
$dsize = $size unless (defined($dsize));
$output = "$device\t${dsize}MB\t$adapter\t$wwpn\t$lun\tdumpdevice";
Accepting request 531958 from home:markkp:branches:Base:System - Modified mkdump perl script to work with the updated version of the IBM tools dasdview, zipl and zgetdump. (bsc#1020336). - Upgraded to version 2.1.0 (Fate#323291). Changes from 2.0.0 to 2.1.0 * Added the following tools: netboot: Scripts for building a PXE-style netboot image for KVM 90-cpi.rules/cpictl: New udev rule to update CPI when KVM is used * Modified lsqeth/zdev to add VNIC Characteristics support Bug fixes * chzcrypt: Corrected handling of insufficient permissions * cpacfstats: Add size setting to perf event * fdasd: Skip partition check with the force option * ttyrun: Fix deprecated BindTo usage in ttyrun-getty@.service.in * lszcrypt: Fix core dump caused by stack overwrite * lszcrypt: Fix random domain printout when no config available * zdev: Fix segfault with unknown qeth attribute * zdev: Fix IPv6 NDP proxy description * zdev: Fix zdev dracut module temp file location * zkey: Correctly detect abbreviated commands * zkey: Validate XTS key: ignore domain and card * zkey: Use octal values instead of S_IRWX* constants * zkey: Properly set umask to prohibit permissions to group and others * zkey: Add -ldl to LDLIBS (not LDFLAGS) * znetconf: Re-add missing line in lsznet.raw * Fix several gcc 7 warnings - Modified s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch to apply cleanly to this version. - Removed the following obsolete patches: * s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch * s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch * s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch * s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch * s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Added the following patches (bsc#1056498) - s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch - s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch - s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch - s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch - s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Upgraded to version 2.0.0 (Fate#323291). - Changes from 1.34.0 to 1.35.0 - cpuplugd: Make default config file location more distribution agnostic Add systemd service unit to start/stop the cpuplug daemon Add force-reload action to init script for LSB-compliance - mon_statd: Add force-reload action to init script for LSB-compliance - chiucvallow: corrected verification return code - lczdev/chzdev: Add support for resolving iSCSI block devices Bug fixes - chzdev, lszdev: Fix incorrect zfcp module parameter name - chreipl: Fix chreipl node for virtio devices - libus2s: Fix busid parsing - zipl/boot: Fix failed start subchannel in FBA loader - Changes from 1.35.0 to 1.36.0 - chzdev/lszdev: Add device resolution for vlan and bonding devices - dasdfmt: Add quick format support - lsdasd/fdasd/dasdfmt/zdsfs: Add query host access to volume support - zfcpdbf: Make timestamp the first field in record output Exclude Payload hex field from log message record output Add Area field to record output Add missing header fields to area record output Print the Record id field for Area area class records Mark oldest and newest trace area records Mark oldest and newest def_err pseudo area records Mark oldest and newest foreign area records Mark oldest and newest log message records Add a warning about low resolution timestamps Add Trace Area Statistics table to script output Add time zone command line option Add collection of domain xml files Bug fixes - zfcpdbf: Move and fix CPU id field output to print_header function Include microseconds in warning threshold calculation Fix parsing of precise syslog timestamps Fix labels for REC ERP action status and ERP step fields - Changes from 1.36.0 to 1.36.1 - zfcpdbf: Support basic HBA record type without warning Restore tracing of handle for port and LUN with HBA records Print full payload for all SAN traces (req, resp, iels) Print payload length everywhere applicable Disambiguate printing of payload record content Bug fixes - fdasd: Prevent buffer overflow - znetconf: Fix detection of chpids as OSX instead of OSM - Changes from 1.36.1 to 1.37.0 - Added dump2tar: sysfs collection helper for dbginfo.sh - qethconf: Remove check for OSN-device - znetconf: Remove OSN-support - lsdasd/tunedasd: Add channel path aware erp - zcrypt: Add multi domain support for zcrypt device driver - scm: Reimplement lsscm in C - chp: Reimplement chchp and lschp in C - dbginfo.sh: Make use of sysinfo collection helper Bug fixes - zfcpdbf: Only cap SAN short payload if pl_len exists - chzdev: Fix bug when configuring QETH devices - libu2s: Prevent buffer overflow - ziomon: No blktrace kill which can corrupt kernel blktrace state - Changes from 1.37.0 to 1.37.1 - dbginfo.sh: Add Docker debug data Bug fixes - lsdasd: Replace continue with return - lscss: Allow to specify devices from subchannel set 3 - mon_fsstatd: Only use physical filesystems Fix double free in error path - mon_procd: Fix segmentation fault - Changes from 1.37.1 to 1.38.0 - systemd: Add new units for cpi, dumpconf, mon_fsstatd, and mon_procd - fdasd: Add new command action 'l' to list known partition types - chmem: Try to online memory to zone movable Starting with kernel 4.13 (commit f1dd2cd1), the default zone for hotplug memory is changed from zone movable to zone normal. In order to preserve the previous default behaviour, chmem will now always try to set memory online to the zone movable, before trying to set it online to the default zone. - zfcpdbf: Print high part of "new" 64 bit SCSI LUN Print payload with full FCP_RSP IU in SCSI trace records - util_opt: Add command specific command line parsing - util_rec: Implement util_rec_iterate() function - util_rec: Record field values can be stored and processed in argz format Bug fixes - zipl/zgetdump: Add missing SCSI multipath dump information to man pages - lsqeth: Fix attributes name: ipa -> ipa_takeover and parp -> rxip Fix lsqeth output of ipa/vipa/rxip addresses of interfaces - zfcpdbf: Fix payload length for zfcp_dbf_hba_bit_err - chzdev: Add implicit qeth layer settings handling - qethqoat: Fix OSA 6S detection - Changes from 1.38.0 to 2.0.0 (also known as 1.39.0) - IBM changed the license to MIT. - Added zkey: Generate, re-encipher, and validate secure AES keys - cpumf: Add hardware counters for z13 and z13s - lscss: Reimplement lscss script in C - lsqeth: Reimplement lsqeth script in C Bug fixes - lscpumf: Fix Perl warnings - Removed the following obsolete patches: s390-tools-sles12sp2-chiucvallow-verify.patch s390-tools-sles12sp2-chreipl-virtio.patch s390-tools-sles12sp2-chzdev-disable-root-update.patch s390-tools-sles12sp2-lscss-allow-to-specify-devices-from-ssid-3.patch s390-tools-sles12sp2-zipl-fix-failed-start-subchannel.patch s390-tools-sles12sp3-chmem-try-to-online-zone-movable.patch s390-tools-sles12sp3-dasdfmt-01-Fix-behaviour-of-t-combined-with-y.patch s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch s390-tools-sles12sp3-dasdfmt-03-Apply-coding-convention.patch s390-tools-sles12sp3-dasdfmt-04-Use-enhanced-DASD-information.patch s390-tools-sles12sp3-dasdfmt-05-Refactor-do_format_dasd.patch s390-tools-sles12sp3-dasdfmt-06-Make-the-IOCTL-BLKSSZGET-reusable.patch s390-tools-sles12sp3-dasdfmt-07-Add-quick-format-support.patch s390-tools-sles12sp3-dasdfmt-08-Make-progress-output-reusable-and-add-ETR.patch s390-tools-sles12sp3-dasdfmt-09-Add-command-line-argument-check.patch s390-tools-sles12sp3-dasdfmt-10-Add-expand-format-mode.patch s390-tools-sles12sp3-dbginfo-01-libutil-Add-utility-functions.patch s390-tools-sles12sp3-dbginfo-02-dump2tar-Add-sysfs-collection-helper-for-dbginfo.sh-v2.patch s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch s390-tools-sles12sp3-dbginfo-Collect-docker-debug-data.patch s390-tools-sles12sp3-lsdasd-tunedasd-Add-channel-path-aware-erp.patch s390-tools-sles12sp3-mon_fsstatd-fix-double-free-in-error-path-and-skip-virtual-fs.patch s390-tools-sles12sp3-util_proc-fix-memory-allocation-error-messages.patch s390-tools-sles12sp3-ziomon-no-blktrace-kill-which-can-corrupt-kernel-blk.patch - Added s390-tools-sles15-add--ldl-to-LDLIBS.patch to fix a problem with zkey/Makefile. OBS-URL: https://build.opensuse.org/request/show/531958 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=19
2017-10-06 00:49:30 +02:00
$dump_device = 1;
}
}
if ($only_dump_disks) {
if ($dump_device) {
print("$output\n");
}
} else {
print("$output\n");
}
}
sub list_free_disks
{
my $devices_ref = shift();
my $type = shift();
if (@$devices_ref) {
for my $device (@$devices_ref) {
print_device($device);
}
} else {
print STDERR "No free $type devices available!\n";
}
}
sub list_dump_disks
{
my @devices = @_;
if (@devices) {
for my $device (@devices) {
print_device($device, 1);
}
} else {
print STDERR "No dump devices available!\n";
}
}
sub determine_free_disks
{
my @dasd;
my @zfcp;
my @devices;
# gather block devices
my $path="/sys/block/";
opendir(DIR, $path) or exit_with("Unable to find $path: $!", 15);
while (defined(my $file = readdir(DIR))) {
# no need to add other devices then dasd* or sd*
# or dm-multipath
if ($file =~ /^dasd[a-z]+$/ or $file =~ /^sd[a-z]+$/ or
$file =~ /^dm-[0-9]+$/) {
push(@devices, $file);
}
}
closedir(DIR);
for my $entry (@devices) {
# only allow disks, no partitions
my ($device) = $entry =~ /^([a-z]+)$/;
# dm devices other than dm-multipath are filtered by is_zfcp()
($device) = $entry =~ /^(dm-[0-9]+)$/ unless ($device);
next unless ($device);
$device = "/dev/$device";
# determine if the block device could be accessed exclusively
if(-b $device and sysopen(my $blockdev, $device, O_RDWR|O_EXCL)) {
close($blockdev);
if (is_dasd($device)) {
push(@dasd, $device);
}
my $zfcp = is_zfcp($device);
if (defined $zfcp) {
push(@zfcp, $zfcp);
}
} else {
# A dm-multipath device with a single holder
# being a kpartx partition number 1 could still
# be free or contain a zfcpdump boot record.
# Due to the kpartx linear dm mapping, such
# dm-multipath device cannot open exclusively.
if (has_free_single_kpartx($device)) {
my $zfcp = is_zfcp($device);
if (defined $zfcp) {
push(@zfcp, $zfcp);
}
}
}
# wait for udev to process all events triggered by sysopen(,O_EXCL)
system("$UDEVADM settle");
}
return(\@dasd, \@zfcp);
}
sub prepare_dasd
{
my @devices = @_;
my $format_disks = "";
# check formatting
for my $device (@devices) {
# determine disk layout
Accepting request 531958 from home:markkp:branches:Base:System - Modified mkdump perl script to work with the updated version of the IBM tools dasdview, zipl and zgetdump. (bsc#1020336). - Upgraded to version 2.1.0 (Fate#323291). Changes from 2.0.0 to 2.1.0 * Added the following tools: netboot: Scripts for building a PXE-style netboot image for KVM 90-cpi.rules/cpictl: New udev rule to update CPI when KVM is used * Modified lsqeth/zdev to add VNIC Characteristics support Bug fixes * chzcrypt: Corrected handling of insufficient permissions * cpacfstats: Add size setting to perf event * fdasd: Skip partition check with the force option * ttyrun: Fix deprecated BindTo usage in ttyrun-getty@.service.in * lszcrypt: Fix core dump caused by stack overwrite * lszcrypt: Fix random domain printout when no config available * zdev: Fix segfault with unknown qeth attribute * zdev: Fix IPv6 NDP proxy description * zdev: Fix zdev dracut module temp file location * zkey: Correctly detect abbreviated commands * zkey: Validate XTS key: ignore domain and card * zkey: Use octal values instead of S_IRWX* constants * zkey: Properly set umask to prohibit permissions to group and others * zkey: Add -ldl to LDLIBS (not LDFLAGS) * znetconf: Re-add missing line in lsznet.raw * Fix several gcc 7 warnings - Modified s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch to apply cleanly to this version. - Removed the following obsolete patches: * s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch * s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch * s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch * s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch * s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Added the following patches (bsc#1056498) - s390-tools-sles15-zgetdump-Fix-gcc-7-warning.patch - s390-tools-sles15-lscss-Get-rid-of-gcc-7-buffer-truncation-warnings.patch - s390-tools-sles15-Get-rid-of-gcc-7-fall-through-warnings.patch - s390-tools-sles15-lszcrypt-Fix-core-dump-caused-by-stack-overwrite.patch - s390-tools-sles15-dasdinfo-Fix-GCC-7-overflow-warning.patch - Upgraded to version 2.0.0 (Fate#323291). - Changes from 1.34.0 to 1.35.0 - cpuplugd: Make default config file location more distribution agnostic Add systemd service unit to start/stop the cpuplug daemon Add force-reload action to init script for LSB-compliance - mon_statd: Add force-reload action to init script for LSB-compliance - chiucvallow: corrected verification return code - lczdev/chzdev: Add support for resolving iSCSI block devices Bug fixes - chzdev, lszdev: Fix incorrect zfcp module parameter name - chreipl: Fix chreipl node for virtio devices - libus2s: Fix busid parsing - zipl/boot: Fix failed start subchannel in FBA loader - Changes from 1.35.0 to 1.36.0 - chzdev/lszdev: Add device resolution for vlan and bonding devices - dasdfmt: Add quick format support - lsdasd/fdasd/dasdfmt/zdsfs: Add query host access to volume support - zfcpdbf: Make timestamp the first field in record output Exclude Payload hex field from log message record output Add Area field to record output Add missing header fields to area record output Print the Record id field for Area area class records Mark oldest and newest trace area records Mark oldest and newest def_err pseudo area records Mark oldest and newest foreign area records Mark oldest and newest log message records Add a warning about low resolution timestamps Add Trace Area Statistics table to script output Add time zone command line option Add collection of domain xml files Bug fixes - zfcpdbf: Move and fix CPU id field output to print_header function Include microseconds in warning threshold calculation Fix parsing of precise syslog timestamps Fix labels for REC ERP action status and ERP step fields - Changes from 1.36.0 to 1.36.1 - zfcpdbf: Support basic HBA record type without warning Restore tracing of handle for port and LUN with HBA records Print full payload for all SAN traces (req, resp, iels) Print payload length everywhere applicable Disambiguate printing of payload record content Bug fixes - fdasd: Prevent buffer overflow - znetconf: Fix detection of chpids as OSX instead of OSM - Changes from 1.36.1 to 1.37.0 - Added dump2tar: sysfs collection helper for dbginfo.sh - qethconf: Remove check for OSN-device - znetconf: Remove OSN-support - lsdasd/tunedasd: Add channel path aware erp - zcrypt: Add multi domain support for zcrypt device driver - scm: Reimplement lsscm in C - chp: Reimplement chchp and lschp in C - dbginfo.sh: Make use of sysinfo collection helper Bug fixes - zfcpdbf: Only cap SAN short payload if pl_len exists - chzdev: Fix bug when configuring QETH devices - libu2s: Prevent buffer overflow - ziomon: No blktrace kill which can corrupt kernel blktrace state - Changes from 1.37.0 to 1.37.1 - dbginfo.sh: Add Docker debug data Bug fixes - lsdasd: Replace continue with return - lscss: Allow to specify devices from subchannel set 3 - mon_fsstatd: Only use physical filesystems Fix double free in error path - mon_procd: Fix segmentation fault - Changes from 1.37.1 to 1.38.0 - systemd: Add new units for cpi, dumpconf, mon_fsstatd, and mon_procd - fdasd: Add new command action 'l' to list known partition types - chmem: Try to online memory to zone movable Starting with kernel 4.13 (commit f1dd2cd1), the default zone for hotplug memory is changed from zone movable to zone normal. In order to preserve the previous default behaviour, chmem will now always try to set memory online to the zone movable, before trying to set it online to the default zone. - zfcpdbf: Print high part of "new" 64 bit SCSI LUN Print payload with full FCP_RSP IU in SCSI trace records - util_opt: Add command specific command line parsing - util_rec: Implement util_rec_iterate() function - util_rec: Record field values can be stored and processed in argz format Bug fixes - zipl/zgetdump: Add missing SCSI multipath dump information to man pages - lsqeth: Fix attributes name: ipa -> ipa_takeover and parp -> rxip Fix lsqeth output of ipa/vipa/rxip addresses of interfaces - zfcpdbf: Fix payload length for zfcp_dbf_hba_bit_err - chzdev: Add implicit qeth layer settings handling - qethqoat: Fix OSA 6S detection - Changes from 1.38.0 to 2.0.0 (also known as 1.39.0) - IBM changed the license to MIT. - Added zkey: Generate, re-encipher, and validate secure AES keys - cpumf: Add hardware counters for z13 and z13s - lscss: Reimplement lscss script in C - lsqeth: Reimplement lsqeth script in C Bug fixes - lscpumf: Fix Perl warnings - Removed the following obsolete patches: s390-tools-sles12sp2-chiucvallow-verify.patch s390-tools-sles12sp2-chreipl-virtio.patch s390-tools-sles12sp2-chzdev-disable-root-update.patch s390-tools-sles12sp2-lscss-allow-to-specify-devices-from-ssid-3.patch s390-tools-sles12sp2-zipl-fix-failed-start-subchannel.patch s390-tools-sles12sp3-chmem-try-to-online-zone-movable.patch s390-tools-sles12sp3-dasdfmt-01-Fix-behaviour-of-t-combined-with-y.patch s390-tools-sles12sp3-dasdfmt-02-Fix-trailing-whitespace.patch s390-tools-sles12sp3-dasdfmt-03-Apply-coding-convention.patch s390-tools-sles12sp3-dasdfmt-04-Use-enhanced-DASD-information.patch s390-tools-sles12sp3-dasdfmt-05-Refactor-do_format_dasd.patch s390-tools-sles12sp3-dasdfmt-06-Make-the-IOCTL-BLKSSZGET-reusable.patch s390-tools-sles12sp3-dasdfmt-07-Add-quick-format-support.patch s390-tools-sles12sp3-dasdfmt-08-Make-progress-output-reusable-and-add-ETR.patch s390-tools-sles12sp3-dasdfmt-09-Add-command-line-argument-check.patch s390-tools-sles12sp3-dasdfmt-10-Add-expand-format-mode.patch s390-tools-sles12sp3-dbginfo-01-libutil-Add-utility-functions.patch s390-tools-sles12sp3-dbginfo-02-dump2tar-Add-sysfs-collection-helper-for-dbginfo.sh-v2.patch s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch s390-tools-sles12sp3-dbginfo-Collect-docker-debug-data.patch s390-tools-sles12sp3-lsdasd-tunedasd-Add-channel-path-aware-erp.patch s390-tools-sles12sp3-mon_fsstatd-fix-double-free-in-error-path-and-skip-virtual-fs.patch s390-tools-sles12sp3-util_proc-fix-memory-allocation-error-messages.patch s390-tools-sles12sp3-ziomon-no-blktrace-kill-which-can-corrupt-kernel-blk.patch - Added s390-tools-sles15-add--ldl-to-LDLIBS.patch to fix a problem with zkey/Makefile. OBS-URL: https://build.opensuse.org/request/show/531958 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=19
2017-10-06 00:49:30 +02:00
my ($fmtstr) = `$DASDVIEW -x $device` =~ /(\w\w\w) formatted/;
SWITCH:
for($fmtstr) {
if (/NOT/) {
print("Unformatted disk, formatting $device.\n");
$format_disks .= " $device";
last SWITCH;
}
if (/LDL/) {
if ($OPT_FORCE) {
print("Linux disk layout, reformatting $device.\n");
$format_disks .= " $device";
} else {
print("$device was formatted with the Linux disk layout.\n");
print("Unable to use it without reformatting.\n");
exit_with("Re-issue the mkdump command with the --force option.", 12);
}
last SWITCH;
}
if (/CDL/) {
# allow reformatting with force, since fdasd isn't able to create volume label interactively
if ($OPT_FORCE) {
print("Compatible disk layout, force reformatting $device.\n");
$format_disks .= " $device";
} else {
print("$device: Compatible disk layout, Ok to use.\n");
}
last SWITCH;
}
exit_with("Unknown layout ($fmtstr), cannot use disk.", 11);
}
}
# format devices
if ($format_disks) {
#up to eight devices in parallel
run_cmd("$DASDFMT -P 8 -b 4096 -y -f $format_disks");
}
# check partitioning and partition
for my $device (@devices) {
my $part_num = get_partition_num($device);
if ($part_num == 0 or $OPT_FORCE) {
print("Re-partitioning disk $device.\n");
run_cmd("$FDASD -a $device");
} else {
# allow disk with one partition if it don't consist a file system
if ($part_num == 1) {
my ($fstype) = `$BLKID ${device}1` =~ /TYPE=\"(\w+)\"/;
if ($fstype) {
exit_with("Device ${device}1 already contains a filesystem of type $fstype.", 12);
}
} else {
exit_with("$part_num partitions detected, cannot use disk $device.", 12);
}
}
}
}
sub setup_dasddump
{
my @devices = @_;
prepare_dasd(@devices);
# create zipl device configuration file
# don't create files in debug mode
unless ($OPT_DEBUG) {
open(my $file, ">", $MDPATH) or exit_with("Unable to access $MDPATH: $!.", 15);
for my $device (@devices) {
print{$file}("${device}1\n");
}
close($file);
}
print("Creating dump record.\n");
run_cmd("${ZIPL} -V -n -M $MDPATH");
cleanup();
}
sub setup_zfcpdump
{
my $device = shift();
# check partitioning
my $part_num = get_partition_num($device);
if ($part_num == 0 or $OPT_FORCE) {
print("Re-partitioning disk $device.\n");
run_cmd("$PARTED -s -- $device mklabel gpt mkpart primary 0 -1");
} else {
if ($part_num > 1) {
exit_with("$part_num partitions detected, cannot use disk $device.", 12);
}
}
# install bootloader
print("Creating dump record.\n");
my $partdev;
if ($device =~ /^\/dev\/mapper\//) {
$partdev = $device . "-part1"; # kpartx partition on multipath
} else {
$partdev = $device . "1"; # real partition, single path SCSI
}
run_cmd("${ZIPL} -V -d ${partdev}");
cleanup();
}
sub print_version
{
print << "EOF";
mkdump $VERSION
Copyright (c) 2011 SUSE LINUX Products GmbH
License GPLv2 or (at your option) any later version.
<http://www.gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Tim Hardeck <thardeck\@suse.de>.
EOF
exit(0);
}
sub print_usage
{
my $exitcode = shift();
print << "EOF";
Usage: mkdump [OPTIONS] [DEVICE]...
mkdump $VERSION
Prepare one or more volumes for use as S/390 dump device. Supported devices
are ECKD DASD and SCSI over zFCP disks, while multi-volumes are limited to DASD.
Only whole disks can be used, no partitions! If the device is incompatible
formatted/partioned, the script will refuse to install the dump record
unless the --force switch is given.
Disks which are in use or have mounted partitions will not be listed and can't be used.
The mentioning of "dumpdevice" after a disk indicates that it is an already usable dump device. Additionally multi-volume dump devices are indicated by the list of including DASD ids.
Options:
-h, --help display this help and exit
-V, --version display version information and exit
-d, --debug debug mode, do not run programs which commit changes
-v, --verbose be verbose and show command outputs
-f, --force force overwrite of the disk
-l, --list-dump display dump disks
-D, --list-dasd display usable DASD disks (Device, Size, ID, Dump)
-Z, --list-zfcp display usable SCSI over zFCP disks (Device, Size, ID, WWPN, LUN, Dump)
Report bugs on https://bugzilla.novell.com/
EOF
exit($exitcode);
}
sub analyze_cmd_parameters
{
#verbose, debug and force are global
my $opt_help = 0;
my $opt_version = 0;
my $opt_dump = 0;
my $opt_dasd = 0;
my $opt_zfcp = 0;
if (@ARGV == 0) {
print_usage(14);
}
Getopt::Long::Configure('bundling');
GetOptions(
'h|help' => \$opt_help,
'V|version' => \$opt_version,
'd|debug' => \$OPT_DEBUG,
'v|verbose' => \$OPT_VERBOSE,
'f|force' => \$OPT_FORCE,
'l|list-dump' => \$opt_dump,
'D|list-dasd' => \$opt_dasd,
'Z|list-zfcp' => \$opt_zfcp,
) or print_usage(14);
if ($opt_help) {
print_usage(0);
}
if ($opt_version) {
print_version();
}
# determine free dasd and zfcp devices
my ($dasd_ref, $zfcp_ref) = determine_free_disks();
if ($opt_dump) {
list_dump_disks(@$dasd_ref, @$zfcp_ref);
exit 0;
}
if ($opt_dasd) {
list_free_disks(\@$dasd_ref, "dasd");
}
if ($opt_zfcp) {
list_free_disks(\@$zfcp_ref, "zfcp");
}
# allow listing of both device types at the same time
if ($opt_dasd or $opt_zfcp) {
exit 0;
}
# check provided devices and be strict
my @devices;
for my $device (@ARGV) {
if (grep(/$device/, @devices)) {
exit_with("$device is mentioned more than once.", 14);
}
# dm devices other than dm-multipath are filtered by is_zfcp()
if ( $device =~ /^\/dev\/[a-z]+$/ == 0 and
$device !~ /^\/dev\/mapper\// ) {
exit_with("The device parameter $device is inaccurate. Only whole disks are allowed.", 14);
}
if (grep(/$device/, (@$dasd_ref, @$zfcp_ref))) {
my $zfcp = is_zfcp($device);
if (defined $zfcp and @ARGV > 1) {
exit_with("Multi-volume dumps aren't supported with zFCP.", 14);
}
push(@devices, (defined $zfcp) ? $zfcp : $device);
} else {
if (-b $device) {
exit_with("$device is in use or not a DASD/zFCP disk!", 14);
} else {
exit_with("$device does not exist!", 14);
}
}
}
if (@devices == 0) {
exit_with("No usable devices where provided.", 14);
}
return(@devices);
}
sub main
{
check_paths();
my @devices = analyze_cmd_parameters();
# only one dump device is possible with zFCP which is enforced in analyze_cmd_parameters
my $zfcp = is_zfcp($devices[0]);
if (defined $zfcp) {
setup_zfcpdump($zfcp);
} else {
setup_dasddump(@devices);
}
print("Creating the dump device was successful.\n");
}
main();