r578 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-15 15:12:47 +0000 (Thu, 15 Jul 2010)
New Revision: 578
Modified:
trunk/v7/hardwaretest.py
Log:
568518 - FEAT: add a BMC fencing testing
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2010-07-15 15:12:34 UTC (rev 577)
+++ trunk/v7/hardwaretest.py 2010-07-15 15:12:47 UTC (rev 578)
@@ -417,12 +417,12 @@
subcommand = args[1]
else:
subcommand = "start"
-
+ daemon = V7Daemon(self.environment, self.options)
+ # run daemon in foreground
if subcommand == "daemon":
- daemon = V7Daemon(self.environment, self.options)
return daemon.run()
-
+ # otherwise, do test-specific services
planner = Planner(self.options, virtualization=None)
planner.analyse(self.environment.getSourceDirectory())
testCount = 0
@@ -432,6 +432,10 @@
rv = self.runServer(test, subcommand)
if rv != 0:
result = rv
+
+ # do the daemon
+ if not daemon.do(subcommand):
+ result = False
return result
def addTask(self):
13 years, 10 months
r577 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-15 15:12:34 +0000 (Thu, 15 Jul 2010)
New Revision: 577
Modified:
trunk/v7/daemon.py
Log:
568518 - FEAT: add a BMC fencing testing
Modified: trunk/v7/daemon.py
===================================================================
--- trunk/v7/daemon.py 2010-07-14 20:56:57 UTC (rev 576)
+++ trunk/v7/daemon.py 2010-07-15 15:12:34 UTC (rev 577)
@@ -52,6 +52,9 @@
mask = os.umask(0111)
os.mkfifo(self.environment.getTaskFilePath()+ ".in", 0666)
os.mkfifo(self.environment.getTaskFilePath()+ ".out", 0666)
+ pid = open(self.environment.getTaskFilePath()+ ".pid", "w")
+ pid.write("%u" % os.getpid())
+ pid.close()
os.umask(mask)
@@ -61,38 +64,40 @@
if self.options.debug != Constants.off:
print "checking for tasks"
sys.stdout.flush()
- taskInFile = open(self.environment.getTaskFilePath()+ ".in", 'r')
- line = taskInFile.readline()
- taskInFile.close()
- if len(line.strip()) is 0:
- continue
- else:
- print "\"" + line.strip() + "\""
-
- if line.strip() == "shutdown":
- print "v7 daemon shutdown"
- # delete the lines from the file
+ taskInFile = open(self.environment.getTaskFilePath()+ ".in", 'r')
+ line = taskInFile.readline()
+ taskInFile.close()
+ if len(line.strip()) is 0:
+ continue
+ else:
+ print "\"" + line.strip() + "\""
+
+ if line.strip() == "shutdown":
+ print "v7 daemon shutdown"
+ # delete the lines from the file
+ taskOutFile = open(self.environment.getTaskFilePath()+ ".out", 'w')
+ taskOutFile.write("v7 shutdown")
+ taskOutFile.close()
+ return 0
+ # otherwise
+ # only run v7 - nothing else
+ words = line.split()
+ if len(words) > 0 and words[0] == "v7" and ";" not in line:
+ if words[1] == "daemon" and words[2] =="run":
+ self.serverTest(line)
+ else: # run local vi subprocess
+ if self.options.debug != Constants.off:
+ print "Running: " + line
+ sys.stdout.flush()
taskOutFile = open(self.environment.getTaskFilePath()+ ".out", 'w')
- taskOutFile.write("v7 shutdown")
+ pipe = subprocess.Popen(line, shell=True,
+ stdin=subprocess.PIPE,
+ stdout=taskOutFile,
+ stderr=taskOutFile,)
+ (output, errors) = pipe.communicate()
taskOutFile.close()
- return 0
- # otherwise
- # only run v7 - nothing else
- words = line.split()
- if len(words) > 0 and words[0] == "v7" and ";" not in line:
- if words[1] == "daemon" and words[2] =="run":
- self.serverTest(line)
- else: # run local vi subprocess
- print "Running: " + line
- taskOutFile = open(self.environment.getTaskFilePath()+ ".out", 'w')
- pipe = subprocess.Popen(line, shell=True,
- stdin=subprocess.PIPE,
- stdout=taskOutFile,
- stderr=taskOutFile,)
- (output, errors) = pipe.communicate()
- taskOutFile.close()
- else:
- print "unsupported command: " + line
+ else:
+ print "unsupported command: " + line
def __parseRequest(self, line):
args = dict()
word=line.split()[3:]
@@ -103,10 +108,13 @@
return args
def openLogFile(self, args, mode):
+ if not os.path.exists(self.environment.getLogDirectory()):
+ os.mkdir(self.environment.getLogDirectory(), mode=0666)
logFileName = "v7-daemon-"
for (key, value) in args.items():
if key != "results":
logFileName = logFileName + "%s=%s_" % (key, value)
+ print "log file: " + logFileName
log = open(os.path.join(self.environment.getLogDirectory(), logFileName), mode)
return log
@@ -117,6 +125,8 @@
# if it's a results request, find the log
try:
if len(args["results"]) > 0:
+ if self.options.debug != Constants.off:
+ print "Getting test results"
log = self.openLogFile(args, "r")
taskOutFile = open(self.environment.getTaskFilePath()+ ".out", 'w')
for line in log:
@@ -129,7 +139,7 @@
# otherwise, queue he request
taskOutFile = open(self.environment.getTaskFilePath()+ ".out", 'w')
- taskOutFile.write("Queuing request for test " + args["test"] + "\n")
+ taskOutFile.write("Running test " + args["test"] + "\n")
taskOutFile.close()
result = True
try:
@@ -146,4 +156,43 @@
result = False
return result
-
\ No newline at end of file
+ def do(self, subcommand):
+ try:
+ command = Command("ps ax")
+ command.getString("v7 server daemon", singleLine=False)
+ running = True
+ except:
+ running = False
+
+ if subcommand == "start":
+ if running:
+ print "The v7 server daemon is already started"
+ return True
+ print "Starting v7 daemon"
+ sys.stdout.flush()
+ if os.system("v7 server daemon &"):
+ print "Error: could not start v7 server daemon"
+ return False
+ elif subcommand == "stop":
+ if not running:
+ print "The v7 server daemon is not running"
+ return True
+ print "Stopping v7 daemon"
+ sys.stdout.flush()
+ try:
+ pidFile = open(self.environment.getTaskFilePath()+ ".pid", 'r')
+ pid = pidFile.readline().strip()
+ kill = Command("kill %s" % pid)
+ kill.echo()
+ except Exception, e:
+ print "Error: could not stop daemon:"
+ print e
+ else: # assume status
+ if running:
+ print "The v7 server daemon is running"
+ else:
+ print "The v7 server daemon is NOT running"
+
+ return True
+
+
\ No newline at end of file
13 years, 10 months
r576 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-14 20:56:57 +0000 (Wed, 14 Jul 2010)
New Revision: 576
Modified:
trunk/v7/tags.py
Log:
568518 - FEAT: add a BMC fencing testing
Modified: trunk/v7/tags.py
===================================================================
--- trunk/v7/tags.py 2010-07-14 20:56:34 UTC (rev 575)
+++ trunk/v7/tags.py 2010-07-14 20:56:57 UTC (rev 576)
@@ -58,7 +58,10 @@
partner_server="partner-server"
product="product"
os_type="os_type"
+ agent="agent"
+ subtest="subtest"
+
class Attributes:
v7_version="v7-version"
v7_release="v7-release"
@@ -88,9 +91,12 @@
task_file="task_file"
maximum_attachment_size="maximum-attachment-size"
description="description"
-
+ type="type"
+ user="user"
+ password="password"
+
class Constants:
PASS="PASS"
FAIL="FAIL"
13 years, 10 months
r575 - trunk/tests/fencing
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-14 20:56:34 +0000 (Wed, 14 Jul 2010)
New Revision: 575
Added:
trunk/tests/fencing/agent.py
Modified:
trunk/tests/fencing/Makefile
trunk/tests/fencing/fencing.py
Log:
568518 - FEAT: add a BMC fencing testing
Modified: trunk/tests/fencing/Makefile
===================================================================
--- trunk/tests/fencing/Makefile 2010-07-12 20:56:35 UTC (rev 574)
+++ trunk/tests/fencing/Makefile 2010-07-14 20:56:34 UTC (rev 575)
@@ -15,7 +15,7 @@
.PHONY: all install download clean
-FILES=$(METADATA) runtest.sh fencing.py
+FILES=$(METADATA) runtest.sh fencing.py agent.py
run: $(FILES) build
./runtest.sh
Added: trunk/tests/fencing/agent.py
===================================================================
--- trunk/tests/fencing/agent.py (rev 0)
+++ trunk/tests/fencing/agent.py 2010-07-14 20:56:34 UTC (rev 575)
@@ -0,0 +1,68 @@
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Greg Nichols
+
+import os
+import string
+from xml.dom.minidom import getDOMImplementation, parse
+import xml.dom.ext
+from v7.tags import Tags, Attributes, Constants
+from v7.certificationtest import DocumentBase
+
+class Agent(DocumentBase):
+
+
+ def __init__(self):
+ pass
+
+ def new(self):
+ self._new(topElement=Tags.agent, stylesheet="/v7/css/agent.css")
+
+ def setIP(self, ip):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.hostname)
+ self.setTextNode(element, ip)
+ def getIP(self):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.hostname)
+ return self.getTextNode(element).data
+ def setSubTest(self, subtest):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.subtest)
+ self.setTextNode(element, subtest)
+ def getSubTest(self):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.subtest)
+ return self.getTextNode(element).data
+ def setType(self, type):
+ self.document.documentElement.setAttribute(Attributes.type, type)
+ def getType(self):
+ return self.document.documentElement.getAttribute(Attributes.type)
+
+ def setUser(self, user):
+ self.document.documentElement.setAttribute(Attributes.user, user)
+ def getUser(self):
+ return self.document.documentElement.getAttribute(Attributes.user)
+
+ def setPassword(self, password):
+ self.document.documentElement.setAttribute(Attributes.password, password)
+ def getPassword(self):
+ return self.document.documentElement.getAttribute(Attributes.password)
+ def setSummary(self, result):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.summary)
+ self.setTextNode(element, result)
+ def getSummary(self):
+ element = self.findOrCreateElement(self.document.documentElement, Tags.summary)
+ textNode = self.getTextNode(element)
+ if textNode:
+ return textNode.data
+ # otherwise
+ return ""
+
Modified: trunk/tests/fencing/fencing.py
===================================================================
--- trunk/tests/fencing/fencing.py 2010-07-12 20:56:35 UTC (rev 574)
+++ trunk/tests/fencing/fencing.py 2010-07-14 20:56:34 UTC (rev 575)
@@ -22,13 +22,14 @@
from v7.controller import Controller
from v7.environment import Environment
from v7.documentbase import DocumentWrapper
+from agent import Agent
class FencingTest(Test):
def __init__(self):
Test.__init__(self, name="fencing")
- self.interactive = False # will prompt in --mode normal, but runs ok in --mode auto
+ self.interactive = True
self.deviceClass = DeviceClass.system
self.v7Controller = Controller()
self.environment = Environment()
@@ -36,12 +37,33 @@
self.rebootTimeLimit = 10 # minutes
self.priority = 1001 # run last
self.url = "/v7/cgi/v7web.py?command=daemon&subcommand=run&test=fencing"
+ self.agent = None
def plan(self, devices):
tests = list()
# manual planning only, for now
# tests.append(self.makeCopy())
return tests
+
+ def getAgentInfo(self, subtest):
+ self.agent = Agent()
+ self.agent.new()
+ self.agent.setSubTest(subtest)
+ print("Please enter the information for this system's fencing agent:")
+ self.agent.setType(self.prompt("Agent Type (examples: ilo, drac)? "))
+ self.agent.setIP(self.prompt("IP Address or Hostname? "))
+ self.agent.setUser(self.prompt("User Name? "))
+ self.agent.setPassword(self.prompt("Password? "))
+ self.agent.save(os.path.join(self.environment.getDataDirectory(), "agent.xml"))
+ return True
+
+ def recoverAgentInfo(self):
+ self.agent = Agent()
+ self.agent.load(os.path.join(self.environment.getDataDirectory(), "agent.xml"))
+ return True
+
+ def getAgentParameters(self):
+ return "&agentIP=" + self.agent.getIP() + "&agentType=" + self.agent.getType() + "&agentUser=" + self.agent.getUser() +"&agentPassword=" + self.agent.getPassword() + "&subtest=" + self.agent.getSubTest()
def setInitConfig(self):
# chkconfig = Command("chkconfig --add v7")
@@ -61,45 +83,60 @@
chkconfig = Command("chkconfig --del v7")
chkconfig.echo()
- def sendFencingRequest(self):
- request = self.url
- agentIPAddress = "localhost"
- agentType = ""
- request = request + "&agentIP=" + agentIPAddress + "&agentType=" + agentType
+ def sendFencingRequest(self, subtest):
+ request = self.url + self.getAgentParameters()
print "Sending Request:"
print request
- request = urllib2.Request('http://%s%s' % (self.getTestServer(), request))
- opener = urllib2.build_opener()
- response = opener.open(request).readlines()
+ sys.stdout.flush()
+ try:
+ request = urllib2.Request('http://%s%s' % (self.getTestServer(), request))
+ opener = urllib2.build_opener()
+ response = opener.open(request).readlines()
+ except urllib2.URLError, e:
+ print "Error: Could not contact v7 server %s" % self.getTestServer()
+ print e
+ return False
+
print "%s response: --------------------------------------------" % self.getTestServer()
for line in response: sys.stdout.write(line)
print "---------------------------------------------------------"
print "Please wait for test to continue"
sys.stdout.flush()
- while True:
- # wait here for reboot
- waitTime = 60 #sec
- print "Waiting for shutdown..."
- sys.stdout.flush()
- time.sleep(waitTime)
+
+ # wait here for reboot
+ waitTime = 60 #sec
+ print "Waiting %u sec, for shutdown..." % waitTime
+ sys.stdout.flush()
+ time.sleep(waitTime)
+ print "Error: shutdown has not happened."
+ return False
+
def getResults(self):
- request = self.url
- agentIPAddress = "localhost"
- agentType = ""
- request = request + "&agentIP=" + agentIPAddress + "&agentType=" + agentType + "&results=1"
+ request = self.url + self.getAgentParameters() + "&results=1"
print "Sending Request:"
print request
- request = urllib2.Request('http://%s%s' % (self.getTestServer(), request))
- opener = urllib2.build_opener()
- response = opener.open(request).readlines()
+ try:
+ request = urllib2.Request('http://%s%s' % (self.getTestServer(), request))
+ opener = urllib2.build_opener()
+ response = opener.open(request).readlines()
+ except urllib2.URLError, e:
+ print "Error: Could not contact v7 server %s" % self.getTestServer()
+ print e
+ return False
+
print "result: "
result = False
for line in response:
sys.stdout.write(line)
if "<summary>%s</summary>" % Constants.PASS in line:
result = True
- return result
+
+ #fail if prior subtest failed
+ if self.agent.getSummary() == Constants.FAIL:
+ result = False
+
+ return result
def run(self):
PASSED = 0
@@ -111,33 +148,69 @@
print "using test server %s" % self.getTestServer()
if self.incomplete:
- result = self.getResults()
+ if self.recoverAgentInfo():
+ result = self.getResults()
+ if self.agent.getSubTest() == "reboot":
+ self.agent.setSubTest("powercycle")
+ if not result:
+ self.agent.setSummary(Constants.FAIL)
+ self.agent.save(os.path.join(self.environment.getDataDirectory(), "agent.xml"))
+ result = self.sendFencingRequest("powercycle")
+ else:
+ print "Error: could not recover agent info on continuation after reboot/powercycle"
+ result = False
self.removeInitConfig()
else:
- self.setInitConfig()
- result = self.sendFencingRequest()
+ if self.getAgentInfo("reboot"):
+ self.setInitConfig()
+ result = self.sendFencingRequest("reboot")
+ else:
+ result = False
if result: return PASSED
# otherwise
return FAILED
+
+ def getAgentCommand(self, args):
+ return "fence_" + args["agentType"] + " -a " + args["agentIP"] + " -l " + args["agentUser"] + " -p " + args["agentPassword"] + " "
+
def runOnServer(self, args, outFile):
print "Server side test for %s\n" % self.Name()
outFile.write("Server side test for %s\n" % self.Name())
+ if not args["subtest"] in ["reboot", "powercycle"]:
+ message = "Error: unknown subtest " + args["subtest"]
+ print message
+ outFile.write(message)
+ return False
try:
- agentIP = args["agentIP"]
- ping = Command("ping -c 1 " + agentIP)
- ping.run()
- for line in ping.output:
- print line
- outFile.write(line + "\n")
- except Exception, e:
- print "Error: "
- print e
- outFile.write("Error: %s" % e)
+
+ if args["subtest"] == "reboot":
+ fenceCommand = Command(self.getAgentCommand(args) + " -o reboot ")
+ print "running: " + fenceCommand.command
+ fenceCommand.echo()
+ elif args["subtest"] == "powercycle":
+ fenceCommand = Command(self.getAgentCommand(args) + " -o off ")
+ print "running: " + fenceCommand.command
+ fenceCommand.echo()
+ fenceCommand = Command(self.getAgentCommand(args) + " -o status ")
+ print "running: " + fenceCommand.command
+ fenceCommand.echo()
+ fenceCommand = Command(self.getAgentCommand(args) + " -o on ")
+ print "running: " + fenceCommand.command
+ fenceCommand.echo()
+ except V7CommandException, e:
+ message = "Error: agent command failed.\n" + e.message
+ print message
+ outFile.write(message + "\n")
+ fenceCommand.printErrors()
+ if fenceCommand.errors:
+ for line in fenceCommand.errors:
+ outFile.write(line)
return False
+
return True
if __name__ == "__main__":
13 years, 10 months
r574 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 20:56:35 +0000 (Mon, 12 Jul 2010)
New Revision: 574
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2010-07-12 20:49:03 UTC (rev 573)
+++ trunk/v7.spec.in 2010-07-12 20:56:35 UTC (rev 574)
@@ -71,7 +71,7 @@
%changelog
* Mon Jul 12 2010 Greg Nichols <gnichols(a)redhat.com>
-V7 1.2 R8
+V7 1.2 R9
599725 - attempts to contact libvirtd during "v7 plan" cause spurious error messages
586568 - v7 submit fails with error
13 years, 10 months
r573 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 20:49:03 +0000 (Mon, 12 Jul 2010)
New Revision: 573
Modified:
trunk/v7/planner.py
Log:
python version issue
Modified: trunk/v7/planner.py
===================================================================
--- trunk/v7/planner.py 2010-07-12 20:48:12 UTC (rev 572)
+++ trunk/v7/planner.py 2010-07-12 20:49:03 UTC (rev 573)
@@ -64,7 +64,7 @@
del sys.modules[moduleName]
except KeyError:
pass
- module = __import__(moduleName, globals(), locals(), [], -1)
+ module = __import__(moduleName, globals(), locals())
for thing in dir(module):
if self.options.debug == Constants.high:
print "thing: %s" % thing
13 years, 10 months
r572 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 20:48:12 +0000 (Mon, 12 Jul 2010)
New Revision: 572
Modified:
trunk/v7/daemon.py
Log:
remove stray import
Modified: trunk/v7/daemon.py
===================================================================
--- trunk/v7/daemon.py 2010-07-12 20:42:27 UTC (rev 571)
+++ trunk/v7/daemon.py 2010-07-12 20:48:12 UTC (rev 572)
@@ -22,7 +22,6 @@
from v7.command import Command, V7CommandException
from v7.test import Test
from v7.planner import Planner
-from v7.log import Log
class V7Daemon(Controller):
13 years, 10 months
r571 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 20:42:27 +0000 (Mon, 12 Jul 2010)
New Revision: 571
Modified:
trunk/Makefile
Log:
R9
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2010-07-12 19:26:39 UTC (rev 570)
+++ trunk/Makefile 2010-07-12 20:42:27 UTC (rev 571)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.2
-V7_RELEASE := 8
+V7_RELEASE := 9
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
13 years, 10 months
r570 - in tags: . v7-V1-2R8/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 19:26:39 +0000 (Mon, 12 Jul 2010)
New Revision: 570
Added:
tags/v7-V1-2R8/
tags/v7-V1-2R8/v7/version.py
Log:
tag version
Copied: tags/v7-V1-2R8 (from rev 569, trunk)
Copied: tags/v7-V1-2R8/v7/version.py (from rev 335, trunk/v7/version.py)
===================================================================
--- tags/v7-V1-2R8/v7/version.py (rev 0)
+++ tags/v7-V1-2R8/v7/version.py 2010-07-12 19:26:39 UTC (rev 570)
@@ -0,0 +1,5 @@
+
+# v7/version.py is automatically-generated - DO NOT EDIT
+version = '1.2'
+release = '8'
+rhel_version = '5'
13 years, 10 months
r569 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2010-07-12 19:25:53 +0000 (Mon, 12 Jul 2010)
New Revision: 569
Modified:
trunk/v7.spec.in
Log:
changlog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2010-07-12 18:59:34 UTC (rev 568)
+++ trunk/v7.spec.in 2010-07-12 19:25:53 UTC (rev 569)
@@ -69,6 +69,15 @@
/etc/init.d/v7
%changelog
+* Mon Jul 12 2010 Greg Nichols <gnichols(a)redhat.com>
+
+V7 1.2 R8
+
+ 599725 - attempts to contact libvirtd during "v7 plan" cause spurious error messages
+ 586568 - v7 submit fails with error
+ 584121 - RHEL6 network test mount command fails in NFS testing
+ 612278 - v7 NETWORK tests defaults to NFS/UDP and OS defaults to NFSv4 which is unsupported combination
+
* Thu Jun 10 2010 Greg Nichols <gnichols(a)redhat.com>
V7 1.2 R6
13 years, 10 months