[libvirt] [PATCH 4/4] lxc: store tty pid
Daniel Veillard
veillard at redhat.com
Fri May 30 06:38:22 UTC 2008
On Thu, May 29, 2008 at 03:44:24PM -0700, Dave Leskovec wrote:
> er, this time with the patch....
>
> Dave Leskovec wrote:
> > This patch will use a file in the lxc configuration directory to store the tty
> > forwarding process pid. The pid is stored after the process is fork()'d. It's
> > loaded during startup when the config for a running container is loaded. The
> > file is deleted when the domain is undefined. This should avoid "losing" the
> > tty pid over a libvirtd restart.
> >
the idea sounds fine,
> Index: b/src/lxc_driver.c
> ===================================================================
> --- a/src/lxc_driver.c 2008-05-29 14:34:45.000000000 -0700
> +++ b/src/lxc_driver.c 2008-05-29 14:34:51.000000000 -0700
> @@ -328,6 +328,8 @@
>
> vm->configFile[0] = '\0';
>
> + lxcDeleteTtyPid(vm);
> +
> lxcRemoveInactiveVM(driver, vm);
>
> return 0;
> @@ -798,6 +800,10 @@
> lxcTtyForward(vm->parentTty, vm->containerTtyFd);
> }
>
> + if (lxcStoreTtyPid(driver, vm)) {
> + DEBUG0("unable to store tty pid");
> + }
> +
> close(vm->parentTty);
> close(vm->containerTtyFd);
Hum, I'm surprized the PID file is removed only in lxcDomainUndefine.
The PID file need to be re-created each time the domain is started. But
a domain could be started and stopped many time while being defined,
what happen in a (define/start/stop/start) sequence ? Looks to me the
O_CREAT flag in the second start would break because the PID file is still
here ...
Maybe I'm just wrong but if you could just double check that scenario before
the commit, that would be nice :-)
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list