Skip to contentSkip to conversation

How can we install RPMs in guest VM from host machine using QEMU guest agents

Qemu-devel Puneet Bakshi 1 participant 1 message Jun 12, 2014 4 messages not in the archive

lore
Share & tools
lore
#4 lore raw
In reply to a message not in the archive

Including qemu-devel also.

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.

    "virsh qemu-agent-command vm_01          \
        '{"execute":"guest-rpm-install",     \
          "arguments":{"path":"/usr/local/bin/ABC.rpm"}}

In existing qemu-ga code, I saw some examples where they fork() and execle() some stuff. I think 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. Basically how can I do following.

1. take some bulky file from host to guest
2. perform some operation on that file
3. get the result of that operation.

Regards,
~Puneet

Quoted 62 lines · Puneet Bakshi

Forgot to mention that these guest VMs can be UNIX based or Windows.

Quoted 55 lines · Puneet Bakshi

Thanks Dale for responding.

Actually, these guest VMs may or may not have scp, ftp, etc. What is assured is that they have the QEMU guest agent running and there is a possibility of having additional commands if required.

Let me put up my problem.

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,

Quoted 14 lines · Dale R. Worley
Quoted 3 lines

From: Puneet <[email protected]>

I am able to pass arguments from host to guest VM but how am I

supposed to

Quoted 2 lines

pass the whole RPM image from host to guest (which the guest agent can receive and install)?

What occurs to me is:

scp /usr/local/bin/ABC.rpm root@guest:/usr/local/bin/ABC.rpm ssh root@guest rpm --install -p /usr/local/bin/ABC.rpm

Dale