One inconvenient of VMBuilder is the command line length. There is no way you can remember all the parameters without making mistakes. So I created a small bash script on the host servers I manage to allow to create new VMs without searching all the parameters to submit.
Here is the simple script I use. Feel free to adapt it to your environment:
(You need the python-vm-builder
package to use this script.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
The DISK_SIZE is in megabytes so in this example, 10 000 = 10 gigabytes. When you have adapted your vmbuilder command line for your machine and network (netmask, DNS, gateway, etc.) you only have to edit the first 5 variables and you are good to go! It may take 10 to 20 minutes to build the VM depending on your network and server speed.
When the VM is working, you will then be able to login with the user “myadmin” and password “mysecret” with the virt-viewer client from your desktop:
virt-viewer -c qemu+ssh://kvmhost/system vm4
where “vm4” is the hostname of the VM you have just created.