[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] Avoid power-on plugin failure



# HG changeset patch
# User Javier Alvarez-Valle <javier.alvarez-valle@xxxxxxxxxx>
# Date 1278584479 -3600
# Node ID b9d131eda02f682382ffc58a804421f700f27a9e
# Parent  1aade1532deea9b779674b461dad428d2d64ff1d
This avoids a failure when power on is used with HP iLO and DRAC.

Signed-off-by: Javier Alvarez-Valle <javier.alvarez-valle@xxxxxxxxxx>

diff -r 1aade1532dee -r b9d131eda02f scripts/poweron/power-on.py
--- a/scripts/poweron/power-on.py       Thu Jul 08 11:20:47 2010 +0100
+++ b/scripts/poweron/power-on.py       Thu Jul 08 11:21:19 2010 +0100
@@ -15,6 +15,20 @@
         Exception.__init__(self, *args)
 
 
+def waitForXapi(session,host):
+    attempts = 0
+    finished = False
+    metrics = None
+    while not finished and (attempts < 120):
+        attempts = attempts + 1
+        time.sleep(5)
+        metrics = session.xenapi.host.get_metrics(host)
+        try:
+            finished = session.xenapi.host_metrics.get_live(metrics)
+        except:
+            pass
+    return str(finished)
+
 
 def main(session, args):
     remote_host_uuid = args['remote_host_uuid']
@@ -33,20 +47,21 @@
         secret = power_on_config['power_on_password_secret']
         secretref=session.xenapi.secret.get_by_uuid(secret)
         password = session.xenapi.secret.get_value(secretref)
-        
         if mode == "iLO":
             modu= __import__('iLO')
-            return modu.iLO( ip, user, password)
+            modu.iLO( ip, user, password)
         else: 
             modu= __import__('DRAC')
-            return modu.DRAC(ip, user, password)
+            modu.DRAC( ip, user, password)
+        return waitForXapi(session,remote_host)
     elif mode=="wake-on-lan":
         modu= __import__('wlan')
         return modu.wake_on_lan(session, remote_host, remote_host_uuid)
     # Custom script
     elif mode!="":
         modu= __import__(mode)
-        return modu.custom(session,remote_host,power_on_config)
+        modu.custom(session,remote_host,power_on_config)
+        return waitForXapi(session,remote_host)
     # Disabled
     else: 
         raise HOST_POWER_ON_NOT_CONFIGURED()
 scripts/poweron/power-on.py |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)


Attachment: lastminutepoweronchange.diff
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.