Hello,

The following patch retries power commands 5 times before giving up. Some switches only support one connection at a time and retrying usually makes this work.

Also, it looks like the fix from stable for wti didn't get put in devel.
>From c9d871cf03303a03e49a745ce45b9bdbee4c1806 Mon Sep 17 00:00:00 2001
From: Bill Peck <[email protected]>
Date: Thu, 19 Feb 2009 11:52:27 -0500
Subject: [PATCH] try the power command 5 times before giving up.  Some power 
switches are flakey

---
 cobbler/action_power.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/cobbler/action_power.py b/cobbler/action_power.py
index 8f92cc5..789750a 100644
--- a/cobbler/action_power.py
+++ b/cobbler/action_power.py
@@ -31,6 +31,7 @@ import os.path
 import sub_process
 import sys
 import traceback
+import time
 
 import utils
 from cexceptions import *
@@ -106,7 +107,15 @@ class PowerTool:
         #if not os.path.exists(tool_needed):
         #   print "warning: %s does not seem to be installed" % tool_needed
 
-        rc = sub_process.call(cmd, shell=False, close_fds=True)
+        # Try the power command 5 times before giving up.
+        # Some power switches are flakey
+        for x in range(0,5):
+            rc = sub_process.call(cmd, shell=False, close_fds=True)
+            if rc == 0:
+                break
+            else:
+                time.sleep(2)
+
         if not rc == 0:
            raise CX("command failed (rc=%s), please validate the physical 
setup and cobbler config" % rc)
 
@@ -138,6 +147,7 @@ class PowerTool:
             "bladecenter": os.path.join(powerdir,"power_bladecenter.template"),
             "virsh"      : os.path.join(powerdir,"power_virsh.template"),
             "integrity"  : os.path.join(powerdir,"power_integrity.template"),
+            "wti"        : os.path.join(powerdir,"power_wti.template"),
         }
 
         result = map.get(self.system.power_type, "")
-- 
1.6.0.6

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to