[libvirt-users] Starting processes inside VMs using Libvirt?

Eric Blake eblake at redhat.com
Mon Mar 24 17:17:36 UTC 2014


On 03/24/2014 10:36 AM, Taimur Al Said wrote:
> Hi there,
> 
> I am a beginner with Libvirt. I was practicing using Python bindings with
> libvirt to do some basic stuff like starting a VM, rebooting a VM,
> displaying the number of domain,etc. I was wondering since the hypervisor
> has control over the VMs, it is possible to use Libvirt to inject code into
> the VM? Is it possible to start processes inside a particular VM using the
> Libvirt API. If not, what would you recommend instead? Thanks in advance

What hypervisor are you using?  With lxc:// URI, this is already
possible (see virsh lxc-enter-namespace).  With qemu:// URI, this isn't
really libvirt's thing to do directly; but you might be able to enhance
the qemu-guest-agent to run an arbitrary command, then install that
agent in your guest, then use libvirt's 'virsh qemu-agent-command' to
drive that new agent command.

If the changes you want in your guest can be done while the guest is
offline, then libguestfs is a great suite of tools for making all sorts
of guest disk image modifications (which is as programmatic as you can
get for injecting behavior changes into your guest).  But actually
injecting live processes into a running qemu guest is not possible
without setting up some sort of higher-level protocol, such as
qemu-guest-agent.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140324/3736364c/attachment.sig>


More information about the libvirt-users mailing list