diff --git a/SOURCES/0011-saveconfig-way-for-block-level-save-with-delete-comm.patch b/SOURCES/0011-saveconfig-way-for-block-level-save-with-delete-comm.patch new file mode 100644 index 0000000..76817d0 --- /dev/null +++ b/SOURCES/0011-saveconfig-way-for-block-level-save-with-delete-comm.patch @@ -0,0 +1,46 @@ +From bca03ea400a691e4218113b6d10adb61ce0cd511 Mon Sep 17 00:00:00 2001 +From: Prasanna Kumar Kalever +Date: Fri, 1 Jun 2018 16:15:22 +0530 +Subject: [PATCH] saveconfig: way for block-level save with delete command + +currently, we can use block-level save feature for create command and +reconfig of different attributes, but there is no way to use block-level +feature for delete command. + +This patch introduces 'save' flag (False on default), which can trigger +saveconfig internally as part of delete command. + +$ targetcli /backstores/user:glfs delete test save=True +Deleted storage object test. + +Signed-off-by: Prasanna Kumar Kalever +--- + targetcli/ui_backstore.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py +index 0af29f0..02695ba 100644 +--- a/targetcli/ui_backstore.py ++++ b/targetcli/ui_backstore.py +@@ -284,7 +284,7 @@ class UIBackstore(UINode): + def summary(self): + return ("Storage Objects: %d" % len(self._children), None) + +- def ui_command_delete(self, name): ++ def ui_command_delete(self, name, save=None): + ''' + Recursively deletes the storage object having the specified I{name}. If + there are LUNs using this storage object, they will be deleted too. +@@ -301,7 +301,8 @@ class UIBackstore(UINode): + except ValueError: + raise ExecutionError("No storage object named %s." % name) + +- child.rtsnode.delete() ++ save = self.ui_eval_param(save, 'bool', False) ++ child.rtsnode.delete(save=save) + self.remove_child(child) + self.shell.log.info("Deleted storage object %s." % name) + +-- +1.8.3.1 + diff --git a/SOURCES/0012-saveconfig-handle-backups-with-block-level-delete.patch b/SOURCES/0012-saveconfig-handle-backups-with-block-level-delete.patch new file mode 100644 index 0000000..f45c669 --- /dev/null +++ b/SOURCES/0012-saveconfig-handle-backups-with-block-level-delete.patch @@ -0,0 +1,28 @@ +From a7254dfc15830eb64ae8d47639889cb6a23bd7f4 Mon Sep 17 00:00:00 2001 +From: Prasanna Kumar Kalever +Date: Tue, 12 Jun 2018 15:36:42 +0530 +Subject: [PATCH] saveconfig: handle backups with block-level delete + +Signed-off-by: Prasanna Kumar Kalever +--- + targetcli/ui_backstore.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py +index 02695ba..7af2568 100644 +--- a/targetcli/ui_backstore.py ++++ b/targetcli/ui_backstore.py +@@ -302,6 +302,10 @@ class UIBackstore(UINode): + raise ExecutionError("No storage object named %s." % name) + + save = self.ui_eval_param(save, 'bool', False) ++ if save: ++ rn = self.get_root() ++ rn._save_backups(default_save_file) ++ + child.rtsnode.delete(save=save) + self.remove_child(child) + self.shell.log.info("Deleted storage object %s." % name) +-- +1.8.3.1 + diff --git a/SPECS/targetcli.spec b/SPECS/targetcli.spec index 04521c4..0eff5fa 100644 --- a/SPECS/targetcli.spec +++ b/SPECS/targetcli.spec @@ -5,7 +5,7 @@ License: ASL 2.0 Group: System Environment/Libraries Summary: An administration shell for storage targets Version: 2.1.fb46 -Release: 4%{?dist} +Release: 6%{?dist} URL: https://fedorahosted.org/targetcli-fb/ Source: https://fedorahosted.org/released/targetcli-fb/%{oname}-%{version}.tar.gz Patch0: 0001-Properly-detect-errors-when-writing-backup-files.-Cl.patch @@ -18,6 +18,8 @@ Patch6: 0007-Fix-default-max_backup_files-in-ui_command_saveconfi.patch Patch7: 0008-config-add-saveconfig-command-to-StorageObject-level.patch Patch8: 0009-Support-tcmu-hw-max-sectors.patch Patch9: 0010-create-add-a-way-to-set-control-string.patch +Patch10: 0011-saveconfig-way-for-block-level-save-with-delete-comm.patch +Patch11: 0012-saveconfig-handle-backups-with-block-level-delete.patch BuildArch: noarch BuildRequires: python-devel python-setuptools Requires: python-rtslib >= 2.1.fb41, python-configshell, python-ethtool @@ -41,6 +43,8 @@ users will also need to install and use fcoe-utils. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 +%patch11 -p1 %build %{__python} setup.py build @@ -61,6 +65,12 @@ install -m 644 targetcli.8.gz %{buildroot}%{_mandir}/man8/ %{_mandir}/man8/targetcli.8.gz %changelog +* Wed Jun 13 2018 Maurizio Lombardi - 2.1.fb46-6 +- handle backups with block-level delete + +* Mon Jun 04 2018 Maurizio Lombardi - 2.1.fb46-5 +- saveconfig: way for block-level save with delete command + * Mon Apr 23 2018 Maurizio Lombardi - 2.1.fb46-4 - Properly detect errors when writing backup files. (Closes: #80) (#81) - Read number of backup files to keep from file