You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by rg...@apache.org on 2010/12/27 21:06:08 UTC
svn commit: r1053186 - in /incubator/tashi/branches/zoni-dev/trunk/src/zoni:
client/zoni-cli.py hardware/delldrac.py hardware/systemmanagement.py
services/pcvciservice.py
Author: rgass
Date: Mon Dec 27 21:06:08 2010
New Revision: 1053186
URL: http://svn.apache.org/viewvc?rev=1053186&view=rev
Log:
Minor changes to logging messages of pcvci service
Other minor changes
Modified:
incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py
incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/delldrac.py
incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/systemmanagement.py
incubator/tashi/branches/zoni-dev/trunk/src/zoni/services/pcvciservice.py
Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py?rev=1053186&r1=1053185&r2=1053186&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/client/zoni-cli.py Mon Dec 27 21:06:08 2010
@@ -89,7 +89,7 @@ def main():
# Hardware controller
group = optparse.OptionGroup(parser, "Hardware control", "Options for node power control")
- #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")
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)
@@ -206,45 +206,30 @@ def main():
# Hardware control
- #if options.hardwareType:
- #hardware = zoni.hardware.systemmanagement.SystemManagement(configs,data)
- #hardware.test("r1r2u29", "getPowerStatus", "test", "tes1t")
- #hardware.getPowerStatus("r1r2u29")
- #hardware.powerOn()
- #hardware.powerOff("r1r2u29")
- #hardware.runCmd("r1r2u29", "getPowerStatus", "test", "tes1t")
- #exit()
-
- #if (options.hardwareType) and options.hardwareType not in configs['hardware_control']:
- #mesg = "Non support hardware type specified\n"
- #mesg += "Supported types:\n"
- #mesg += str(configs['hardware_control'])
- #mesg += "\n\n"
- #sys.stdout.write(mesg)
- #exit()
-#
- #if (options.hardwareType) and options.nodeName:
- ##host = data.getHostInfo(options.nodeName)
- #if options.hardwareType == "ipmi":
- #hw = Ipmi(options.nodeName, host["ipmi_user"], host["ipmi_password"])
+ if options.hardwareType and options.nodeName:
+ host = data.getHostInfo(options.nodeName)
+ if options.hardwareType == "ipmi":
+ #hardware = zoni.hardware.systemmanagement.SystemManagement(configs,data)
+ hw = Ipmi(options.nodeName, host["ipmi_user"], host["ipmi_password"])
#
- #if options.hardwareType == "pdu":
- #hw = raritanDominionPx(configs, host)
+ if options.hardwareType == "pdu":
+ hw = raritanDominionPx(configs, host)
#
- #if options.hardwareType == "drac":
- ## Check if node has drac card
- #if "drac_name" in host:
- #hw = dellDrac(host)
- #else:
- #mesg = "Host (" + options.nodeName + ") does not have a DRAC card!!\n"
- #sys.stdout.write(mesg)
- #exit(1)
+ if options.hardwareType == "drac":
+ ## Check if node has drac card
+ if "drac_name" in host:
+ hw= dellDrac(configs, options.nodeName, host)
+ else:
+ mesg = "Host (" + options.nodeName + ") does not have a DRAC card!!\n"
+ sys.stdout.write(mesg)
+ exit(1)
+ else:
+ hw = zoni.hardware.systemmanagement.SystemManagement(configs,data)
if (options.REBOOTNODE or options.POWERCYCLE or options.POWEROFF or \
options.POWERON or options.POWERSTATUS or options.CONSOLE or \
options.POWERRESET) and options.nodeName:
- hw = zoni.hardware.systemmanagement.SystemManagement(configs,data)
if options.verbosity:
hw.setVerbose(True)
@@ -364,11 +349,12 @@ def main():
#print "host is ", host
#drac = dellDrac("drac-r2r1c3", 1)
drac = dellDrac(configs, options.nodeName, host)
- drac.getPowerStatus()
+ #drac.getPowerStatus()
#drac.powerOff()
#drac.powerOn()
#drac.powerCycle()
- #drac.powerReset()
+ drac.setVerbose(options.verbosity)
+ drac.powerReset()
#drac.getPowerStatus()
#print "host is ", host
#pdu = raritanDominionPx(configs, options.nodeName, host)
@@ -493,7 +479,7 @@ def main():
# Domain interface
if (options.showDomains):
- idata.showDomains()
+ data.showDomains()
if (options.addDomain):
if len(args) > 2 and options.reservationId:
data.addDomain(args[0], string.join(args[1:len(args)]), options.reservationId)
Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/delldrac.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/delldrac.py?rev=1053186&r1=1053185&r2=1053186&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/delldrac.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/delldrac.py Mon Dec 27 21:06:08 2010
@@ -32,6 +32,7 @@ from zoni.extra.util import timeF, log
class dellDrac(SystemManagementInterface):
def __init__(self, config, nodeName, hostInfo):
self.config = config
+ self.nodeName = nodeName
self.hostname = hostInfo['location']
self.host = hostInfo['drac_name']
self.user = hostInfo['drac_userid']
@@ -191,13 +192,13 @@ class dellDrac(SystemManagementInterface
fout.seek(0)
for val in fout.readlines():
if "OK" in val:
- mesg = self.hostname + " Power Reset\n\n"
- self.log.info(mesg)
+ self.log.info("Hardware power reset : %s", self.nodeName)
code = 1
- else:
- mesg = self.hostname + " Power Reset Fail\n\n"
- self.log.info(mesg)
- code = -1
+ break
+ if code == 0:
+ self.log.info("Hardware power reset fail: %s", self.nodeName)
+ code = -1
+
child.terminate()
fout.close()
return code
Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/systemmanagement.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/systemmanagement.py?rev=1053186&r1=1053185&r2=1053186&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/systemmanagement.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/hardware/systemmanagement.py Mon Dec 27 21:06:08 2010
@@ -67,15 +67,11 @@ class SystemManagement(SystemManagementI
a = "inst.%s" % mycmd
for count in range(retries):
doit = eval(a)
- if doit == -1:
- self.log.error("%s method failed (%s) on %s (attempt %s)", i[0], mycmd, nodeName, count)
- continue
if doit > 0:
+ self.log.info("%s method success (%s) on %s (attempt %s)", i[0], mycmd, nodeName, count + 1)
break
else:
- self.log.error("%s method failed (%s) on %s (attempt %s)", i[0], mycmd, nodeName, count)
- if doit > 0:
- break
+ self.log.error("%s method failed (%s) on %s (attempt %s)", i[0], mycmd, nodeName, count + 1)
return doit
Modified: incubator/tashi/branches/zoni-dev/trunk/src/zoni/services/pcvciservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/zoni-dev/trunk/src/zoni/services/pcvciservice.py?rev=1053186&r1=1053185&r2=1053186&view=diff
==============================================================================
--- incubator/tashi/branches/zoni-dev/trunk/src/zoni/services/pcvciservice.py (original)
+++ incubator/tashi/branches/zoni-dev/trunk/src/zoni/services/pcvciservice.py Mon Dec 27 21:06:08 2010
@@ -71,18 +71,18 @@ class pcmService(object):
def powerOn(self, key, nodeName):
vcm = self.__key2vcm(key)
- self.log.info("VCM_COMMAND_POWER_ON: VCM %s" % (vcm))
+ self.log.info("VCM_COMMAND_POWER_ON: VCM %s NODE %s" % (vcm, nodeName))
self.hardware.powerOn(nodeName)
def powerReset(self, key, nodeName):
vcm = self.__key2vcm(key)
- self.log.info("VCM_COMMAND_POWER_RESET: VCM %s" % (vcm))
+ self.log.info("VCM_COMMAND_POWER_RESET: VCM %s NODE %s" % (vcm, nodeName))
self.hardware.powerReset(nodeName)
def powerOff(self, key, nodeName):
vcm = self.__key2vcm(key)
- self.log.info("VCM_COMMAND_POWER_OFF: VCM %s" % (vcm))
+ self.log.info("VCM_COMMAND_POWER_OFF: VCM %s NODE %s" % (vcm, nodeName))
self.hardware.powerOff(nodeName)
#def selectBootImage