Dynamic memory management for Windows virtual machines in Libvirt

Source: Internet
Author: User

A very short premise.

Libvirt supports dynamic memory expansion of virtual machines, but Windows virtual machines first need to install the Virtio-win driver.

Virtio-win drivers provided by KVM:
Http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers
http://alt.fedoraproject.org/pub/alt/virtio-win/

Here are the chestnuts

Image: Windows2008r2,64 bit
Virtio-win:virtio-win-0.1-100.iso
Disk: Differential Mirroring (qemu-img create-f qcow2-b./windows_2008r2_x86_64 disk)

Use the QEMU command to start the virtual machine and load the Virtio driver:

qemu-system-x86_64 -hda ./windows_2008R2_x86_64 -drive file=./disk,if=virtio -drive file=./virtio-win-0.1-100.iso,media=cdrom,index=1 -net nic,model=virtio -net user -boot d -vga std -m 4096 -usbdevice tablet -vnc :50 -enable-kvm

To access the virtual machine via VNC, do the following:

    1. Go to "Device Manager"-"System device", install "Unknown Device" as "Virtio Balloon Driver"
    2. Copy the Win7/x86 directory from the Virtio-win optical drive to the "C:/Program Files/balloon"
    3. Use the cmd command line as an administrator to enter the above directory
    4. Perform "blnsvr.exe-i" to install the BLNSVR service
    5. Normal shutdown Save Settings

At this point, the disk file has the ability to obtain detailed memory information, dynamically adjust the memory size, the following methods are verified:

Memory details Get Validation:

1. Use the disk file to start the virtual machine, add the following paragraph in the XML file to enable the balloon device, and set the acquisition period to 10s

...<devices>    <memballoon model=‘virtio‘>      <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x02‘function=‘0x0‘/>      <stats period=‘10‘/>    </memballoon>  </devices></domain>

2. Acquisition time can be set manually

virsh dommemstat <dommain> --period <time(sec)>

3. Get the current memory usage of the virtual machine

virsh dommemstat <dommain>

Memory Dynamic Resizing verification:

1. Turn off the virtual machine

virsh destroy <domain>

2. Set the virtual machine maximum memory value (if the XML file has already been written can be skipped)

virsh setmaxmem <domain> --size <max_size>

3. Start the virtual machine

virsh start <domain>

4. Dynamic adjustment

virsh setmem <domain> --size <mem_size>

A bit different from the Linux system is that Windows displays the set maximum memory value, which can be confusing.

References :
Https://pve.proxmox.com/wiki/Dynamic_Memory_Management#Ballooning

Another address

Dynamic memory management for Windows virtual machines in Libvirt

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.