incubator-tashi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Gass <richardg...@gmail.com>
Subject Support for iLo in zoni
Date Tue, 09 Feb 2010 04:37:00 GMT
2 more files to add support for HP iLo.   Capture iLo info for the
host object and adding the command line switch to zoni-cli.py

Index: resourcequerysql.py
===================================================================
--- resourcequerysql.py (revision 907874)
+++ resourcequerysql.py (working copy)
@@ -477,16 +477,16 @@
                '''

                #  Get IPMI info
-               query = "select * from ipmiinfo where node_id = " +
str(host['node_id']) + ""
-               result = self.__selectDb(query)
-               if result.rowcount> 1:
-                       print "Mulitple entries for system exist.
Please correct"
-                       exit()
-               for i in result.fetchall():
-                       host['ipmi_user'] = i[2]
-                       host['ipmi_password'] = i[3]
-                       host['ipmi_addr'] = i[1]
-
+               #query = "select * from ipmiinfo where node_id = " +
str(host['node_id']) + ""
+               #result = self.__selectDb(query)
+               #if result.rowcount> 1:
+                       #print "Mulitple entries for system exist.
Please correct"
+                       #exit()
+               #for i in result.fetchall():
+                       #host['ipmi_user'] = i[2]
+                       #host['ipmi_password'] = i[3]
+                       #host['ipmi_addr'] = i[1]
+#
                #  Get image info
                query = "select image_name from imagemap i, imageinfo
j where i.image_id = j.image_id and mac_addr = \"" + host['mac_addr']
+ "\""
                result = self.__selectDb(query)
@@ -533,7 +533,20 @@
                        host['pdu_password'] = i[5]
                        host['pdu_port'] = int(i[6])

+               #  Get ilo info
+               query = "select h.hw_id, h.hw_name, h.hw_model,
h.hw_ipaddr, h.hw_userid, h.hw_password, p.port_num from hardwareinfo
h, portmap p where p.hw_id = h.hw_id and hw_type = 'ilo' and node_id =
" +  str(host['node_id'])
+               result = self.__selectDb(query)
+               if result.rowcount > 0:
+                       for i in result.fetchall():
+                               host['ilo_id'] = int(i[0])
+                               host['ilo_name'] = i[1]
+                               host['ilo_model'] = i[2]
+                               host['ilo_ipaddr'] = i[3]
+                               host['ilo_userid'] = i[4]
+                               host['ilo_password'] = i[5]
+                               host['ilo_port'] = int(i[6])

+
                #print "host is ", host
                return host


Index: zoni-cli.py
===================================================================
--- zoni-cli.py (revision 907874)
+++ zoni-cli.py (working copy)
@@ -1,4 +1,4 @@
-# /usr/bin/env python
+#!/usr/bin/env python
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -28,6 +28,7 @@
 import resourcequerysql
 from systemmanagementinterface import SystemManagementInterface
 from ipmi import Ipmi
+from hpilo import hpILo
 from usermanagementinterface import UserManagementInterface

 from bootmanagementinterface import BootManagementInterface
@@ -65,7 +66,7 @@

        #  Hardware controller
        group = optparse.OptionGroup(parser, "Hardware control",
"Options to control power on nodes")
-       group.add_option("--hw", dest="hardwareType", help="Make
hardware call to ipmi|drac|pdu")
+       group.add_option("--hw", dest="hardwareType", help="Make
hardware call to ipmi|drac|pdu|ilo")
        group.add_option("--powerStatus", "--powerstatus",
dest="POWERSTATUS", help="Get power status on node",
action="store_true", default=False)
        group.add_option("--reboot", "--reboot", dest="REBOOTNODE",
help="Reboot node (Soft)", action="store_true", default=False)
        group.add_option("--powerCycle", "--powercycle",
dest="POWERCYCLE", help="Power Cycle (Hard)", action="store_true",
default=False)
@@ -183,6 +184,9 @@
                                        sys.stdout.write(mesg)
                                        exit(1)

+                       if options.hardwareType == "ilo":
+                               hw = hpILo(host)
+
                        if options.verbosity:
                                hw.setVerbose(True)


-- 
Richard Gass

Mime
View raw message