A very slow file system for simulating overloaded storage
# dnf install -y git python python-pip fuse fuse-devel
# apt-get install -y git python python-pip fuse
# git clone https://github.com/nirs/slowfs.git
# cd slowfs
# pip install -r requirements.txt
# python setup.py install
# mkdir /realfs /slowfs
# slowfs -c slowfs.cfg /realfs /slowfs
You will see all files in /realfs under /slowfs. Manipulating the files under slowfs will be slow as you configure in slowfs.cfg
The config file is a Python module, with key value pairs for all fuse operations.
Example: adding delay of 60 seconds when removing a file:
# slowfs.cfg
unlink = 60
Operations without configuration use no delay. See slowfs.cfg.example
for
more info.
To change configuration when the mount is online, edit the configuration file and reload the configuration:
slowfsctl reload
Note: you must run this in the same directory you started slowfs. slowfsctl uses the "control" socket created by slowfs in the worrking directory.
You can use slowfsctl
tool to modify slowfs without restarting it.
Available comamnds:
- help
- status
- disable
- enable
- reload
- get
- set
- log
slowfsctl help
Print available commands
slowfsctl status
Print current status (Enabled, Disable)
slowfsctl disable
Disable current configuration, deactivating all delays.
slowfsctl enable
Enable current configuration, activating all delays
slowfsctl reload
Reload configuration from cofiguration file specified using the -c, --config option. If slowfs is running without configuration file, reset configuration to defaults.
slowfsctl get NAME
Print current delay for fuse operation NAME.
slowfsctl set NAME VALUE
Set dealy for fuse opration NAME to VALUE, overriding value read form configuration file.
slowfsctl log LEVEL
Change logging level to (debug, info, warning, error)
Note: debug log level is extermely detailed and slow, logging every read or written to storage, generating gigabytes of logs.
Assuming you mounted your slowfs filesystem on /slowfs
Edit /etc/exports and add:
/slowfs *(rw,sync,no_subtree_check,anonuid=36,anongid=36,fsid=0)
Notes:
- fsid=NNN is required
- anonid=36,anongid=36 - required for ovirt
- seems that all_squash does not work with fuse
Restart nfs service:
systemctl restart nfs
Testing the mount on the client side:
# mkdir mountpoint
# mount -t nfs my.server.name:/slowfs mountpoint
# touch mnt/test
# time rm mnt/test
# time rm mnt/test
real 1m0.063s
user 0m0.000s
sys 0m0.001s
Note: unlink() was configured with 60 seconds sleep.
- slowfs - slowing down storage for fun and profit at QeCamp TLV 2017
To run the tests locally, please install tox:
pip install tox
To run the tests locally:
$ tox
You can also run specific env:
$ tox -e py27
To stop on the first failure:
$ tox -- -x
To see test logs in tests output:
$ tox -- -s
To see slowfs debug logs in tests output, set the DEBUG environment variable:
$ DEBUG=1 tox -- -s
Note that this creates extremely verbose logs.