From 07db575ff9d0ee5a5168e604288f5c451ef13af3 Mon Sep 17 00:00:00 2001 From: songbuhuang <544824346@qq.com> Date: Fri, 16 Dec 2022 19:28:32 +0800 Subject: [PATCH 1/2] add memory stats patch --- .gitignore | 2 ++ ...-parameter-in-lxc-attach-help-output.patch | 26 +++++++++++++++++ 0022-add_memory_stats.patch | 28 +++++++++++++++++++ lxc.spec | 9 +++++- series.conf | 2 ++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch create mode 100644 0022-add_memory_stats.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aafda3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +.idea diff --git a/0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch b/0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch new file mode 100644 index 0000000..6fe236a --- /dev/null +++ b/0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch @@ -0,0 +1,26 @@ +From 026fea0b424c20c867be1577f5d98bc7bf97ba5a Mon Sep 17 00:00:00 2001 +From: isuladci +Date: Fri, 16 Dec 2022 19:17:11 +0800 +Subject: [PATCH] change the --suffi parameter in lxc-attach --help output + +Signed-off-by: isuladci +--- + src/lxc/tools/lxc_attach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c +index f6ddf2d..fc0529a 100644 +--- a/src/lxc/tools/lxc_attach.c ++++ b/src/lxc/tools/lxc_attach.c +@@ -151,7 +151,7 @@ Options :\n\ + --in-fifo Stdin fifo path\n\ + --out-fifo Stdout fifo path\n\ + --err-fifo Stderr fifo path\n\ +- --suffi ID for mutli-attach on one container\n\ ++ --suffix ID for mutli-attach on one container\n\ + --timeout Timeout in seconds (default: 0)\n\ + --disable-pty Disable pty for attach\n\ + --open-stdin Open stdin for attach\n\ +-- +2.25.1 + diff --git a/0022-add_memory_stats.patch b/0022-add_memory_stats.patch new file mode 100644 index 0000000..58ff832 --- /dev/null +++ b/0022-add_memory_stats.patch @@ -0,0 +1,28 @@ +diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c +index 317dcf6..efa73b2 100644 +--- a/src/lxc/lxccontainer.c ++++ b/src/lxc/lxccontainer.c +@@ -6065,14 +6065,17 @@ static bool do_lxcapi_get_container_metrics(struct lxc_container *c, struct lxc + metrics_get_blk_stats(c, cgroup_ops, "blkio.io_service_bytes_recursive", &metrics->io_service_bytes); + } + +- metrics->avaliable_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + +- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + +- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1) - +- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1); ++ metrics->avaliable_bytes = metrics_get_ull(c, cgroup_ops, "memory.limit_in_bytes")- ++ ( ++ metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + ++ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + ++ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1) - ++ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1) ++ ); + + metrics->usage_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + +- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + +- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1); ++ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + ++ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1); + + metrics->rss_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1); + metrics->page_faults = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "pgfault", 1); diff --git a/lxc.spec b/lxc.spec index 29229a8..f470730 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 2022102405 +%global _release 2022102406 Name: lxc Version: 4.0.3 @@ -28,6 +28,7 @@ Patch0017: 0017-lxc-Add-sw64-architecture.patch Patch0018: 0018-add-macro-to-adapt-musl-libc.patch Patch0019: 0019-add-lxc-attach-add-gids-option.patch Patch0020: 0020-add-sscanf-adapation-code-for-musl.patch +Patch0021: 0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -208,6 +209,12 @@ make check %endif %changelog +* Fri Dec 16 2022 huangsong - 4.0.3-2022102406 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: change the suffi parameter in lxc attach --help output + * Thu Dec 08 2022 zhongtao - 4.0.3-2022102405 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index 104f149..1a4e9f9 100644 --- a/series.conf +++ b/series.conf @@ -17,3 +17,5 @@ 0018-add-macro-to-adapt-musl-libc.patch 0019-add-lxc-attach-add-gids-option.patch 0020-add-sscanf-adapation-code-for-musl.patch +0021-change-the-suffi-parameter-in-lxc-attach-help-output.patch +0022-add_memory_stats.patch -- Gitee From b35049e5aaa383c3e2abc23fc410af3566c8a1a9 Mon Sep 17 00:00:00 2001 From: ilyakuksenok Date: Thu, 16 Feb 2023 10:28:27 +0000 Subject: [PATCH 2/2] Remove 0022-add_memory_stats.patch --- 0022-add_memory_stats.patch | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 0022-add_memory_stats.patch diff --git a/0022-add_memory_stats.patch b/0022-add_memory_stats.patch deleted file mode 100644 index 58ff832..0000000 --- a/0022-add_memory_stats.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c -index 317dcf6..efa73b2 100644 ---- a/src/lxc/lxccontainer.c -+++ b/src/lxc/lxccontainer.c -@@ -6065,14 +6065,17 @@ static bool do_lxcapi_get_container_metrics(struct lxc_container *c, struct lxc - metrics_get_blk_stats(c, cgroup_ops, "blkio.io_service_bytes_recursive", &metrics->io_service_bytes); - } - -- metrics->avaliable_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + -- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + -- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1) - -- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1); -+ metrics->avaliable_bytes = metrics_get_ull(c, cgroup_ops, "memory.limit_in_bytes")- -+ ( -+ metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + -+ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + -+ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1) - -+ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1) -+ ); - - metrics->usage_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) + -- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + -- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1); -+ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) + -+ metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1); - - metrics->rss_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1); - metrics->page_faults = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "pgfault", 1); -- Gitee