Update dependencies after protobuf update in hcsshim

Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
(cherry picked from commit d129b6f890bceb56b050bbb23ad330bb5699f78c)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
This commit is contained in:
Kirtana Ashok
2023-08-08 14:58:07 -07:00
parent e7e5619fed
commit a645ff2e68
7 changed files with 17 additions and 27 deletions

View File

@@ -27,7 +27,6 @@ import (
v1 "github.com/containerd/cgroups/v3/cgroup1/stats"
v2 "github.com/containerd/cgroups/v3/cgroup2/stats"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/typeurl/v2"
"github.com/urfave/cli"
)
@@ -154,22 +153,8 @@ func printCgroup2MetricsTable(w *tabwriter.Writer, data *v2.Metrics) {
func printWindowsStats(w *tabwriter.Writer, windowsStats *wstats.Statistics) error {
if windowsStats.GetLinux() != nil {
var stats v1.Metrics
// It cannot be casted to v1.Metrics since windowsStats is still generated by gogo/protobuf.
linux := windowsStats.GetLinux()
// But Marshal/Unmarshal works because the underlying protobuf message is compatible.
data, err := linux.Marshal()
if err != nil {
return err
}
err = proto.Unmarshal(data, &stats)
if err != nil {
return err
}
printCgroupMetricsTable(w, &stats)
stats := windowsStats.GetLinux()
printCgroupMetricsTable(w, stats)
} else if windowsStats.GetWindows() != nil {
printWindowsContainerStatistics(w, windowsStats.GetWindows())
}