return true;
}
+static void lxcapi_clear_config(struct lxc_container *c)
+{
+ if (c && c->lxc_conf) {
+ lxc_conf_free(c->lxc_conf);
+ c->lxc_conf = NULL;
+ }
+}
+
static bool lxcapi_destroy(struct lxc_container *c);
/*
* lxcapi_create:
// now clear out the lxc_conf we have, reload from the created
// container
- if (c->lxc_conf)
- lxc_conf_free(c->lxc_conf);
- c->lxc_conf = NULL;
+ lxcapi_clear_config(c);
if (t) {
if (!prepend_lxc_header(c->configfile, tpath, argv)) {
if (ongoing_create(c) == 2) {
ERROR("Error: %s creation was not completed", c->name);
lxcapi_destroy(c);
- lxc_conf_free(c->lxc_conf);
- c->lxc_conf = NULL;
+ lxcapi_clear_config(c);
}
// assign the member functions
c->createl = lxcapi_createl;
c->shutdown = lxcapi_shutdown;
c->reboot = lxcapi_reboot;
+ c->clear_config = lxcapi_clear_config;
c->clear_config_item = lxcapi_clear_config_item;
c->get_config_item = lxcapi_get_config_item;
c->get_cgroup_item = lxcapi_get_cgroup_item;
bool (*reboot)(struct lxc_container *c);
/* send SIGPWR. if timeout is not 0 or -1, do a hard stop after timeout seconds */
bool (*shutdown)(struct lxc_container *c, int timeout);
+ /* completely clear a configuration */
+ void (*clear_config)(struct lxc_container *c);
/* clear all network or capability items in the in-memory configuration */
bool (*clear_config_item)(struct lxc_container *c, const char *key);
/* print a config item to a in-memory string allocated by the caller. Return