News for hackers. Stuff that matters.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by sneak on Saturday May 01, 2021 @10:13AM (#27006483)
What do you all use for quick one-command (non gui) new vm bringup?

I haven't had much luck with terraform with libvirt, and I miss Vagrant but don't want to lock myself into its syntax. Maybe I should just start using it again but I feel like there has got to be a good libvirt-based way.

Provisioning new test vms with userdata embedded into an kickstart-or-whatever iso that is provided to libvirt also seems clunky. docker-machine is no longer maintained so I can't use it as a vagrant replacement to just bring up sshable hosts. Multipass?

Curious as to how others have solved this.

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by vegardx on Saturday May 01, 2021 @10:31AM (#27006625)
I was playing around with this a while ago, using cloud-init and virt-install. But I found it to be quite cumbersome if you don't have some kind of metadata service that can provide cloud-init with the user-data, ie. not using the nocloud provider.

I started looking at this mock EC2 metadata service, but never did anything with it: https://github.com/sjjf/md_server

Ninja-edit: It seems like virt-install rencently abstracted the whole NoCloud-provider, this changes a lot of things: https://blog.wikichoon.com/2020/09/virt-install-cloud-init.h...

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by SteveNuts on Saturday May 01, 2021 @10:46AM (#27006742)
We implemented our own mock ec2 metadata service for KVM cloud-init, probably the most fun project I've worked on.

The tricky part is intercepting the requests and redirecting them to your service

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by mazatta on Saturday May 01, 2021 @05:03PM (#27009778)
I've had luck with Proxmox and this Terraform provider: https://registry.terraform.io/providers/Telmate/proxmox/late...

Other than a working Proxmox install, you'll need to create a cloud-init template, which is documented here: https://pve.proxmox.com/wiki/Cloud-Init_Support

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by ofrzeta on Sunday May 02, 2021 @02:32AM (#27012817)
virt-install with kickstart or preseed files and VMs attached to the serial console, like

virt-install -n centos -r 1024 --cpu=host -l http://mirror.cogentco.com/pub/linux/centos/6/os/x86_64/ --disk path=/var/lib/libvirt/images/centos.img,size=10,bus=virtio --boot kernel_args="console=/dev/ttyS0" -w network=internal,model=virtio --initrd-inject=centos.ks -x "ks=file:/centos.ks console=ttyS0" --graphics none

Setting up the serial console requires some configuration on the host part, too, unfortunately, depending on the OS.

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by lioeters on Saturday May 01, 2021 @08:28PM (#27011246)
Just wanted to chime in and say that, for my purposes, Multipass has been perfect for work and personal use.

https://multipass.run/

(For others, it's a simple-to-use CLI that provisions Ubuntu instances.)

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by madjam002 on Saturday May 01, 2021 @11:56AM (#27007292)
You mention Terraform, I'm using https://github.com/dmacvicar/terraform-provider-libvirt quite heavily and it works a treat.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by sneak on Saturday May 01, 2021 @12:33PM (#27007611)
That's the one I've had suboptimal experience with. Maybe I need to learn it better. What kind of storage are you using it with? I ran into issues using file-backed trying to keep everything in tf.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by madjam002 on Sunday May 02, 2021 @03:47PM (#27018369)
I’m copying qcow2 volumes with it to file based storage and some Ceph RBD as well, I mean AFAIK it just talks to the standard libvirt volumes interface so anything you can do with that you can do with the Terraform provider.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by abbbi on Sunday May 02, 2021 @06:59AM (#27014049)
vagrant with the vagrant-libvirt plugin. The roboxes project provides pre-installed and configured vagrant boxes for allmost all distributions. Its really just a matter of seconds to bring up whatever distribution box you like. Even pre-configured and sysprepped windows images exist.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by bonzini on Saturday May 01, 2021 @10:21AM (#27006520)
virt-install or virt-builder.
Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by sneak on Saturday May 01, 2021 @10:48AM (#27006763)
I have some extremely clunky 50 line shell scripts around virt-install presently but was hoping to find something a little more streamlined (like the usual Vagrant or docker-machine workflow).

Do you just manually run a huge virt-install command each time?

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by ohyeshedid on Saturday May 01, 2021 @02:19PM (#27008505)
Have you looked into Weaveworks Ignite?

https://github.com/weaveworks/ignite

Re:Linux Hypervisor Setup (Libvirt/QEMU/KVM) by bonzini on Saturday May 01, 2021 @11:44AM (#27007195)
I usually use virt-builder actually. But it's like 3-4 command line options for virt-install, not 50.