Blame SOURCES/0011-saveconfig-way-for-block-level-save-with-delete-comm.patch

5cbafe
From bca03ea400a691e4218113b6d10adb61ce0cd511 Mon Sep 17 00:00:00 2001
5cbafe
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
5cbafe
Date: Fri, 1 Jun 2018 16:15:22 +0530
5cbafe
Subject: [PATCH] saveconfig: way for block-level save with delete command
5cbafe
5cbafe
currently, we can use block-level save feature for create command and
5cbafe
reconfig of different attributes, but there is no way to use block-level
5cbafe
feature for delete command.
5cbafe
5cbafe
This patch introduces 'save' flag (False on default), which can trigger
5cbafe
saveconfig internally as part of delete command.
5cbafe
5cbafe
$ targetcli /backstores/user:glfs delete test save=True
5cbafe
Deleted storage object test.
5cbafe
5cbafe
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
5cbafe
---
5cbafe
 targetcli/ui_backstore.py | 5 +++--
5cbafe
 1 file changed, 3 insertions(+), 2 deletions(-)
5cbafe
5cbafe
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
5cbafe
index 0af29f0..02695ba 100644
5cbafe
--- a/targetcli/ui_backstore.py
5cbafe
+++ b/targetcli/ui_backstore.py
5cbafe
@@ -284,7 +284,7 @@ class UIBackstore(UINode):
5cbafe
     def summary(self):
5cbafe
         return ("Storage Objects: %d" % len(self._children), None)
5cbafe
 
5cbafe
-    def ui_command_delete(self, name):
5cbafe
+    def ui_command_delete(self, name, save=None):
5cbafe
         '''
5cbafe
         Recursively deletes the storage object having the specified I{name}. If
5cbafe
         there are LUNs using this storage object, they will be deleted too.
5cbafe
@@ -301,7 +301,8 @@ class UIBackstore(UINode):
5cbafe
         except ValueError:
5cbafe
             raise ExecutionError("No storage object named %s." % name)
5cbafe
 
5cbafe
-        child.rtsnode.delete()
5cbafe
+        save = self.ui_eval_param(save, 'bool', False)
5cbafe
+        child.rtsnode.delete(save=save)
5cbafe
         self.remove_child(child)
5cbafe
         self.shell.log.info("Deleted storage object %s." % name)
5cbafe
 
5cbafe
-- 
5cbafe
1.8.3.1
5cbafe