Removed Python 2 and Python 3.5- support
Deprecation of Python versions below 3.6 gives opportunity to unify the build and install requirements for OpenZFS packages. The minimal supported Python version is 3.6 as this is the most recent Python package CentOS/RHEL 7 users can get. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12925
This commit is contained in:
parent
e202d3b867
commit
07cc8ae46a
|
@ -1,13 +1,8 @@
|
||||||
bin_SCRIPTS = arc_summary
|
bin_SCRIPTS = arc_summary
|
||||||
|
|
||||||
CLEANFILES = arc_summary
|
CLEANFILES = arc_summary
|
||||||
EXTRA_DIST = arc_summary2 arc_summary3
|
EXTRA_DIST = arc_summary3
|
||||||
|
|
||||||
if USING_PYTHON_2
|
|
||||||
SCRIPT = arc_summary2
|
|
||||||
else
|
|
||||||
SCRIPT = arc_summary3
|
SCRIPT = arc_summary3
|
||||||
endif
|
|
||||||
|
|
||||||
arc_summary: $(SCRIPT)
|
arc_summary: $(SCRIPT)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -191,21 +191,13 @@ elif sys.platform.startswith('linux'):
|
||||||
# there, so we fall back on modinfo
|
# there, so we fall back on modinfo
|
||||||
command = ["/sbin/modinfo", request, "-0"]
|
command = ["/sbin/modinfo", request, "-0"]
|
||||||
|
|
||||||
# The recommended way to do this is with subprocess.run(). However,
|
|
||||||
# some installed versions of Python are < 3.5, so we offer them
|
|
||||||
# the option of doing it the old way (for now)
|
|
||||||
info = ''
|
info = ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
if 'run' in dir(subprocess):
|
info = subprocess.run(command, stdout=subprocess.PIPE,
|
||||||
info = subprocess.run(command, stdout=subprocess.PIPE,
|
check=True, universal_newlines=True)
|
||||||
universal_newlines=True)
|
raw_output = info.stdout.split('\0')
|
||||||
raw_output = info.stdout.split('\0')
|
|
||||||
else:
|
|
||||||
info = subprocess.check_output(command,
|
|
||||||
universal_newlines=True)
|
|
||||||
raw_output = info.split('\0')
|
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print("Error: Descriptions not available",
|
print("Error: Descriptions not available",
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
# @hdr is the array of fields that needs to be printed, so we
|
# @hdr is the array of fields that needs to be printed, so we
|
||||||
# just iterate over this array and print the values using our pretty printer.
|
# just iterate over this array and print the values using our pretty printer.
|
||||||
#
|
#
|
||||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
# This script must remain compatible with Python 3.6+.
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
# Copyright (C) 2013 Lawrence Livermore National Security, LLC.
|
# Copyright (C) 2013 Lawrence Livermore National Security, LLC.
|
||||||
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||||
#
|
#
|
||||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
# This script must remain compatible with and Python 3.6+.
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
dnl #
|
dnl #
|
||||||
dnl # The majority of the python scripts are written to be compatible
|
dnl # The majority of the python scripts are written to be compatible
|
||||||
dnl # with Python 2.6 and Python 3.4. Therefore, they may be installed
|
dnl # with Python 3.6. This option is intended to
|
||||||
dnl # and used with either interpreter. This option is intended to
|
|
||||||
dnl # to provide a method to specify the default system version, and
|
dnl # to provide a method to specify the default system version, and
|
||||||
dnl # set the PYTHON environment variable accordingly.
|
dnl # set the PYTHON environment variable accordingly.
|
||||||
dnl #
|
dnl #
|
||||||
|
@ -13,9 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||||
[with_python=check])
|
[with_python=check])
|
||||||
|
|
||||||
AS_CASE([$with_python],
|
AS_CASE([$with_python],
|
||||||
[check], [AC_CHECK_PROGS([PYTHON], [python3 python2], [:])],
|
[check], [AC_CHECK_PROGS([PYTHON], [python3], [:])],
|
||||||
[2*], [PYTHON="python${with_python}"],
|
|
||||||
[*python2*], [PYTHON="${with_python}"],
|
|
||||||
[3*], [PYTHON="python${with_python}"],
|
[3*], [PYTHON="python${with_python}"],
|
||||||
[*python3*], [PYTHON="${with_python}"],
|
[*python3*], [PYTHON="${with_python}"],
|
||||||
[no], [PYTHON=":"],
|
[no], [PYTHON=":"],
|
||||||
|
@ -23,8 +20,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||||
)
|
)
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Minimum supported Python versions for utilities:
|
dnl # Minimum supported Python versions for utilities: Python 3.6
|
||||||
dnl # Python 2.6 or Python 3.4
|
|
||||||
dnl #
|
dnl #
|
||||||
AM_PATH_PYTHON([], [], [:])
|
AM_PATH_PYTHON([], [], [:])
|
||||||
AS_IF([test -z "$PYTHON_VERSION"], [
|
AS_IF([test -z "$PYTHON_VERSION"], [
|
||||||
|
@ -33,25 +29,16 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||||
PYTHON_MINOR=${PYTHON_VERSION#*\.}
|
PYTHON_MINOR=${PYTHON_VERSION#*\.}
|
||||||
|
|
||||||
AS_CASE([$PYTHON_VERSION],
|
AS_CASE([$PYTHON_VERSION],
|
||||||
[2.*], [
|
|
||||||
AS_IF([test $PYTHON_MINOR -lt 6],
|
|
||||||
[AC_MSG_ERROR("Python >= 2.6 is required")])
|
|
||||||
],
|
|
||||||
[3.*], [
|
[3.*], [
|
||||||
AS_IF([test $PYTHON_MINOR -lt 4],
|
AS_IF([test $PYTHON_MINOR -lt 6],
|
||||||
[AC_MSG_ERROR("Python >= 3.4 is required")])
|
[AC_MSG_ERROR("Python >= 3.6 is required")])
|
||||||
],
|
],
|
||||||
[:|2|3], [],
|
[:|2|3], [],
|
||||||
[PYTHON_VERSION=3]
|
[PYTHON_VERSION=3]
|
||||||
)
|
)
|
||||||
|
|
||||||
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
|
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
|
||||||
AM_CONDITIONAL([USING_PYTHON_2], [test "x${PYTHON_VERSION%%\.*}" = x2])
|
AC_SUBST([PYTHON_SHEBANG], [python3])
|
||||||
AM_CONDITIONAL([USING_PYTHON_3], [test "x${PYTHON_VERSION%%\.*}" = x3])
|
|
||||||
|
|
||||||
AM_COND_IF([USING_PYTHON_2],
|
|
||||||
[AC_SUBST([PYTHON_SHEBANG], [python2])],
|
|
||||||
[AC_SUBST([PYTHON_SHEBANG], [python3])])
|
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Request that packages be built for a specific Python version.
|
dnl # Request that packages be built for a specific Python version.
|
||||||
|
|
|
@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Determines if pyzfs can be built, requires Python 2.7 or later.
|
dnl # Determines if pyzfs can be built, requires Python 3.6 or later.
|
||||||
dnl #
|
dnl #
|
||||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
|
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
|
||||||
AC_ARG_ENABLE([pyzfs],
|
AC_ARG_ENABLE([pyzfs],
|
||||||
|
@ -72,12 +72,11 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl #
|
dnl #
|
||||||
dnl # Require python-devel libraries
|
dnl # Require python3-devel libraries
|
||||||
dnl #
|
dnl #
|
||||||
AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
|
AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
|
||||||
AS_CASE([$PYTHON_VERSION],
|
AS_CASE([$PYTHON_VERSION],
|
||||||
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.4.0'"],
|
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.6.0'"],
|
||||||
[2.*], [PYTHON_REQUIRED_VERSION=">= '2.7.0'"],
|
|
||||||
[AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
|
[AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,12 @@ setup(
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.4",
|
|
||||||
"Programming Language :: Python :: 3.5",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
"Topic :: System :: Filesystems",
|
"Topic :: System :: Filesystems",
|
||||||
"Topic :: Software Development :: Libraries",
|
"Topic :: Software Development :: Libraries",
|
||||||
],
|
],
|
||||||
|
@ -53,7 +52,7 @@ setup(
|
||||||
setup_requires=[
|
setup_requires=[
|
||||||
"cffi",
|
"cffi",
|
||||||
],
|
],
|
||||||
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<4',
|
python_requires='>=3.6,<4',
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
test_suite="libzfs_core.test",
|
test_suite="libzfs_core.test",
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
# Set the default udev directory based on distribution.
|
# Set the default udev directory based on distribution.
|
||||||
%if %{undefined _udevdir}
|
%if %{undefined _udevdir}
|
||||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 || 0%{?openEuler}
|
%if 0%{?fedora}%{?rhel}%{?centos}%{?openEuler}
|
||||||
%global _udevdir %{_prefix}/lib/udev
|
%global _udevdir %{_prefix}/lib/udev
|
||||||
%else
|
%else
|
||||||
%global _udevdir /lib/udev
|
%global _udevdir /lib/udev
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
# Set the default udevrule directory based on distribution.
|
# Set the default udevrule directory based on distribution.
|
||||||
%if %{undefined _udevruledir}
|
%if %{undefined _udevruledir}
|
||||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 || 0%{?openEuler}
|
%if 0%{?fedora}%{?rhel}%{?centos}%{?openEuler}
|
||||||
%global _udevruledir %{_prefix}/lib/udev/rules.d
|
%global _udevruledir %{_prefix}/lib/udev/rules.d
|
||||||
%else
|
%else
|
||||||
%global _udevruledir /lib/udev/rules.d
|
%global _udevruledir /lib/udev/rules.d
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
# Set the default dracut directory based on distribution.
|
# Set the default dracut directory based on distribution.
|
||||||
%if %{undefined _dracutdir}
|
%if %{undefined _dracutdir}
|
||||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 || 0%{?openEuler}
|
%if 0%{?fedora}%{?rhel}%{?centos}%{?openEuler}
|
||||||
%global _dracutdir %{_prefix}/lib/dracut
|
%global _dracutdir %{_prefix}/lib/dracut
|
||||||
%else
|
%else
|
||||||
%global _dracutdir %{_prefix}/share/dracut
|
%global _dracutdir %{_prefix}/share/dracut
|
||||||
|
@ -57,64 +57,28 @@
|
||||||
%bcond_with asan
|
%bcond_with asan
|
||||||
%bcond_with systemd
|
%bcond_with systemd
|
||||||
%bcond_with pam
|
%bcond_with pam
|
||||||
|
%bcond_without pyzfs
|
||||||
|
|
||||||
# Generic enable switch for systemd
|
# Generic enable switch for systemd
|
||||||
%if %{with systemd}
|
%if %{with systemd}
|
||||||
%define _systemd 1
|
%define _systemd 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# RHEL >= 7 comes with systemd
|
# Distros below support systemd
|
||||||
%if 0%{?rhel} >= 7
|
%if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}
|
||||||
%define _systemd 1
|
%define _systemd 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Fedora >= 15 comes with systemd, but only >= 18 has
|
# When not specified default to distribution provided version.
|
||||||
# the proper macros
|
|
||||||
%if 0%{?fedora} >= 18
|
|
||||||
%define _systemd 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# opensuse >= 12.1 comes with systemd, but only >= 13.1
|
|
||||||
# has the proper macros
|
|
||||||
%if 0%{?suse_version} >= 1310
|
|
||||||
%define _systemd 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# openEuler comes with systemd
|
|
||||||
%if 0%{?openEuler}
|
|
||||||
%define _systemd 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# When not specified default to distribution provided version. This
|
|
||||||
# is normally Python 3, but for RHEL <= 7 only Python 2 is provided.
|
|
||||||
%if %{undefined __use_python}
|
%if %{undefined __use_python}
|
||||||
%if 0%{?rhel} && 0%{?rhel} <= 7
|
|
||||||
%define __python /usr/bin/python2
|
|
||||||
%define __python_pkg_version 2
|
|
||||||
%define __python_cffi_pkg python-cffi
|
|
||||||
%define __python_setuptools_pkg python-setuptools
|
|
||||||
%else
|
|
||||||
%define __python /usr/bin/python3
|
%define __python /usr/bin/python3
|
||||||
%define __python_pkg_version 3
|
%define __python_pkg_version 3
|
||||||
%define __python_cffi_pkg python3-cffi
|
|
||||||
%define __python_setuptools_pkg python3-setuptools
|
|
||||||
%endif
|
|
||||||
%else
|
%else
|
||||||
%define __python %{__use_python}
|
%define __python %{__use_python}
|
||||||
%define __python_pkg_version %{__use_python_pkg_version}
|
%define __python_pkg_version %{__use_python_pkg_version}
|
||||||
%define __python_cffi_pkg python%{__python_pkg_version}-cffi
|
|
||||||
%define __python_setuptools_pkg python%{__python_pkg_version}-setuptools
|
|
||||||
%endif
|
%endif
|
||||||
%define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
%define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
||||||
|
|
||||||
# By default python-pyzfs is enabled, with the exception of
|
|
||||||
# RHEL 6 which by default uses Python 2.6 which is too old.
|
|
||||||
%if 0%{?rhel} == 6
|
|
||||||
%bcond_with pyzfs
|
|
||||||
%else
|
|
||||||
%bcond_without pyzfs
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: @PACKAGE@
|
Name: @PACKAGE@
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Release: @RELEASE@%{?dist}
|
Release: @RELEASE@%{?dist}
|
||||||
|
@ -137,7 +101,7 @@ Obsoletes: spl <= %{version}
|
||||||
# Renaming those on either side would conflict with all available documentation.
|
# Renaming those on either side would conflict with all available documentation.
|
||||||
Conflicts: zfs-fuse
|
Conflicts: zfs-fuse
|
||||||
|
|
||||||
%if 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler}
|
%if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
|
||||||
BuildRequires: gcc, make
|
BuildRequires: gcc, make
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
BuildRequires: libuuid-devel
|
BuildRequires: libuuid-devel
|
||||||
|
@ -290,7 +254,7 @@ Requires: sudo
|
||||||
Requires: sysstat
|
Requires: sysstat
|
||||||
Requires: libaio
|
Requires: libaio
|
||||||
Requires: python%{__python_pkg_version}
|
Requires: python%{__python_pkg_version}
|
||||||
%if 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler}
|
%if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
|
||||||
BuildRequires: libaio-devel
|
BuildRequires: libaio-devel
|
||||||
%endif
|
%endif
|
||||||
AutoReqProv: no
|
AutoReqProv: no
|
||||||
|
@ -313,6 +277,8 @@ This package contains a dracut module used to construct an initramfs
|
||||||
image which is ZFS aware.
|
image which is ZFS aware.
|
||||||
|
|
||||||
%if %{with pyzfs}
|
%if %{with pyzfs}
|
||||||
|
# Enforce `python36-` package prefix for CentOS 7
|
||||||
|
# since dependencies come from EPEL and are named this way
|
||||||
%package -n python%{__python_pkg_version}-pyzfs
|
%package -n python%{__python_pkg_version}-pyzfs
|
||||||
Summary: Python %{python_version} wrapper for libzfs_core
|
Summary: Python %{python_version} wrapper for libzfs_core
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
|
@ -322,16 +288,26 @@ Requires: libzfs5 = %{version}-%{release}
|
||||||
Requires: libnvpair3 = %{version}-%{release}
|
Requires: libnvpair3 = %{version}-%{release}
|
||||||
Requires: libffi
|
Requires: libffi
|
||||||
Requires: python%{__python_pkg_version}
|
Requires: python%{__python_pkg_version}
|
||||||
Requires: %{__python_cffi_pkg}
|
|
||||||
%if 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler}
|
%if 0%{?centos} == 7
|
||||||
%if 0%{?rhel} >= 8 || 0%{?centos} >= 8 || 0%{?fedora} >= 28 || 0%{?openEuler}
|
Requires: python36-cffi
|
||||||
BuildRequires: python3-packaging
|
|
||||||
%else
|
%else
|
||||||
BuildRequires: python-packaging
|
Requires: python%{__python_pkg_version}-cffi
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
|
||||||
|
%if 0%{?centos} == 7
|
||||||
|
BuildRequires: python36-packaging
|
||||||
|
BuildRequires: python36-devel
|
||||||
|
BuildRequires: python36-cffi
|
||||||
|
BuildRequires: python36-setuptools
|
||||||
|
%else
|
||||||
|
BuildRequires: python%{__python_pkg_version}-packaging
|
||||||
BuildRequires: python%{__python_pkg_version}-devel
|
BuildRequires: python%{__python_pkg_version}-devel
|
||||||
BuildRequires: %{__python_cffi_pkg}
|
BuildRequires: python%{__python_pkg_version}-cffi
|
||||||
BuildRequires: %{__python_setuptools_pkg}
|
BuildRequires: python%{__python_pkg_version}-setuptools
|
||||||
|
%endif
|
||||||
|
|
||||||
BuildRequires: libffi-devel
|
BuildRequires: libffi-devel
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
@ -490,7 +466,7 @@ systemctl --system daemon-reload >/dev/null || true
|
||||||
%{_bindir}/raidz_test
|
%{_bindir}/raidz_test
|
||||||
%{_sbindir}/zgenhostid
|
%{_sbindir}/zgenhostid
|
||||||
%{_bindir}/zvol_wait
|
%{_bindir}/zvol_wait
|
||||||
# Optional Python 2/3 scripts
|
# Optional Python 3 scripts
|
||||||
%{_bindir}/arc_summary
|
%{_bindir}/arc_summary
|
||||||
%{_bindir}/arcstat
|
%{_bindir}/arcstat
|
||||||
%{_bindir}/dbufstat
|
%{_bindir}/dbufstat
|
||||||
|
|
|
@ -15,19 +15,14 @@
|
||||||
# Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
# Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||||
# Copyright (c) 2019 Datto Inc.
|
# Copyright (c) 2019 Datto Inc.
|
||||||
#
|
#
|
||||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
# This script must remain compatible with Python 3.6+.
|
||||||
#
|
#
|
||||||
|
|
||||||
# some python 2.7 system don't have a configparser shim
|
|
||||||
try:
|
|
||||||
import configparser
|
|
||||||
except ImportError:
|
|
||||||
import ConfigParser as configparser
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import ctypes
|
import ctypes
|
||||||
import re
|
import re
|
||||||
|
import configparser
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
@ -38,7 +33,7 @@ from subprocess import PIPE
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from threading import Timer
|
from threading import Timer
|
||||||
from time import time
|
from time import time, CLOCK_MONOTONIC_RAW
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
|
|
||||||
BASEDIR = '/var/tmp/test_results'
|
BASEDIR = '/var/tmp/test_results'
|
||||||
|
@ -52,9 +47,6 @@ LOG_OUT = 'LOG_OUT'
|
||||||
LOG_ERR = 'LOG_ERR'
|
LOG_ERR = 'LOG_ERR'
|
||||||
LOG_FILE_OBJ = None
|
LOG_FILE_OBJ = None
|
||||||
|
|
||||||
# some python 2.7 system don't have a concept of monotonic time
|
|
||||||
CLOCK_MONOTONIC_RAW = 4 # see <linux/time.h>
|
|
||||||
|
|
||||||
|
|
||||||
class timespec(ctypes.Structure):
|
class timespec(ctypes.Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# Copyright (c) 2017 by Delphix. All rights reserved.
|
# Copyright (c) 2017 by Delphix. All rights reserved.
|
||||||
# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
|
# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
|
||||||
#
|
#
|
||||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
# This script must remain compatible with Python 3.6+.
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -62,13 +62,13 @@ known_reason = 'Known issue'
|
||||||
exec_reason = 'Test user execute permissions required for utilities'
|
exec_reason = 'Test user execute permissions required for utilities'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Some tests require a minimum python version of 3.5 and will be skipped when
|
# Some tests require a minimum python version of 3.6 and will be skipped when
|
||||||
# the default system version is too old. There may also be tests which require
|
# the default system version is too old. There may also be tests which require
|
||||||
# additional python modules be installed, for example python-cffi is required
|
# additional python modules be installed, for example python3-cffi is required
|
||||||
# by the pyzfs tests.
|
# by the pyzfs tests.
|
||||||
#
|
#
|
||||||
python_reason = 'Python v3.5 or newer required'
|
python_reason = 'Python v3.6 or newer required'
|
||||||
python_deps_reason = 'Python modules missing: python-cffi'
|
python_deps_reason = 'Python modules missing: python3-cffi'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Some tests require the O_TMPFILE flag which was first introduced in the
|
# Some tests require the O_TMPFILE flag which was first introduced in the
|
||||||
|
|
|
@ -70,8 +70,6 @@ export SYSTEM_FILES_COMMON='arp
|
||||||
printf
|
printf
|
||||||
ps
|
ps
|
||||||
pwd
|
pwd
|
||||||
python
|
|
||||||
python2
|
|
||||||
python3
|
python3
|
||||||
quotaon
|
quotaon
|
||||||
readlink
|
readlink
|
||||||
|
|
|
@ -92,27 +92,13 @@ typeset -a pos_cmds_out=(
|
||||||
}
|
}
|
||||||
}")
|
}")
|
||||||
|
|
||||||
#
|
|
||||||
# N.B. json.tool is needed to guarantee consistent ordering of fields,
|
|
||||||
# sed is needed to trim trailing space in CentOS 6's json.tool output
|
|
||||||
#
|
|
||||||
# As of Python 3.5 the behavior of json.tool changed to keep the order
|
|
||||||
# the same as the input and the --sort-keys option was added. Detect when
|
|
||||||
# --sort-keys is supported and apply the option to ensure the expected order.
|
|
||||||
#
|
|
||||||
if python -m json.tool --sort-keys <<< "{}"; then
|
|
||||||
JSON_TOOL_CMD="python -m json.tool --sort-keys"
|
|
||||||
else
|
|
||||||
JSON_TOOL_CMD="python -m json.tool"
|
|
||||||
fi
|
|
||||||
|
|
||||||
typeset -i cnt=0
|
typeset -i cnt=0
|
||||||
typeset cmd
|
typeset cmd
|
||||||
for cmd in ${pos_cmds[@]}; do
|
for cmd in ${pos_cmds[@]}; do
|
||||||
log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
|
log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
|
||||||
log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
|
log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
|
||||||
OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 |
|
OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 |
|
||||||
$JSON_TOOL_CMD | sed 's/[[:space:]]*$//')
|
python3 -m json.tool --sort-keys)
|
||||||
if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then
|
if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then
|
||||||
log_note "Got :$OUTPUT"
|
log_note "Got :$OUTPUT"
|
||||||
log_note "Expected:${pos_cmds_out[$cnt]}"
|
log_note "Expected:${pos_cmds_out[$cnt]}"
|
||||||
|
|
|
@ -30,7 +30,7 @@ verify_runnable "global"
|
||||||
# Verify that the required dependencies for testing are installed.
|
# Verify that the required dependencies for testing are installed.
|
||||||
@PYTHON@ -c "import cffi" 2>/dev/null
|
@PYTHON@ -c "import cffi" 2>/dev/null
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
log_unsupported "python-cffi not found by Python"
|
log_unsupported "python3-cffi not found by Python"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We don't just try to "import libzfs_core" because we want to skip these tests
|
# We don't just try to "import libzfs_core" because we want to skip these tests
|
||||||
|
|
|
@ -87,7 +87,7 @@ log_must xattrtest -f 10 -x 3 -s 32768 -r -k -p /$TESTPOOL/$TESTFS2/xattrsadir
|
||||||
# OpenZFS issue #7432
|
# OpenZFS issue #7432
|
||||||
log_must zfs set compression=on xattr=sa $TESTPOOL/$TESTFS2
|
log_must zfs set compression=on xattr=sa $TESTPOOL/$TESTFS2
|
||||||
log_must touch /$TESTPOOL/$TESTFS2/attrs
|
log_must touch /$TESTPOOL/$TESTFS2/attrs
|
||||||
log_must eval "python -c 'print \"a\" * 4096' | \
|
log_must eval "python3 -c 'print \"a\" * 4096' | \
|
||||||
set_xattr_stdin bigval /$TESTPOOL/$TESTFS2/attrs"
|
set_xattr_stdin bigval /$TESTPOOL/$TESTFS2/attrs"
|
||||||
log_must zfs set compression=off xattr=on $TESTPOOL/$TESTFS2
|
log_must zfs set compression=off xattr=on $TESTPOOL/$TESTFS2
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ log_must zfs snapshot $POOL/fs@c
|
||||||
# 4. Create an empty file and add xattrs to it to exercise reclaiming a
|
# 4. Create an empty file and add xattrs to it to exercise reclaiming a
|
||||||
# dnode that requires more than 1 slot for its bonus buffer (Zol #7433)
|
# dnode that requires more than 1 slot for its bonus buffer (Zol #7433)
|
||||||
log_must zfs set compression=on xattr=sa $POOL/fs
|
log_must zfs set compression=on xattr=sa $POOL/fs
|
||||||
log_must eval "python -c 'print \"a\" * 512' |
|
log_must eval "python3 -c 'print \"a\" * 512' |
|
||||||
set_xattr_stdin bigval /$POOL/fs/attrs"
|
set_xattr_stdin bigval /$POOL/fs/attrs"
|
||||||
log_must zfs snapshot $POOL/fs@d
|
log_must zfs snapshot $POOL/fs@d
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue