I have a server with 32 gb ram and there is libvirt. There are 12 gb of ram is used. When I try to add ram to my guest OS it is not possible to add more than 12gb ram. How can I check how much ram available to add to guest OS on libvirt? I want to give all available memory to it.
The absolute maximum amount of RAM you can give to a guest is the total amount of RAM available to the host. But of course, if you do that, then you should expect some performance issues, or things will just fail to start or run properly.
That number is displayed both when you create the VM in virt-manager, and by
# virsh nodememstats total : 32938320 KiB free : 1087720 KiB buffers: 1249844 KiB cached : 3681120 KiB
This system is using almost all of its memory, so it has little room left for memory for new VMs.
To improve memory usage in KVM, make sure that each Windows guest has the virtio balloon driver installed (Linux already includes this driver), and enable ksm on the host to deduplicate virtual machine memory.