CORTX ha (High-Availability) is responsible for ensuring that CORTX Solution is available in case of any hardware component or software service failures. It takes care of failover/ failback control flow for affected services and stabilizes them across CORTX cluster.
Implement a health event generator framework python script file which will help to generate a mock event for node and disk
Design
It will be python script file which will have options to get ids. Script file will have following options:
"get disks":
"get cvgs":
"publish":
This script will also provide implementation of these options except publish option
Coding
[x] Coding conventions are followed and code is consistent
Testing
[x] Unit and System Tests are added
[x] Test Cases cover Happy Path, Non-Happy Path and Scalability
[x] Testing was performed with RPM
Review Checklist
[x] PR is self reviewed
[x] JIRA number/GitHub Issue added to PR
[x] Jira and state/status is updated and JIRA is updated with PR link
[x] Check if the description is clear and explained
[x] If yes for above point, is a notification sent to all other cortx components? [Y/N] N/A
[x] Side effects on other features (deployment/upgrade)? [Y/N] N
[x] Dependencies on other component(s)? [Y/N] N
If yes for above point, post link to the corresponding PR.
Review Checklist
Documentation
Checklist for Author
[ ] Changes done to WIKI / Confluence page / Quick Start Guide
positional arguments:
{publish,get-disks,get-cvgs,help}
publish Publish the message
get-disks Displys the Disk Ids assosciated with the Node
get-cvgs Displys the CVG Ids assosciated with the Node
help see help -h
optional arguments:
-h, --help show this help message and exit
-gdt, --get-data-nodes
Get the list of data node ids
-gs, --get-server-nodes
Get the list of server node ids
Hope it is useful! :)
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks
usage: health_event_publisher [options] get-disks [-h] -n NODE_ID
health_event_publisher [options] get-disks: error: the following arguments are required: -n/--node-id
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -gdt
['2757bb52dfce434f9d7fc4b434160210', '869e1a0029a04c7a8764893dfac6a06b', 'f7b4878d84f64ab28785c5c5c1127ae4']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py --get-data-nodes
['2757bb52dfce434f9d7fc4b434160210', '869e1a0029a04c7a8764893dfac6a06b', 'f7b4878d84f64ab28785c5c5c1127ae4']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -gs
['7a43f0a461e74bba96481e5f82fad217', 'd6ac367e8b0742559deafece2c5c5338', 'ef09d68a19a64292b3b0a28d7e5f5be4']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py --get-server-nodes
['7a43f0a461e74bba96481e5f82fad217', 'd6ac367e8b0742559deafece2c5c5338', 'ef09d68a19a64292b3b0a28d7e5f5be4']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks
usage: health_event_publisher [options] get-disks [-h] -n NODE_ID
health_event_publisher [options] get-disks: error: the following arguments are required: -n/--node-id
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks -n f7b4878d84f64ab28785c5c5c1127ae4
['/dev/sdd', '/dev/sde', '/dev/sdc', '/dev/sdg', '/dev/sdh', '/dev/sdf']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks -n ef09d68a19a64292b3b0a28d7e5f5be4
Please provide data node id to get disk and cvg id
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -n ef09d68a19a64292b3b0a28d7e5f5be4
Please provide data node id to get disk and cvg id
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -n 869e1a0029a04c7a8764893dfac6a06b
['cvg-01', 'cvg-02']
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -h
usage: health_event_publisher [options] get-cvgs [-h] -n NODE_ID
optional arguments:
-h, --help show this help message and exit
-n NODE_ID, --node-id NODE_ID
Node id for which disk id is required
sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -h
usage: health_event_publisher [options]
Helps in publishing the mock health event
positional arguments:
{publish,get-disks,get-cvgs,help}
publish Publish the message
get-disks Displys the Disk Ids assosciated with the Node
get-cvgs Displys the CVG Ids assosciated with the Node
help see help -h
optional arguments:
-h, --help show this help message and exit
-gdt, --get-data-nodes
Get the list of data node ids
-gs, --get-server-nodes
Get the list of server node ids
Problem Statement
Implement a health event generator framework python script file which will help to generate a mock event for node and disk
Design
It will be python script file which will have options to get ids. Script file will have following options: "get disks": "get cvgs": "publish": This script will also provide implementation of these options except publish option
Coding
Testing
Review Checklist
Review Checklist
Documentation
Checklist for Author
Testing Details: sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py publish -f jgu inside publish, config file: jgu sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py publish usage: health_event_publisher [options] publish [-h] -f FILE health_event_publisher [options] publish: error: the following arguments are required: -f/--file sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py usage: health_event_publisher [options]
Helps in publishing the mock health event
positional arguments: {publish,get-disks,get-cvgs,help} publish Publish the message get-disks Displys the Disk Ids assosciated with the Node get-cvgs Displys the CVG Ids assosciated with the Node help see
help -h
optional arguments: -h, --help show this help message and exit -gdt, --get-data-nodes Get the list of data node ids -gs, --get-server-nodes Get the list of server node ids
Hope it is useful! :) sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks usage: health_event_publisher [options] get-disks [-h] -n NODE_ID health_event_publisher [options] get-disks: error: the following arguments are required: -n/--node-id sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -gdt ['2757bb52dfce434f9d7fc4b434160210', '869e1a0029a04c7a8764893dfac6a06b', 'f7b4878d84f64ab28785c5c5c1127ae4'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py --get-data-nodes ['2757bb52dfce434f9d7fc4b434160210', '869e1a0029a04c7a8764893dfac6a06b', 'f7b4878d84f64ab28785c5c5c1127ae4'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -gs ['7a43f0a461e74bba96481e5f82fad217', 'd6ac367e8b0742559deafece2c5c5338', 'ef09d68a19a64292b3b0a28d7e5f5be4'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py --get-server-nodes ['7a43f0a461e74bba96481e5f82fad217', 'd6ac367e8b0742559deafece2c5c5338', 'ef09d68a19a64292b3b0a28d7e5f5be4'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks usage: health_event_publisher [options] get-disks [-h] -n NODE_ID health_event_publisher [options] get-disks: error: the following arguments are required: -n/--node-id sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks -n f7b4878d84f64ab28785c5c5c1127ae4 ['/dev/sdd', '/dev/sde', '/dev/sdc', '/dev/sdg', '/dev/sdh', '/dev/sdf'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-disks -n ef09d68a19a64292b3b0a28d7e5f5be4 Please provide data node id to get disk and cvg id sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -n ef09d68a19a64292b3b0a28d7e5f5be4 Please provide data node id to get disk and cvg id sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -n 869e1a0029a04c7a8764893dfac6a06b ['cvg-01', 'cvg-02'] sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py get-cvgs -h usage: health_event_publisher [options] get-cvgs [-h] -n NODE_ID
optional arguments: -h, --help show this help message and exit -n NODE_ID, --node-id NODE_ID Node id for which disk id is required sh-4.2# python3 /usr/lib/python3.6/site-packages/ha/util/mock_health_event_publisher.py -h usage: health_event_publisher [options]
Helps in publishing the mock health event
positional arguments: {publish,get-disks,get-cvgs,help} publish Publish the message get-disks Displys the Disk Ids assosciated with the Node get-cvgs Displys the CVG Ids assosciated with the Node help see
help -h
optional arguments: -h, --help show this help message and exit -gdt, --get-data-nodes Get the list of data node ids -gs, --get-server-nodes Get the list of server node ids
Hope it is useful! :) sh-4.2#