#!/bin/bash set -x # Purpose: Attach ten Virtio disks # Variable to increment the disk number j=1 # Create 10 raw disk images function create_disk() { for i in `seq 1 10`; do qemu-img create -f raw $i.raw 1G; done } function attach_disk(){ for i in {b..k} ; do j=$(expr $j + 1) sudo virsh attach-disk cvm1 /export/vmimages/$j.raw vd$i --config; done } create_disk attach_disk