[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
be quiet, iscsi
- From: Chris Lumens <clumens redhat com>
- To: anaconda-devel-list redhat com
- Subject: be quiet, iscsi
- Date: Mon, 2 Feb 2009 15:49:50 -0500
Making iscsi no longer spew to tty1 requires two things:
(1) Some redirection in iscsi.py to not send stderr to tty1,
(2) Actually doing what the caller says in execWithCapture.
- Chris
diff --git a/iscsi.py b/iscsi.py
index 5feae15..a4d301e 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -87,7 +87,7 @@ def iscsi_make_node_autostart(disk):
sysfs_path = os.path.realpath("/sys/block/%s/device" %(disk,))
argv = [ "-m", "session", "-r", sysfs_path ]
log.debug("iscsiadm %s" %(string.join(argv),))
- node_settings = iutil.execWithCapture(ISCSIADM, argv).splitlines()
+ node_settings = iutil.execWithCapture(ISCSIADM, argv, stderr="/dev/tty5").splitlines()
node_name = iscsi_get_node_record(node_settings, "node.name")
argv = [ "-m", "node", "-T", node_name, "-o", "update", "-n",
"node.startup", "-v", "automatic" ]
@@ -116,7 +116,7 @@ class iscsiTarget:
if self._portal is None:
argv = [ "-m", "discovery", "-t", "st", "-p", self.ipaddr ]
log.debug("iscsiadm %s" %(string.join(argv),))
- records = iutil.execWithCapture(ISCSIADM, argv)
+ records = iutil.execWithCapture(ISCSIADM, argv, stderr="/dev/tty5")
records = records.strip()
for line in records.split("\n"):
log.debug(" %s" % (line,))
@@ -272,7 +272,7 @@ class iscsi(object):
argv = [ "-m", "fw" ]
log.debug("queryFirmware: ISCSIADM is %s" % (ISCSIADM,))
- result = iutil.execWithCapture(ISCSIADM, argv)
+ result = iutil.execWithCapture(ISCSIADM, argv, stderr="/dev/tty5")
result = result.strip()
if len(result) == 0 \
@@ -283,7 +283,7 @@ class iscsi(object):
# Try querying the node records instead
argv = [ "-m", "node", "-o", "show", "-S" ]
- result = iutil.execWithCapture(ISCSIADM, argv)
+ result = iutil.execWithCapture(ISCSIADM, argv, stderr="/dev/tty5")
if len(result) == 0 \
or result[0].find("iscsiadm -") != -1 \
@@ -312,7 +312,7 @@ class iscsi(object):
time.sleep(2)
def _stopIscsiDaemon(self):
- result = iutil.execWithCapture(ISCSIADM, ["-k", "0"])
+ result = iutil.execWithCapture(ISCSIADM, ["-k", "0"], stderr="/dev/tty5")
result.strip()
if result == "":
self.iscsidStarted = False
@@ -338,7 +338,7 @@ class iscsi(object):
find_iscsi_files()
argv = [ "-m", "discovery", "-t", "fw", "-l" ]
- result = iutil.execWithCapture(ISCSIADM, argv)
+ result = iutil.execWithCapture(ISCSIADM, argv, stderr="/dev/tty5")
log.debug("iscsiadm result: %s" % (result,))
start = result.find('[')
diff --git a/iutil.py b/iutil.py
index df16c7d..c39f642 100644
--- a/iutil.py
+++ b/iutil.py
@@ -105,15 +105,18 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root='/'):
os.chroot(root)
rc = ""
-
argv = list(argv)
+
if type(stdin) == type("string"):
if os.access(stdin, os.R_OK):
stdin = open(stdin)
else:
stdin = 0
+
if type(stderr) == type("string"):
stderr = open(stderr, "w")
+ else:
+ stderr = stderr
runningLog = open("/tmp/program.log", "a")
runningLog.write("Running... %s\n" % ([command] + argv,))
@@ -131,7 +134,7 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root='/'):
rc += outStr
if errStr:
runningLog.write(errStr)
- sys.__stdout__.write(errStr)
+ stderr.write(errStr)
if proc.returncode is not None:
break
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]