<commit_before># DestroyStack

**WARNING:** Some of the described features are work in progress, please don't
try to run this yet

**WARNING:** Do not run these on a production system! I will destroy everything
you love.

This project tries to test the reliability of OpenStack by simulating failures,
network problems and generally destroying data and nodes to see if the setup
survives it. The basic idea is to inject some fault, see if everything still
works as expected and restore the state back to what it was before the fault.
Currently contains only Swift tests, but other components are planned.

## Requirements

You will either need access to some VMs running in an OpenStack cloud or
VirtualBox locally. Using VMs is necessary because the machines are being
snapshotted between the tests to provide test isolation and recover from
failures (see [FAQ](FAQ.md)). Support for Amazon AWS and libvirt VMs might be
added in the future.

If you need bare metal, you can add support for LVM snapshotting, or you can
use the manual best-effort recovery (see [FAQ](FAQ.md]).

The tests don't tend to be computationally intensive. For now, you should be
fine if you can spare 2GB of memory for the VMs in total. Certain topologies
need extra disks for Swift, but their size isn't important - 1GB is enough per
disk.

I've only tried these with RHEL and Fedora, plus RDO Havana or RHOS-4.0,
installed by [Packstack](https://github.com/stackforge/packstack). The tests
themselves don't really care what or how is it deployed. For more info on the
setups, see the file `TEST_PLAN.md`. The tests use the `python-nose` framework
and the OpenStack clients, both of which will be installed as dependencies if
you install this repository with pip.


## Demo using VirtualBox

You can try out the demo with Vagrant and VirtualBox (libvirt may be added
later). While easier to use, it isn't fast - creating the virtual machines will
take a few minutes, installing OpenStack on them another 15 minutes and the
tests themselves take a while to run.

    # install the latest version of Vagrant and Virtualbox
    $ pip install -e --user destroystack/
    $ cd destroystack/
    $ vagrant plugin install vagrant-vbox-snapshot
    $ vagrant up
    $ ./demo/run

This will boot up 3 Fedora VMs in VirtualBox, deploy the basic topology for
most DestroyStack tests (others might take more resources than this), create a
snapshot and run the basic tests that are able to run on this topology. Between
the test runs, the snapshot will be restored to provide test isolation.

To remove the VMs and extra files, run

    $ cd destroystack/
    $ vagrant destroy
    $ rm -r tmp/


## Running the tested system inside OpenStack VMs

If you have a production instance of OpenStack where you can manage VMs, you
can install OpenStack on them (therefore, run OpenStack inside OpenStack). You
will give the tests access to the meta OpenStack API and IDs of the VMs, so
that it can snapshot them between tests. First, create 3 VMs and either use the
ephemeral flavor or add a cinder disk. (I will hopefully provide a Heat
template and a script to do all this later).

    $ cd destroystack
    $ cp etc/config.json.openstack.sample etc/config.json

Set the VM IDs and links in the config file. Change the disk names in case they
are called differently than `/dev/{vdb,vdc,vdd}`. Don't put your main disk in
here! They will all be
formatted. Just add or remove server entries depending on how many you
have. The services password is what will be set in the answer files for keystone
and other things, you don't need to change it. The timeout is in seconds and
tells the tests how long to wait for stuff like replica regeneration before
failing the tests.

    $ python bin/generate_answerfiles.py


If you chose to use packstack, install the basic topology with this (more will
be supported later):<commit_msg>README file fixes<commit_after># DestroyStack

**WARNING:** Some of the described features are work in progress

**WARNING:** Do not run these on a production system! I will destroy everything
you love.

This project tries to test the reliability of OpenStack by simulating failures,
network problems and generally destroying data and nodes to see if the setup
survives it. The basic idea is to inject some fault, see if everything still
works as expected and restore the state back to what it was before the fault.
Currently contains only Swift tests, but other components are planned.

## Requirements

You will either need access to some VMs running in an OpenStack cloud or
VirtualBox locally. Using VMs is necessary because the machines are being
snapshotted between the tests to provide test isolation and recover from
failures (see [FAQ](FAQ.md)). Support for Amazon AWS and libvirt VMs might be
added in the future.

If you need bare metal, you can add support for LVM snapshotting, or you can
use the manual best-effort recovery (see [FAQ](FAQ.md)).

The tests don't tend to be computationally intensive. For now, you should be
fine if you can spare 2GB of memory for the VMs in total. Certain topologies
need extra disks for Swift, but their size isn't important - 1GB is enough per
disk.

I've only tried these with RHEL and Fedora, plus RDO Havana or RHOS-4.0,
installed by [Packstack](https://github.com/stackforge/packstack). The tests
themselves don't really care what or how is it deployed. For more info on the
setups, see the file [test plan](TEST_PLAN.md). The tests use the `python-nose`
framework and the OpenStack clients, both of which will be installed as
dependencies if you install this repository with pip.


## Demo using VirtualBox

You can try out the demo with Vagrant and VirtualBox (libvirt may be added
later). While easier to use, it isn't fast - creating the virtual machines will
take a few minutes, installing OpenStack on them another 15 minutes and the
tests themselves take a while to run.

    # install the latest version of Vagrant and Virtualbox
    $ pip install -e --user destroystack/
    $ cd destroystack/
    $ vagrant plugin install vagrant-vbox-snapshot
    $ vagrant up
    $ ./demo/run

This will boot up 3 Fedora VMs in VirtualBox, deploy the basic topology for
most DestroyStack tests (others might take more resources than this), create a
snapshot and run the basic tests that are able to run on this topology. Between
the test runs, the snapshot will be restored to provide test isolation.

To remove the VMs and extra files, run

    $ cd destroystack/
    $ vagrant destroy
    $ rm -r tmp/


## Running the tested system inside OpenStack VMs

If you have a production instance of OpenStack where you can manage VMs, you
can install OpenStack on them (therefore, run OpenStack inside OpenStack). You
will give the tests access to the meta OpenStack API and IDs of the VMs, so
that it can snapshot them between tests. First, create 3 VMs and either use the
ephemeral flavor or add a cinder disk. (I will hopefully provide a Heat
template and a script to do all this later).

    $ cd destroystack
    $ cp etc/config.json.openstack.sample etc/config.json

Set the VM IDs and links in the config file. Change the disk names in case they
are called differently than `/dev/{vdb,vdc,vdd}`. Don't put your main disk in
here! They will all be formatted. The services password is what will be set in
the answer files for keystone and other things, you don't need to change it.
The timeout is in seconds and tells the tests how long to wait for stuff like
replica regeneration before failing the tests.

    $ python bin/generate_config_files.py

If you chose to use packstack, install the basic topology with this (more will
be supported later):
{'fraction_non_alphanumeric': 0.044134878271058456, 'fraction_numerical': 0.0020830621012888945, 'mean_word_length': 4.030779305828422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7332478', 'n_tokens_mistral': 2041, 'n_tokens_neox': 1939, 'n_words': 1221}