sync from openeuler 0427
Signed-off-by: fcwicky <307610302@qq.com>
This commit is contained in:
parent
948c20998f
commit
5ccc22a51b
2
lcr.spec
2
lcr.spec
@ -1,5 +1,5 @@
|
||||
%global _version 2.0.0
|
||||
%global _release 20200418.180849.git0944f121
|
||||
%global _release 20200418.180709.gitaabdb4e4
|
||||
Name: lcr
|
||||
Version: %{_version}
|
||||
Release: %{_release}
|
||||
|
||||
37
src/conf.c
37
src/conf.c
@ -182,28 +182,6 @@ static int check_cgroup_dir(const char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_empty_value(const char *value)
|
||||
{
|
||||
if (value == NULL || strlen(value) == 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_console_log_driver(const char *value)
|
||||
{
|
||||
if (value == NULL || strlen(value) == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(value, "syslog") == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(value, "json-file") == 0) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const lcr_annotation_item_t g_require_annotations[] = {
|
||||
{
|
||||
"files.limit",
|
||||
@ -225,21 +203,6 @@ static const lcr_annotation_item_t g_require_annotations[] = {
|
||||
"lxc.console.rotate",
|
||||
check_console_log_filerotate,
|
||||
},
|
||||
{
|
||||
"log.console.driver",
|
||||
"lxc.console.logdriver",
|
||||
check_console_log_driver,
|
||||
},
|
||||
{
|
||||
"log.console.tag",
|
||||
"lxc.console.syslog_tag",
|
||||
check_empty_value,
|
||||
},
|
||||
{
|
||||
"log.console.facility",
|
||||
"lxc.console.syslog_facility",
|
||||
check_empty_value,
|
||||
},
|
||||
{
|
||||
"rootfs.mount",
|
||||
"lxc.rootfs.mount",
|
||||
|
||||
@ -270,22 +270,6 @@ out_free:
|
||||
free(path);
|
||||
}
|
||||
|
||||
bool lcr_create_from_ocidata(const char *name, const char *lcrpath, const void *oci_json_data)
|
||||
{
|
||||
oci_runtime_spec *oci_spec = NULL;
|
||||
bool ret = true;
|
||||
|
||||
if (!container_parse(NULL, oci_json_data, &oci_spec)) {
|
||||
ret = false;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
ret = lcr_create(name, lcrpath, oci_spec);
|
||||
out_free:
|
||||
free_oci_runtime_spec(oci_spec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool lcr_create_spec(struct lxc_container *c, oci_runtime_spec *oci_spec)
|
||||
{
|
||||
// Translate oci config
|
||||
|
||||
@ -140,16 +140,9 @@ void lcr_containers_info_free(struct lcr_container_info **info_arr, size_t size)
|
||||
/*
|
||||
* Create a container
|
||||
* param name : container name
|
||||
* param lcrpath : container path
|
||||
* param oci_json_data : json string of oci config data
|
||||
*/
|
||||
bool lcr_create_from_ocidata(const char *name, const char *lcrpath, const void *oci_json_data);
|
||||
|
||||
/*
|
||||
* Create a container
|
||||
* param name : container name
|
||||
* param lcrpath : container path
|
||||
* param oci_config : pointer of struct oci config
|
||||
* param lcrpath: container path
|
||||
* param rootfs : the path of rootfs used for the container
|
||||
* param oci_config_data : json string of oci config data
|
||||
*/
|
||||
bool lcr_create(const char *name, const char *lcrpath, void *oci_config);
|
||||
|
||||
|
||||
@ -821,7 +821,6 @@ static int lcr_spec_write_config(int fd, const struct lcr_list *lcr_conf)
|
||||
}
|
||||
|
||||
nret = snprintf(line, len, "%s = %s", item->name, item->value);
|
||||
|
||||
if (nret < 0 || (size_t)nret >= len) {
|
||||
ERROR("Sprintf failed");
|
||||
goto cleanup;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user