diff --git a/common/src/stack/checklist/BackendTest.py b/common/src/stack/checklist/BackendTest.py index d6582edfc..8913216e2 100644 --- a/common/src/stack/checklist/BackendTest.py +++ b/common/src/stack/checklist/BackendTest.py @@ -2,9 +2,11 @@ from collections import deque import os +from functools import partial import re import socket import subprocess +import sys import time """ @@ -21,8 +23,8 @@ def sendStateToMsgQ(state, isErr, msg=''): cmd = ['/opt/stack/bin/smq-publish', '-chealth', '-t300', - '{"systest":"%s","flag":"%s","msg":"%s"}' % (state, str(isErr), msg)] - + '{"systest":"%s","flag":"%s","msg":"%s"}' \ + % (state, str(isErr), msg)] subprocess.run(cmd, env=pyenv) # @@ -30,7 +32,7 @@ def sendStateToMsgQ(state, isErr, msg=''): # wait mode, so it can be processed by MQ health processor # if state.lower() in ['stalled', 'wait']: - cmd = ['/opt/stack/bin/smq-publish', '-chealth', \ + cmd = ['/opt/stack/bin/smq-publish', '-chealth', '{"state":"%s %s"}' % (state, msg)] subprocess.run(cmd, env=pyenv) @@ -99,10 +101,11 @@ class BackendTest: Main class that runs a sequence of tests that indicate the progress of installation """ - PARTITION_XML = '/tmp/partition.xml' - LUDICROUS_LOG = '/var/log/ludicrous-client-debug.log' - NUM_RETRIES = 100 - SLEEP_TIME = 10 + PARTITION_FILE_SLES = '/tmp/partition.xml' + PARTITION_FILE_REDHAT = '/tmp/partition-info' + LUDICROUS_LOG = '/var/log/ludicrous-client-debug.log' + NUM_RETRIES = 100 + SLEEP_TIME = 10 """ Checks if a file size is 0 @@ -178,13 +181,13 @@ def checkLudicrousStarted(self): """ Checks if partition file is present """ - def checkPartition(self): - if self.checkFileExists(BackendTest.PARTITION_XML): - msg = 'Backend - %s - Present' % BackendTest.PARTITION_XML - sendStateToMsgQ("Partition_XML_Present", False, msg) + def checkPartitionFile(self, partitionFileName): + if self.checkFileExists(partitionFileName): + msg = 'Backend - %s - Present' % partitionFileName + sendStateToMsgQ("Partition_File_Present", False, msg) else: - msg = 'Backend - %s - Not Present' % BackendTest.PARTITION_XML - sendStateToMsgQ("Partition_XML_Present", True, msg) + msg = 'Backend - %s - Not Present' % partitionFileName + sendStateToMsgQ("Partition_File_Present", True, msg) """ Checks if SSH port 2200 is open @@ -214,14 +217,14 @@ def checkSSHOpen(self): Main function that runs a series of tests which validates various states of a backend installation. """ - def run(self): + def run_sles(self): # # Sequence of tests (in the same order) that need to be run on # the installing node # test_list = [self.checkSSHOpen, self.checkAutoyastFiles, self.checkLudicrousStarted, - self.checkPartition, + partial(self.checkPartitionFile, BackendTest.PARTITION_FILE_SLES), self.checkPkgInstall] # @@ -252,6 +255,24 @@ def run(self): test() os._exit(os.EX_OK) + def run_redhat(self): + test_list = [self.checkSSHOpen, self.checkLudicrousStarted, + partial(self.checkPartitionFile, BackendTest.PARTITION_FILE_REDHAT), + self.checkPkgInstall] + + child3pid = os.fork() + if child3pid == 0: + for test in test_list: + test() + os._exit(os.EX_OK) + if __name__ == "__main__": b = BackendTest() - b.run() + + sys.path.append('/tmp') + from stack_site import attributes + + if attributes['os'] == 'sles': + b.run_sles() + elif attributes['os'] == 'redhat': + b.run_redhat() diff --git a/common/src/stack/checklist/pylib/__init__.py b/common/src/stack/checklist/pylib/__init__.py index d99512fbf..c917b1549 100644 --- a/common/src/stack/checklist/pylib/__init__.py +++ b/common/src/stack/checklist/pylib/__init__.py @@ -136,7 +136,7 @@ class State(Enum): Profile_XML_Sent = 140 SSH_Open = 150 AUTOINST_Present = 160 - Partition_XML_Present = 170 + Partition_File_Present = 170 Ludicrous_Started = 180 Ludicrous_Populated = 190 Set_DB_Partitions = 200 @@ -169,7 +169,7 @@ class StateSequence: {'state': State.Profile_XML_Sent, 'time': 140}, {'state': State.SSH_Open, 'time': 150}, {'state': State.AUTOINST_Present, 'time': 160}, - {'state': State.Partition_XML_Present, 'time': 170}, + {'state': State.Partition_File_Present, 'time': 170}, {'state': State.Ludicrous_Started, 'time': 180}, {'state': State.Ludicrous_Populated, 'time': 600}, {'state': State.Set_DB_Partitions, 'time': 200}, @@ -195,7 +195,7 @@ class StateSequence: {'state': State.Profile_XML_Sent, 'time': 140}, {'state': State.SSH_Open, 'time': 150}, {'state': State.AUTOINST_Present, 'time': 160}, - {'state': State.Partition_XML_Present, 'time': 170}, + {'state': State.Partition_File_Present, 'time': 170}, {'state': State.Ludicrous_Started, 'time': 180}, {'state': State.Ludicrous_Populated, 'time': 600}, {'state': State.Set_DB_Partitions, 'time': 200}, @@ -211,8 +211,12 @@ class StateSequence: {'state': State.DHCPACK, 'time': 40}, {'state': State.TFTP_RRQ, 'time': 50}, {'state': State.VMLinuz_RRQ_Install, 'time': 60}, - {'state': State.Initrd_RRQ, 'time': 70}, - {'state': State.Profile_XML_Sent, 'time': 1600}, + {'state': State.Initrd_RRQ, 'time': 300}, + {'state': State.Profile_XML_Sent, 'time': 300}, + {'state': State.SSH_Open, 'time': 300}, + {'state': State.Partition_File_Present, 'time': 170}, + {'state': State.Ludicrous_Started, 'time': 180}, + {'state': State.Ludicrous_Populated, 'time': 600}, {'state': State.Set_DB_Partitions, 'time': 200}, {'state': State.Set_Bootaction_OS, 'time': 210}, {'state': State.Rebooting_HDD, 'time': 220}, diff --git a/redhat/nodes/backend.xml b/redhat/nodes/backend.xml index afa9dd1c3..dac47ff76 100644 --- a/redhat/nodes/backend.xml +++ b/redhat/nodes/backend.xml @@ -46,6 +46,8 @@ for o in stack.api.Call('list cart'): include ld.so.conf.d/*.conf + +/opt/stack/bin/BackendTest.py > /var/log/BackendTest.log 2>&1 </dev/null & @@ -60,4 +62,3 @@ cp /run/install/tmp/stack.conf /tmp/stack.conf - diff --git a/redhat/src/stack/images/7.1708/initrd.img/dracut/hooks/initqueue/online/79-stackiq-start-ludicrous-server.sh b/redhat/src/stack/images/7.1708/initrd.img/dracut/hooks/initqueue/online/79-stackiq-start-ludicrous-server.sh index e6557af4a..fc9844767 100755 --- a/redhat/src/stack/images/7.1708/initrd.img/dracut/hooks/initqueue/online/79-stackiq-start-ludicrous-server.sh +++ b/redhat/src/stack/images/7.1708/initrd.img/dracut/hooks/initqueue/online/79-stackiq-start-ludicrous-server.sh @@ -50,4 +50,5 @@ fi export LANG=en_US.UTF-8 /usr/sbin/build-locale-archive > /dev/null 2>&1 + /opt/stack/bin/ludicrous-client.py --environment=initrd --trackerfile='/tmp/stack.conf' --nosavefile diff --git a/redhat/src/stack/images/7.1708/initrd.img/version.mk b/redhat/src/stack/images/7.1708/initrd.img/version.mk index 90c63d19e..d909d22fa 100644 --- a/redhat/src/stack/images/7.1708/initrd.img/version.mk +++ b/redhat/src/stack/images/7.1708/initrd.img/version.mk @@ -6,7 +6,9 @@ OVERLAY.UPDATE.PKGS = \ MegaCLI storcli \ foundation-python \ ludicrous-speed \ + stack-checklist \ stack-command \ + stack-mq \ stack-pylib \ foundation-newt \ foundation-python-Flask \ diff --git a/redhat/src/stack/images/7.1708/updates.img/version.mk b/redhat/src/stack/images/7.1708/updates.img/version.mk index 8bc1afcec..a588f7503 100644 --- a/redhat/src/stack/images/7.1708/updates.img/version.mk +++ b/redhat/src/stack/images/7.1708/updates.img/version.mk @@ -3,6 +3,8 @@ OVERLAY.PKGS = \ MegaCLI \ foundation-redhat \ ludicrous-speed \ + stack-checklist \ + stack-mq \ stack-storage-config \ stack-wizard \ storcli \ diff --git a/test-framework/test-suites/unit/tests/checklist/test_checklist_daemons.py b/test-framework/test-suites/unit/tests/checklist/test_checklist_daemons.py index a0afe3fd1..e4b59b4b2 100644 --- a/test-framework/test-suites/unit/tests/checklist/test_checklist_daemons.py +++ b/test-framework/test-suites/unit/tests/checklist/test_checklist_daemons.py @@ -150,7 +150,7 @@ def test_MQProcessors(self): mq.start() sm = None payload = {} - payload['systest'] = "Partition_XML_Present" + payload['systest'] = "Partition_File_Present" payload['flag'] = "False" payload['msg'] = "Backend - /tmp/partition.xml - Present" msg = stack.mq.Message(json.dumps(payload), channel='health', ttl=120) @@ -165,7 +165,7 @@ def test_MQProcessors(self): while not sm and not q.empty(): sm = q.get() - expectedSm = StateMessage('8.8.8.8', State.Partition_XML_Present, + expectedSm = StateMessage('8.8.8.8', State.Partition_File_Present, False, time.time(), msg='Backend - /tmp/partition.xml - Present') matchedFlag = False