Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL: Added stack-checklist package to Redhat install images. Ren… #594

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions common/src/stack/checklist/BackendTest.py
Original file line number Diff line number Diff line change
@@ -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,16 +23,16 @@ 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)

#
# Send status update to health channel if installation is stalled or in
# 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()
14 changes: 9 additions & 5 deletions common/src/stack/checklist/pylib/__init__.py
Original file line number Diff line number Diff line change
@@ -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},
3 changes: 2 additions & 1 deletion redhat/nodes/backend.xml
Original file line number Diff line number Diff line change
@@ -46,6 +46,8 @@ for o in stack.api.Call('list cart'):
include ld.so.conf.d/*.conf
</stack:file>

<!-- Run BackendTest.py in a non-blocking way -->
/opt/stack/bin/BackendTest.py &gt; /var/log/BackendTest.log 2&gt;&amp;1 &lt;/dev/null &amp;
</stack:script>

<!-- stacki-profile adds the extra interfaces -->
@@ -60,4 +62,3 @@ cp /run/install/tmp/stack.conf /tmp/stack.conf
</stack:script>

</stack:stack>

Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions redhat/src/stack/images/7.1708/initrd.img/version.mk
Original file line number Diff line number Diff line change
@@ -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 \
2 changes: 2 additions & 0 deletions redhat/src/stack/images/7.1708/updates.img/version.mk
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ OVERLAY.PKGS = \
MegaCLI \
foundation-redhat \
ludicrous-speed \
stack-checklist \
stack-mq \
stack-storage-config \
stack-wizard \
storcli \
Original file line number Diff line number Diff line change
@@ -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