How to configure and use qemu-guest-agent in Ubuntu 12.04? My main aim is to get the IP address of guest VM from Host machine
-
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
-
Add the following to the bottom of /etc/apparmor.d/abstractions/libvirt-qemu:
/var/lib/libvirt/qemu/channel/target/* rw,
-
Install qemu-guest-agent in guest VM.
sudo apt-get install qemu-guest-agent
-
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>
-
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
Related videos on Youtube
A-B
Updated on September 18, 2022Comments
-
A-B almost 2 years
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 ?
-
David Corsalini over 9 yearsthe 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 -
Nehal J Wani about 8 yearsIf your main aim is to get the IP address, then see serverfault.com/a/676257/140905
-