[libvirt] [PATCH V3 1/2] Intorduce file descriptor set for QEMU domains
Daniel P. Berrange
berrange at redhat.com
Thu Feb 7 17:58:44 UTC 2013
On Thu, Feb 07, 2013 at 12:56:45PM -0500, Stefan Berger wrote:
> On 02/07/2013 10:12 AM, Daniel P. Berrange wrote:
> >On Mon, Feb 04, 2013 at 07:12:37PM -0500, Stefan Berger wrote:
> >>Create field in virDomainDeviceInfo structure to hold
> >>file descriptor set the device is associated with. Have
> >>the number written into the Device Info XML and parsed
> >>from the XML.
> >>
> >>Remember the next-toy use file descriptor set in the QEMU
> >>private domain structure.
> >>Upon libvirt restart determine the maximum file descriptor
> >>set used in the Device Info XML and remember the
> >>next-to-use file descriptor set in the QEMU private domain
> >>structure.
> >>
> >>Upon termination of a domain, reset the next-to-use file
> >>descriptor set to its initial value '1'.
> >>
> >>Stefan Berger <stefanb at linux.vnet.ibm.com>
> >>
> >>---
> >> src/conf/capabilities.h | 5 ++++-
> >> src/conf/domain_conf.c | 20 +++++++++++++++++---
> >> src/conf/domain_conf.h | 1 +
> >> src/lxc/lxc_domain.c | 3 ++-
> >> src/qemu/qemu_domain.c | 23 ++++++++++++++++++++++-
> >> src/qemu/qemu_domain.h | 2 ++
> >> src/qemu/qemu_process.c | 2 ++
> >> 7 files changed, 50 insertions(+), 6 deletions(-)
> >I really don't like the fact that we're modifying the virDomainDef
> >structs, which are intended to hold static config description, to
> >also hold QEMU specific dynamic state. We did this in the past
> >before we had the per-driver 'privateData' associated with
> >virDomainObjPtr instances.
>
> In these patches we are storing the fdset that's in use by a
> particular device in the virDomainDeviceInfo structure and are
> persisting that fdset number next to the device's alias into XML
> written into /var/run/libvirt/qemu to be able to restore it upon
> libvirt restart. Now we would either need a similar per-device
> structure in parallel to those virDomainDeviceInfo structures or
> connect a QEMU private data structure to that virDomainDeviceInfo
> structure for storing the dynamic data and to keep reference back to
> the device. Not sure what's the best path ...
Just have a hashtable mapping device alias names -> fd set numbers
in the qemuDomainObjPrivatePtr, and write that out in the QEMU
private XML. There's no need to directly mirror the structs.
>
> This is how the per-device XML in /var/run/libvirt/qemu/xyz.xml looks now:
>
> <serial type='pipe'>
> <source path='/tmp/testpipe'/>
> <target port='1'/>
> <alias name='serial1' fdset='3'/>
> </serial>
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list