Linux Container Development
 help / color / mirror / Atom feed
From: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
To: Sukadev Bhattiprolu
	<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org
Subject: Re: [RFC][PATCH 0/5][lxc]: Link with USERCR
Date: Wed, 24 Mar 2010 21:52:37 +0100	[thread overview]
Message-ID: <4BAA7B95.2070401@fr.ibm.com> (raw)
In-Reply-To: <20100324194744.GC20031-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

Sukadev Bhattiprolu wrote:
> Daniel Lezcano [dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org] wrote:
>> Sukadev Bhattiprolu wrote:
>>> Link lxc_checkpoint, lxc_restart with USERCR[2]
>>>
>>> 3. Checkpoint/restart a simple LXC container
>>>
>>> 	$ lxc-execute --name foo --rcfile lxc-no-netns.conf -- /bin/sleep 1000
>>>
>>> 	$ lxc-freeze --name foo
>>>
>>> 	$ lxc-checkpoint --name foo --image /root/lxc-foo.ckpt
>>>
>>> 	$ lxc-unfreeze --name foo
>> IMO, the freeze / thaw should be done in the lxc_checkpoint function code.
> 
> Well, by separating the freeze and checkpoint, we could do things like
> snapshot the filesystem or would lxc_checkpoint make an external call
> to do that ?
> 
> I will leave it as is for my next version and I am guessing it can be done
> easily later ?
>>> 	$ lxc-stop --name foo
>>>
>>> 	$ lxc-restart --name foo --image /root/lxc-foo.ckpt
>> Is the container restarted in a frozen state ?
> 
> It can be (by setting the restart_args->freezer). I will leave it in
> frozen for now. Maybe later we can add a command line option to let
> user choose whether or not to leave it frozen

The lxc_checkpoint / lxc_restart API have already the --pause option 
defined.

If you don't specify the --pause option, the checkpoint and the restart 
release the application right after finishing their job.

There is also the --kill option for the checkpoint, to kill the 
container after the checkpoint.

The lxc_checkpoint function should do:

    freeze();

    checkpoint();

    if (kill) {
        stop();
        unfreeze();
        return;
    }

    if (!pause)
        unfreeze();

    return;

The same for the restart except for the 'kill'.

The functions are already defined in lxc, it takes 5 mins to write this 
code.

Defined in lxc.h :
extern int lxc_stop(const char *name);
extern int lxc_freeze(const char *name);
extern int lxc_unfreeze(const char *name);

The lxc_checkpoint / lxc_restart functions have a 'flags' parameter with 
LXC_FLAG_PAUSE or LXC_FLAG_HALT (if set in the command line).

      parent reply	other threads:[~2010-03-24 20:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19  6:39 [RFC][PATCH 0/5][lxc]: Link with USERCR Sukadev Bhattiprolu
     [not found] ` <20100319063912.GA25732-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-19  6:40   ` [PATCH 1/5][lxc] Enable static linking of some lxc binaries Sukadev Bhattiprolu
     [not found]     ` <20100319064024.GB25732-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-22 14:44       ` Daniel Lezcano
2010-03-19  6:40   ` [PATCH 2/5][lxc] lxc_restart: Add --image option Sukadev Bhattiprolu
     [not found]     ` <20100319064046.GC25732-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-22 14:45       ` Daniel Lezcano
     [not found]         ` <4BA78276.2040308-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2010-03-24 19:48           ` Sukadev Bhattiprolu
     [not found]             ` <20100324194851.GD20031-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-24 20:53               ` Daniel Lezcano
2010-03-19  6:41   ` [PATCH 3/5][lxc] lxc_checkpoint: " Sukadev Bhattiprolu
2010-03-19  6:41   ` [PATCH 4/5][lxc] Hook up lxc_restart() with app_restart() Sukadev Bhattiprolu
     [not found]     ` <20100319064121.GE25732-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-22 14:48       ` Daniel Lezcano
2010-03-19  6:41   ` [PATCH 5/5][lxc] Hook up lxc_checkpoint() with app_checkpoint() Sukadev Bhattiprolu
     [not found]     ` <20100319064141.GF25732-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-22 14:44       ` Daniel Lezcano
     [not found]         ` <4BA78262.6050109-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2010-03-24 19:35           ` Sukadev Bhattiprolu
     [not found]             ` <20100324193537.GB20031-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-24 20:51               ` Daniel Lezcano
2010-03-19 10:44   ` [RFC][PATCH 0/5][lxc]: Link with USERCR Michel Normand
2010-03-24 19:22     ` Sukadev Bhattiprolu
2010-03-22 14:45   ` Daniel Lezcano
     [not found]     ` <4BA7826D.10706-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2010-03-24 19:27       ` Oren Laadan
2010-03-24 19:47       ` Sukadev Bhattiprolu
     [not found]         ` <20100324194744.GC20031-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-24 20:52           ` Daniel Lezcano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BAA7B95.2070401@fr.ibm.com \
    --to=dlezcano-nmtc/0zbporqt0dzr+alfa@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox