snapshot.c revision f2363e38d07db2ad4796b5580b95e3665ed34a88
/* liblxcapi
*
* Copyright © 2013 Serge Hallyn <serge.hallyn@ubuntu.com>.
* Copyright © 2013 Canonical Ltd.
*
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <lxc/lxccontainer.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MYNAME "snapxxx1"
#define RESTNAME "snapxxx2"
void try_to_remove()
{
struct lxc_container *c;
char snappath[1024];
if (c) {
if (c->is_defined(c))
c->destroy(c);
}
if (c) {
if (c->is_defined(c))
c->destroy(c);
}
if (c) {
if (c->is_defined(c))
c->destroy(c);
}
}
{
struct lxc_container *c;
char *template = "busybox";
if (argc > 1)
if (!c) {
exit(1);
}
if (c->is_defined(c)) {
(void) c->destroy(c);
}
goto err;
}
c->save_config(c, NULL);
goto err;
}
c->load_config(c, NULL);
goto err;
}
int ret;
char path[1024];
if (ret != 0) {
goto err;
}
struct lxc_snapshot *s;
int i, n;
n = c->snapshot_list(c, &s);
if (n < 1) {
goto err;
}
goto err;
}
for (i=0; i<n; i++) {
s[i].free(&s[i]);
}
free(s);
goto err;
}
if (!c->snapshot_destroy(c, "snap0")) {
goto err;
}
if (!c->destroy(c)) {
goto err;
}
printf("All tests passed\n");
exit(0);
err:
exit(1);
}