[lxc-devel] [PATCH 2/1] snapshot test: make sure that external snapshot was really created

Serge Hallyn serge.hallyn at ubuntu.com
Mon Jun 2 13:53:16 UTC 2014


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Serge, I believe you can ignore this problem for now. Looks like it is
> not an issue if you do a fresh compilation. To reproduce, you need to
> start with compiling master (and then installing it on to your system)
> and then applying your patch on top of that and do a make followed by
> make install.
> 
> My tests started to pass again expect one where I restore a snapshot
> as a new container. I'll debug more to see whether it's related with
> LXC or Go bindings cause as long as I see lxc-snapshot command works
> fine for that case.

The following tiny patch tests to make sure that external snapshots
are in fact creating a container (not just blindly returning
success)

>From efe44c7d20be4962337150e82fb96e87fe6d6685 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Mon, 2 Jun 2014 08:50:35 -0500
Subject: [PATCH 2/1] snapshot test: make sure that external snapshot was
 really created

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/tests/snapshot.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/tests/snapshot.c b/src/tests/snapshot.c
index 21acd3e..b035096 100644
--- a/src/tests/snapshot.c
+++ b/src/tests/snapshot.c
@@ -126,6 +126,12 @@ int main(int argc, char *argv[])
 		goto err;
 	}
 
+	c2 = lxc_container_new(RESTNAME, NULL);
+	if (!c2 || !c2->is_defined(c2)) {
+		fprintf(stderr, "%s: %d: external snapshot restore failed\n", __FILE__, __LINE__);
+		goto err;
+	}
+	lxc_container_put(c2);
 
 	c2 = c->clone(c, MYNAME2, NULL, LXC_CLONE_SNAPSHOT, "overlayfs", NULL, 0, NULL);
 	if (!c2) {
-- 
2.0.0



More information about the lxc-devel mailing list