[libvirt] Qemu guest agent to install RPMs in guest VM from host machine

Puneet Bakshi bakshi.puneet at gmail.com
Thu Jun 12 15:48:32 UTC 2014


I understand your point, Eric and Daniel. Let me rephrase my problem
statement. Please suggest me how can I address them.

I have a project environment where guest VMs are getting created and
destroyed based on some (irrelevant) parameters (these guest VMs are
instantiated with QEMU guest agent running and with any possible changes in
that). There is a module in host which is controlling all this. I need to
do following things from within that module.

1. Whenever a new guest VM is created, take (predefined) RPM packages from
host to guest VM and install them.

2. Start a script in guest VM (at certain events).

3. Start a process in guest VM (at certain events).

I thought to address above issues by having a QEMU guest agent running
inside guest VM which has one new command, to which I somehow pass RPMs
using "virsh qemu-guest-agent ..." command.

In existing qemu-ga code, I saw some examples where they fork() and
execle() some stuff. I though I can achieve [2] and [3] using the same way.

But, I was getting stuck at [1] in how to transfer files from host to guest
and do something with them. I thought I should be able to transfer files
using channel like socket/virtio, but was not getting the clue on how to
use them.

Regards,
~Puneet
[PS: What is meant by top-post. I am using gmail and using "reply all". How
can I avoid top-post?]



On Thu, Jun 12, 2014 at 8:45 PM, Eric Blake <eblake at redhat.com> wrote:

> On 06/12/2014 09:02 AM, Puneet Bakshi wrote:
>
> [once again, please don't top-post]
>
> > If I add following channel in guest VM's xml file
> >
> >     <channel type='unix'>
> >       <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
> >       <target type='virtio' name='org.qemu.guest_agent.0'/>
> >       <alias name='channel0'/>
> >       <address type='virtio-serial' controller='0' bus='0' port='1'/>
> >     </channel>
>
> Yes, that's how you set up a guest agent.
>
> >
> > Would it be possible to use virtio org.qemu.guest_agent.0 for such
> > communication between host and guest? If yes, how can we do it?
>
> Your FIRST task is to submit a patch to the qemu list to add yet another
> guest agent command that does what you want.  Merely having the guest
> agent does not mean you can do anything, but only that you can do what
> has already been coded up in the agent interface.  And looking at
> http://git.qemu.org/?p=qemu.git;a=blob;f=qga/qapi-schema.json I don't
> yet see a command that does what you seem to want (guest-file-open will
> let you create/open a file in the guest from the host, but nothing yet
> lets you create a process in the guest).
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140612/49068cda/attachment-0001.htm>


More information about the libvir-list mailing list