# Filesystem Test ### Example of use ``` git clone https://gitlab.resds.ru/vlasov.dv/fs-test.git cd fs-test chmod +x create-vm.sh ./create-vm.sh --bootstrap-env env vi env sudo ./create-vm.sh -e ./env ``` ### Usage of `./create-vm.sh`: ``` usage: ./create-vm.sh required_args [optional_args] OR ./create-vm.sh misc_args Create a new virtual machine according to specified parameters and run test on filesystem misc_args: --bootstrap-env ENV_PATH create template env file and exit required_args: -n, --name NAME name of a virtual machine -o, --os-variant OS_VARIANT operating system -m, --memory MEMORY RAM size -c, --vcpus VCPUS Amount of of cores -i, --image IMAGE URL or path to an ISO image -s, --size SIZE Size of an OS drive (example: 8G) -b, --bridge BRIDGE bridge name (LinuxBridge only) -a, --ip-address IP ip address of eth0 -p, --prefix PREFIX network prefix -g, --gateway GATEWAY ip address of network gateway -d, --dns DNS ip address of dns server -S, --source-dev SOURCE_DEV size of the created image for performing a test on it -f, --fstype FSTYPE filesystem type default: xfs -t, --test-suite TEST_UTIL what should be used for the test (bonnie++ and iozone are available) default: bonnie++ -T, --testargs TEST_UTIL_ARGS arguments that shoud be passed to testing program (-d for bonnie++ or -f for iozone being set automatically) default: -u 0 optional_args: -h, --help show this help message and exit -e, --env export args from env file -r, --rm-if-exist if vm exist, remove it first default: false -P, --pubkey PUBKEY place public key into autorized_keys of all defined in config.yaml users default: /home/$USER/.ssh/id_rsa.pub -v, --vnc-password VNC_PASSWORD vnc console password default: PASSWD1! -C, --cloud-init CLOUD_INIT Path to a cloud-init config - will be created if not provided env example: NAME=Ubuntu22.04 OS_VARIANT=ubuntu22.04 MEMORY=2048 VCPUS=2 IMAGE=https://cloud-images.ubuntu.com/jammy/20231010/jammy-server-cloudimg-amd64.img SIZE=8G BRIDGE=virbr0 IP=192.168.122.2 PREFIX=24 GATEWAY=192.168.122.1 DNS=8.8.8.8 SOURCE_DEV=/dev/sdx # CHANGE IT! FSTYPE=xfs TEST_UTIL=bonnie++ TEST_UTIL_ARGS="-u 0" RM=true PUBKEY=/root/.ssh/id_rsa.pub VNC_PASSWORD=PASSWD1! cloud-init example: #cloud-config package_upgrade: false packages: - vim - htop - bonnie++ - iozone3 users: - name: ubuntu ssh-authorized-keys: - {{PUBKEY}} sudo: ['ALL=(ALL) NOPASSWD:ALL'] ssh_pwauth: true lock-passwd: false chpasswd: {expire: False} groups: sudo shell: /bin/bash - name: adminuser ssh-authorized-keys: - {{PUBKEY}} sudo: ['ALL=(ALL) NOPASSWD:ALL'] ssh_pwauth: true lock-passwd: false chpasswd: {expire: False} groups: sudo shell: /bin/bash runcmd: - wipefs -a /dev/{{DEV_INTERNAL_NAME}} - mkfs.{{FSTYPE}} /dev/{{DEV_INTERNAL_NAME}} - mkdir -p {{TESTDIR}} - mount /dev/{{DEV_INTERNAL_NAME}} {{TESTDIR}} - {{TEST_UTIL}} {{TEST_UTIL_ARGS}} ```