[libvir] How to seek a running QEMU instance

Daniel P. Berrange berrange at redhat.com
Tue Mar 18 18:46:45 UTC 2008

On Tue, Mar 18, 2008 at 06:38:44PM +0000, Richard W.M. Jones wrote:
> On Tue, Mar 18, 2008 at 05:47:38PM +0300, Anton Protopopov wrote:
> > I have the following question. How can virsh (or, more accurately, libvirt)
> > detect a running QEMU vm, when latter was already started? For example, I
> > have got the following:
> As Dan says, it doesn't, but this is kind of a bug in libvirt.
> It is in theory possible for libvirt to enumerate running qemu/kvm
> instances, eg. by looking at the process table.  But this is rather
> nasty.
> A better way would be to allow qemu processes to drop a monitor socket
> into a well-known directory; something like:
>   qemu -monitor unix:/var/run/libvirt/monitors/<uuid>
> (and perhaps wrap this up in a shell script to make it simpler for
> users to start their own qemu instances and have them transparently
> managed by libvirt).

This is one part, but it is not sufficient as we can't determine the
full config associated with an existing VM.

> This would also allow libvirtd to be restarted without killing the
> qemu guests (I think ...).

Yes, that would work, since libvirt already has the VM config in that

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list