commit
480d09e258
@ -0,0 +1 @@
|
|||||||
|
SOURCES/system-storage-manager-1.4.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
14c095c24b57a44eec76807cf788f9cb715cbdb4 SOURCES/system-storage-manager-1.4.tar.gz
|
@ -0,0 +1,259 @@
|
|||||||
|
From e19db289c5080530f2d2a2f21dde35fd12571c1b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Fri, 10 Aug 2018 17:29:48 +0200
|
||||||
|
Subject: [PATCH 1/9] ssm: enforce python3
|
||||||
|
|
||||||
|
RHEL8 and later have python3 only.
|
||||||
|
|
||||||
|
Change all shebangs and version-dependent calls to explicitly use
|
||||||
|
Python 3 and update the docs respectively. This also marks the end of
|
||||||
|
python2 support.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
INSTALL | 2 +-
|
||||||
|
Makefile | 8 ++++----
|
||||||
|
README | 2 +-
|
||||||
|
bin/ssm | 2 +-
|
||||||
|
bin/ssm.local | 2 +-
|
||||||
|
doc/Makefile | 2 +-
|
||||||
|
doc/generate_usage_includes.py | 2 +-
|
||||||
|
doc/src/requirements.rst | 2 +-
|
||||||
|
man8/ssm.8 | 2 +-
|
||||||
|
test.py | 2 +-
|
||||||
|
tests/__init__.py | 2 +-
|
||||||
|
tests/unittests/__init__.py | 2 +-
|
||||||
|
tests/unittests/common.py | 2 +-
|
||||||
|
tests/unittests/test_btrfs.py | 2 +-
|
||||||
|
tests/unittests/test_lvm.py | 2 +-
|
||||||
|
tests/unittests/test_misc.py | 2 +-
|
||||||
|
tests/unittests/test_multipath.py | 2 +-
|
||||||
|
tests/unittests/test_ssm.py | 2 +-
|
||||||
|
18 files changed, 21 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/INSTALL b/INSTALL
|
||||||
|
index f1f0277..4dbcd2e 100644
|
||||||
|
--- a/INSTALL
|
||||||
|
+++ b/INSTALL
|
||||||
|
@@ -21,7 +21,7 @@ local sources with:
|
||||||
|
Requirements
|
||||||
|
************
|
||||||
|
|
||||||
|
-Python 2.6 or higher is required to run this tool. System Storage
|
||||||
|
+Python 3.6 or higher is required to run this tool. System Storage
|
||||||
|
Manager can only be run as root since most of the commands require
|
||||||
|
root privileges.
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 2d887c4..80ae3f9 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -28,7 +28,7 @@ ifndef PREVIOUS
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
- @python setup.py clean
|
||||||
|
+ @python3 setup.py clean
|
||||||
|
rm -f MANIFEST
|
||||||
|
find . -\( -name "*.pyc" -o -name '*.pyo' -o -name "*~" -\) -delete
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ git-clean:
|
||||||
|
git clean -f
|
||||||
|
|
||||||
|
install:
|
||||||
|
- @python setup.py install
|
||||||
|
+ @python3 setup.py install
|
||||||
|
|
||||||
|
spec: check_vars
|
||||||
|
@(LC_ALL=C date +"* %a %b %e %Y `git config --get user.name` <`git config --get user.email`> - $(VERSION)"; git log --pretty="format:- %s (%an)" $(PREVIOUS)..HEAD| cat; echo -e "\n\n"; cat CHANGES) > CHANGES.bck; mv CHANGES.bck CHANGES
|
||||||
|
@@ -51,10 +51,10 @@ docs:
|
||||||
|
@make dist -C doc
|
||||||
|
|
||||||
|
source: test clean
|
||||||
|
- @python setup.py sdist
|
||||||
|
+ @python3 setup.py sdist
|
||||||
|
|
||||||
|
test:
|
||||||
|
- @python test.py
|
||||||
|
+ @python3 test.py
|
||||||
|
|
||||||
|
push_html:
|
||||||
|
scp -r doc/_build/singlehtml/* lczerner@shell.sourceforge.net:/home/project-web/storagemanager/htdocs/
|
||||||
|
diff --git a/README b/README
|
||||||
|
index fe16990..95f20ae 100644
|
||||||
|
--- a/README
|
||||||
|
+++ b/README
|
||||||
|
@@ -684,7 +684,7 @@ local sources with:
|
||||||
|
Requirements
|
||||||
|
************
|
||||||
|
|
||||||
|
-Python 2.6 or higher is required to run this tool. System Storage
|
||||||
|
+Python 3.6 or higher is required to run this tool. System Storage
|
||||||
|
Manager can only be run as root since most of the commands require
|
||||||
|
root privileges.
|
||||||
|
|
||||||
|
diff --git a/bin/ssm b/bin/ssm
|
||||||
|
index 53aece6..13b2241 100755
|
||||||
|
--- a/bin/ssm
|
||||||
|
+++ b/bin/ssm
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/bin/ssm.local b/bin/ssm.local
|
||||||
|
index d5bedec..94ea9dd 100755
|
||||||
|
--- a/bin/ssm.local
|
||||||
|
+++ b/bin/ssm.local
|
||||||
|
@@ -26,7 +26,7 @@ export PYTHONPATH="$SSMDIR"
|
||||||
|
|
||||||
|
# Run coverage if the environment variable is set up.
|
||||||
|
if [ "$RUN_COVERAGE" = "" ]; then
|
||||||
|
- python $SSMDIR/bin/ssm "$@"
|
||||||
|
+ python3 $SSMDIR/bin/ssm "$@"
|
||||||
|
else
|
||||||
|
$RUN_COVERAGE $SSMDIR/bin/ssm "$@"
|
||||||
|
fi
|
||||||
|
diff --git a/doc/Makefile b/doc/Makefile
|
||||||
|
index 09ee867..43e531b 100644
|
||||||
|
--- a/doc/Makefile
|
||||||
|
+++ b/doc/Makefile
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
-SPHINXBUILD = sphinx-build
|
||||||
|
+SPHINXBUILD = sphinx-build-3
|
||||||
|
PAPER = a4
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
diff --git a/doc/generate_usage_includes.py b/doc/generate_usage_includes.py
|
||||||
|
index d7695f8..5ced9e6 100755
|
||||||
|
--- a/doc/generate_usage_includes.py
|
||||||
|
+++ b/doc/generate_usage_includes.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys, os
|
||||||
|
diff --git a/doc/src/requirements.rst b/doc/src/requirements.rst
|
||||||
|
index 0482e1d..18508e9 100644
|
||||||
|
--- a/doc/src/requirements.rst
|
||||||
|
+++ b/doc/src/requirements.rst
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
|
||||||
|
-Python 2.6 or higher is required to run this tool. System Storage Manager
|
||||||
|
+Python 3.6 or higher is required to run this tool. System Storage Manager
|
||||||
|
can only be run as root since most of the commands require root privileges.
|
||||||
|
|
||||||
|
There are other requirements listed below, but note that you do not
|
||||||
|
diff --git a/man8/ssm.8 b/man8/ssm.8
|
||||||
|
index 12859dc..94ad144 100644
|
||||||
|
--- a/man8/ssm.8
|
||||||
|
+++ b/man8/ssm.8
|
||||||
|
@@ -865,7 +865,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <\fI\%http://www.gnu.org/licenses/\fP>.
|
||||||
|
.SH REQUIREMENTS
|
||||||
|
.sp
|
||||||
|
-Python 2.6 or higher is required to run this tool. System Storage Manager
|
||||||
|
+Python 3.6 or higher is required to run this tool. System Storage Manager
|
||||||
|
can only be run as root since most of the commands require root privileges.
|
||||||
|
.sp
|
||||||
|
There are other requirements listed below, but note that you do not
|
||||||
|
diff --git a/test.py b/test.py
|
||||||
|
index 721fe08..28530fa 100755
|
||||||
|
--- a/test.py
|
||||||
|
+++ b/test.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/__init__.py b/tests/__init__.py
|
||||||
|
index 6d8f17e..9f0c266 100644
|
||||||
|
--- a/tests/__init__.py
|
||||||
|
+++ b/tests/__init__.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/__init__.py b/tests/unittests/__init__.py
|
||||||
|
index 3776154..512baac 100644
|
||||||
|
--- a/tests/unittests/__init__.py
|
||||||
|
+++ b/tests/unittests/__init__.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/common.py b/tests/unittests/common.py
|
||||||
|
index 5495e22..37e0434 100644
|
||||||
|
--- a/tests/unittests/common.py
|
||||||
|
+++ b/tests/unittests/common.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/test_btrfs.py b/tests/unittests/test_btrfs.py
|
||||||
|
index 36db292..6af94cd 100644
|
||||||
|
--- a/tests/unittests/test_btrfs.py
|
||||||
|
+++ b/tests/unittests/test_btrfs.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/test_lvm.py b/tests/unittests/test_lvm.py
|
||||||
|
index 6489ba8..abe6d6b 100644
|
||||||
|
--- a/tests/unittests/test_lvm.py
|
||||||
|
+++ b/tests/unittests/test_lvm.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/test_misc.py b/tests/unittests/test_misc.py
|
||||||
|
index 2afc88f..cea3d19 100644
|
||||||
|
--- a/tests/unittests/test_misc.py
|
||||||
|
+++ b/tests/unittests/test_misc.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2018 Red Hat, Inc., Jan Tulak <jtulak@redhat.com>
|
||||||
|
#
|
||||||
|
diff --git a/tests/unittests/test_multipath.py b/tests/unittests/test_multipath.py
|
||||||
|
index 7239c2a..49c4a6c 100644
|
||||||
|
--- a/tests/unittests/test_multipath.py
|
||||||
|
+++ b/tests/unittests/test_multipath.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
# (C)2016 Red Hat, Inc., Jan Tulak <jtulak@redhat.com>
|
||||||
|
diff --git a/tests/unittests/test_ssm.py b/tests/unittests/test_ssm.py
|
||||||
|
index 1fb0297..142bee2 100644
|
||||||
|
--- a/tests/unittests/test_ssm.py
|
||||||
|
+++ b/tests/unittests/test_ssm.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# (C)2011 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
#
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,511 @@
|
|||||||
|
From a80454ac89489945349f2eb0c0c70d6621b67f5b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Fri, 10 Aug 2018 16:43:45 +0200
|
||||||
|
Subject: [PATCH 2/9] Remove info command for RHEL
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
README | 9 --
|
||||||
|
doc/generate_usage_includes.py | 10 --
|
||||||
|
doc/src/commands/index.rst | 1 -
|
||||||
|
doc/src/commands/info.rst | 8 --
|
||||||
|
doc/src/commands/info.txt | 7 -
|
||||||
|
man8/ssm.8 | 47 +------
|
||||||
|
ssmlib/main.py | 32 -----
|
||||||
|
tests/bashtests/017-info.sh | 230 ---------------------------------
|
||||||
|
tests/unittests/test_ssm.py | 1 -
|
||||||
|
9 files changed, 1 insertion(+), 344 deletions(-)
|
||||||
|
delete mode 100644 doc/src/commands/info.rst
|
||||||
|
delete mode 100644 doc/src/commands/info.txt
|
||||||
|
delete mode 100755 tests/bashtests/017-info.sh
|
||||||
|
|
||||||
|
diff --git a/README b/README
|
||||||
|
index 95f20ae..17df34d 100644
|
||||||
|
--- a/README
|
||||||
|
+++ b/README
|
||||||
|
@@ -148,15 +148,6 @@ The following sections can be specified:
|
||||||
|
Info command
|
||||||
|
************
|
||||||
|
|
||||||
|
-**EXPERIMENTAL** This feature is currently experimental. The output
|
||||||
|
-format can change and fields can be added or removed.
|
||||||
|
-
|
||||||
|
-Show detailed information about all detected devices, pools, volumes
|
||||||
|
-and snapshots found on the system. The **info** command can be used
|
||||||
|
-either alone to show all available items, or you can specify a device,
|
||||||
|
-pool, or any other identifier to see information about the specific
|
||||||
|
-item.
|
||||||
|
-
|
||||||
|
|
||||||
|
Remove command
|
||||||
|
**************
|
||||||
|
diff --git a/doc/generate_usage_includes.py b/doc/generate_usage_includes.py
|
||||||
|
index 5ced9e6..b672dec 100755
|
||||||
|
--- a/doc/generate_usage_includes.py
|
||||||
|
+++ b/doc/generate_usage_includes.py
|
||||||
|
@@ -12,7 +12,6 @@ SYNOPSIS_INC = "src/synopsis.inc"
|
||||||
|
OPTIONS_DIR = "src/options/"
|
||||||
|
SSM_OPTIONS_INC = OPTIONS_DIR + "ssm_options.inc"
|
||||||
|
CREATE_OPTIONS_INC = OPTIONS_DIR + "create_options.inc"
|
||||||
|
-INFO_OPTIONS_INC = OPTIONS_DIR + "info_options.inc"
|
||||||
|
LIST_OPTIONS_INC = OPTIONS_DIR + "list_options.inc"
|
||||||
|
REMOVE_OPTIONS_INC = OPTIONS_DIR + "remove_options.inc"
|
||||||
|
RESIZE_OPTIONS_INC = OPTIONS_DIR + "resize_options.inc"
|
||||||
|
@@ -24,7 +23,6 @@ MIGRATE_OPTIONS_INC = OPTIONS_DIR + "migrate_options.inc"
|
||||||
|
|
||||||
|
SSM_USAGE_INC = OPTIONS_DIR + "ssm_usage.inc"
|
||||||
|
CREATE_USAGE_INC = OPTIONS_DIR + "create_usage.inc"
|
||||||
|
-INFO_USAGE_INC = OPTIONS_DIR + "info_usage.inc"
|
||||||
|
LIST_USAGE_INC = OPTIONS_DIR + "list_usage.inc"
|
||||||
|
REMOVE_USAGE_INC = OPTIONS_DIR + "remove_usage.inc"
|
||||||
|
RESIZE_USAGE_INC = OPTIONS_DIR + "resize_usage.inc"
|
||||||
|
@@ -68,10 +66,6 @@ class GenerateIncludes(object):
|
||||||
|
message = self.format_synopsis(self.ssm_parser.parser_create)
|
||||||
|
self._write_message(message, CREATE_USAGE_INC)
|
||||||
|
|
||||||
|
- def write_info_usage(self):
|
||||||
|
- message = self.format_synopsis(self.ssm_parser.parser_info)
|
||||||
|
- self._write_message(message, INFO_USAGE_INC)
|
||||||
|
-
|
||||||
|
def write_list_usage(self):
|
||||||
|
message = self.format_synopsis(self.ssm_parser.parser_list)
|
||||||
|
self._write_message(message, LIST_USAGE_INC)
|
||||||
|
@@ -107,7 +101,6 @@ class GenerateIncludes(object):
|
||||||
|
def write_usage(self):
|
||||||
|
self.write_ssm_usage()
|
||||||
|
self.write_create_usage()
|
||||||
|
- self.write_info_usage()
|
||||||
|
self.write_list_usage()
|
||||||
|
self.write_remove_usage()
|
||||||
|
self.write_resize_usage()
|
||||||
|
@@ -137,9 +130,6 @@ class GenerateIncludes(object):
|
||||||
|
message = self._format_options(self.ssm_parser.parser_create)
|
||||||
|
self._write_message(message, CREATE_OPTIONS_INC)
|
||||||
|
|
||||||
|
- message = self._format_options(self.ssm_parser.parser_info)
|
||||||
|
- self._write_message(message, INFO_OPTIONS_INC)
|
||||||
|
-
|
||||||
|
message = self._format_options(self.ssm_parser.parser_list)
|
||||||
|
self._write_message(message, LIST_OPTIONS_INC)
|
||||||
|
|
||||||
|
diff --git a/doc/src/commands/index.rst b/doc/src/commands/index.rst
|
||||||
|
index 85ee495..d3f0a0f 100644
|
||||||
|
--- a/doc/src/commands/index.rst
|
||||||
|
+++ b/doc/src/commands/index.rst
|
||||||
|
@@ -7,7 +7,6 @@ System Storage Manager Commands
|
||||||
|
|
||||||
|
commands_introduction
|
||||||
|
create
|
||||||
|
- info
|
||||||
|
list
|
||||||
|
remove
|
||||||
|
resize
|
||||||
|
diff --git a/doc/src/commands/info.rst b/doc/src/commands/info.rst
|
||||||
|
deleted file mode 100644
|
||||||
|
index d2917ef..0000000
|
||||||
|
--- a/doc/src/commands/info.rst
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,8 +0,0 @@
|
||||||
|
-Info command
|
||||||
|
-============
|
||||||
|
-
|
||||||
|
-.. include:: ../options/info_usage.inc
|
||||||
|
-
|
||||||
|
-.. include:: info.txt
|
||||||
|
-
|
||||||
|
-.. include:: ../options/info_options.inc
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/doc/src/commands/info.txt b/doc/src/commands/info.txt
|
||||||
|
deleted file mode 100644
|
||||||
|
index 7fadda0..0000000
|
||||||
|
--- a/doc/src/commands/info.txt
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,7 +0,0 @@
|
||||||
|
-**EXPERIMENTAL** This feature is currently experimental. The output format can
|
||||||
|
-change and fields can be added or removed.
|
||||||
|
-
|
||||||
|
-Show detailed information about all detected devices, pools, volumes and
|
||||||
|
-snapshots found on the system. The **info** command can be used either alone
|
||||||
|
-to show all available items, or you can specify a device, pool, or any other
|
||||||
|
-identifier to see information about the specific item.
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/man8/ssm.8 b/man8/ssm.8
|
||||||
|
index 94ad144..5e4057a 100644
|
||||||
|
--- a/man8/ssm.8
|
||||||
|
+++ b/man8/ssm.8
|
||||||
|
@@ -30,43 +30,14 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||||
|
..
|
||||||
|
-.
|
||||||
|
-.nr rst2man-indent-level 0
|
||||||
|
-.
|
||||||
|
-.de1 rstReportMargin
|
||||||
|
-\\$1 \\n[an-margin]
|
||||||
|
-level \\n[rst2man-indent-level]
|
||||||
|
-level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
|
--
|
||||||
|
-\\n[rst2man-indent0]
|
||||||
|
-\\n[rst2man-indent1]
|
||||||
|
-\\n[rst2man-indent2]
|
||||||
|
-..
|
||||||
|
-.de1 INDENT
|
||||||
|
-.\" .rstReportMargin pre:
|
||||||
|
-. RS \\$1
|
||||||
|
-. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||||
|
-. nr rst2man-indent-level +1
|
||||||
|
-.\" .rstReportMargin post:
|
||||||
|
-..
|
||||||
|
-.de UNINDENT
|
||||||
|
-. RE
|
||||||
|
-.\" indent \\n[an-margin]
|
||||||
|
-.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
|
-.nr rst2man-indent-level -1
|
||||||
|
-.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||||
|
-.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||||
|
-..
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.sp
|
||||||
|
-\fBssm\fP [\fB\-h\fP] [\fB\-\-version\fP] [\fB\-v\fP] [\fB\-v**v] [\fP\-v**vv] [\fB\-f\fP] [\fB\-b\fP BACKEND] [\fB\-n\fP] {check,resize,create,list,info,add,remove,snapshot,mount,migrate} ...
|
||||||
|
+\fBssm\fP [\fB\-h\fP] [\fB\-\-version\fP] [\fB\-v\fP] [\fB\-v**v] [\fP\-v**vv] [\fB\-f\fP] [\fB\-b\fP BACKEND] [\fB\-n\fP] {check,resize,create,list,add,remove,snapshot,mount,migrate} ...
|
||||||
|
.sp
|
||||||
|
\fBssm\fP \fBcreate\fP [\fB\-h\fP] [\fB\-s\fP SIZE] [\fB\-n\fP NAME] [\fB\-\-fstype\fP FSTYPE] [\fB\-r\fP LEVEL] [\fB\-I\fP STRIPESIZE] [\fB\-i\fP STRIPES] [\fB\-p\fP POOL] [\fB\-e\fP [{luks,plain}]] [\fB\-o\fP MNT_OPTIONS] [\fB\-v\fP VIRTUAL_SIZE] [\fBdevice\fP [\fBdevice\fP ...]] [mount]
|
||||||
|
.sp
|
||||||
|
\fBssm\fP \fBlist\fP [\fB\-h\fP] [{volumes,vol,dev,devices,pool,pools,fs,filesystems,snap,snapshots}]
|
||||||
|
.sp
|
||||||
|
-\fBssm\fP \fBinfo\fP [\fB\-h\fP] [item]
|
||||||
|
-.sp
|
||||||
|
\fBssm\fP \fBremove\fP [\fB\-h\fP] [\fB\-a\fP] [\fBitems\fP [\fBitems\fP ...]]
|
||||||
|
.sp
|
||||||
|
\fBssm\fP \fBresize\fP [\fB\-h\fP] [\fB\-s\fP SIZE] \fBvolume\fP [\fBdevice\fP [\fBdevice\fP ...]]
|
||||||
|
@@ -249,22 +220,6 @@ volume. A size suffix K|k, M|m, G|g, T|t, P|p, E|e can
|
||||||
|
be used to define \(aqpower of two\(aq units. If no unit is
|
||||||
|
provided, it defaults to kilobytes.
|
||||||
|
.UNINDENT
|
||||||
|
-.SS Info command
|
||||||
|
-.sp
|
||||||
|
-\fBssm\fP \fBinfo\fP [\fB\-h\fP] [item]
|
||||||
|
-.sp
|
||||||
|
-\fBEXPERIMENTAL\fP This feature is currently experimental. The output format can
|
||||||
|
-change and fields can be added or removed.
|
||||||
|
-.sp
|
||||||
|
-Show detailed information about all detected devices, pools, volumes and
|
||||||
|
-snapshots found on the system. The \fBinfo\fP command can be used either alone
|
||||||
|
-to show all available items, or you can specify a device, pool, or any other
|
||||||
|
-identifier to see information about the specific item.
|
||||||
|
-.INDENT 0.0
|
||||||
|
-.TP
|
||||||
|
-.B \-h\fP,\fB \-\-help
|
||||||
|
-show this help message and exit
|
||||||
|
-.UNINDENT
|
||||||
|
.SS List command
|
||||||
|
.sp
|
||||||
|
\fBssm\fP \fBlist\fP [\fB\-h\fP] [{volumes,vol,dev,devices,pool,pools,fs,filesystems,snap,snapshots}]
|
||||||
|
diff --git a/ssmlib/main.py b/ssmlib/main.py
|
||||||
|
index 5e99ae4..57a75cc 100644
|
||||||
|
--- a/ssmlib/main.py
|
||||||
|
+++ b/ssmlib/main.py
|
||||||
|
@@ -2032,26 +2032,6 @@ class StorageHandle(object):
|
||||||
|
elif args.type in ['snap', 'snapshots']:
|
||||||
|
self.snap.psummary()
|
||||||
|
|
||||||
|
- def info(self, args):
|
||||||
|
- """
|
||||||
|
- Show a detailed info about an object
|
||||||
|
- """
|
||||||
|
- sources = [self.pool, self.dev, self.vol, self.snap]
|
||||||
|
- create_graph(*sources)
|
||||||
|
- print("EXPERIMENTAL FEATURE (The format can yet change)\n")
|
||||||
|
-
|
||||||
|
- if not args.item:
|
||||||
|
- for source in sources:
|
||||||
|
- source.pinfo()
|
||||||
|
- else:
|
||||||
|
- found = False
|
||||||
|
- for source in sources:
|
||||||
|
- found |= source.pinfo(item=args.item)
|
||||||
|
- if not found:
|
||||||
|
- err = "The item '%s' was not found." % args.item
|
||||||
|
- raise argparse.ArgumentTypeError(err)
|
||||||
|
-
|
||||||
|
-
|
||||||
|
def add(self, args, skip_check=False):
|
||||||
|
"""
|
||||||
|
Add devices into the pool
|
||||||
|
@@ -2585,7 +2565,6 @@ class SsmParser(object):
|
||||||
|
self.parser_resize = self._get_parser_resize()
|
||||||
|
self.parser_create = self._get_parser_create()
|
||||||
|
self.parser_list = self._get_parser_list()
|
||||||
|
- self.parser_info = self._get_parser_info()
|
||||||
|
self.parser_add = self._get_parser_add()
|
||||||
|
self.parser_remove = self._get_parser_remove()
|
||||||
|
self.parser_snapshot = self._get_parser_snapshot()
|
||||||
|
@@ -2769,17 +2748,6 @@ class SsmParser(object):
|
||||||
|
parser_list.set_defaults(func=self.storage.list)
|
||||||
|
return parser_list
|
||||||
|
|
||||||
|
- def _get_parser_info(self):
|
||||||
|
- """
|
||||||
|
- Info command
|
||||||
|
- """
|
||||||
|
- parser_info = self.subcommands.add_parser("info",
|
||||||
|
- help='''Show detailed information about
|
||||||
|
- an object. EXPERIMENTAL''')
|
||||||
|
- parser_info.add_argument('item', nargs='?')
|
||||||
|
- parser_info.set_defaults(func=self.storage.info)
|
||||||
|
- return parser_info
|
||||||
|
-
|
||||||
|
def _get_parser_add(self):
|
||||||
|
"""
|
||||||
|
Add command
|
||||||
|
diff --git a/tests/bashtests/017-info.sh b/tests/bashtests/017-info.sh
|
||||||
|
deleted file mode 100755
|
||||||
|
index 2e947db..0000000
|
||||||
|
--- a/tests/bashtests/017-info.sh
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,230 +0,0 @@
|
||||||
|
-#!/bin/bash
|
||||||
|
-#
|
||||||
|
-# (C)2013 Red Hat, Inc., Jan Tulak <jtulak@redhat.com>
|
||||||
|
-#
|
||||||
|
-# 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
-
|
||||||
|
-export test_name='017-info'
|
||||||
|
-export test_description='Check whether info command prints correct values'
|
||||||
|
-
|
||||||
|
-. lib/test
|
||||||
|
-
|
||||||
|
-DEV_COUNT=10
|
||||||
|
-DEV_SIZE=128
|
||||||
|
-TEST_MAX_SIZE=$(($DEV_COUNT*$DEV_SIZE))
|
||||||
|
-aux prepare_devs $DEV_COUNT $DEV_SIZE
|
||||||
|
-aux prepare_mnts 10
|
||||||
|
-TEST_DEVS=$(cat DEVICES)
|
||||||
|
-export LVOL_PREFIX="lvol"
|
||||||
|
-export SSM_DEFAULT_BACKEND='lvm'
|
||||||
|
-export SSM_LVM_DEFAULT_POOL=$vg1
|
||||||
|
-export SSM_NONINTERACTIVE='1'
|
||||||
|
-
|
||||||
|
-snap1="snap1"
|
||||||
|
-snap2="snap2"
|
||||||
|
-
|
||||||
|
-lvol1=${LVOL_PREFIX}001
|
||||||
|
-lvol2=${LVOL_PREFIX}002
|
||||||
|
-lvol3=${LVOL_PREFIX}003
|
||||||
|
-
|
||||||
|
-pool0=$vg1
|
||||||
|
-pool1=$vg2
|
||||||
|
-pool2=$vg3
|
||||||
|
-pool3=$vg4
|
||||||
|
-
|
||||||
|
-TEST_FS=
|
||||||
|
-#which mkfs.ext2 && TEST_FS+="ext2 "
|
||||||
|
-#which mkfs.ext3 && TEST_FS+="ext3 "
|
||||||
|
-which mkfs.ext4 && TEST_FS+="ext4 "
|
||||||
|
-which mkfs.xfs && TEST_FS+="xfs"
|
||||||
|
-
|
||||||
|
-TEST_MNT=$TESTDIR/mnt
|
||||||
|
-[ ! -d $TEST_MNT ] && mkdir $TEST_MNT &> /dev/null
|
||||||
|
-
|
||||||
|
-# Prepare pools and volumes
|
||||||
|
-
|
||||||
|
-vol1=volsf
|
||||||
|
-vol2=volss
|
||||||
|
-vol3=volmf
|
||||||
|
-vol4=volms1
|
||||||
|
-vol5=volms2
|
||||||
|
-vol6=volms3
|
||||||
|
-maxvolsz=$((DEV_SIZE-4))
|
||||||
|
-size1=$maxvolsz
|
||||||
|
-size2=$((DEV_SIZE/2))
|
||||||
|
-size3=$((maxvolsz*2))
|
||||||
|
-size4=$((DEV_SIZE/2))
|
||||||
|
-size5=$((DEV_SIZE*2))
|
||||||
|
-size6=$((DEV_SIZE/4))
|
||||||
|
-size4s=$((size4-20))
|
||||||
|
-size2r=$((size2-4))
|
||||||
|
-size5r=$((size5+16))
|
||||||
|
-
|
||||||
|
-## test a btrfs on a partition
|
||||||
|
-#
|
||||||
|
-# this is commented out, because the current testing infrastructure is not able
|
||||||
|
-# to handle such configuration. We need to move away from the lvm-like test suite
|
||||||
|
-# as anything complex and non-lvm is having issues with it. But at the same time
|
||||||
|
-# I want this test documented.
|
||||||
|
-#
|
||||||
|
-#
|
||||||
|
-# Test btrfs on a (loopback) partition.
|
||||||
|
-# This is a reproducer of a reported issue with ssm info.
|
||||||
|
-#
|
||||||
|
-# to create the partitions programatically (rather than manually)
|
||||||
|
-# we're going to simulate the manual input to fdisk
|
||||||
|
-# The sed script strips off all the comments so that we can
|
||||||
|
-# document what we're doing in-line with the actual commands
|
||||||
|
-# Note that a blank line (commented as "defualt" will send a empty
|
||||||
|
-# line terminated with a newline to take the fdisk default.
|
||||||
|
-#
|
||||||
|
-#sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | gdisk ${dev1}
|
||||||
|
-# n # new partition
|
||||||
|
-# 1 # partition number 1
|
||||||
|
-# # default - start at beginning of disk
|
||||||
|
-# # default - end at end of disk
|
||||||
|
-# # default - partition type is not important
|
||||||
|
-# p # print the in-memory partition table
|
||||||
|
-# w # write the partition table
|
||||||
|
-# Y # confirm
|
||||||
|
-# q # and we're done
|
||||||
|
-#EOF
|
||||||
|
-#partprobe -s $dev1
|
||||||
|
-#
|
||||||
|
-#mkfs.btrfs ${dev1}p1
|
||||||
|
-#ssm info
|
||||||
|
-#
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-# Test without a filesystem
|
||||||
|
-ssm -f create -n $vol1 $dev1
|
||||||
|
-ssm create -n $vol2 -p $pool1 -s ${size2}M $dev2
|
||||||
|
-ssm create -n $vol3 -p $pool2 $dev3 $dev4
|
||||||
|
-ssm add -p $pool3 $dev{5,6,7,8}
|
||||||
|
-ssm create -p $pool3 -s ${size4}m -n $vol4
|
||||||
|
-ssm create -p $pool3 -s ${size5}m -n $vol5
|
||||||
|
-ssm create -p $pool3 -s ${size6}m -n $vol6
|
||||||
|
-lvchange -an $pool3/$vol6
|
||||||
|
-
|
||||||
|
-# test a not found case
|
||||||
|
-output=$(not ssm info foobarbaznotfound 2>&1 )
|
||||||
|
-echo "$output" | grep "The item 'foobarbaznotfound' was not found."
|
||||||
|
-
|
||||||
|
-# Check vol, dev, pool, resized vol, and snapshot
|
||||||
|
-output=`ssm info $pool0`
|
||||||
|
-check info_table none "$output" "pool name" name $pool0
|
||||||
|
-check info_table none "$output" type lvm volume group
|
||||||
|
-check info_table none "$output" "logical volume" volume ".*$pool0-$vol1"
|
||||||
|
-check info_table none "$output" size $size1.00MB
|
||||||
|
-check info_table none "$output" used $size1.00MB
|
||||||
|
-
|
||||||
|
-output=`ssm info $pool1`
|
||||||
|
-check info_table none "$output" "pool name" name $pool1
|
||||||
|
-check info_table none "$output" type lvm volume group
|
||||||
|
-check info_table none "$output" "logical volume" volume ".*$pool1-$vol2"
|
||||||
|
-check info_table none "$output" size $size1.00MB
|
||||||
|
-check info_table none "$output" used $size2.00MB
|
||||||
|
-
|
||||||
|
-output=`ssm info $pool2`
|
||||||
|
-check info_table none "$output" "pool name" name $pool2
|
||||||
|
-check info_table none "$output" type lvm volume group
|
||||||
|
-check info_table none "$output" "logical volume" volume ".*$pool2-$vol3"
|
||||||
|
-check info_table none "$output" size $size3.00MB
|
||||||
|
-check info_table none "$output" used $size3.00MB
|
||||||
|
-
|
||||||
|
-output=`ssm info $pool3`
|
||||||
|
-check info_table none "$output" "pool name" name $pool3
|
||||||
|
-check info_table none "$output" type lvm volume group
|
||||||
|
-# The "\|#" is there because info_table none adds a space at the end
|
||||||
|
-# of the expression, but we have to get rid of it without causing
|
||||||
|
-# false matches.
|
||||||
|
-check info_table none "$output" "logical volume.*$vol4\|#" volume ".*$pool3.$vol4"
|
||||||
|
-check info_table none "$output" "logical volume.*$vol5\|#" volume ".*$pool3.$vol5"
|
||||||
|
-check info_table none "$output" "logical volume.*$vol6\|#" volume ".*$pool3.$vol6"
|
||||||
|
-check info_table none "$output" size $((maxvolsz*4)).00MB
|
||||||
|
-check info_table none "$output" used $((size4+size5+size6)).00MB
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-output=`ssm info $dev1`
|
||||||
|
-check info_table none "$output" type disk
|
||||||
|
-check info_table none "$output" "object name" name ".*$dev1"
|
||||||
|
-check info_table none "$output" "size" $size1.00MB
|
||||||
|
-
|
||||||
|
-output=$(ssm info $pool0/$vol1)
|
||||||
|
-check info_table none "$output" type lvm logical volume
|
||||||
|
-check info_table none "$output" "object name.*dev/$pool0/$vol1\|#"
|
||||||
|
-check info_table none "$output" "object name.*mapper/$pool0-$vol1\|#"
|
||||||
|
-check info_table none "$output" "size" $size1.00MB
|
||||||
|
-check info_table none "$output" "parent pool"
|
||||||
|
-check info_table "parent pool" "$output" type lvm volume group
|
||||||
|
-check info_table "parent pool" "$output" name $pool0
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-# Check ssm vol after resize
|
||||||
|
-ssm -f resize $pool1/$vol2 -s ${size2r}M
|
||||||
|
-ssm resize -s ${size5r}m $pool3/$vol5
|
||||||
|
-
|
||||||
|
-output=`ssm info $pool1`
|
||||||
|
-check info_table none "$output" size $size1.00MB
|
||||||
|
-check info_table none "$output" used $size2r.00MB
|
||||||
|
-output=`ssm info $pool3/$vol5`
|
||||||
|
-check info_table none "$output" size $size5r.00MB
|
||||||
|
-
|
||||||
|
-ssm snapshot $pool3/$vol4 -n snap1
|
||||||
|
-ssm snapshot $pool3/$vol4 -s ${size4s}m -n snap2
|
||||||
|
-output=`ssm info $pool3/snap1`
|
||||||
|
-check info_table none "$output" type snapshot
|
||||||
|
-check info_table none "$output" parent volume $pool3/$vol4
|
||||||
|
-output=`ssm info $pool3/snap2`
|
||||||
|
-check info_table none "$output" size $size4s.00MB
|
||||||
|
-
|
||||||
|
-ssm -f remove -a
|
||||||
|
-
|
||||||
|
-# Test with filesystem
|
||||||
|
-for fs in $TEST_FS ; do
|
||||||
|
- ssm -f create -n $vol1 $dev1 --fs $fs
|
||||||
|
- ssm create -n $vol2 -p $pool1 -s ${size2}M $dev2 --fs $fs
|
||||||
|
-
|
||||||
|
- # Check fs, vol, dev, pool, resized vol, and snapshot
|
||||||
|
- output=`ssm info $pool0/$vol1`
|
||||||
|
- check info_table none "$output" "object name.*$pool0/$vol1"
|
||||||
|
- check info_table filesystem "$output" "type" $fs
|
||||||
|
-
|
||||||
|
- ssm -f remove -a
|
||||||
|
-
|
||||||
|
-done
|
||||||
|
-
|
||||||
|
-# Create volume with all devices at once
|
||||||
|
-size=$(($DEV_SIZE*6))
|
||||||
|
-ssm create --size ${size}M $TEST_DEVS
|
||||||
|
-
|
||||||
|
-# Take a snapshot with the default params
|
||||||
|
-export SSM_DEFAULT_BACKEND='btrfs'
|
||||||
|
-ssm snapshot --name $snap1 $SSM_LVM_DEFAULT_POOL/$lvol1
|
||||||
|
-
|
||||||
|
-output=$(ssm info $SSM_LVM_DEFAULT_POOL/$snap1)
|
||||||
|
-check info_table none "$output" "object name.*$SSM_LVM_DEFAULT_POOL/$snap1"
|
||||||
|
-check info_table none "$output" "type" snapshot
|
||||||
|
-check info_table none "$output" "parent volume.*$SSM_LVM_DEFAULT_POOL/$lvol1"
|
||||||
|
-
|
||||||
|
-output=$(ssm info $SSM_LVM_DEFAULT_POOL)
|
||||||
|
-check info_table none "$output" "type" lvm volume group
|
||||||
|
-check info_table none "$output" "logical volume.*$snap1"
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-export SSM_DEFAULT_BACKEND='lvm'
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-exit 0
|
||||||
|
diff --git a/tests/unittests/test_ssm.py b/tests/unittests/test_ssm.py
|
||||||
|
index 142bee2..3fe8f5f 100644
|
||||||
|
--- a/tests/unittests/test_ssm.py
|
||||||
|
+++ b/tests/unittests/test_ssm.py
|
||||||
|
@@ -281,7 +281,6 @@ class SimpleSsmSanityCheck(unittest.TestCase):
|
||||||
|
self.assert_("resize" in obj)
|
||||||
|
self.assert_("create" in obj)
|
||||||
|
self.assert_("list" in obj)
|
||||||
|
- self.assert_("info" in obj)
|
||||||
|
self.assert_("add" in obj)
|
||||||
|
self.assert_("remove" in obj)
|
||||||
|
self.assert_("snapshot" in obj)
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From 168e3e9b41cfa4a954576c08cf03e0a18c80edb4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Thu, 11 Apr 2019 13:17:36 +0200
|
||||||
|
Subject: [PATCH 3/9] unittests: better multipath message on fail
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
tests/unittests/test_multipath.py | 5 +++--
|
||||||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/unittests/test_multipath.py b/tests/unittests/test_multipath.py
|
||||||
|
index 49c4a6c..6e58153 100644
|
||||||
|
--- a/tests/unittests/test_multipath.py
|
||||||
|
+++ b/tests/unittests/test_multipath.py
|
||||||
|
@@ -167,13 +167,14 @@ class MultipathFunctionCheck(MockSystemDataSource):
|
||||||
|
finally:
|
||||||
|
sys.stdout = self._stdout
|
||||||
|
vol_entries = 0
|
||||||
|
- for line in self._stringio.getvalue().splitlines():
|
||||||
|
+ output = self._stringio.getvalue()
|
||||||
|
+ for line in output.splitlines():
|
||||||
|
if line[:6] in ['------', 'Device']:
|
||||||
|
continue
|
||||||
|
dev = line.split(" ")
|
||||||
|
if dev[0] in ['/dev/dm-90', '/dev/dm-91']:
|
||||||
|
vol_entries += 1
|
||||||
|
- self.assertEqual(vol_entries, 2, "List vol should show 2 entries for 2 multipath devices, but found {0}.".format(vol_entries))
|
||||||
|
+ self.assertEqual(vol_entries, 2, "List vol should show 2 entries for 2 multipath devices, but found {0}: {1}".format(vol_entries, output))
|
||||||
|
|
||||||
|
# There should be no output for pools
|
||||||
|
sys.stdout = self._stringio = StringIO()
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,163 @@
|
|||||||
|
From 63b1437d96468d0fc81ea6ed0def628b98cbb285 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Tue, 24 Jul 2018 14:11:13 +0200
|
||||||
|
Subject: [PATCH 6/9] tests: add bash test skipping capabilities
|
||||||
|
|
||||||
|
Not all tests can be run all the time. If e.g. a required tool for some
|
||||||
|
backend is missing, it is better to skip the test and mark it so, rather
|
||||||
|
than fail, leaving the developer to search why.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
.gitignore | 1 +
|
||||||
|
test.py | 35 ++++++++++++++++++++++++++++----
|
||||||
|
tests/bashtests/016-multipath.sh | 4 ++--
|
||||||
|
tests/bashtests/lib/utils.sh | 5 +++++
|
||||||
|
4 files changed, 39 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/.gitignore b/.gitignore
|
||||||
|
index 53af491..d0038e8 100644
|
||||||
|
--- a/.gitignore
|
||||||
|
+++ b/.gitignore
|
||||||
|
@@ -5,4 +5,5 @@ doc/src/options/
|
||||||
|
*.pyc
|
||||||
|
*.swp
|
||||||
|
tests/bashtests/*.bad
|
||||||
|
+tests/bashtests/*.skipped
|
||||||
|
tests/bashtests/*.out
|
||||||
|
diff --git a/test.py b/test.py
|
||||||
|
index 5620679..9c2610e 100755
|
||||||
|
--- a/test.py
|
||||||
|
+++ b/test.py
|
||||||
|
@@ -103,7 +103,7 @@ def check_system_dependencies():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
-def run_bash_tests(names, want_logs=False):
|
||||||
|
+def run_bash_tests(names, exclude=[], want_logs=False):
|
||||||
|
cur = os.getcwd()
|
||||||
|
os.chdir('./tests/bashtests')
|
||||||
|
command = ['ls', '-m']
|
||||||
|
@@ -112,6 +112,7 @@ def run_bash_tests(names, want_logs=False):
|
||||||
|
|
||||||
|
failed = []
|
||||||
|
passed = []
|
||||||
|
+ skipped = []
|
||||||
|
count = 0
|
||||||
|
misc.run('./set.sh', stdout=False)
|
||||||
|
output = misc.run(command, stdout=False)[1]
|
||||||
|
@@ -122,12 +123,20 @@ def run_bash_tests(names, want_logs=False):
|
||||||
|
continue
|
||||||
|
if names and script not in names and script[:3] not in names:
|
||||||
|
continue
|
||||||
|
+ if exclude and (script in exclude or script[:3] in exclude):
|
||||||
|
+ skipped.append(script)
|
||||||
|
+ print("{0:<29} \033[90m[SKIPPED]\033[0m".format(script))
|
||||||
|
+ continue
|
||||||
|
+
|
||||||
|
count += 1
|
||||||
|
sys.stdout.write("{0:<29}".format(script) + " ")
|
||||||
|
sys.stdout.flush()
|
||||||
|
bad_file = re.sub("\.sh$",".bad", script)
|
||||||
|
+ skip_file = re.sub("\.sh$",".skipped", script)
|
||||||
|
if os.access(bad_file, os.R_OK):
|
||||||
|
os.remove(bad_file)
|
||||||
|
+ if os.access(skip_file, os.R_OK):
|
||||||
|
+ os.remove(skip_file)
|
||||||
|
ret, out, err = misc.run(['./' + script], stdout=False, can_fail=True)
|
||||||
|
if ret:
|
||||||
|
print("\033[91m[FAILED]\033[0m")
|
||||||
|
@@ -140,6 +149,11 @@ def run_bash_tests(names, want_logs=False):
|
||||||
|
print("\033[93m[WARNING]\033[0m")
|
||||||
|
with open(bad_file, 'w') as f:
|
||||||
|
f.write(out)
|
||||||
|
+ elif re.search("\[TEST SKIPPED\]", out):
|
||||||
|
+ print("\033[90m[SKIPPED]\033[0m")
|
||||||
|
+ skipped.append(script)
|
||||||
|
+ with open(skip_file, 'w') as f:
|
||||||
|
+ f.write(out)
|
||||||
|
else:
|
||||||
|
print("\033[92m[PASSED]\033[0m")
|
||||||
|
passed.append(script)
|
||||||
|
@@ -156,6 +170,10 @@ def run_bash_tests(names, want_logs=False):
|
||||||
|
print("Ran {0} tests in {1} seconds.".format(count, round(t1, 2)))
|
||||||
|
print("{0} tests PASSED: {1}".format(len(passed), ", ".join(passed)))
|
||||||
|
ret = 0
|
||||||
|
+ if len(skipped) > 0:
|
||||||
|
+ print("{0} tests SKIPPED: {1}".format(len(skipped), ", ".join(skipped)))
|
||||||
|
+ print("See files with \"skipped\" extension for output")
|
||||||
|
+
|
||||||
|
if len(failed) > 0:
|
||||||
|
print("{0} tests FAILED: {1}".format(len(failed), ", ".join(failed)))
|
||||||
|
print("See files with \"bad\" extension for output")
|
||||||
|
@@ -269,7 +287,11 @@ if __name__ == '__main__':
|
||||||
|
parser.add_argument('-l', '--logs', dest='want_logs', action='store_true',
|
||||||
|
help='if a bash test fails, print out it\'s log to stdout')
|
||||||
|
parser.add_argument('-s', '--system', dest='system', action='store_true',
|
||||||
|
- help='Test the installed version of ssm in system. Implies --bash.')
|
||||||
|
+ help='test the installed version of ssm in system. implies --bash.')
|
||||||
|
+ parser.add_argument('--skip', metavar='TEST', type=str, nargs='+',
|
||||||
|
+ help='Bash tests to to be skipped. '
|
||||||
|
+ 'Can\'t be used together with an explicit list of tests to run.'
|
||||||
|
+ 'Tests can be specified either with a full name, or by just their number.')
|
||||||
|
parser.add_argument('tests', metavar='TEST', type=str, nargs='*',
|
||||||
|
help='Specific tests to be run. For bash tests, '
|
||||||
|
'that means either a full name (001-foo.sh), '
|
||||||
|
@@ -277,10 +299,15 @@ if __name__ == '__main__':
|
||||||
|
'For unit tests, it means something like '
|
||||||
|
'BtrfsFunctionCheck.test_btrfs_resize for a specific test, '
|
||||||
|
'BtrfsFunctionCheck for specific test suite '
|
||||||
|
- 'and test_btrfs for a whole file of tests.')
|
||||||
|
+ 'and test_btrfs for a whole file of tests.'
|
||||||
|
+ 'Can\'t be used together with --skip.')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
+ if args.skip and args.tests:
|
||||||
|
+ print("Do not use --skip together with a list of tests to be run.")
|
||||||
|
+ sys.exit(1)
|
||||||
|
+
|
||||||
|
check_system_dependencies()
|
||||||
|
if args.system:
|
||||||
|
args.bash = True
|
||||||
|
@@ -306,5 +333,5 @@ if __name__ == '__main__':
|
||||||
|
print("\nRoot privileges required to run more tests!\n")
|
||||||
|
sys.exit(0)
|
||||||
|
print("[+] Running bash tests")
|
||||||
|
- result = run_bash_tests(names=args.tests, want_logs=args.want_logs)
|
||||||
|
+ result = run_bash_tests(names=args.tests, exclude=args.skip, want_logs=args.want_logs)
|
||||||
|
sys.exit(result)
|
||||||
|
diff --git a/tests/bashtests/016-multipath.sh b/tests/bashtests/016-multipath.sh
|
||||||
|
index a8e8855..5a43e24 100755
|
||||||
|
--- a/tests/bashtests/016-multipath.sh
|
||||||
|
+++ b/tests/bashtests/016-multipath.sh
|
||||||
|
@@ -25,11 +25,11 @@ if ! mpath_is_configured; then
|
||||||
|
echo "Multipath is not installed or configured!"
|
||||||
|
echo "If it is installed, then you need to have an empty configuration created with this:"
|
||||||
|
echo "sudo mpathconf --enable --with_multipathd y"
|
||||||
|
- exit 1
|
||||||
|
+ skip_test
|
||||||
|
fi
|
||||||
|
if [ mpath_verify -eq 0]; then
|
||||||
|
echo "This test can't be run, because there already is an existing multipath configuration."
|
||||||
|
- exit 1
|
||||||
|
+ skip_test
|
||||||
|
fi
|
||||||
|
|
||||||
|
export COLUMNS=1024
|
||||||
|
diff --git a/tests/bashtests/lib/utils.sh b/tests/bashtests/lib/utils.sh
|
||||||
|
index 5627770..7b87f89 100644
|
||||||
|
--- a/tests/bashtests/lib/utils.sh
|
||||||
|
+++ b/tests/bashtests/lib/utils.sh
|
||||||
|
@@ -205,3 +205,8 @@ if [ -n "$PREFIX" ]; then
|
||||||
|
eval "mnt$i=$mnt"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
+
|
||||||
|
+skip_test() {
|
||||||
|
+ echo "[TEST SKIPPED]"
|
||||||
|
+ exit 0
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From ee669a077d48bf1c5e3ffd8bf14b79d640055c93 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Tue, 23 Apr 2019 14:23:21 +0200
|
||||||
|
Subject: [PATCH 7/9] show available memory when running tests
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
test.py | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/test.py b/test.py
|
||||||
|
index 9c2610e..3c8ba4f 100755
|
||||||
|
--- a/test.py
|
||||||
|
+++ b/test.py
|
||||||
|
@@ -309,6 +309,8 @@ if __name__ == '__main__':
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
check_system_dependencies()
|
||||||
|
+ os.system('free -h')
|
||||||
|
+
|
||||||
|
if args.system:
|
||||||
|
args.bash = True
|
||||||
|
os.environ['SSM_TEST_SYSTEM'] = '1'
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
From 56160e073deee585ea75a2ee69b2706918430ebe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Tue, 23 Apr 2019 16:10:36 +0200
|
||||||
|
Subject: [PATCH 8/9] tests: 018 - remove unnecessary check for crypt
|
||||||
|
|
||||||
|
This is migrate test, not crypt test, so we don't have to test
|
||||||
|
what version of encryption was used; Hardcoded value like the removed
|
||||||
|
line leads to trouble when the system default changes.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
tests/bashtests/018-migrate.sh | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/bashtests/018-migrate.sh b/tests/bashtests/018-migrate.sh
|
||||||
|
index fa1a745..898f827 100755
|
||||||
|
--- a/tests/bashtests/018-migrate.sh
|
||||||
|
+++ b/tests/bashtests/018-migrate.sh
|
||||||
|
@@ -196,7 +196,6 @@ crypt_vol1=${CRYPT_VOL_PREFIX}001
|
||||||
|
|
||||||
|
passwd="cai0ohMo8M"
|
||||||
|
pass | ssm create $dev1
|
||||||
|
-check crypt_vol_field $crypt_vol1 type LUKS1
|
||||||
|
check crypt_vol_field $crypt_vol1 device $dev1
|
||||||
|
check list_table "$(ssm list vol)" $crypt_vol1 $SSM_CRYPT_DEFAULT_POOL none crypt
|
||||||
|
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,102 @@
|
|||||||
|
From a3419509c2f4baadd453fc650cef894a6b53329b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tulak <jtulak@redhat.com>
|
||||||
|
Date: Thu, 6 Jun 2019 13:13:15 +0200
|
||||||
|
Subject: [PATCH] crypt: accept versions with -rc suffix as well
|
||||||
|
|
||||||
|
SSM crashed if cryptsetup --version produced a string like cryptsetup
|
||||||
|
1.2.3-rc0. Make sure that the -rc and similar suffixes doesn't matter.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Tulak <jtulak@redhat.com>
|
||||||
|
---
|
||||||
|
ssmlib/backends/crypt.py | 2 ++
|
||||||
|
tests/unittests/__init__.py | 3 +-
|
||||||
|
tests/unittests/test_crypt.py | 52 +++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 56 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 tests/unittests/test_crypt.py
|
||||||
|
|
||||||
|
diff --git a/ssmlib/backends/crypt.py b/ssmlib/backends/crypt.py
|
||||||
|
index 8d93fe9..dd203e0 100644
|
||||||
|
--- a/ssmlib/backends/crypt.py
|
||||||
|
+++ b/ssmlib/backends/crypt.py
|
||||||
|
@@ -52,6 +52,8 @@ MAX_DEVS = 999
|
||||||
|
def get_cryptsetup_version():
|
||||||
|
try:
|
||||||
|
output = misc.run(['cryptsetup', '--version'], can_fail=True)[1]
|
||||||
|
+ # drop -rc and similar additions
|
||||||
|
+ output = re.sub(r"-.*$", '', output)
|
||||||
|
version = list(map(int, output.strip().split()[-1].split('.', 3)))
|
||||||
|
except (OSError, AttributeError):
|
||||||
|
version = [0, 0, 0]
|
||||||
|
diff --git a/tests/unittests/__init__.py b/tests/unittests/__init__.py
|
||||||
|
index 512baac..52cd1ba 100644
|
||||||
|
--- a/tests/unittests/__init__.py
|
||||||
|
+++ b/tests/unittests/__init__.py
|
||||||
|
@@ -15,4 +15,5 @@
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
-__all__ = ["test_ssm", "test_lvm", "test_btrfs", "test_misc", "test_multipath"]
|
||||||
|
+__all__ = ["test_ssm", "test_lvm", "test_btrfs", "test_misc", "test_multipath",
|
||||||
|
+ "test_crypt"]
|
||||||
|
diff --git a/tests/unittests/test_crypt.py b/tests/unittests/test_crypt.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..2acb58a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/unittests/test_crypt.py
|
||||||
|
@@ -0,0 +1,52 @@
|
||||||
|
+#!/usr/bin/env python
|
||||||
|
+#
|
||||||
|
+# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||||
|
+#
|
||||||
|
+# 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+# Unittests for the system storage manager btrfs backend
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+import unittest
|
||||||
|
+from ssmlib import main
|
||||||
|
+from ssmlib import misc
|
||||||
|
+from ssmlib import problem
|
||||||
|
+from ssmlib.backends import crypt
|
||||||
|
+from tests.unittests.common import *
|
||||||
|
+from unittest.mock import MagicMock, patch
|
||||||
|
+
|
||||||
|
+IGNORE_CMDS = ['udevadm']
|
||||||
|
+
|
||||||
|
+class CryptFunctionCheck(MockSystemDataSource):
|
||||||
|
+
|
||||||
|
+ def test_get_version(self):
|
||||||
|
+ """Traceback (most recent call last):
|
||||||
|
+ File "./test.py", line 32, in <module>
|
||||||
|
+ from ssmlib import main
|
||||||
|
+ File "/var/str/source/ssmlib/main.py", line 31, in <module>
|
||||||
|
+ from ssmlib.backends import lvm, crypt, btrfs, md, multipath
|
||||||
|
+ File "/var/str/source/ssmlib/backends/crypt.py", line 60, in <module>
|
||||||
|
+ CRYPTSETUP_VERSION = get_cryptsetup_version()
|
||||||
|
+ File "/var/str/source/ssmlib/backends/crypt.py", line 55, in get_cryptsetup_version
|
||||||
|
+ version = list(map(int, output.strip().split()[-1].split('.', 3)))
|
||||||
|
+ ValueError: invalid literal for int() with base 10: '0-rc0'
|
||||||
|
+ """
|
||||||
|
+
|
||||||
|
+ mock = MagicMock(return_value=(None, "cryptsetup 1.2.3-rc0"))
|
||||||
|
+ with patch('ssmlib.misc.run', mock):
|
||||||
|
+ self.assertEqual([1, 2, 3], crypt.get_cryptsetup_version())
|
||||||
|
+
|
||||||
|
+ mock = MagicMock(return_value=(None, "cryptsetup 10.21.32"))
|
||||||
|
+ with patch('ssmlib.misc.run', mock):
|
||||||
|
+ self.assertEqual([10, 21, 32], crypt.get_cryptsetup_version())
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
Loading…
Reference in new issue