I thought I understood KVM/QEMU pretty well but then I tried following the instructions on this page:
Took me a while to figure out I needed to substitute the kvm command with qemu-system-x86_64 on a CentOS host.
Now I’m wondering why I need to run the below syntax every time I want to start the VM.
qemu-system-x86_64 -enable-kvm \ -curses \ -name leaf0 \ -pidfile leaf0.pid \ -smp 1 \ -m 256 \ -net nic,vlan=10,macaddr=00:01:00:00:01:00,model=virtio \ -net user,vlan=10,net=192.168.0.0/24,hostfwd=tcp::1401-:22 \ -netdev socket,udp=127.0.0.1:1602,localaddr=127.0.0.1:1601,id=dev0 \ -device virtio-net-pci,mac=00:02:00:00:00:01,addr=6.0,multifunction=on,netdev=dev0,id=swp1 \ -netdev socket,udp=127.0.0.1:1606,localaddr=127.0.0.1:1605,id=dev1 \ -device virtio-net-pci,mac=00:02:00:00:00:02,addr=6.1,multifunction=off,netdev=dev1,id=swp2 \ -netdev socket,udp=127.0.0.1:1610,localaddr=127.0.0.1:1609,id=dev2 \ -device virtio-net-pci,mac=00:02:00:00:00:09,addr=6.2,multifunction=off,netdev=dev2,id=swp3 /home/libvirt/images/leaf0.qcow2
I expected that when I shut down the VM it would be defined, but virsh cannot see it even when it’s running. (virsh list –all) fails to find it too.
Is there some way of dumping a xml file for this VM so I can define it?
The tutorial you linked to provides directions to install libvirtd, but then it never actually uses it anywhere. Instead it advises creating VMs manually, which is completely insane, not least because their configuration isn’t saved anywhere.
Use libvirt-aware tools such as the virt-manager GUI or virt-install to create virtual machines with libvirt.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.