From f7910ed643025fba4b7cfe2673186415722e16d7 Mon Sep 17 00:00:00 2001 From: yuanhui Date: Tue, 18 Apr 2023 15:55:47 +0800 Subject: [PATCH] Remove Windows platform releated patches Signed-off-by: yuanhui --- 0001-Revert-commit-for-Windows-metrics.patch | 157 ------------------- 0002-Remove-windows-only-dep.patch | 24 --- containerd.spec | 9 +- 3 files changed, 4 insertions(+), 186 deletions(-) delete mode 100644 0001-Revert-commit-for-Windows-metrics.patch delete mode 100644 0002-Remove-windows-only-dep.patch diff --git a/0001-Revert-commit-for-Windows-metrics.patch b/0001-Revert-commit-for-Windows-metrics.patch deleted file mode 100644 index 568f98f..0000000 --- a/0001-Revert-commit-for-Windows-metrics.patch +++ /dev/null @@ -1,157 +0,0 @@ -From beb23ffb0624b40b2ee1bc56730e54943bd3020f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= -Date: Thu, 1 Oct 2020 07:19:45 +0200 -Subject: [PATCH] Revert commit for Windows metrics -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Robert-André Mauchin ---- - cmd/ctr/commands/tasks/metrics.go | 113 ------------------------------ - 1 file changed, 113 deletions(-) - -diff --git a/cmd/ctr/commands/tasks/metrics.go b/cmd/ctr/commands/tasks/metrics.go -index a83e45ef..f8371401 100644 ---- a/cmd/ctr/commands/tasks/metrics.go -+++ b/cmd/ctr/commands/tasks/metrics.go -@@ -23,9 +23,6 @@ import ( - "os" - "text/tabwriter" - -- wstats "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats" -- v1 "github.com/containerd/cgroups/stats/v1" -- v2 "github.com/containerd/cgroups/v2/stats" - "github.com/containerd/containerd/cmd/ctr/commands" - "github.com/containerd/typeurl" - "github.com/urfave/cli" -@@ -77,42 +74,12 @@ var metricsCommand = cli.Command{ - if err != nil { - return err - } -- var ( -- data *v1.Metrics -- data2 *v2.Metrics -- windowsStats *wstats.Statistics -- ) -- switch v := anydata.(type) { -- case *v1.Metrics: -- data = v -- case *v2.Metrics: -- data2 = v -- case *wstats.Statistics: -- windowsStats = v -- default: -- return errors.New("cannot convert metric data to cgroups.Metrics or windows.Statistics") -- } - - switch context.String(formatFlag) { - case formatTable: - w := tabwriter.NewWriter(os.Stdout, 1, 8, 4, ' ', 0) - fmt.Fprintf(w, "ID\tTIMESTAMP\t\n") - fmt.Fprintf(w, "%s\t%s\t\n\n", metric.ID, metric.Timestamp) -- if data != nil { -- printCgroupMetricsTable(w, data) -- } else if data2 != nil { -- printCgroup2MetricsTable(w, data2) -- } else { -- if windowsStats.GetLinux() != nil { -- printCgroupMetricsTable(w, windowsStats.GetLinux()) -- } else if windowsStats.GetWindows() != nil { -- printWindowsContainerStatistics(w, windowsStats.GetWindows()) -- } -- // Print VM stats if its isolated -- if windowsStats.VM != nil { -- printWindowsVMStatistics(w, windowsStats.VM) -- } -- } - return w.Flush() - case formatJSON: - marshaledJSON, err := json.MarshalIndent(anydata, "", " ") -@@ -126,83 +93,3 @@ var metricsCommand = cli.Command{ - } - }, - } -- --func printCgroupMetricsTable(w *tabwriter.Writer, data *v1.Metrics) { -- fmt.Fprintf(w, "METRIC\tVALUE\t\n") -- if data.Memory != nil { -- fmt.Fprintf(w, "memory.usage_in_bytes\t%d\t\n", data.Memory.Usage.Usage) -- fmt.Fprintf(w, "memory.limit_in_bytes\t%d\t\n", data.Memory.Usage.Limit) -- fmt.Fprintf(w, "memory.stat.cache\t%d\t\n", data.Memory.TotalCache) -- } -- if data.CPU != nil { -- fmt.Fprintf(w, "cpuacct.usage\t%d\t\n", data.CPU.Usage.Total) -- fmt.Fprintf(w, "cpuacct.usage_percpu\t%v\t\n", data.CPU.Usage.PerCPU) -- } -- if data.Pids != nil { -- fmt.Fprintf(w, "pids.current\t%v\t\n", data.Pids.Current) -- fmt.Fprintf(w, "pids.limit\t%v\t\n", data.Pids.Limit) -- } --} -- --func printCgroup2MetricsTable(w *tabwriter.Writer, data *v2.Metrics) { -- fmt.Fprintf(w, "METRIC\tVALUE\t\n") -- if data.Pids != nil { -- fmt.Fprintf(w, "pids.current\t%v\t\n", data.Pids.Current) -- fmt.Fprintf(w, "pids.limit\t%v\t\n", data.Pids.Limit) -- } -- if data.CPU != nil { -- fmt.Fprintf(w, "cpu.usage_usec\t%v\t\n", data.CPU.UsageUsec) -- fmt.Fprintf(w, "cpu.user_usec\t%v\t\n", data.CPU.UserUsec) -- fmt.Fprintf(w, "cpu.system_usec\t%v\t\n", data.CPU.SystemUsec) -- fmt.Fprintf(w, "cpu.nr_periods\t%v\t\n", data.CPU.NrPeriods) -- fmt.Fprintf(w, "cpu.nr_throttled\t%v\t\n", data.CPU.NrThrottled) -- fmt.Fprintf(w, "cpu.throttled_usec\t%v\t\n", data.CPU.ThrottledUsec) -- } -- if data.Memory != nil { -- fmt.Fprintf(w, "memory.usage\t%v\t\n", data.Memory.Usage) -- fmt.Fprintf(w, "memory.usage_limit\t%v\t\n", data.Memory.UsageLimit) -- fmt.Fprintf(w, "memory.swap_usage\t%v\t\n", data.Memory.SwapUsage) -- fmt.Fprintf(w, "memory.swap_limit\t%v\t\n", data.Memory.SwapLimit) -- } --} -- --func printWindowsContainerStatistics(w *tabwriter.Writer, stats *wstats.WindowsContainerStatistics) { -- fmt.Fprintf(w, "METRIC\tVALUE\t\n") -- fmt.Fprintf(w, "timestamp\t%s\t\n", stats.Timestamp) -- fmt.Fprintf(w, "start_time\t%s\t\n", stats.ContainerStartTime) -- fmt.Fprintf(w, "uptime_ns\t%d\t\n", stats.UptimeNS) -- if stats.Processor != nil { -- fmt.Fprintf(w, "cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS) -- fmt.Fprintf(w, "cpu.runtime_user_ns\t%d\t\n", stats.Processor.RuntimeUserNS) -- fmt.Fprintf(w, "cpu.runtime_kernel_ns\t%d\t\n", stats.Processor.RuntimeKernelNS) -- } -- if stats.Memory != nil { -- fmt.Fprintf(w, "memory.commit_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitBytes) -- fmt.Fprintf(w, "memory.commit_peak_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitPeakBytes) -- fmt.Fprintf(w, "memory.private_working_set_bytes\t%d\t\n", stats.Memory.MemoryUsagePrivateWorkingSetBytes) -- } -- if stats.Storage != nil { -- fmt.Fprintf(w, "storage.read_count_normalized\t%d\t\n", stats.Storage.ReadCountNormalized) -- fmt.Fprintf(w, "storage.read_size_bytes\t%d\t\n", stats.Storage.ReadSizeBytes) -- fmt.Fprintf(w, "storage.write_count_normalized\t%d\t\n", stats.Storage.WriteCountNormalized) -- fmt.Fprintf(w, "storage.write_size_bytes\t%d\t\n", stats.Storage.WriteSizeBytes) -- } --} -- --func printWindowsVMStatistics(w *tabwriter.Writer, stats *wstats.VirtualMachineStatistics) { -- fmt.Fprintf(w, "METRIC\tVALUE\t\n") -- if stats.Processor != nil { -- fmt.Fprintf(w, "vm.cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS) -- } -- if stats.Memory != nil { -- fmt.Fprintf(w, "vm.memory.working_set_bytes\t%d\t\n", stats.Memory.WorkingSetBytes) -- fmt.Fprintf(w, "vm.memory.virtual_node_count\t%d\t\n", stats.Memory.VirtualNodeCount) -- fmt.Fprintf(w, "vm.memory.available\t%d\t\n", stats.Memory.VmMemory.AvailableMemory) -- fmt.Fprintf(w, "vm.memory.available_buffer\t%d\t\n", stats.Memory.VmMemory.AvailableMemoryBuffer) -- fmt.Fprintf(w, "vm.memory.reserved\t%d\t\n", stats.Memory.VmMemory.ReservedMemory) -- fmt.Fprintf(w, "vm.memory.assigned\t%d\t\n", stats.Memory.VmMemory.AssignedMemory) -- fmt.Fprintf(w, "vm.memory.slp_active\t%t\t\n", stats.Memory.VmMemory.SlpActive) -- fmt.Fprintf(w, "vm.memory.balancing_enabled\t%t\t\n", stats.Memory.VmMemory.BalancingEnabled) -- fmt.Fprintf(w, "vm.memory.dm_operation_in_progress\t%t\t\n", stats.Memory.VmMemory.DmOperationInProgress) -- } --} --- -2.28.0 - diff --git a/0002-Remove-windows-only-dep.patch b/0002-Remove-windows-only-dep.patch deleted file mode 100644 index 92a2856..0000000 --- a/0002-Remove-windows-only-dep.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go -index a8498116d..3682be668 100644 ---- a/pkg/cri/server/helpers.go -+++ b/pkg/cri/server/helpers.go -@@ -40,7 +40,7 @@ import ( - runtimespec "github.com/opencontainers/runtime-spec/specs-go" - "github.com/sirupsen/logrus" - -- runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" -+ // runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" - imagedigest "github.com/opencontainers/go-digest" - "github.com/pelletier/go-toml" - "golang.org/x/net/context" -@@ -366,8 +366,8 @@ func getRuntimeOptionsType(t string) interface{} { - return &runcoptions.Options{} - case plugin.RuntimeLinuxV1: - return &runctypes.RuncOptions{} -- case runtimeRunhcsV1: -- return &runhcsoptions.Options{} -+ // case runtimeRunhcsV1: -+ // return &runhcsoptions.Options{} - default: - return &runtimeoptions.Options{} - } diff --git a/containerd.spec b/containerd.spec index 35ee43b..1111028 100644 --- a/containerd.spec +++ b/containerd.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 %bcond_without check @@ -13,9 +13,6 @@ URL: https://github.com/containerd/containerd Source0: https://github.com/containerd/containerd/archive/refs/tags/v%{version}.tar.gz Source1: containerd.service Source2: containerd.toml -# Carve out code requiring github.com/Microsoft/hcsshim -Patch0: 0001-Revert-commit-for-Windows-metrics.patch -Patch1: 0002-Remove-windows-only-dep.patch BuildRequires: btrfs-progs-devel systemd-rpm-macros go-md2man @@ -41,7 +38,6 @@ The %{name}-doc package contains documentation files for %{name}. %prep %goprep -k -%autopatch -p1 # Used only for generation: rm -rf cmd/protoc-gen-gogoctrd @@ -104,6 +100,9 @@ install -D -p -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/containerd/config.toml %doc code-of-conduct.md BUILDING.md %changelog +* Tue Apr 18 2023 yuanhui - 1.6.20-3 +- Remove Windows platform releated patches + * Mon Apr 10 2023 yuanhui - 1.6.20-2 - Optimize the spec file -- Gitee