Taimur Al Said
2014-Mar-24 19:31 UTC
Re: [libvirt-users] Starting processes inside VMs using Libvirt?
Thank you Eric, I am using KVM: qemu.. I'll try to see how I can use qemu-guest-agent.. If you have links to examples on how to start with it let me know please. Consider the following simple scenario.. I am using KVM to run several VMs; one of OSs in the guests is Windows XP. I want to send to it something from the Hypervisor level, e,g text,parameters,etc so that it will be displayed in the VM screen or stored in a file so I can read from the VM later.. It's best to be done on a live VM. How can such a simple scenario be performed. Does it have to be through the method of qemu-guest-agent?? Thanks alot, T.alsaid On Mon, Mar 24, 2014 at 5:17 PM, Eric Blake <eblake@redhat.com> wrote:> 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 > >
Eric Blake
2014-Mar-24 19:36 UTC
Re: [libvirt-users] Starting processes inside VMs using Libvirt?
On 03/24/2014 01:31 PM, Taimur Al Said wrote:> Thank you Eric,[please don't top-post on technical lists]> > I am using KVM: qemu.. I'll try to see how I can use qemu-guest-agent.. > If you have links to examples on how to start with it let me know please. > Consider the following simple scenario.. > > I am using KVM to run several VMs; one of OSs in the guests is Windows XP. > I want to send to it something from the Hypervisor level, e,g > text,parameters,etc > so that it will be displayed in the VM screen or stored in a file so I can > read from the VM later.. > It's best to be done on a live VM.Definitely a job for a guest agent. But libvirt doesn't maintain guest agents - the qemu-guest-agent is part of the qemu project, so you may be better off asking there.> > How can such a simple scenario be performed. Does it have to be through the > method of qemu-guest-agent??As far as I know, qga does not yet have such a command, so your first line of attack is to patch the qemu sources to add a new guest agent command. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Martin Kletzander
2014-Mar-25 09:14 UTC
Re: [libvirt-users] Starting processes inside VMs using Libvirt?
On Mon, Mar 24, 2014 at 01:36:37PM -0600, Eric Blake wrote:> On 03/24/2014 01:31 PM, Taimur Al Said wrote: > > Thank you Eric, > > [please don't top-post on technical lists] > > > > > I am using KVM: qemu.. I'll try to see how I can use qemu-guest-agent.. > > If you have links to examples on how to start with it let me know please. > > Consider the following simple scenario.. > > > > I am using KVM to run several VMs; one of OSs in the guests is Windows XP. > > I want to send to it something from the Hypervisor level, e,g > > text,parameters,etc > > so that it will be displayed in the VM screen or stored in a file so I can > > read from the VM later.. > > It's best to be done on a live VM. > > Definitely a job for a guest agent. But libvirt doesn't maintain guest > agents - the qemu-guest-agent is part of the qemu project, so you may be > better off asking there. >Unless you really just want to setup some initial data in which case you might use your own initrd and setup things according to command-line parameters. You would have to use direct kernel boot though. The other option (if you don't want to change guest agent) would be to run your own application inside the VM with which you'd be able to communicate with e.g. virtio-serial to send it the data you need. Or, probably too overkilling, fetch the data from the VM over network from some setup server in which this data would be stored based on UUID of the machine for example. Martin> > > > How can such a simple scenario be performed. Does it have to be through the > > method of qemu-guest-agent?? > > As far as I know, qga does not yet have such a command, so your first > line of attack is to patch the qemu sources to add a new guest agent > command. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >> _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users