#!/bin/bash

set -e

export TIMEFORMAT="%R"

cfg=/tmp/pvm.cfg

for mem_gb in 1 2 4 8 16 32 64 128 256 512 1024 1500; do
    mem_mb=$(($mem_gb*1024))
    vm=$(grep "^name" $cfg | sed -e 's/ //g' | sed -e 's/"//g' | sed -e "s/'//g" | cut -d= -f2)
    sed -i -e "s/memory = .*/memory = ${mem_mb}/g" $cfg
    echo $mem_gb
    time xm create -p $cfg >/dev/null
    time xm destroy $vm >/dev/null
    echo
done
