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

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