summaryrefslogtreecommitdiff
path: root/targetcli
diff options
context:
space:
mode:
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>2018-05-02 16:01:21 -0500
committerBryant G. Ly <bryantly@linux.ibm.com>2018-08-31 09:10:06 -0500
commit7d4f82eb08763a6a1f65af9e6c4c130ec760c5fd (patch)
tree3c04358e3a8b9bb17d6ae594a7a657566bb0a8cf /targetcli
parentf80ebf283cf753f57f4e5565537e7780eb7ba68f (diff)
downloadtargetcli-7d4f82eb08763a6a1f65af9e6c4c130ec760c5fd.tar.gz
targetcli-fb: Add support for media change
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Mike Christie mchristi@redhat.com
Diffstat (limited to 'targetcli')
-rw-r--r--targetcli/ui_backstore.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 0af29f0..9cbeed5 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -651,6 +651,19 @@ class UIUserBackedBackstore(UIBackstore):
% (name, size))
return self.new_node(ui_so)
+ def ui_command_changemedium(self, name, size, cfgstring):
+ size = human_to_bytes(size)
+ config = self.handler + "/" + cfgstring
+
+ try:
+ rc, errmsg = self.iface.ChangeMedium('(sts)', name, size, config)
+ except Exception as e:
+ raise ExecutionError("ChangeMedium failed: %s" % e)
+ else:
+ if rc == 0:
+ self.shell.log.info("Medium Changed.")
+ else:
+ raise ExecutionError("ChangeMedium failed: %s" % errmsg)
class UIStorageObject(UIRTSLibNode):
'''