Skip to content

Instantly share code, notes, and snippets.

@d6e
Created May 29, 2013 18:06
Show Gist options
  • Save d6e/5672375 to your computer and use it in GitHub Desktop.
Save d6e/5672375 to your computer and use it in GitHub Desktop.
Creates a new vm on kvm/qemu
#!/bin/bash
host="[email protected]"
if [ ! -f vm-namelist.txt ];
then
echo "vm-namelist.txt does not exist. You should create a it. (Make a list of names for the VMs)"
fi
for vmname in $(cat vm-namelist.txt); do
(
virt-install \
--connect=qemu+ssh://$host/system \
--name=$vmname \
--pxe --ram=2048 \
--noautoconsole \
--os-type=linux --os-variant=ubuntuquantal \
--network bridge=br3 --network bridge=br5 \
--disk path=/var/lib/libvirt/images/$vmname.img,size=10,sparse=true
)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment