summaryrefslogtreecommitdiff
path: root/targetcli
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2018-06-01 16:15:22 +0530
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2018-06-01 16:18:11 +0530
commitbca03ea400a691e4218113b6d10adb61ce0cd511 (patch)
tree93ae77a6047474daef98f9e09698c2b03e23bd41 /targetcli
parentf80ebf283cf753f57f4e5565537e7780eb7ba68f (diff)
downloadtargetcli-bca03ea400a691e4218113b6d10adb61ce0cd511.tar.gz
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 <prasanna.kalever@redhat.com>
Diffstat (limited to 'targetcli')
-rw-r--r--targetcli/ui_backstore.py5
1 files 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)