Set up port-forwarding via libvirt's hook

It’s a bad idea using one file to maintain all port-forwarding rules for VMs. In such a traditional environment (without SDN I mean), consider libvirt’s hook mechanism as a more modular way.

For Ubuntu, edit /etc/libvirt/hooks/qemu and then restart the libvirt-bin service.


virsh error: Cannot allocate memory

Today I was trying to increase memory size on a qemu-kvm hosted VM. My plan was as simple as shut it down and then change memory setting via virsh edit <VMName>, but both virsh edit and virsh start throws the same error message:

error: cannot fork child process: Cannot allocate memory