
The library can also read configuration from the file specified in `OS_FAULTS_CONFIG` environment variable or read it from one of default locations: * current directory * ~/.config/os-faults * /etc/openstack Change-Id: Iced9b55bb0992cd23eb689103d62183e200ba76b
3.6 KiB
os-faults
OpenStack faults injection library
The library does destructive actions inside OpenStack cloud. It provides an abstraction layer over different type of cloud deployment. The actions are implemented as drivers (e.g. DevStack driver, Fuel driver, KVM driver etc.).
- Free software: Apache license
- Documentation: http://os-faults.readthedocs.io
- Source: https://github.com/openstack/os-faults
- Bugs: http://bugs.launchpad.net/os_faults
Usage
Cloud deployment configuration schema is an extension to cloud config used by os-client-config library:
= {
cloud_config 'auth': {
'username': 'admin',
'password': 'admin',
'project_name': 'admin',
},'region_name': 'RegionOne',
'cloud_management': {
'driver': 'devstack',
'address': 'devstack.local',
'username': 'root',
},'power_management': {
'driver': 'kvm',
'address': 'kvm.local',
'username': 'root',
} }
Build the connection to the cloud deployment and verify it:
= os_faults.connect(cloud_config)
distractor distractor.verify()
The library can also read configuration from the file specified in OS_FAULTS_CONFIG environment variable or read it from one of default locations: * current directory * ~/.config/os-faults * /etc/openstack
Make some distraction:
='keystone-api').restart() distractor.get_service(name
- The library operates with 2 types of objects:
-
- service - is software that runs in the cloud, e.g. keystone-api
- nodes - nodes that host the cloud, e.g. hardware server with hostname
Use cases
1. Service actions
Get a service and restart it:
= os_faults.connect(cloud_config)
distractor = distractor.get_service(name='keystone-api')
service service.restart()
- Available actions:
-
- start - start Service
- terminate - terminate Service gracefully
- restart - restart Service
- kill - terminate Service abruptly
- unplug - unplug Service out of network
- plug - plug Service into network
2. Nodes operations
Get all nodes in the cloud and reboot them:
= distractor.get_nodes()
nodes nodes.reboot()
- Available actions:
-
- reboot - reboot all nodes gracefully
- poweroff - power off all nodes abruptly
- reset - reset (cold restart) all nodes
- oom - fill all node's RAM
- disable_network - disable network with specified name on each of the nodes
- enable_network - enable network with specified name on each of the nodes
3. Operate with service's nodes
Get all nodes where the service runs, pick one of them and reset:
= service.get_nodes()
nodes = nodes.pick()
one one.reset()
4. Operate with nodes by their FQDNs
Get nodes where l3-agent runs and disable management network on that nodes:
= neutron.l3_agent_list_hosting_router(router_id)
fqdns = distractor.get_nodes(fqdns=fqdns)
nodes ='management') nodes.disable_network(network_name
5. Operate with service on particular node
Restart service on a single node:
= distractor.get_service(name='keystone-api')
service = service.get_nodes().pick()
nodes service.restart(nodes)