[PATCH 08/37] add initial restore support. rename cmds to save/restore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 targetcli/ui_root.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py
index 2dd5f8b..5d6c0a0 100644
--- a/targetcli/ui_root.py
+++ b/targetcli/ui_root.py
@@ -70,7 +70,7 @@ class UIRoot(UINode):
                 self.shell.log.debug("Loading %s." % fabric_module.name)
                 UIFabricModule(fabric_module, self)
 
-    def ui_command_bar(self):
+    def ui_command_save(self):
         from rtslib.root import RTSRoot
         import json
 
@@ -79,6 +79,17 @@ class UIRoot(UINode):
         with open("/savecfg.json", "w+") as f:
             f.write(json.dumps(RTSRoot().dump(), sort_keys=True, indent=2))
 
+    def ui_command_restore(self):
+        from rtslib.root import RTSRoot
+        import json
+
+        self.assert_root()
+
+        with open("/savecfg.json", "r") as f:
+            RTSRoot().restore(json.loads(f.read()))
+
+        self.refresh()
+
     def ui_command_saveconfig(self):
         '''
         Saves the whole configuration tree to disk so that it will be restored
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux