File 0106-lio-utils-Convert-direct-unlink-call-to-os.unlink.patch of Package lio-utils.216
From 91b961032150016b7a32dd5aea81c6330917af20 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@risingtidesystems.com>
Date: Wed, 5 Oct 2011 23:46:42 -0700
Subject: lio-utils: Convert direct unlink call to os.unlink
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
---
lio-py/lio_node.py | 8 ++++----
tcm-py/tcm_fabric.py | 8 ++++----
tcm-py/tcm_loop.py | 3 +--
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/lio-py/lio_node.py b/lio-py/lio_node.py
index c08850d..d1e562e 100755
--- a/lio-py/lio_node.py
+++ b/lio-py/lio_node.py
@@ -361,9 +361,9 @@ def __lio_target_del_port(option, opt_str, value, parser):
if not os.path.islink(lun_dir + "/" + port):
continue
- unlink_op = "unlink " + lun_dir + "/" + port
+ unlink_op = lun_dir + "/" + port
# print "del_portunlink_op: " + unlink_op
- ret = os.system(unlink_op)
+ ret = os.unlink(unlink_op)
if ret:
lio_err("Unable to unlink iSCSI Target Logical Unit")
@@ -552,9 +552,9 @@ def lio_target_del_lunacl(option, opt_str, value, parser):
if not os.path.islink(lun_link_dir + "/" + lun_acl_link):
continue;
- unlink_op = "unlink " + lio_root + "/" + iqn + "/tpgt_" + tpgt + "/acls/" + initiator_iqn + "/lun_" + mapped_lun + "/" + lun_acl_link
+ unlink_op = lio_root + "/" + iqn + "/tpgt_" + tpgt + "/acls/" + initiator_iqn + "/lun_" + mapped_lun + "/" + lun_acl_link
# print "unlink_op: " + unlink_op
- ret = os.system(unlink_op)
+ ret = os.unlink(unlink_op)
if ret:
lio_err("Unable to unlink iSCSI Initiator Mapped LUN: " + mapped_lun + " ACL " + initiator_iqn + " for iSCSI Target Portal Group: " + iqn + " " + tpgt)
diff --git a/tcm-py/tcm_fabric.py b/tcm-py/tcm_fabric.py
index 88c7db4..49768e7 100755
--- a/tcm-py/tcm_fabric.py
+++ b/tcm-py/tcm_fabric.py
@@ -358,8 +358,8 @@ def fabric_unload(fabric_name, fabric_root, module_name):
continue
if os.path.islink(lun_link_dir + "/" + lun_acl_link):
- unlink_op = "unlink " + lun_link_dir + "/" + lun_acl_link
- ret = os.system(unlink_op)
+ unlink_op = lun_link_dir + "/" + lun_acl_link
+ ret = os.unlink(unlink_op)
if ret:
print "Unable to unlink MappedLUN: " + lun_link_dir + "/" + lun_acl_link
@@ -383,8 +383,8 @@ def fabric_unload(fabric_name, fabric_root, module_name):
if not os.path.islink(lun_dir + "/" + port):
continue
- unlink_op = "unlink " + lun_dir + "/" + port
- ret = os.system(unlink_op)
+ unlink_op = lun_dir + "/" + port
+ ret = os.unlink(unlink_op)
if ret:
print "Unable to unlink fabric port/lun"
diff --git a/tcm-py/tcm_loop.py b/tcm-py/tcm_loop.py
index 74a6c1b..772222b 100755
--- a/tcm-py/tcm_loop.py
+++ b/tcm-py/tcm_loop.py
@@ -157,8 +157,7 @@ def tcm_loop_dellun(option, opt_str, value, parser):
print "Active TCM_Loop port link does not exist!"
sys.exit(1)
- unlink_op = "unlink " + port_link
- ret = os.system(unlink_op)
+ ret = os.unlink(port_link)
if ret:
print "Unable to unlink port for virtual SCSI Logical Unit: " + port
sys.exit(1)
--
1.8.1.4