[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] How can we install RPMs in guest VM from host machine

From: Mike Lovell
Subject: Re: [Qemu-discuss] How can we install RPMs in guest VM from host machine using QEMU guest agents
Date: Thu, 12 Jun 2014 14:19:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 06/12/2014 04:32 AM, Puneet wrote:

I want to be able to install RPM packages (available in host system at some
path) to the guest VM and want this facility to be available as a tool.

I am thinking of having a gemu guest agent (qemu-ga) running inside guest
VM. I did not find any available command ("virsh qemu-agent-command
<guest_vm> ...") which can do the same.

I am planning to write a command in qemu guest agent, which I can invoke
from virsh like below.

     "virsh qemu-agent-command vm_01          \
         '{"execute":"guest-rpm-install",     \
I am able to pass arguments from host to guest VM but how am I supposed to
pass the whole RPM image from host to guest (which the guest agent can
receive and install)?

according to the schema for the guest agent commands [1], there are several commands for opening and writing a file in the guest. you could use those to transfer a file to the guest. it would be something like guest-file-open, one or more guest-file-write commands to transfer bits of data read from a file on the host, and then a guest-file-close. i don't know if libvirt would support this so you would probably have to implement a program to run on the host that communicates with the guest agent to transfer the file. there is a script in the qemu source tree that has the same basic idea for reading a file from the guest in python. [2] look at the QemuGuestAgentClient.read function. it could probably be easily modified to transfer a file to the guest.

the harder part is going to be executing rpm, yum, or any other command in the guest. the command schema doesn't currently list a command to execute an arbitrary executable in the guest so you would either need to implement a command to execute an arbitrary executable or specifically execute the rpm or yum commands you need. the later would be a little better from a security perspective. and of course rpm wont work on your windows vms though the same basic idea might apply.


[1] http://git.qemu-project.org/?p=qemu.git;a=blob;f=qga/qapi-schema.json
[2] http://git.qemu-project.org/?p=qemu.git;a=blob;f=scripts/qmp/qemu-ga-client

reply via email to

[Prev in Thread] Current Thread [Next in Thread]