[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] [RFC]OpenVZ XML def

On Thu, Jul 05, 2007 at 12:28:40PM +0530, Shuveb Hussain wrote:
> >>> Daemon though?  Can't the libvirt code just invoke the OpenVZ commands
> >>> directly?
> >>
> >> Yeah, that is very much possible. But if it were a daemon, it could be
> >> a Python daemon, since text processing is much simpler and I don't
> >> have to use the str*( ) funcs in C. What is your comment?
> >
> >I'm a big advocate of using a sane language instead of C, but libvirt is
> >written in C for better or worse.
> >
> >The problem with a separate daemon is management of that daemon.
> >Something needs to start it and stop it, it needs to have sockets with
> >the right permissions and so on.  What happens if the process runs and
> >can't find the daemon?  What is the path to the socket?  etc. etc. At
> >the moment we have two daemons - the qemu daemon (which has two separate
> >functions intertwined), and a remote daemon (necessary, because there's
> >no other way to communicate to a remote machine).
> >
> >One idea would be to have the Python code fork off from the main program
> >and communicate over a pipe.  With this, there is no daemon management
> >problem.
> >
> >  +----------------+
> >  | Program        |
> >  | - - - - - - - -|
> >  | libvirt        |
> >  +----------------+
> >       |
> >       | fork(2) and pipe(2)
> >       |
> >  +-------------+
> >  | Python code |
> >  +-------------+
> >
> >But I'm not the person who ultimately decides what would be acceptable
> >in libvirt.  You'd need to get general agreement on the best way to do 
> >this.
> >
> The OpenVZ utils code, as I previously mentioned is GPL and a bigger
> issue is that the code is simple and straight forward. So, even if I
> wanted to add OpenVZ support into Libvirt, it ends up looking very
> close to the original GPL code. If the other Libvirt maintainers don't
> have an issue with what Richard is suggesting, then I can go ahead and
> do it. I have the freedom to work on this full time now. I can either

  Excellent! No issue, go ahead :-)

> write a Python helper(since I have to deal with a lot of text), or
> write C code that will be well integrated into Libvirt. Either way, it
> is going to be popen()ing the OpenVZ utilities. Which of this is
> better?

  Oh at the C level, definitely ! The python layer is really only a language
binding wrapper and should remain that way ! Even if we fork as a new process
the python side of libvirt is packaged separately, and really the core should
be written in C, this would also allow to merge back your code in the existing
daemon code if needed.

I think that forking and using a pipe is not ideal, but that's a good first
step, and eventually we may find a way to improve this if more people start
to use it. Look at how many driver we wrote for Xen and how all this has
evolved over time ! For existing interprocess fork/pipe communications
see the libvirt xen proxy code, src/proxy_internal.c and src/proxy_internal.h
is the part on the libvirt side and proxy/libvirt_proxy.c for the forked
part. Your design is likely to be very very similar, and you can probably
reuse all that code nearly directly for the communication with your daemon,
the code is done and debugged and that should be a good first step to 
bootstrap your development (something like openvz_internal.[ch] in src
and an openvzd/ subdirectory would fit well with existing infrastructure).
I don't know how OpenVZ works, and if a single shared daemon would be
okay or if it is better to create one daemon per OpenVZ instance, probably
the last is the best but it really depends on how the tools work.

I think the key is to try to share your design and development as you progress
(release early, release often motto :-) to gain traction and help. Don't
hesistate to ask, I'm also fine with commiting code which may not work yet
and is not complete, best is to make it optional in configure.in and off
by default.

  In a nutshell, go ahead, and please let us help you as you progress :-)

    thanks !


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]