WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Avoid power-on plugin failure
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 8 Jul 2010 11:22:12 +0100
Delivery-date: Thu, 08 Jul 2010 03:30:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Avoid power-on plugin failure, David Scott <=