[PATCH] targetcli: Add support for iser-target network portal attribute

51 views
Skip to first unread message

Nicholas A. Bellinger

unread,
Apr 12, 2013, 1:04:44 AM4/12/13
to target-devel, Jerome Martin, Ritesh Raj Sarraf, James Page, Hannes Reinecke, Or Gerlitz, Nicholas Bellinger
From: Nicholas Bellinger <n...@risingtidesystems.com>

Hi folks,

This patch adds support to targetcli for enabling/disabling the iser-target
network portal attribute within NetworkPortal context.

Here is how it looks in action:

/> ls iscsi/
o- iscsi ............................................................ [1 Target]
o- iqn.2003-01.org.linux-iscsi.rtslinux.foobar ....................... [1 TPG]
o- tpgt1 ......................................................... [enabled]
o- acls ......................................................... [0 ACLs]
o- luns .......................................................... [1 LUN]
| o- lun0 ......................................... [rd_mcp/foo (ramdisk)]
o- portals .................................................... [1 Portal]
o- 10.100.0.1:3260 ................................. [OK, iser disabled]
/> cd /iscsi/iqn.2003-01.org.linux-iscsi.rtslinux.foobar/tpgt1/portals/10.100.0.1:3260
/iscsi/iqn.20....100.0.1:3260> iser_enable
iser operation has been enabled
/iscsi/iqn.20....100.0.1:3260> ls
o- 10.100.0.1:3260 .......................................... [OK, iser enabled]
/iscsi/iqn.20....100.0.1:3260> iser_disable
iser operation has been disabled
/iscsi/iqn.20....100.0.1:3260> ls
o- 10.100.0.1:3260 ......................................... [OK, iser disabled]
/iscsi/iqn.20....100.0.1:3260>

Thanks,

--nab

Nicholas Bellinger (1):
targetcli: Add support for iser network portal attribute in UIPortal
class

targetcli/ui_target.py | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)

--
1.7.2.5

Nicholas A. Bellinger

unread,
Apr 12, 2013, 1:04:45 AM4/12/13
to target-devel, Jerome Martin, Ritesh Raj Sarraf, James Page, Hannes Reinecke, Or Gerlitz, Nicholas Bellinger
From: Nicholas Bellinger <n...@risingtidesystems.com>

Signed-off-by: Nicholas Bellinger <n...@risingtidesystems.com>
---
targetcli/ui_target.py | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/targetcli/ui_target.py b/targetcli/ui_target.py
index f7eec49..b9ccf8d 100644
--- a/targetcli/ui_target.py
+++ b/targetcli/ui_target.py
@@ -1023,8 +1023,31 @@ class UIPortal(UIRTSLibNode):
name = "%s:%s" % (portal.ip_address, portal.port)
UIRTSLibNode.__init__(self, name, portal, parent)
self.cfs_cwd = portal.path
+ self.portal = portal
self.refresh()

def summary(self):
- return ('', True)
+ if self.portal._get_iser_attr():
+ return ('OK, iser enabled', True)
+ else:
+ return ('OK, iser disabled', True)
+
+ def ui_command_iser_enable(self):
+ '''
+ Enables iser operation on an network portal.
+ '''
+ if self.portal._get_iser_attr() == True:
+ self.shell.log.info("iser operation has already been enabled")
+ else:
+ self.portal._set_iser_attr(True)
+ self.shell.log.info("iser operation has been enabled")

+ def ui_command_iser_disable(self):
+ '''
+ Disabled iser operation on an network portal.
+ '''
+ if self.portal._get_iser_attr() == False:
+ self.shell.log.info("iser operation has already been disabled")
+ else:
+ self.portal._set_iser_attr(False)
+ self.shell.log.info("iser operation has been disabled")
--
1.7.2.5

Reply all
Reply to author
Forward
0 new messages