s390-tools/mkdump.pl.opensuse
Mark Post cab6866186 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 15:36:05 +00:00

578 lines
13 KiB
Perl

#!/usr/bin/perl
########################################################################
#
# mkdump.pl - Preparing disks for use as S/390 dump device
#
# Copyright (c) 2011 Tim Hardeck, SUSE LINUX Products GmbH
# 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.3";
my $BLKID = "/usr/sbin/blkid";
my $PARTED = "/usr/sbin/parted";
my $FDASD = "/usr/sbin/fdasd";
my $DASDVIEW = "/usr/sbin/dasdview";
my $DASDFMT = "/usr/sbin/dasdfmt";
my $ZIPL = "/usr/sbin/zipl";
my $UDEVADM = "/usr/sbin/udevadm";
my $ZGETDUMP = "/usr/sbin/zgetdump";
# temporary DASD device configuration file for Zipl
my $MDPATH = "/tmp/mvdump.conf.".`mcookie`;
# zFCP dump dir, without a leading '/'
my $ZFCP_DUMP_DIR = "mydumps";
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 is_zfcp
{
# remove leading /dev/
my $device = substr(shift(), 5);
my $devpath = "/sys/block/$device/device";
unless (-r "$devpath/hba_id" or -r "$devpath/type") {
return(0);
}
my $devtype = read_file("$devpath/type");
# SCSI type '0' means disk
if ($devtype == 0) {
return(1);
} else {
return(0);
}
}
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 = "/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 {
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";
$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*
if ($file =~ /^dasd[a-z]+$/ or $file =~ /^sd[a-z]+$/) {
push(@devices, $file);
}
}
closedir(DIR);
for my $entry (@devices) {
# only allow disks, no partitions
my ($device) = $entry =~ /^([a-z]+)$/;
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);
}
if (is_zfcp($device)) {
push(@zfcp, $device);
}
}
# 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
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");
run_cmd("${ZIPL} -V -d ${device}1");
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);
}
if ( $device =~ /^\/dev\/[a-z]+$/ == 0) {
exit_with("The device parameter $device is inaccurate. Only whole disks are allowed.", 14);
}
if (grep(/$device/, (@$dasd_ref, @$zfcp_ref))) {
if (is_zfcp($device) and @ARGV > 1) {
exit_with("Multi-volume dumps aren't supported with zFCP.", 14);
}
push(@devices, $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
if (is_zfcp($devices[0])) {
setup_zfcpdump($devices[0]);
} else {
setup_dasddump(@devices);
}
print("Creating the dump device was successful.\n");
}
main();