[CRIU] Restarting Process in an LXC Container

Thouraya TH thouraya87 at gmail.com
Thu Jan 22 08:41:46 PST 2015


*Dumping Process* with - s option:

root at g-9:/home# lxc-checkpoint *-s *-D /home/ImGLXC1Worker -n worker
root at g-9:/home# lxc-ls -f
NAME     STATE    IPV4  IPV6  GROUPS  AUTOSTART
-----------------------------------------------
worker   *STOPPED*  -     -     -       NO

*I have done this test:*
You have said: "
*Check the file contents after dump but before restore. Does this file
exists at all? Does it contain proper data?*"

1) dumping Process with -s option
2) root at g-9:/home/ImGLXC1Worker1# lxc-start -n worker
    root at g-9:/home/ImGLXC1Worker1# lxc-ls -f
NAME     STATE    IPV4        IPV6  GROUPS  AUTOSTART
-----------------------------------------------------
worker   RUNNING  10.0.3.109  -     -       NO
worker1  STOPPED  -           -     -       NO
root at g-9:/home/ImGLXC1Worker1# ssh ubuntu@$(sudo lxc-info -n worker -H -i)
..............
ubuntu at worker:/home$ vim results.txt

*the file exists and contains the proper data.*

3) i stopped the container to test the restart:
   root at g-9:/home/ImGLXC1Worker1# lxc-stop -n worker
   root at g-9:/home/ImGLXC1Worker1# lxc-ls -f
NAME     STATE    IPV4  IPV6  GROUPS  AUTOSTART
-----------------------------------------------
worker   STOPPED  -     -     -       NO
worker1  STOPPED  -     -     -       NO
    root at g-9:/home/ImGLXC1Worker1#  *lxc-checkpoint -r* -D
/home/ImGLXC1Worker1 -n worker
    root at g-9:/home/ImGLXC1Worker1# ssh ubuntu@$(sudo lxc-info -n worker -H
-i)
    ^C
   root at g-9:/home/ImGLXC1Worker1#
   root at g-9:/home/ImGLXC1Worker1# lxc-ls -f

^CTraceback (most recent call last):
  File "/usr/bin/lxc-ls", line 432, in <module>
    containers = get_containers(root=True)
  File "/usr/bin/lxc-ls", line 261, in get_containers
    if container.controllable:
KeyboardInterrupt

*it's blocked!! *



*I proceeded as follows and the test process in the container restarts
correctly:Restart* (after dumping process without starting and stopping the
container)

root at g-9:/home# lxc-checkpoint -r -D /home/ImGLXC1Worker -n worker
root at g-9:/home#  lxc-ls -f
NAME     STATE    IPV4        IPV6  GROUPS  AUTOSTART
-----------------------------------------------------
worker   RUNNING  10.0.3.109  -     -       NO
worker1  STOPPED  -           -     -       NO
root at g-9:/home# ssh ubuntu@$(sudo lxc-info -n worker -H -i)
..............
ubuntu at worker:/home$ vim results.txt

i find the old and the new results in the file :)

Bests.
Thouraya.



2015-01-21 18:14 GMT+01:00 Pavel Emelyanov <xemul at parallels.com>:

> On 01/21/2015 07:20 PM, Thouraya TH wrote:
> > Hello :)
> >
> > i have repeated all steps from the begining.
> > The only change I made:
> >
> > *Before the dumping process, *instead of
> >                     root at g-2:~# lxc-start -n worker
> >                     root at g-2:~# *lxc-attach -n worker*
> >
> > i have done:
> >
> >                     root at g-2:~# lxc-start -n worker
> >                     root at g-2:~# *ssh ubuntu@$(sudo lxc-info -n worker
> -H -i)*
> >
> > Dumping Process.
> > Then, after restart, the process "test.sh" restarts well :)
> >
> > ./test.sh > results.txt
>
> Do you do this command manually?
>
> > As you see, the result of test.sh is saved in the file results.txt.
> When, i restart the container, the process test.sh
> > restarts and  the old file is overwritten! i find only the new results
> in the file !
>
> Check the file contents after dump but before restore. Does this file
> exists
> at all? Does it contain proper data?
>
> > Have you an idea please ?
> >
> > Thanks a lot for help.
> > Best Regards.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150122/40ef0c99/attachment-0001.html>


More information about the CRIU mailing list