Seagate / cortx-ha

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.
https://github.com/Seagate/cortx
GNU Affero General Public License v3.0
4 stars 45 forks source link

Cortx-29005: Implement health event generator framework #653

Closed Madhura-08 closed 2 years ago

Madhura-08 commented 2 years ago

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#

ArchanaLimaye commented 2 years ago

Please fix codacy issues