diff --git a/0001-lcr-remove-NOTIFY_SOCKET-env-when-do-fork.patch b/0001-lcr-remove-NOTIFY_SOCKET-env-when-do-fork.patch new file mode 100644 index 0000000000000000000000000000000000000000..b58aead0ed47acc350da83e3e6e8784b0dbd93c4 --- /dev/null +++ b/0001-lcr-remove-NOTIFY_SOCKET-env-when-do-fork.patch @@ -0,0 +1,70 @@ +From 3f79044279c2379eb73939522b9933f64fd65e89 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Thu, 13 Aug 2020 14:16:03 +0800 +Subject: [PATCH 01/10] lcr: remove NOTIFY_SOCKET env when do fork + +Signed-off-by: lifeng68 +--- + src/lcrcontainer.c | 3 ++- + src/lcrcontainer_execute.c | 3 ++- + tests/fuzz/log_fuzz.cc | 2 +- + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/lcrcontainer.c b/src/lcrcontainer.c +index 547830a..ed9a4f7 100644 +--- a/src/lcrcontainer.c ++++ b/src/lcrcontainer.c +@@ -430,7 +430,7 @@ bool lcr_start(const struct lcr_start_request *request) + } + + pid = fork(); +- if (pid == (pid_t) - 1) { ++ if (pid == (pid_t) -1) { + ERROR("Failed to fork()\n"); + close(pipefd[0]); + close(pipefd[1]); +@@ -438,6 +438,7 @@ bool lcr_start(const struct lcr_start_request *request) + } + + if (pid == (pid_t)0) { ++ (void)unsetenv("NOTIFY_SOCKET"); + // child process, dup2 pipefd[1] to stderr + close(pipefd[0]); + dup2(pipefd[1], 2); +diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c +index 1486d2a..3a9e2de 100644 +--- a/src/lcrcontainer_execute.c ++++ b/src/lcrcontainer_execute.c +@@ -665,7 +665,7 @@ bool do_attach(const char *name, const char *path, const struct lcr_exec_request + } + + pid = fork(); +- if (pid == (pid_t) - 1) { ++ if (pid == (pid_t) -1) { + ERROR("Failed to fork()\n"); + close(pipefd[0]); + close(pipefd[1]); +@@ -673,6 +673,7 @@ bool do_attach(const char *name, const char *path, const struct lcr_exec_request + } + + if (pid == (pid_t)0) { ++ (void)unsetenv("NOTIFY_SOCKET"); + if (lcr_util_null_stdfds() < 0) { + COMMAND_ERROR("Failed to close fds"); + exit(EXIT_FAILURE); +diff --git a/tests/fuzz/log_fuzz.cc b/tests/fuzz/log_fuzz.cc +index 9dc02bb..a8f80d4 100644 +--- a/tests/fuzz/log_fuzz.cc ++++ b/tests/fuzz/log_fuzz.cc +@@ -46,7 +46,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) + std::vector ret_vec; + std::string tmpstr; + std::istringstream istr(testData); +- while(std::getline(istr, tmpstr, ',')) { ++ while (std::getline(istr, tmpstr, ',')) { + ret_vec.push_back(tmpstr); + } + +-- +2.20.1 + diff --git a/0002-blk-add-blkiops-define.patch b/0002-blk-add-blkiops-define.patch new file mode 100644 index 0000000000000000000000000000000000000000..83ab2da78f539cde71353932fa21ca3b43a0e670 --- /dev/null +++ b/0002-blk-add-blkiops-define.patch @@ -0,0 +1,597 @@ +From 0f31b6d8ff4019e1158fb1a0c63456db67be63e5 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Fri, 4 Sep 2020 15:55:21 +0800 +Subject: [PATCH 02/10] blk: add blkiops define + +Signed-off-by: lifeng68 +--- + src/json/schema/defs.json | 424 ++++++++++++++++--------------- + src/json/schema/host-config.json | 49 +--- + 2 files changed, 237 insertions(+), 236 deletions(-) + +diff --git a/src/json/schema/defs.json b/src/json/schema/defs.json +index a69b15e..9512caa 100644 +--- a/src/json/schema/defs.json ++++ b/src/json/schema/defs.json +@@ -42,8 +42,7 @@ + "maximum": 18446744073709552000 + }, + "int32Pointer": { +- "oneOf": [ +- { ++ "oneOf": [{ + "$ref": "#/definitions/int32" + }, + { +@@ -52,8 +51,7 @@ + ] + }, + "uint16Pointer": { +- "oneOf": [ +- { ++ "oneOf": [{ + "$ref": "#/definitions/uint16" + }, + { +@@ -62,8 +60,7 @@ + ] + }, + "uint64Pointer": { +- "oneOf": [ +- { ++ "oneOf": [{ + "$ref": "#/definitions/uint64" + }, + { +@@ -72,8 +69,7 @@ + ] + }, + "stringPointer": { +- "oneOf": [ +- { ++ "oneOf": [{ + "type": "string" + }, + { +@@ -104,6 +100,40 @@ + "Env": { + "$ref": "#/definitions/ArrayOfStrings" + }, ++ "BlkioDevice": { ++ "type": "object", ++ "properties": { ++ "Path": { ++ "$ref": "#/definitions/FilePath" ++ }, ++ "Rate": { ++ "$ref": "#/definitions/uint64" ++ } ++ } ++ }, ++ "ArrayOfBlkioDevice": { ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/BlkioDevice" ++ } ++ }, ++ "BlkioWeightDevice": { ++ "type": "object", ++ "properties": { ++ "Path": { ++ "$ref": "#/definitions/FilePath" ++ }, ++ "Weight": { ++ "$ref": "#/definitions/uint16" ++ } ++ } ++ }, ++ "ArrayOfBlkioWeightDevice": { ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/BlkioWeightDevice" ++ } ++ }, + "Hook": { + "type": "object", + "properties": { +@@ -250,9 +280,9 @@ + "type": "string" + }, + "runtime-args": { +- "type":"array", ++ "type": "array", + "items": { +- "type":"string" ++ "type": "string" + } + } + } +@@ -273,8 +303,8 @@ + } + }, + "digest": { +- "type": "string", +- "pattern": "^[a-z0-9]+(?:[+._-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$" ++ "type": "string", ++ "pattern": "^[a-z0-9]+(?:[+._-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$" + }, + "ociVersion": { + "description": "The version of Open Container Runtime Specification that the document complies with", +@@ -340,7 +370,7 @@ + } + } + }, +- "filters": { ++ "filters": { + "type": "object", + "patternProperties": { + ".{1,}": { +@@ -366,7 +396,7 @@ + "type": "object", + "properties": { + "name": { +- "type":"string" ++ "type": "string" + }, + "offset": { + "$ref": "#/definitions/uint8" +@@ -607,8 +637,7 @@ + }, + "blockIODeviceWeight": { + "type": "object", +- "allOf": [ +- { ++ "allOf": [{ + "$ref": "#/definitions/blockIODevice" + }, + { +@@ -625,8 +654,7 @@ + ] + }, + "blockIODeviceThrottle": { +- "allOf": [ +- { ++ "allOf": [{ + "$ref": "#/definitions/blockIODevice" + }, + { +@@ -865,184 +893,184 @@ + } + } + }, +- "resources": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources", +- "type": "object", +- "properties": { +- "devices": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/devices", +- "type": "array", +- "items": { +- "$ref": "#/definitions/DeviceCgroup" +- } +- }, +- "pids": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/pids", +- "type": "object", +- "properties": { +- "limit": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/pids/limit", +- "$ref": "#/definitions/int64" +- } +- }, +- "required": [ +- "limit" +- ] +- }, +- "blockIO": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO", +- "type": "object", +- "properties": { +- "weight": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/weight", +- "$ref": "#/definitions/weight" +- }, +- "leafWeight": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/leafWeight", +- "$ref": "#/definitions/weight" +- }, +- "throttleReadBpsDevice": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleReadBpsDevice", +- "type": "array", +- "items": { +- "$ref": "#/definitions/blockIODeviceThrottle" +- } +- }, +- "throttleWriteBpsDevice": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleWriteBpsDevice", +- "type": "array", +- "items": { +- "$ref": "#/definitions/blockIODeviceThrottle" +- } +- }, +- "throttleReadIOPSDevice": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleReadIOPSDevice", +- "type": "array", +- "items": { +- "$ref": "#/definitions/blockIODeviceThrottle" +- } +- }, +- "throttleWriteIOPSDevice": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleWriteIOPSDevice", +- "type": "array", +- "items": { +- "$ref": "#/definitions/blockIODeviceThrottle" +- } +- }, +- "weightDevice": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/weightDevice", +- "type": "array", +- "items": { +- "$ref": "#/definitions/blockIODeviceWeight" +- } +- } +- } +- }, +- "cpu": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu", +- "type": "object", +- "properties": { +- "cpus": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/cpus", +- "type": "string" +- }, +- "mems": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/mems", +- "type": "string" +- }, +- "period": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/period", +- "$ref": "#/definitions/uint64" +- }, +- "quota": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota", +- "$ref": "#/definitions/int64" +- }, +- "realtimePeriod": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod", +- "$ref": "#/definitions/uint64" +- }, +- "realtimeRuntime": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime", +- "$ref": "#/definitions/int64" +- }, +- "shares": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares", +- "$ref": "#/definitions/uint64" +- } +- } +- }, +- "hugepageLimits": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits", +- "type": "array", +- "items": { +- "type": "object", +- "properties": { +- "pageSize": { +- "type": "string" +- }, +- "limit": { +- "$ref": "#/definitions/uint64" +- } +- }, +- "required": [ +- "pageSize", +- "limit" +- ] +- } +- }, +- "memory": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory", +- "type": "object", +- "properties": { +- "kernel": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel", +- "$ref": "#/definitions/int64" +- }, +- "kernelTCP": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernelTCP", +- "$ref": "#/definitions/int64" +- }, +- "limit": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit", +- "$ref": "#/definitions/int64" +- }, +- "reservation": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation", +- "$ref": "#/definitions/int64" +- }, +- "swap": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap", +- "$ref": "#/definitions/int64" +- }, +- "swappiness": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness", +- "$ref": "#/definitions/uint64" +- }, +- "disableOOMKiller": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/disableOOMKiller", +- "type": "boolean" +- } +- } +- }, +- "network": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/network", +- "type": "object", +- "properties": { +- "classID": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/network/classId", +- "$ref": "#/definitions/uint32" +- }, +- "priorities": { +- "id": "https://opencontainers.org/schema/bundle/linux/resources/network/priorities", +- "type": "array", +- "items": { +- "$ref": "#/definitions/NetworkInterfacePriority" +- } +- } +- } +- } +- } +- } ++ "resources": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources", ++ "type": "object", ++ "properties": { ++ "devices": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/devices", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/DeviceCgroup" ++ } ++ }, ++ "pids": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/pids", ++ "type": "object", ++ "properties": { ++ "limit": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/pids/limit", ++ "$ref": "#/definitions/int64" ++ } ++ }, ++ "required": [ ++ "limit" ++ ] ++ }, ++ "blockIO": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO", ++ "type": "object", ++ "properties": { ++ "weight": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/weight", ++ "$ref": "#/definitions/weight" ++ }, ++ "leafWeight": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/leafWeight", ++ "$ref": "#/definitions/weight" ++ }, ++ "throttleReadBpsDevice": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleReadBpsDevice", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/blockIODeviceThrottle" ++ } ++ }, ++ "throttleWriteBpsDevice": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleWriteBpsDevice", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/blockIODeviceThrottle" ++ } ++ }, ++ "throttleReadIOPSDevice": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleReadIOPSDevice", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/blockIODeviceThrottle" ++ } ++ }, ++ "throttleWriteIOPSDevice": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/throttleWriteIOPSDevice", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/blockIODeviceThrottle" ++ } ++ }, ++ "weightDevice": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/weightDevice", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/blockIODeviceWeight" ++ } ++ } ++ } ++ }, ++ "cpu": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu", ++ "type": "object", ++ "properties": { ++ "cpus": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/cpus", ++ "type": "string" ++ }, ++ "mems": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/mems", ++ "type": "string" ++ }, ++ "period": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/period", ++ "$ref": "#/definitions/uint64" ++ }, ++ "quota": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota", ++ "$ref": "#/definitions/int64" ++ }, ++ "realtimePeriod": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod", ++ "$ref": "#/definitions/uint64" ++ }, ++ "realtimeRuntime": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime", ++ "$ref": "#/definitions/int64" ++ }, ++ "shares": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares", ++ "$ref": "#/definitions/uint64" ++ } ++ } ++ }, ++ "hugepageLimits": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits", ++ "type": "array", ++ "items": { ++ "type": "object", ++ "properties": { ++ "pageSize": { ++ "type": "string" ++ }, ++ "limit": { ++ "$ref": "#/definitions/uint64" ++ } ++ }, ++ "required": [ ++ "pageSize", ++ "limit" ++ ] ++ } ++ }, ++ "memory": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory", ++ "type": "object", ++ "properties": { ++ "kernel": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel", ++ "$ref": "#/definitions/int64" ++ }, ++ "kernelTCP": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernelTCP", ++ "$ref": "#/definitions/int64" ++ }, ++ "limit": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit", ++ "$ref": "#/definitions/int64" ++ }, ++ "reservation": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation", ++ "$ref": "#/definitions/int64" ++ }, ++ "swap": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap", ++ "$ref": "#/definitions/int64" ++ }, ++ "swappiness": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness", ++ "$ref": "#/definitions/uint64" ++ }, ++ "disableOOMKiller": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/memory/disableOOMKiller", ++ "type": "boolean" ++ } ++ } ++ }, ++ "network": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/network", ++ "type": "object", ++ "properties": { ++ "classID": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/network/classId", ++ "$ref": "#/definitions/uint32" ++ }, ++ "priorities": { ++ "id": "https://opencontainers.org/schema/bundle/linux/resources/network/priorities", ++ "type": "array", ++ "items": { ++ "$ref": "#/definitions/NetworkInterfacePriority" ++ } ++ } ++ } ++ } ++ } ++ } + } +-} ++} +\ No newline at end of file +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index 725c1e7..b3fca51 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -53,8 +53,8 @@ + "Sysctls": { + "$ref": "defs.json#/definitions/mapStringString" + }, +- "Runtime":{ +- "type":"string" ++ "Runtime": { ++ "type": "string" + }, + "RestartPolicy": { + "type": "object", +@@ -119,46 +119,19 @@ + "type": "uint16" + }, + "BlkioWeightDevice": { +- "type": "array", +- "items": { +- "type": "object", +- "properties": { +- "Path": { +- "type": "string" +- }, +- "Weight": { +- "type": "uint16" +- } +- } +- } ++ "$ref": "defs.json#/definitions/ArrayOfBlkioWeightDevice" + }, + "BlkioDeviceReadBps": { +- "type": "array", +- "items": { +- "type": "object", +- "properties": { +- "Path": { +- "type": "string" +- }, +- "Rate": { +- "type": "uint64" +- } +- } +- } ++ "$ref": "defs.json#/definitions/ArrayOfBlkioDevice" + }, + "BlkioDeviceWriteBps": { +- "type": "array", +- "items": { +- "type": "object", +- "properties": { +- "Path": { +- "type": "string" +- }, +- "Rate": { +- "type": "uint64" +- } +- } +- } ++ "$ref": "defs.json#/definitions/ArrayOfBlkioDevice" ++ }, ++ "BlkioDeviceReadIops": { ++ "$ref": "defs.json#/definitions/ArrayOfBlkioDevice" ++ }, ++ "BlkioDeviceWriteIops": { ++ "$ref": "defs.json#/definitions/ArrayOfBlkioDevice" + }, + "CPUPeriod": { + "type": "int64" +-- +2.20.1 + diff --git a/0003-update-add-support-update-cpu-rt.patch b/0003-update-add-support-update-cpu-rt.patch new file mode 100644 index 0000000000000000000000000000000000000000..db41f301ea7793b5062393d691f02ab705daef2b --- /dev/null +++ b/0003-update-add-support-update-cpu-rt.patch @@ -0,0 +1,493 @@ +From a06d44ffb5c6acc492b73bfbb307a6af390ba23f Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Tue, 8 Sep 2020 18:46:41 +0800 +Subject: [PATCH 03/10] update: add support update cpu rt + +Signed-off-by: lifeng68 +--- + src/lcrcontainer.h | 169 +++++++++++++++++++------------------ + src/lcrcontainer_execute.c | 88 +++++++++++++++---- + 2 files changed, 157 insertions(+), 100 deletions(-) + +diff --git a/src/lcrcontainer.h b/src/lcrcontainer.h +index 9b41fd9..68014ba 100644 +--- a/src/lcrcontainer.h ++++ b/src/lcrcontainer.h +@@ -38,7 +38,6 @@ + extern "C" { + #endif + +- + /* define console log config */ + + struct lcr_console_config { +@@ -48,8 +47,8 @@ struct lcr_console_config { + }; + + /* +- * Store lcr container info +- */ ++* Store lcr container info ++*/ + struct lcr_container_info { + /* Name of container. */ + char *name; +@@ -72,8 +71,8 @@ struct blkio_stats { + }; + + /* +- * Store lcr container state +- */ ++* Store lcr container state ++*/ + struct lcr_container_state { + /* Name of container */ + char *name; +@@ -125,66 +124,68 @@ struct lcr_cgroup_resources { + uint64_t memory_swap; + uint64_t memory_reservation; + uint64_t kernel_memory_limit; ++ int64_t cpurt_period; ++ int64_t cpurt_runtime; + }; + + /* +- * Get one container info for a given lcrpath. +- * return struct of container info, or NULL on error. +- */ ++* Get one container info for a given lcrpath. ++* return struct of container info, or NULL on error. ++*/ + struct lcr_container_info *lcr_container_info_get(const char *name, const char *lcrpath); + + /* +- * Free lcr_container_info returned lcr_container_info_get +- */ ++* Free lcr_container_info returned lcr_container_info_get ++*/ + void lcr_container_info_free(struct lcr_container_info *info); + + /* +- * Get a complete list of all containers for a given lcrpath. +- * return Number of containers, or -1 on error. +- */ ++* Get a complete list of all containers for a given lcrpath. ++* return Number of containers, or -1 on error. ++*/ + int lcr_list_all_containers(const char *lcrpath, struct lcr_container_info **info_arr); + + /* +- * Free lcr_container_info array returned by lcr_list_{active,all}_containers +- */ ++* Free lcr_container_info array returned by lcr_list_{active,all}_containers ++*/ + 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 +- */ ++* 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 +- */ ++* Create a container ++* param name : container name ++* param lcrpath : container path ++* param oci_config : pointer of struct oci config ++*/ + bool lcr_create(const char *name, const char *lcrpath, void *oci_config); + + /* +- * Start a container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param logpath : log file path. +- * param loglevel : log level. +- * param pidfile : container pidfile path, set to NULL if you don't need. +- * param daemonize : daemonize the container. +- * console_fifos[] : path of the console fifos,[0]:input, [1]:output.used internal by iSulad +- * console_logpath :path of console log file, +- * set to NULL if want to use the default configure(base on the config file) +- set to PATH(for example "/home/XX/XX.log"), LXC will save the console to this file +- * share_ns : array of container's name or pid which want to share namespace with them +- * start_timeout : seconds for waiting on a container to start before it is killed +- * container_pidfile : container's pidfile +- * param argv : array of arguments to pass to init. +- * uid : user to run container +- * gid : user in which group +- * additional_gids : Add additional groups to join +- */ ++* Start a container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param logpath : log file path. ++* param loglevel : log level. ++* param pidfile : container pidfile path, set to NULL if you don't need. ++* param daemonize : daemonize the container. ++* console_fifos[] : path of the console fifos,[0]:input, [1]:output.used internal by iSulad ++* console_logpath :path of console log file, ++* set to NULL if want to use the default configure(base on the config file) ++ set to PATH(for example "/home/XX/XX.log"), LXC will save the console to this file ++* share_ns : array of container's name or pid which want to share namespace with them ++* start_timeout : seconds for waiting on a container to start before it is killed ++* container_pidfile : container's pidfile ++* param argv : array of arguments to pass to init. ++* uid : user to run container ++* gid : user in which group ++* additional_gids : Add additional groups to join ++*/ + struct lcr_start_request { + const char *name; + const char *lcrpath; +@@ -203,73 +204,73 @@ struct lcr_start_request { + bool lcr_start(const struct lcr_start_request *request); + + /* +- * Stop a container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param signal : signal to send to the container. +- */ ++* Stop a container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param signal : signal to send to the container. ++*/ + bool lcr_kill(const char *name, const char *lcrpath, uint32_t signal); + + /* +- * Delete a container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param force : force to delete container +- */ ++* Delete a container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param force : force to delete container ++*/ + bool lcr_delete(const char *name, const char *lcrpath); + + bool lcr_clean(const char *name, const char *lcrpath, const char *logpath, const char *loglevel, pid_t pid); + + /* +- * Get state of the container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param lcs : returned contaiener state +- */ ++* Get state of the container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param lcs : returned contaiener state ++*/ + bool lcr_state(const char *name, const char *lcrpath, struct lcr_container_state *lcs); + + /* +- * Pause a container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- */ ++* Pause a container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++*/ + bool lcr_pause(const char *name, const char *lcrpath); + + /* +- * Resume a container +- * param name : container name, required. +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- */ ++* Resume a container ++* param name : container name, required. ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++*/ + bool lcr_resume(const char *name, const char *lcrpath); + + /* +- * Free lcr_container_state returned by lcr_state +- */ ++* Free lcr_container_state returned by lcr_state ++*/ + void lcr_container_state_free(struct lcr_container_state *lcs); + + /* +- * console function +- * param name : name of container +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param in_fifo : fifo names of input FIFO +- * param out_fifo : fifo names of output FIFO +- * Returns false if the console FIFOs add failed, true if success +- */ ++* console function ++* param name : name of container ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param in_fifo : fifo names of input FIFO ++* param out_fifo : fifo names of output FIFO ++* Returns false if the console FIFOs add failed, true if success ++*/ + bool lcr_console(const char *name, const char *lcrpath, const char *in_fifo, const char *out_fifo, + const char *err_fifo); + + /* +- * get container console configs +- * param name : name of container +- * param lcrpath : container path, set to NULL if you want use default lcrpath. +- * param config : use to store container console configs, cannot be NULL +- */ ++* get container console configs ++* param name : name of container ++* param lcrpath : container path, set to NULL if you want use default lcrpath. ++* param config : use to store container console configs, cannot be NULL ++*/ + bool lcr_get_console_config(const char *name, const char *lcrpath, struct lcr_console_config *config); + + void lcr_free_console_config(struct lcr_console_config *config); + + int lcr_log_init(const char *name, const char *file, const char *priority, +- const char *prefix, int quiet, const char *lcrpath); ++ const char *prefix, int quiet, const char *lcrpath); + + struct lcr_exec_request { + const char *name; +@@ -295,8 +296,8 @@ struct lcr_exec_request { + bool open_stdin; + }; + /* +- * Execute process inside a container +- */ ++* Execute process inside a container ++*/ + bool lcr_exec(const struct lcr_exec_request *request, int *exit_code); + + bool lcr_update(const char *name, const char *lcrpath, const struct lcr_cgroup_resources *cr); +diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c +index 3a9e2de..a2a4bed 100644 +--- a/src/lcrcontainer_execute.c ++++ b/src/lcrcontainer_execute.c +@@ -46,6 +46,8 @@ + #define CGROUP_CPU_SHARES "cpu.shares" + #define CGROUP_CPU_PERIOD "cpu.cfs_period_us" + #define CGROUP_CPU_QUOTA "cpu.cfs_quota_us" ++#define CGROUP_CPU_RT_PERIOD "cpu.rt_period_us" ++#define CGROUP_CPU_RT_RUNTIME "cpu.rt_runtime_us" + #define CGROUP_CPUSET_CPUS "cpuset.cpus" + #define CGROUP_CPUSET_MEMS "cpuset.mems" + #define CGROUP_MEMORY_LIMIT "memory.limit_in_bytes" +@@ -53,7 +55,8 @@ + #define CGROUP_MEMORY_RESERVATION "memory.soft_limit_in_bytes" + + #define REPORT_SET_CGROUP_ERROR(item, value) \ +- do { \ ++ do \ ++ { \ + SYSERROR("Error updating cgroup %s to %s", (item), (value)); \ + lcr_set_error_message(LCR_ERR_RUNTIME, "Error updating cgroup %s to %s: %s", (item), (value), \ + strerror(errno)); \ +@@ -79,7 +82,7 @@ static inline void add_array_kv(char **array, size_t total, size_t *pos, const c + + static uint64_t stat_get_ull(struct lxc_container *c, const char *item) + { +- char buf[80] = { 0 }; ++ char buf[80] = {0}; + int len = 0; + uint64_t val = 0; + +@@ -126,7 +129,7 @@ err_out: + static int update_resources_cpu_shares(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->cpu_shares != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->cpu_shares)); +@@ -149,7 +152,7 @@ out: + static int update_resources_cpu_period(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->cpu_period != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->cpu_period)); +@@ -169,10 +172,56 @@ out: + return ret; + } + ++static int update_resources_cpu_rt_period(struct lxc_container *c, const struct lcr_cgroup_resources *cr) ++{ ++ int ret = 0; ++ char numstr[LCR_NUMSTRLEN64] = {0}; /* max buffer */ ++ ++ if (cr->cpurt_period != 0) { ++ int num = snprintf(numstr, sizeof(numstr), "%lld", (long long)(cr->cpurt_period)); ++ if (num < 0 || (size_t)num >= sizeof(numstr)) { ++ ret = -1; ++ goto out; ++ } ++ ++ if (!c->set_cgroup_item(c, CGROUP_CPU_RT_PERIOD, numstr)) { ++ REPORT_SET_CGROUP_ERROR(CGROUP_CPU_RT_PERIOD, numstr); ++ ret = -1; ++ goto out; ++ } ++ } ++ ++out: ++ return ret; ++} ++ ++static int update_resources_cpu_rt_runtime(struct lxc_container *c, const struct lcr_cgroup_resources *cr) ++{ ++ int ret = 0; ++ char numstr[LCR_NUMSTRLEN64] = {0}; /* max buffer */ ++ ++ if (cr->cpurt_runtime != 0) { ++ int num = snprintf(numstr, sizeof(numstr), "%lld", (long long)(cr->cpurt_runtime)); ++ if (num < 0 || (size_t)num >= sizeof(numstr)) { ++ ret = -1; ++ goto out; ++ } ++ ++ if (!c->set_cgroup_item(c, CGROUP_CPU_RT_RUNTIME, numstr)) { ++ REPORT_SET_CGROUP_ERROR(CGROUP_CPU_RT_RUNTIME, numstr); ++ ret = -1; ++ goto out; ++ } ++ } ++ ++out: ++ return ret; ++} ++ + static int update_resources_cpu_quota(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->cpu_quota != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->cpu_quota)); +@@ -216,6 +265,13 @@ static bool update_resources_cpu(struct lxc_container *c, const struct lcr_cgrou + goto err_out; + } + ++ if (update_resources_cpu_rt_period(c, cr) != 0) { ++ goto err_out; ++ } ++ if (update_resources_cpu_rt_runtime(c, cr) != 0) { ++ goto err_out; ++ } ++ + ret = true; + err_out: + return ret; +@@ -224,7 +280,7 @@ err_out: + static int update_resources_memory_limit(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->memory_limit != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->memory_limit)); +@@ -247,7 +303,7 @@ out: + static int update_resources_memory_swap(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->memory_swap != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->memory_swap)); +@@ -270,7 +326,7 @@ out: + static int update_resources_memory_reservation(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->memory_reservation != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->memory_reservation)); +@@ -337,7 +393,7 @@ err_out: + static int update_resources_blkio_weight(struct lxc_container *c, const struct lcr_cgroup_resources *cr) + { + int ret = 0; +- char numstr[128] = { 0 }; /* max buffer */ ++ char numstr[128] = {0}; /* max buffer */ + + if (cr->blkio_weight != 0) { + int num = snprintf(numstr, sizeof(numstr), "%llu", (unsigned long long)(cr->blkio_weight)); +@@ -422,7 +478,7 @@ static inline bool is_blk_stat_total(const char *value) + + static void stat_get_blk_stats(struct lxc_container *c, const char *item, struct blkio_stats *stats) + { +- char buf[BUFSIZE] = { 0 }; ++ char buf[BUFSIZE] = {0}; + int i = 0; + size_t len = 0; + char **lines = NULL; +@@ -464,7 +520,7 @@ err_out: + + static uint64_t stat_match_get_ull(struct lxc_container *c, const char *item, const char *match, int column) + { +- char buf[BUFSIZE] = { 0 }; ++ char buf[BUFSIZE] = {0}; + int i = 0; + int j = 0; + int len = 0; +@@ -595,7 +651,7 @@ static void execute_lxc_attach(const char *name, const char *path, const struct + } + + if (request->timeout != 0) { +- char timeout_str[LCR_NUMSTRLEN64] = { 0 }; ++ char timeout_str[LCR_NUMSTRLEN64] = {0}; + add_array_elem(params, args_len, &i, "--timeout"); + int num = snprintf(timeout_str, LCR_NUMSTRLEN64, "%lld", (long long)request->timeout); + if (num < 0 || num >= LCR_NUMSTRLEN64) { +@@ -655,8 +711,8 @@ bool do_attach(const char *name, const char *path, const struct lcr_exec_request + bool ret = false; + pid_t pid = 0; + ssize_t size_read = 0; +- char buffer[BUFSIZ] = { 0 }; +- int pipefd[2] = { -1, -1 }; ++ char buffer[BUFSIZ] = {0}; ++ int pipefd[2] = {-1, -1}; + int status = 0; + + if (pipe(pipefd) != 0) { +@@ -717,7 +773,7 @@ out: + void execute_lxc_start(const char *name, const char *path, const struct lcr_start_request *request) + { + // should check the size of params when add new params. +- char *params[PARAM_NUM] = { NULL }; ++ char *params[PARAM_NUM] = {NULL}; + size_t i = 0; + + if (lcr_util_check_inherited(true, -1) != 0) { +@@ -746,7 +802,7 @@ void execute_lxc_start(const char *name, const char *path, const struct lcr_star + add_array_kv(params, PARAM_NUM, &i, "--exit-fifo", request->exit_fifo); + + if (request->start_timeout != 0) { +- char start_timeout_str[LCR_NUMSTRLEN64] = { 0 }; ++ char start_timeout_str[LCR_NUMSTRLEN64] = {0}; + add_array_elem(params, PARAM_NUM, &i, "--start-timeout"); + int num = snprintf(start_timeout_str, LCR_NUMSTRLEN64, "%u", request->start_timeout); + if (num < 0 || num >= LCR_NUMSTRLEN64) { +-- +2.20.1 + diff --git a/0004-nano-cpus-add-support-nano-cpus.patch b/0004-nano-cpus-add-support-nano-cpus.patch new file mode 100644 index 0000000000000000000000000000000000000000..157e620521a361c4a5d0cde27ac0cabe757553aa --- /dev/null +++ b/0004-nano-cpus-add-support-nano-cpus.patch @@ -0,0 +1,34 @@ +From d10eb785228c60ccaad7f8a476c88107ea51b0b1 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Wed, 9 Sep 2020 15:20:20 +0800 +Subject: [PATCH 04/10] nano cpus: add support nano cpus + +Signed-off-by: lifeng68 +--- + src/json/schema/host-config.json | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index b3fca51..4eac222 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -133,6 +133,9 @@ + "BlkioDeviceWriteIops": { + "$ref": "defs.json#/definitions/ArrayOfBlkioDevice" + }, ++ "NanoCpus": { ++ "type": "int64" ++ }, + "CPUPeriod": { + "type": "int64" + }, +@@ -256,4 +259,4 @@ + "type": "string" + } + } +-} ++} +\ No newline at end of file +-- +2.20.1 + diff --git a/0005-device_cgroup_rule-add-support-device-cgroup-rule.patch b/0005-device_cgroup_rule-add-support-device-cgroup-rule.patch new file mode 100644 index 0000000000000000000000000000000000000000..d666c789d66537d1ab27cafcddf55933cb617943 --- /dev/null +++ b/0005-device_cgroup_rule-add-support-device-cgroup-rule.patch @@ -0,0 +1,37 @@ +From e21fd7de9ea37d6de7a1f5a6f5fc651777766938 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Thu, 10 Sep 2020 16:55:48 +0800 +Subject: [PATCH 05/10] device_cgroup_rule: add support device cgroup rule + +Signed-off-by: lifeng68 +--- + src/json/schema/host-config.json | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index 4eac222..ac54b40 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -171,6 +171,12 @@ + } + } + }, ++ "DeviceCgroupRules": { ++ "type": "array", ++ "items": { ++ "type": "string" ++ } ++ }, + "SecurityOpt": { + "type": "array", + "items": { +@@ -259,4 +265,4 @@ + "type": "string" + } + } +-} +\ No newline at end of file ++} +-- +2.20.1 + diff --git a/0006-lcr-add-libisula_libutils.so-isula-group.patch b/0006-lcr-add-libisula_libutils.so-isula-group.patch new file mode 100644 index 0000000000000000000000000000000000000000..c94abde265126b3a8017765b63e7bb92cd4b9bf7 --- /dev/null +++ b/0006-lcr-add-libisula_libutils.so-isula-group.patch @@ -0,0 +1,23 @@ +From eca2b3990157355058ed2480af73db861149abd0 Mon Sep 17 00:00:00 2001 +From: gaohuatao +Date: Fri, 18 Sep 2020 11:25:26 +0800 +Subject: [PATCH 06/10] lcr: add libisula_libutils.so isula group + +Signed-off-by: gaohuatao +--- + src/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 6ed2d95..c018ef4 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -107,4 +107,4 @@ endif() + install(TARGETS liblcr + LIBRARY DESTINATION ${LIB_INSTALL_DIR_DEFAULT} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) + install(TARGETS isula_libutils +- LIBRARY DESTINATION ${LIB_INSTALL_DIR_DEFAULT} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE) ++ LIBRARY DESTINATION ${LIB_INSTALL_DIR_DEFAULT} PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +-- +2.20.1 + diff --git a/0007-lcr-release-v2.0.4.patch b/0007-lcr-release-v2.0.4.patch new file mode 100644 index 0000000000000000000000000000000000000000..222ff6d1d044cc17b946afa4d0869ade61d971ba --- /dev/null +++ b/0007-lcr-release-v2.0.4.patch @@ -0,0 +1,59 @@ +From 2860c9429e59a4ebf70ce87dd5f3b41672314f75 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Wed, 14 Oct 2020 14:32:16 +0800 +Subject: [PATCH 07/10] lcr: release v2.0.4 + +Signed-off-by: lifeng68 +--- + CMakeLists.txt | 2 +- + lcr.spec | 4 ++-- + release_notes | 11 +++++++++++ + 3 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 224269a..3f7d6ad 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,7 +25,7 @@ project (lcr) + + option(VERSION "set lcr version" ON) + if (VERSION STREQUAL "ON") +- set(LCR_VERSION "2.0.3") ++ set(LCR_VERSION "2.0.4") + endif() + + option(DEBUG "set lcr gcc option" ON) +diff --git a/lcr.spec b/lcr.spec +index c0cd6cf..2ed7191 100644 +--- a/lcr.spec ++++ b/lcr.spec +@@ -1,5 +1,5 @@ +-%global _version 2.0.3 +-%global _release 20200810.102757.git9fc48b6c ++%global _version 2.0.4 ++%global _release 20201014.143152.git71d77d16 + %global _inner_name isula_libutils + + Name: lcr +diff --git a/release_notes b/release_notes +index 579a061..b93694a 100644 +--- a/release_notes ++++ b/release_notes +@@ -1,3 +1,14 @@ ++2020-10-14 lifeng release 2.0.4 ++ - !73 lcr: add libisula_libutils.so isula group From: @gaohuatao Reviewed-by: @jingxiaolu,@lifeng2221dd1 Signed-off-by: @lifeng2221dd1 ++ - !72 device_cgroup_rule: add support device cgroup rule Merge pull request !72 from lifeng_isula/blk ++ - !71 nano cpus: add support nano cpus Merge pull request !71 from lifeng_isula/blk ++ - !70 update: add support update cpu rt Merge pull request !70 from lifeng_isula/blk ++ - !69 blk: add blkiops define Merge pull request !69 from lifeng_isula/blk ++ ++ dev stats: ++ - 7 files changed, 409 insertions(+), 340 deletions(-) ++ - contributors: lifeng68, gaohuatao ++ + 2020-08-10 lifeng release 2.0.3 + - !67 add debug package Merge pull request !67 from YoungJQ/master + - !66 info.json add name field Merge pull request !66 from Zhangxiaoyu/master +-- +2.20.1 + diff --git a/0008-support-local-volume.patch b/0008-support-local-volume.patch new file mode 100644 index 0000000000000000000000000000000000000000..8bae38a21e77e7f77f984411405b808df34338d1 --- /dev/null +++ b/0008-support-local-volume.patch @@ -0,0 +1,312 @@ +From 14c30632d33cdce2d3b0bb5072bf8af823003e63 Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Thu, 3 Sep 2020 10:46:38 +0800 +Subject: [PATCH 08/10] support local volume + +Signed-off-by: WangFengTu +--- + src/json/schema/bind-options.json | 12 +++++++++ + src/json/schema/container/config-v2.json | 3 +++ + src/json/schema/container/inspect.json | 3 +++ + src/json/schema/defs.json | 5 +++- + src/json/schema/docker/types/mount-point.json | 3 +++ + src/json/schema/host-config.json | 9 +++++++ + src/json/schema/mount_spec.json | 27 +++++++++++++++++++ + .../schema/volume/list-volume-request.json | 6 +++++ + .../schema/volume/list-volume-response.json | 18 +++++++++++++ + src/json/schema/volume/options.json | 9 +++++++ + .../schema/volume/prune-volume-request.json | 6 +++++ + .../schema/volume/prune-volume-response.json | 18 +++++++++++++ + .../schema/volume/remove-volume-request.json | 9 +++++++ + .../schema/volume/remove-volume-response.json | 12 +++++++++ + src/json/schema/volume/volume.json | 12 +++++++++ + 15 files changed, 151 insertions(+), 1 deletion(-) + create mode 100644 src/json/schema/bind-options.json + create mode 100644 src/json/schema/mount_spec.json + create mode 100644 src/json/schema/volume/list-volume-request.json + create mode 100644 src/json/schema/volume/list-volume-response.json + create mode 100644 src/json/schema/volume/options.json + create mode 100644 src/json/schema/volume/prune-volume-request.json + create mode 100644 src/json/schema/volume/prune-volume-response.json + create mode 100644 src/json/schema/volume/remove-volume-request.json + create mode 100644 src/json/schema/volume/remove-volume-response.json + create mode 100644 src/json/schema/volume/volume.json + +diff --git a/src/json/schema/bind-options.json b/src/json/schema/bind-options.json +new file mode 100644 +index 0000000..8900361 +--- /dev/null ++++ b/src/json/schema/bind-options.json +@@ -0,0 +1,12 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "Propagation": { ++ "type": "string" ++ }, ++ "selinux-opts": { ++ "type": "string" ++ } ++ } ++} +diff --git a/src/json/schema/container/config-v2.json b/src/json/schema/container/config-v2.json +index ba97bd8..f299f01 100644 +--- a/src/json/schema/container/config-v2.json ++++ b/src/json/schema/container/config-v2.json +@@ -55,6 +55,9 @@ + ".{1,}": { + "type": "object", + "properties": { ++ "Type": { ++ "type": "string" ++ }, + "Destination": { + "type": "string" + }, +diff --git a/src/json/schema/container/inspect.json b/src/json/schema/container/inspect.json +index d1c6288..bf53a59 100644 +--- a/src/json/schema/container/inspect.json ++++ b/src/json/schema/container/inspect.json +@@ -157,6 +157,9 @@ + "Labels": { + "$ref": "../defs.json#/definitions/mapStringString" + }, ++ "Volumes": { ++ "$ref": "../defs.json#/definitions/mapStringObject" ++ }, + "Annotations": { + "$ref": "../defs.json#/definitions/mapStringString" + }, +diff --git a/src/json/schema/defs.json b/src/json/schema/defs.json +index 9512caa..317cab4 100644 +--- a/src/json/schema/defs.json ++++ b/src/json/schema/defs.json +@@ -192,6 +192,9 @@ + "options": { + "$ref": "#/definitions/ArrayOfStrings" + }, ++ "named": { ++ "type": "boolean" ++ }, + "type": { + "type": "string" + } +@@ -1073,4 +1076,4 @@ + } + } + } +-} +\ No newline at end of file ++} +diff --git a/src/json/schema/docker/types/mount-point.json b/src/json/schema/docker/types/mount-point.json +index 33b7768..f204cdc 100644 +--- a/src/json/schema/docker/types/mount-point.json ++++ b/src/json/schema/docker/types/mount-point.json +@@ -2,6 +2,9 @@ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { ++ "Type":{ ++ "type":"string" ++ }, + "Name":{ + "type":"string" + }, +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index ac54b40..eb99c87 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -2,9 +2,18 @@ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { ++ "VolumesFrom": { ++ "$ref": "defs.json#/definitions/ArrayOfStrings" ++ }, + "Binds": { + "$ref": "defs.json#/definitions/ArrayOfStrings" + }, ++ "Mounts": { ++ "type": "array", ++ "items": { ++ "$ref": "mount_spec.json" ++ } ++ }, + "NetworkMode": { + "type": "string" + }, +diff --git a/src/json/schema/mount_spec.json b/src/json/schema/mount_spec.json +new file mode 100644 +index 0000000..94aa5b3 +--- /dev/null ++++ b/src/json/schema/mount_spec.json +@@ -0,0 +1,27 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "Type": { ++ "type": "string" ++ }, ++ "Source": { ++ "type": "string" ++ }, ++ "Target": { ++ "type": "string" ++ }, ++ "Readonly": { ++ "type": "boolean" ++ }, ++ "Consistency": { ++ "type": "string" ++ }, ++ "BindOptions": { ++ "$ref": "bind-options.json" ++ }, ++ "VolumeOptions": { ++ "$ref": "volume/options.json" ++ } ++ } ++} +diff --git a/src/json/schema/volume/list-volume-request.json b/src/json/schema/volume/list-volume-request.json +new file mode 100644 +index 0000000..8084880 +--- /dev/null ++++ b/src/json/schema/volume/list-volume-request.json +@@ -0,0 +1,6 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ } ++} +diff --git a/src/json/schema/volume/list-volume-response.json b/src/json/schema/volume/list-volume-response.json +new file mode 100644 +index 0000000..d89f4e2 +--- /dev/null ++++ b/src/json/schema/volume/list-volume-response.json +@@ -0,0 +1,18 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "volumes": { ++ "type": "array", ++ "items": { ++ "$ref": "volume.json" ++ } ++ }, ++ "cc": { ++ "type": "uint32" ++ }, ++ "errmsg": { ++ "type": "string" ++ } ++ } ++} +diff --git a/src/json/schema/volume/options.json b/src/json/schema/volume/options.json +new file mode 100644 +index 0000000..57b3c34 +--- /dev/null ++++ b/src/json/schema/volume/options.json +@@ -0,0 +1,9 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "NoCopy": { ++ "type": "boolean" ++ } ++ } ++} +diff --git a/src/json/schema/volume/prune-volume-request.json b/src/json/schema/volume/prune-volume-request.json +new file mode 100644 +index 0000000..8084880 +--- /dev/null ++++ b/src/json/schema/volume/prune-volume-request.json +@@ -0,0 +1,6 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ } ++} +diff --git a/src/json/schema/volume/prune-volume-response.json b/src/json/schema/volume/prune-volume-response.json +new file mode 100644 +index 0000000..064f839 +--- /dev/null ++++ b/src/json/schema/volume/prune-volume-response.json +@@ -0,0 +1,18 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "volumes": { ++ "type": "array", ++ "items": { ++ "type": "string" ++ } ++ }, ++ "cc": { ++ "type": "uint32" ++ }, ++ "errmsg": { ++ "type": "string" ++ } ++ } ++} +diff --git a/src/json/schema/volume/remove-volume-request.json b/src/json/schema/volume/remove-volume-request.json +new file mode 100644 +index 0000000..788b40d +--- /dev/null ++++ b/src/json/schema/volume/remove-volume-request.json +@@ -0,0 +1,9 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "name": { ++ "type": "string" ++ } ++ } ++} +diff --git a/src/json/schema/volume/remove-volume-response.json b/src/json/schema/volume/remove-volume-response.json +new file mode 100644 +index 0000000..8c398e8 +--- /dev/null ++++ b/src/json/schema/volume/remove-volume-response.json +@@ -0,0 +1,12 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "cc": { ++ "type": "uint32" ++ }, ++ "errmsg": { ++ "type": "string" ++ } ++ } ++} +diff --git a/src/json/schema/volume/volume.json b/src/json/schema/volume/volume.json +new file mode 100644 +index 0000000..035451f +--- /dev/null ++++ b/src/json/schema/volume/volume.json +@@ -0,0 +1,12 @@ ++{ ++ "$schema": "http://json-schema.org/draft-04/schema#", ++ "type": "object", ++ "properties": { ++ "driver": { ++ "type": "string" ++ }, ++ "name": { ++ "type": "string" ++ } ++ } ++} +-- +2.20.1 + diff --git a/0009-remove-extension-json-config-of-cni-net.patch b/0009-remove-extension-json-config-of-cni-net.patch new file mode 100644 index 0000000000000000000000000000000000000000..d403011e23f0c66f3b892068b0f74485c1fc6e1e --- /dev/null +++ b/0009-remove-extension-json-config-of-cni-net.patch @@ -0,0 +1,95 @@ +From 5ef0ddb02783bbe5abeb0998fe8b65b9138268df Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Tue, 27 Oct 2020 11:15:31 +0800 +Subject: [PATCH 09/10] remove extension json config of cni net + +Signed-off-by: haozi007 +--- + src/json/schema/cni/net_conf.json | 64 ------------------------------- + 1 file changed, 64 deletions(-) + +diff --git a/src/json/schema/cni/net_conf.json b/src/json/schema/cni/net_conf.json +index 89427ae..7a03a3f 100644 +--- a/src/json/schema/cni/net_conf.json ++++ b/src/json/schema/cni/net_conf.json +@@ -43,27 +43,6 @@ + "dns": { + "$ref": "network/dns.json" + }, +- "multi_entry": { +- "type": "int32" +- }, +- "backup_mode": { +- "type": "boolean" +- }, +- "vlanID": { +- "type": "int32" +- }, +- "vlan_inside": { +- "type": "boolean" +- }, +- "vxlanID": { +- "type": "int32" +- }, +- "vxlanID_inside": { +- "type": "boolean" +- }, +- "actions": { +- "type": "string" +- }, + "args": { + "$ref": "net_args.json" + }, +@@ -84,49 +63,6 @@ + } + } + }, +- "log_level": { +- "type": "string" +- }, +- "etcd_endpoints": { +- "type": "string" +- }, +- "etcd_key_file": { +- "type": "string" +- }, +- "etcd_cert_file": { +- "type": "string" +- }, +- "etcd_ca_cert_file": { +- "type": "string" +- }, +- "mtu": { +- "type": "int32" +- }, +- "datastore_type": { +- "type": "string" +- }, +- "nodename": { +- "type": "string" +- }, +- "policy": { +- "type": "object", +- "properties": { +- "type": { +- "type": "string" +- } +- } +- }, +- "kubernetes": { +- "type": "object", +- "properties": { +- "kubeconfig": { +- "type": "string" +- } +- } +- }, +- "snat": { +- "type": "boolean" +- }, + "capabilities": { + "$ref": "../defs.json#/definitions/mapStringBool" + } +-- +2.20.1 + diff --git a/0010-fix-ctest-error-when-use-make.patch b/0010-fix-ctest-error-when-use-make.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a237dfe4fff6c49046d1526edad79e1500f62d7 --- /dev/null +++ b/0010-fix-ctest-error-when-use-make.patch @@ -0,0 +1,26 @@ +From 88f2a60d014299241b6e53f60340b2debc1adc10 Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Tue, 3 Nov 2020 17:23:57 +0800 +Subject: [PATCH 10/10] fix ctest error when use make + +Signed-off-by: haozi007 +--- + tests/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +index 8110f10..39d0270 100644 +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -83,7 +83,7 @@ target_link_libraries(mock_ut + ${GTEST_LIBRARY} + pthread + ) +-add_dependencies(mock_ut log_ut libocispec_ut) ++add_dependencies(mock_ut log_ut libocispec_ut go_crc64_ut) + + # run ut and gcov + if (ENABLE_GCOV) +-- +2.20.1 + diff --git a/lcr.spec b/lcr.spec index 01b3e45619c96d934c1ca323c7c180d1a8507471..dbd6ce10d5d71208e718af79d078265a3c94529e 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.0.3 -%global _release 20200904.101728.git8b4641a4 +%global _release 20201112.163615.git01787bcd %global _inner_name isula_libutils Name: lcr @@ -12,6 +12,18 @@ Group: Applications/System License: LGPLv2.1+ BuildRoot: %{_tmppath}/lcr-%{version} +Patch9001: 0001-lcr-remove-NOTIFY_SOCKET-env-when-do-fork.patch +Patch9002: 0002-blk-add-blkiops-define.patch +Patch9003: 0003-update-add-support-update-cpu-rt.patch +Patch9004: 0004-nano-cpus-add-support-nano-cpus.patch +Patch9005: 0005-device_cgroup_rule-add-support-device-cgroup-rule.patch +Patch9006: 0006-lcr-add-libisula_libutils.so-isula-group.patch +Patch9007: 0007-lcr-release-v2.0.4.patch +Patch9008: 0008-support-local-volume.patch +Patch9009: 0009-remove-extension-json-config-of-cni-net.patch +Patch9010: 0010-fix-ctest-error-when-use-make.patch + + BuildRequires: cmake BuildRequires: lxc BuildRequires: lxc-devel @@ -96,8 +108,13 @@ rm -rf %{buildroot} %{_includedir}/lcr/lcrcontainer.h %{_includedir}/%{_inner_name}/*.h - %changelog +* Thu Nov 12 2020 gaohuatao - 2.0.3-20201112.163615.git01787bcd +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: update from master + * Fri Sep 04 2020 zhangxiaoyu - 2.0.3-20200904.101728.git8b4641a4 - Type:enhancement - ID:NA