forked from pool/s390-tools
6a6c0cb679
*** v2.34.0 * Changes of existing tools: - ap_tools/ap-check: Add support for vfio-ap dynamic configuration - dbginfo.sh: Update/Add additional DASD data collection - dumpconf: Add new parameter 'SCP_DATA' for SCSI/NVMe/ECKD dump devices - libutil: Make formatted meta-data configurable - s390-tools: Replace 'which' with built-in 'command -v' - zdump/dfi_elf: Support core dumps of vr-kernels * Bug Fixes: - chzdev: Fix warning about failed ATTR writes by udev - rust/pv: Try again if first CRL-URI is invalid - rust/pvattest: Add short option for --arpk - zdump: Fix 'zgetdump -i' ioctl error on s390 formatted dump file *** v2.33.1 * Bug Fixes: - s390-tools: Fix formatting and typos in README.md - s390-tools: Fix release string *** v2.33.0 * Add new tools / libraries: - chpstat: New tool for displaying channel path statistics - libutil: Add output format helpers(util_fmt: JSON, JSON-SEQ, CSV, text pairs) * Changes of existing tools / libraries: - chzdev: Add --is-owner to identify files created by zdev - dasdfmt: Change default mode to always use full-format (Note: affects ESE DASD) - libap: Significantly reduce delay time between file lock retries - pvattest: Rewrite from C to Rust - pvattest: Support additional data & user-data - rust/pv: Support for Attestation * Bug Fixes: - chreipl: Improve disk type detection when running under QEMU - dbginfo.sh: Use POSIX option with uname - s390-tools: Fix missing hyphen escapes in the man page for many tools - zipl/src: Fix bugs in disk_get_info() reproducible in corner cases *** v2.32.0 * Changes of existing tools: - cpumf/lscpumf: add support for machine type 3932 - genprotimg, pvattest, and pvsecret accept IBM signing key with Armonk as subject locality - zdump/zipl: Support for List-Directed dump from ECKD DASD - zkey: Detect FIPS mode and generate PBKDF for luksFormat according to it * Bug Fixes: - dbginfo.sh: dash compatible copy sequence - rust/pv_core: Fix UvDeviceInfo::get() method - zipl/src: Fix leak of files if run with a broken configuration - zkey: Fix convert command to accept only keys of type CCA-AESDATA * Revendored vendor.tar.gz * Removed obsolete patches - s390-tools-sles15sp5-01-rust-pv-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-02-genprotimg-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-03-libpv-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-04-pvattest-Fix-root-ca-parsing.patch - s390-tools-sles15sp6-genprotimg-makefile.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=219
336 lines
7.8 KiB
Bash
336 lines
7.8 KiB
Bash
#!/bin/sh
|
|
|
|
function check_sysoper(){
|
|
local SYSOPER=$(vmcp q sysoper | cut -f4 -d" ")
|
|
local USERID=$(vmcp q userid | cut -f1 -d" ")"."
|
|
if [ "${SYSOPER}" == "${USERID}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_disc(){
|
|
local USERID=$(vmcp q userid | cut -f1 -d" ")
|
|
local DISCONNECTED=$(vmcp q ${USERID} | cut -f2 -d-)
|
|
if [ "${DISCONNECTED}" == " DSC" ]; then
|
|
return 1
|
|
else return 0
|
|
fi
|
|
}
|
|
|
|
function check_3270(){
|
|
local CONMODE=$(vmcp q term | sed -n -e '/CONMODE/ {s/CONMODE \([0-9]*\), .*$/\1/;p}')
|
|
if [ "${CONMODE}" == "3270" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_graf(){
|
|
local GRAF
|
|
GRAF=$(vmcp -b 1048576 q v graf 2>/dev/null | grep -v "^CONS" | grep "ON LDEV" )
|
|
if [ ${?} -eq 0 ] && [ -n "${GRAF}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_ascii_console(){
|
|
local SYSASCII=$(vmcp q v sysascii 2>/dev/null | grep "not attached to you")
|
|
if [ -z "${SYSASCII}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_tdisk(){
|
|
local TDISK=$(vmcp -b 1048576 q v dasd 2>/dev/null | grep TEMP)
|
|
if [ -n "${TDISK}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_ctc(){
|
|
local CTC
|
|
CTC=$(vmcp -b 1048576 q v ctc 2>/dev/null)
|
|
if [ ${?} -eq 0 ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_dynamic_switch(){
|
|
local SWCH
|
|
SWCH=$(vmcp -b 1048576 q v switches 2>/dev/null)
|
|
if [ ${?} -eq 0 ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_maint_mdisks(){
|
|
local MDISKS
|
|
MDISKS=$(vmcp -b 1048576 q v dasd | grep -E "0190|0191|0193|019D|019E")
|
|
if [ -n "${MDISKS}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_wrkalleg(){
|
|
local WRKALLEG
|
|
WRKALLEG=$(vmcp -b 1048576 q wrkalleg | grep "is not simulated")
|
|
if [ -z "${WRKALLEG}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_isolated_vswitch(){
|
|
local ISOLATED=0
|
|
local VSWITCH
|
|
|
|
# Find out if we have any NICs coupled to any VSWITCH or not. If not, we're OK.
|
|
VSWITCH=$(vmcp -b 1048576 q nic | sed -e '1~2 {N;s/\n//;}' | grep VSWITCH)
|
|
if [ -z "${VSWITCH}" ]; then
|
|
return 1
|
|
fi
|
|
|
|
ISOLATED=$(vmcp -b 1048576 q nic | sed -e '1~2 {N;s/\n//;}' | \
|
|
grep VSWITCH | \
|
|
sed -e 's/^.* VSWITCH: //' | \
|
|
while read owner name
|
|
do VSWITCH=$(vmcp -b 1048576 q vswitch $name | grep RDEV)
|
|
if [ -z "${VSWITCH}" ]; then
|
|
echo 1
|
|
fi
|
|
done)
|
|
|
|
if [ "${ISOLATED}" == "1" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_chpidvirt(){
|
|
local CHPIDV
|
|
CHPIDV=$(vmcp q chpidv 2>/dev/null | grep "CHPID Virtualization is on")
|
|
if [ -z "${CHPIDV}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_pci_functions(){
|
|
local PCIF
|
|
local RETCODE
|
|
PCIF=$(vmcp -b 1048576 q v pcif 2>/dev/null | grep "A PCI function was not found.")
|
|
RETCODE=${?}
|
|
if [ ${RETCODE} -eq 0 ] && [ -z "${PCIF}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_tape_assign(){
|
|
local TAPES
|
|
local RETCODE=1
|
|
TAPES=$(vmcp -b 1048576 q v tapes 2>/dev/null | grep "Device TAPE does not exist")
|
|
if [ -n "${TAPES}" ]; then
|
|
return 1
|
|
fi
|
|
|
|
TAPES=$(vmcp -b 1048576 q v tapes 2>/dev/null | grep "NOASSIGN")
|
|
if [ -n "${TAPES}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_open_spool(){
|
|
local QSPOOL
|
|
local OPENSPOOL=0
|
|
QSPOOL=$(vmcp -b 1048576 q pun \* all 2>/dev/null | grep "OPEN")
|
|
if [ -n "${QSPOOL}" ]; then
|
|
let OPENSPOOL=1
|
|
fi
|
|
|
|
QSPOOL=$(vmcp -b 1048576 q prt \* all 2>/dev/null | grep "OPEN" | grep -v " CON ")
|
|
if [ -n "${QSPOOL}" ]; then
|
|
let OPENSPOOL=1
|
|
fi
|
|
|
|
if [ ${OPENSPOOL} -eq 1 ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_xstore(){
|
|
local XSTOR
|
|
XSTOR=$(vmcp -b 1048576 q v xstor 2>/dev/null | grep "XSTORE = none")
|
|
if [ -z "${XSTOR}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function check_iucv(){
|
|
local QIUCV
|
|
QIUCV=$(vmcp -b 1048576 q iucv 2>/dev/null | grep -vE "^No IUCV paths exist|^Source| *MSG| *MSGALL")
|
|
if [ -n "${QIUCV}" ]; then
|
|
return 0
|
|
else return 1
|
|
fi
|
|
}
|
|
|
|
function usage(){
|
|
echo "Usage: ${0} [ -f ] [ -h ] devno|busid"
|
|
echo " -q Don't generate any output, just set a return code."
|
|
echo " -m Suppress the check for local minidisks."
|
|
echo " Only use this if you know for certain all minidisks for this"
|
|
echo " guest are NOT local to this instance of z/VM."
|
|
echo " -h Display this help message."
|
|
}
|
|
|
|
ARCH="$(/bin/uname -m)"
|
|
if [ "${ARCH}" != "s390x" ] && [ "${ARCH}" != "s390" ]; then
|
|
echo "This script is only useful on IBM mainframes."
|
|
exit 1
|
|
fi
|
|
|
|
HYPERVISOR=$(systemd-detect-virt)
|
|
if [ "${HYPERVISOR}" != "zvm" ]; then
|
|
echo "This script is only useful for guests of the z/VM hypervisor."
|
|
exit 1
|
|
fi
|
|
|
|
MDISK_SUPPRESS=0
|
|
msg="echo"
|
|
|
|
############################################################
|
|
# Parse the parameters from the command line
|
|
#
|
|
ARGS=$(getopt -a --options qhm -n "lgr_check" -- "$@")
|
|
if [ $? -ne 0 ]; then
|
|
usage
|
|
exit 3
|
|
fi
|
|
|
|
eval set -- "${ARGS}"
|
|
for ARG; do
|
|
case "${ARG}" in
|
|
-h) usage;
|
|
exit 0
|
|
;;
|
|
-m) let MDISK_SUPPRESS=1;
|
|
shift 1
|
|
;;
|
|
-q) msg="/bin/true"
|
|
shift 1
|
|
;;
|
|
--) shift 1
|
|
;;
|
|
*) ${msg} "Extraneous input detected: ${1}"
|
|
shift 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
let FAIL=0
|
|
##let COLS=$(stty -a | sed -n -e '/columns/{s/^.*columns \([0-9]*\);.*$/\1/;p}')
|
|
|
|
if [ ! -c /dev/vmcp ]; then
|
|
${msg} "Cannot find /dev/vmcp to issue z/VM CP commands."
|
|
exit 1
|
|
fi
|
|
|
|
${msg} "Checking for conditions that might prevent Live Guest Relocation"
|
|
|
|
if check_chpidvirt; then
|
|
${msg} "This guest does not have CHPID Virtualization set for it in the CP directory."
|
|
${msg} "Live Guest Relocation is absolutely not possible for this guest."
|
|
# exit 99
|
|
let FAIL=1
|
|
fi
|
|
if check_sysoper ; then
|
|
${msg} "This guest is currently the z/VM system operator."
|
|
let FAIL=1
|
|
fi
|
|
let GUEST_CONN=0
|
|
if check_disc; then
|
|
${msg} "The guest is not running disconnected."
|
|
let GUEST_CONN=1
|
|
let FAIL=1
|
|
fi
|
|
if check_3270; then
|
|
${msg} -n "The guest has a 3270 console, "
|
|
if [ ${GUEST_CONN} -eq 0 ]; then
|
|
${msg} "but it is not currently in use."
|
|
else ${msg} "and it is currently in use."
|
|
let FAIL=1
|
|
fi
|
|
fi
|
|
if check_graf; then
|
|
${msg} "The guest has a DIALED 3270 device in current use."
|
|
let FAIL=1
|
|
fi
|
|
if check_ascii_console; then
|
|
${msg} "The guest has the ASCII console attached to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_tdisk; then
|
|
${msg} "The guest has a temporary disk (T-disk) attached to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_ctc; then
|
|
${msg} "The guest has a Channel-to-Channel device (CTC) attached to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_dynamic_switch; then
|
|
${msg} "The guest has a dynamic switching device attached to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_wrkalleg; then
|
|
${msg} "The guest is currently using virtual working allegiance."
|
|
let FAIL=1
|
|
fi
|
|
if [ ${MDISK_SUPPRESS} -eq 0 ] && check_maint_mdisks; then
|
|
${msg} "The guest currently has one or more Minidisks that might be local to this instance of z/VM."
|
|
let FAIL=1
|
|
fi
|
|
if check_isolated_vswitch; then
|
|
${msg} "The guest is currently coupled to an isolated VSWITCH."
|
|
let FAIL=1
|
|
fi
|
|
if check_pci_functions; then
|
|
${msg} "The guest has PCI functions available to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_tape_assign; then
|
|
${msg} "The guest has potential problems with a tape."
|
|
let FAIL=1
|
|
fi
|
|
if check_open_spool; then
|
|
${msg} "The guest has an open SPOOL file that is not from the virtual console."
|
|
let FAIL=1
|
|
fi
|
|
if check_xstore; then
|
|
${msg} "The guest has Expanded Storage attached to it."
|
|
let FAIL=1
|
|
fi
|
|
if check_iucv; then
|
|
${msg} "The guest has an IUCV connection to a z/VM system service or another z/VM user."
|
|
let FAIL=1
|
|
fi
|
|
|
|
if [ ${FAIL} == 1 ]; then
|
|
${msg} "The guest is currently not eligible for Live Guest Relocation."
|
|
exit 1
|
|
else ${msg} "As far as can be determined from within the guest, it is currently eligible for Live Guest Relocation."
|
|
${msg} "This is not a guarantee. Other factors that cannot be checked from within the guest may prevent it from being eligible for LGR."
|
|
fi
|
|
|