[libvirt] [PATCH RFC 0/5] lxc: Add save/restore support to lxc driver

Katerina Koukiou k.koukiou at googlemail.com
Thu Jul 21 15:37:22 UTC 2016


This patch series adds support for saving an running lxc domain's state into
files with lxcDomainSave and restore afterwards from files with lxcDomainRestore.
Usage: virsh save [domain-name] [domain-id or domain-uuid] [directory name]
I use CRIU tool (https://criu.org/Main_Page), that offers checkpoint/restore
functionality for containers in userspace.
For the time, I have tried successfully the C/R procedure for simple sh containers
and OS containers.
I'll mention some notes/issues here:
*I have working C/R only for non systemd hosts (on systemd host I was facing
problems with CRIU).
*I have not done anything for container networking. Thats should be done with
 --veth-pair IN=OUT option in CRIU.
*In new distros, where efivars mountpoint exists, CRIU dump fails.
*The only tty restored is /dev/tty1. I'll fix this in another patch, to allow more ttys.
*Currently for things to work, I have slightly modified criu source. That is in criu master
I have the following diff:

diff --git a/criu/tty.c b/criu/tty.c
index 302dd54..2226484 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1394,8 +1394,10 @@ static int verify_info(struct tty_info *info)
         */
        if (term_opts_missing_any(info)) {
                if (tty_is_master(info)) {
+                       /*
                        pr_err("Corrupted master peer %x\n", info->tfe->id);
                        return -1;
+                       */
                } else if (!term_opts_missing_all(info)) {
                        pr_err("Corrupted slave peer %x\n", info->tfe->id);
                        return -1;

Lastly, I have ready a patch that adds support for migration but I wait for
feedback on this series, and I'll send the migration one later.
Anyway, any comments here are more than welcome.

ps: That is a work in terms of my GSoC 2016 project.

Katerina Koukiou (5):
  Include criu support in autotools
  lxc: make container's init process session leader
  lxc: adds checkpoint and restore helper functions
  lxc: adjusted libvirt-lxc process to add restore mode to it.
  lxc: adds save and restore support

 configure.ac             |   8 ++
 po/POTFILES.in           |   1 +
 src/Makefile.am          |   6 +-
 src/lxc/lxc_container.c  | 208 ++++++++++++++++++++++++++++++++++--
 src/lxc/lxc_container.h  |   3 +-
 src/lxc/lxc_controller.c | 109 +++++++++++++++++--
 src/lxc/lxc_criu.c       | 273 +++++++++++++++++++++++++++++++++++++++++++++++
 src/lxc/lxc_criu.h       |  34 ++++++
 src/lxc/lxc_driver.c     | 238 ++++++++++++++++++++++++++++++++++++++++-
 src/lxc/lxc_process.c    |  23 +++-
 src/lxc/lxc_process.h    |   1 +
 11 files changed, 883 insertions(+), 21 deletions(-)
 create mode 100644 src/lxc/lxc_criu.c
 create mode 100644 src/lxc/lxc_criu.h

-- 
2.7.3




More information about the libvir-list mailing list