QEMU-GA installation and monitoring development under Windows

Source: Internet
Author: User

Windows installation Qemu-gaadd virtio serial port in virtual machine configuration

#virsh Edit Instance-name

Add the following configuration in the devices,

1<channel type='Unix'>2<source mode='Bind'Path='/var/lib/libvirt/qemu/org.qemu.guest_agent.0.instance-name.sock'/>3<target type='Virtio'Name='org.qemu.guest_agent.0'/>4<address type='virtio-serial'Controller='0'bus='0'port='1'/>5</channel>

Installing the QEMU Guest Agent service

#wget Https://fedorapeople.org/groups/virt/virtio-win/virtio-win.repo -o/etc/yum.repos.d/ Virtio-win.repo

#yum Install Virtio-win

Install the Virtio-win package, Virtio-win contains the Windows Virtio device driver, and the QEMU-GA installation package.

Copy the MSI installation files and Virtio-win.iso to Windows.

Virtio-win.iso contains virtio serial drivers under each version of Windows, with the corresponding version installed the driver.

Install the corresponding version qemu-ga.msi, at this point, QGA installation is complete.

qga Feature ExtensionsBuild the build environment:
  • RPM-IVH Epel-release

  • Download the Microsoft VSS SDK: http://www.microsoft.com/en-us/download/details.aspx?id=23490

  • Extract the source files for the Microsoft VSS SDK (Extract-vsssdk-headers is available under qemu/scripts, or it can be copied to Linux under Windows)

  • wget http://wiki.qemu-project.org/download/qemu-2.6.0-rc1.tar.bz2

  • Yum Install-y Mingw64-pixman

  • Yum Install-y mingw64-glib2

  • Yum Install-y Mingw64-gmp

  • Yum Install-y mingw64-sdl

  • Yum Install-y mingw64-pkg-config

  • ./configure--enable-guest-agent--with-vss-sdk=/vss_path--cross-prefix=x86_64-w64-mingw32-

  • Make Qemu-ga.exe

Add a feature example (add memory usage detection)

Edit Qapi-schema.json, add custom struct body and command declaration.

1 # # struct Declaration2 # @GuestMemInfo3     #4 # Information about Memory usage.5     #6 # @total: Total size of Memory7     #8 # @usage: Memory usage9     #Ten# Since2.6 One     ## A{'struct':'Guestmeminfo', -       'Data': {' Total':'int','usage':'int' } } -            the # # Command Declaration -# @guest-Get-mem-Usage: -     # - # Get the memory utilization rate. +     # - # Returns: @GuestMemInfo on success. +     # A# Since2.6 at     ## -{'Command':'Guest-get-mem-usage', -       'returns':'Guestmeminfo'}

To add a command implementation in COMMANDS-WIN32.C:

1Guestmeminfo *qmp_guest_get_mem_usage (Error * *ERRP)2 {3 Memorystatus MS;4Guestmeminfo *meminfo = g_new0 (Guestmeminfo,1);5GlobalMemoryStatus (&ms);6Meminfo->usage =(int64_t) ms.dwmemoryload;7Meminfo->total =(int64_t) Ms.dwtotalphys;8       returnMeminfo;9}

Add the command implementation in COMMANDS-POSIX.C (return qerr_unsupported error directly):

1 guestmeminfo *qmp_guest_get_mem_usage (Error * *ERRP)2{3   ERROR_SETG (ERRP, qerr_unsupported); 4 }

Recompile the Qemu-ga.exe, replace the Qemu-ga.exe under the C:\Program files\qemu-ga, and restart the service.

(DLL dependent, can be found under/usr/x86_64-w64-mingw32/sys-root/mingw/bin/.) )

Reference documents:

Http://wiki.qemu.org/Features/QAPI/GuestAgent

Http://wiki.libvirt.org/page/Qemu_guest_agent

Http://fedoraproject.org/wiki/Windows_Virtio_Drivers

Http://lists.gnu.org/archive/html/qemu-discuss/2014-11/msg00027.html

QEMU-GA installation and monitoring development under Windows

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.