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

d7eb2d
From 7213c27f03e5cbabb755da8e6cbe39c75c68c351 Mon Sep 17 00:00:00 2001
d7eb2d
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
d7eb2d
Date: Fri, 1 Jun 2018 15:18:18 +0530
d7eb2d
Subject: [PATCH] saveconfig: way for block-level save with delete command
d7eb2d
d7eb2d
currently, we can use block-level save feature for create command and
d7eb2d
reconfig of different attributes, but there is no way to use block-level
d7eb2d
feature for delete command.
d7eb2d
d7eb2d
This patch introduces 'save' flag (False on default), which can trigger
d7eb2d
saveconfig internally as part of delete command.
d7eb2d
d7eb2d
$ targetcli /backstores/user:glfs delete test save=True
d7eb2d
Deleted storage object test.
d7eb2d
d7eb2d
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
d7eb2d
---
d7eb2d
 rtslib/tcm.py | 5 ++++-
d7eb2d
 1 file changed, 4 insertions(+), 1 deletion(-)
d7eb2d
d7eb2d
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
d7eb2d
index 4ed96b4..58952d6 100644
d7eb2d
--- a/rtslib/tcm.py
d7eb2d
+++ b/rtslib/tcm.py
d7eb2d
@@ -251,7 +251,7 @@ class StorageObject(CFSNode):
d7eb2d
 
d7eb2d
     # StorageObject public stuff
d7eb2d
 
d7eb2d
-    def delete(self):
d7eb2d
+    def delete(self, save=False):
d7eb2d
         '''
d7eb2d
         Recursively deletes a StorageObject object.
d7eb2d
         This will delete all attached LUNs currently using the StorageObject
d7eb2d
@@ -274,6 +274,9 @@ class StorageObject(CFSNode):
d7eb2d
 
d7eb2d
         super(StorageObject, self).delete()
d7eb2d
         self._backstore.delete()
d7eb2d
+        if save:
d7eb2d
+            from .root import RTSRoot, default_save_file
d7eb2d
+            RTSRoot().save_to_file(default_save_file, '/backstores/' + self.plugin  + '/' + self._name)
d7eb2d
 
d7eb2d
     def is_configured(self):
d7eb2d
         '''
d7eb2d
-- 
d7eb2d
1.8.3.1
d7eb2d