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:
@@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user