I think you can move "vm"'s check to main function "run_virsh_blkiotune".