5

In the documentation it is not very clear that how to install and use qemu-guest-agent in Ubuntu 12.04.

So can anyone help me out ?

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

It is a daemon program running inside the domain which is supposed to help management applications with executing functions which need assistance of the guest OS. I want to know the IP address of the guest VM using guest-network-get-interfaces qemu-guest-agent command.

Is there any other way to find IP address of guest VM ?

arp -an, arpwatch ,echo syslog | grep $mac_address is not useful in my scenario ?

2
  • the guest agent can be contacted via the monitor commands, all the commands are prefixed with guest-. Not sure abut the IP, in oVirt it's done by another agent
    – dyasny
    Mar 1, 2015 at 23:27
  • If your main aim is to get the IP address, then see serverfault.com/a/676257/140905 Apr 24, 2016 at 12:26

1 Answer 1

6
  1. First of all install latest version of libvirt-bin(>=1.0.0) on the host system. Installing libvirt-bin(>=1.0.0) on Ubuntu12.04 is itself a challenge because of dependencies.This link may help to do so: https://tad-do.net/2013/02/22/testing-new-libvirt-features-on-ubuntu-12-04/

    Then execute following commands on host:

    mkdir -p /var/lib/libvirt/qemu/channel/target
    chown -R libvirt-qemu:kvm /var/lib/libvirt/qemu/channel
    
  2. Add the following to the bottom of /etc/apparmor.d/abstractions/libvirt-qemu:

    /var/lib/libvirt/qemu/channel/target/* rw,
    
  3. Install qemu-guest-agent in guest VM.

    sudo apt-get install qemu-guest-agent
    
  4. virsh edit VMNAME and add following lines in the devices:

    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    
  5. Shutdown and start the VM and execute following command to get the IP Address. There are many other things which can be done using guest-agent.

    virsh qemu-agent-command VMNAME '{"execute":"guest-network-get-interfaces"}'
    

References:http://wiki.stoney-cloud.org/wiki/Qemu_Guest_Agent_Integration

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .