[Devel] Re: [RFC][PATCH 0/5][lxc]: Link with USERCR

Daniel Lezcano dlezcano at fr.ibm.com
Wed Mar 24 13:52:37 PDT 2010


Sukadev Bhattiprolu wrote:
> Daniel Lezcano [dlezcano at fr.ibm.com] 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).


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list