diff --git a/.gitignore b/.gitignore index 67be01e..0d574e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/targetcli-fb-2.1.fb34.tar.gz +SOURCES/targetcli-fb-2.1.fb37.tar.gz diff --git a/.targetcli.metadata b/.targetcli.metadata index e257c28..142c6d3 100644 --- a/.targetcli.metadata +++ b/.targetcli.metadata @@ -1 +1 @@ -3b906a0741ac1ca98266c35fd25fc221bde47205 SOURCES/targetcli-fb-2.1.fb34.tar.gz +6f1c5add07a93de52d12e916397d69329e45f0e7 SOURCES/targetcli-fb-2.1.fb37.tar.gz diff --git a/SOURCES/default-portal-pref.patch b/SOURCES/default-portal-pref.patch new file mode 100644 index 0000000..3645009 --- /dev/null +++ b/SOURCES/default-portal-pref.patch @@ -0,0 +1,69 @@ +From 3947c435cb32f8f8347b8f51f8dde967ac0d47c6 Mon Sep 17 00:00:00 2001 +From: Andy Grover +Date: Wed, 17 Dec 2014 16:13:27 -0800 +Subject: [PATCH 2/2] Add a global pref for adding default portal + +Expand info messages to mention this pref as well + +Fixes #46 + +Signed-off-by: Andy Grover +--- + scripts/targetcli | 1 + + targetcli/ui_node.py | 3 +++ + targetcli/ui_target.py | 13 +++++++++---- + 3 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/scripts/targetcli b/scripts/targetcli +index b95e842..5404fcd 100755 +--- a/scripts/targetcli ++++ b/scripts/targetcli +@@ -49,6 +49,7 @@ class TargetCLI(ConfigShell): + 'auto_add_mapped_luns': True, + 'auto_cd_after_create': False, + 'auto_save_on_exit': True, ++ 'auto_add_default_portal': True, + } + + def usage(): +diff --git a/targetcli/ui_node.py b/targetcli/ui_node.py +index 53c095f..5abfd7f 100644 +--- a/targetcli/ui_node.py ++++ b/targetcli/ui_node.py +@@ -43,6 +43,9 @@ class UINode(ConfigNode): + self.define_config_group_param( + 'global', 'auto_save_on_exit', 'bool', + 'If true, saves configuration on exit.') ++ self.define_config_group_param( ++ 'global', 'auto_add_default_portal', 'bool', ++ 'If true, adds a portal listening on all IPs to new targets.') + + def assert_root(self): + ''' +diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py +index a28925c..7fcaab0 100644 +--- a/targetcli/ui_target.py ++++ b/targetcli/ui_target.py +@@ -335,10 +335,15 @@ class UIMultiTPGTarget(UIRTSLibNode): + + self.shell.log.info("Created TPG %s." % tpg.tag) + +- if tpg.has_feature("nps"): +- NetworkPortal(tpg, "0.0.0.0") +- self.shell.log.info("Created default portal listening on all IPs" +- " (0.0.0.0), port 3260.") ++ if tpg.has_feature("nps") and self.shell.prefs['auto_add_default_portal']: ++ try: ++ NetworkPortal(tpg, "0.0.0.0") ++ self.shell.log.info("Global pref auto_add_default_portal=true") ++ self.shell.log.info("Created default portal listening on all IPs" ++ " (0.0.0.0), port 3260.") ++ except RTSLibError: ++ self.shell.log.info("Default portal not created, TPGs within a " + ++ "target cannot share ip:port.") + + ui_tpg = UITPG(tpg, self) + return self.new_node(ui_tpg) +-- +1.9.3 + diff --git a/SOURCES/fix-session-detail.patch b/SOURCES/fix-session-detail.patch new file mode 100644 index 0000000..006f931 --- /dev/null +++ b/SOURCES/fix-session-detail.patch @@ -0,0 +1,25 @@ +commit a3182301b10f1a2be0f26d9d6204021a4b8deac5 +Author: Andy Grover +Date: Tue Nov 4 11:33:40 2014 -0800 + + Fix issue with sessions detail command + + Do not reference the backstore, access the plugin field off the so + directly. This is a regression introduced with the backstore removal + changes a while back. + + Signed-off-by: Andy Grover + +diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py +index ac60133..472d6e0 100644 +--- a/targetcli/ui_root.py ++++ b/targetcli/ui_root.py +@@ -190,7 +190,7 @@ class UIRoot(UINode): + base_steps + 1) + + for mlun in acl.mapped_luns: +- plugin = mlun.tpg_lun.storage_object.backstore.plugin ++ plugin = mlun.tpg_lun.storage_object.plugin + name = mlun.tpg_lun.storage_object.name + if mlun.write_protect: + mode = "r" diff --git a/SOURCES/tpg-invalid-tag.patch b/SOURCES/tpg-invalid-tag.patch new file mode 100644 index 0000000..12621a2 --- /dev/null +++ b/SOURCES/tpg-invalid-tag.patch @@ -0,0 +1,53 @@ +From 4e3f06f529d776f6ce70be16d3f62db6b6211c44 Mon Sep 17 00:00:00 2001 +From: Andy Grover +Date: Wed, 17 Dec 2014 16:07:20 -0800 +Subject: [PATCH 1/2] Catch exception if an invalid tag is given when creating + a tpg + +Also, allow e.g "tpg6" as well as "6" for the tpg tag. This matches what +we do for lun creation. + +Fixes #47 + +Signed-off-by: Andy Grover +--- + targetcli/ui_target.py | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py +index 5c8e2f4..a28925c 100644 +--- a/targetcli/ui_target.py ++++ b/targetcli/ui_target.py +@@ -306,9 +306,10 @@ class UIMultiTPGTarget(UIRTSLibNode): + + def ui_command_create(self, tag=None): + ''' +- Creates a new Target Portal Group within the target. The I{tag} must be +- a strictly positive integer value. If omitted, the next available +- Target Portal Group Tag (TPGT) will be used. ++ Creates a new Target Portal Group within the target. The ++ I{tag} must be a positive integer value, optionally prefaced ++ by 'tpg'. If omitted, the next available Target Portal Group ++ Tag (TPGT) will be used. + + SEE ALSO + ======== +@@ -316,6 +317,15 @@ class UIMultiTPGTarget(UIRTSLibNode): + ''' + self.assert_root() + ++ if tag: ++ if tag.startswith("tpg"): ++ tag = tag[3:] ++ ++ try: ++ tag = int(tag) ++ except ValueError: ++ raise ExecutionError("Tag argument must be a number.") ++ + tpg = TPG(self.rtsnode, tag, mode='create') + if self.shell.prefs['auto_enable_tpgt']: + tpg.enable = True +-- +1.9.3 + diff --git a/SPECS/targetcli.spec b/SPECS/targetcli.spec index cfd0026..1cc3091 100644 --- a/SPECS/targetcli.spec +++ b/SPECS/targetcli.spec @@ -4,10 +4,13 @@ Name: targetcli License: ASL 2.0 Group: System Environment/Libraries Summary: An administration shell for storage targets -Version: 2.1.fb34 -Release: 1%{?dist} +Version: 2.1.fb37 +Release: 3%{?dist} URL: https://fedorahosted.org/targetcli-fb/ Source: https://fedorahosted.org/released/targetcli-fb/%{oname}-%{version}.tar.gz +Patch0: fix-session-detail.patch +Patch1: tpg-invalid-tag.patch +Patch2: default-portal-pref.patch BuildArch: noarch BuildRequires: python-devel python-setuptools Requires: python-rtslib >= 2.1.fb41, python-configshell, python-ethtool @@ -21,6 +24,9 @@ users will also need to install and use fcoe-utils. %prep %setup -q -n %{oname}-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build %{__python} setup.py build @@ -41,6 +47,16 @@ install -m 644 targetcli.8.gz %{buildroot}%{_mandir}/man8/ %{_mandir}/man8/targetcli.8.gz %changelog +* Tue Nov 4 2014 Andy Grover - 2.1.fb37-3 +- add tpg-invalid-tag.patch +- add default-portal-pref.patch + +* Tue Nov 4 2014 Andy Grover - 2.1.fb37-2 +- add fix-session-detail.patch + +* Thu Oct 9 2014 Andy Grover - 2.1.fb37-1 +- New upstream version + * Mon Feb 24 2014 Andy Grover - 2.1.fb34-1 - New upstream version. Fixes rhbz #1066695