From 932d2d1c7016547da65aeec3949db2fc9b03ecd3 Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Sun, 17 Jul 2022 20:53:32 -0700 Subject: [PATCH 1/4] Update gopsutil to v3 --- go.mod | 22 ++++++++++--------- go.sum | 42 ++++++++++++++++++++++--------------- helper/hostutil/hostinfo.go | 8 +++---- physical/raft/bolt_linux.go | 2 +- vault/diagnose/os_common.go | 2 +- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/go.mod b/go.mod index f7b0d4eebf757..345f41fd8a2d0 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/gocql/gocql v1.0.0 github.com/golang-jwt/jwt/v4 v4.3.0 github.com/golang/protobuf v1.5.2 - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/google/go-github v17.0.0+incompatible github.com/google/go-metrics-stackdriver v0.2.0 github.com/google/tink/go v1.6.1 @@ -166,8 +166,8 @@ require ( github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da github.com/sasha-s/go-deadlock v0.2.0 github.com/sethvargo/go-limiter v0.7.1 - github.com/shirou/gopsutil v3.21.5+incompatible - github.com/stretchr/testify v1.7.1 + github.com/shirou/gopsutil/v3 v3.22.6 + github.com/stretchr/testify v1.7.5 go.etcd.io/bbolt v1.3.6 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v2 v2.305.0 @@ -182,7 +182,7 @@ require ( golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 - golang.org/x/sys v0.0.0-20220520151150-f9599da83cde + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 golang.org/x/tools v0.1.5 google.golang.org/api v0.67.0 @@ -224,7 +224,6 @@ require ( github.com/Microsoft/go-winio v0.5.1 // indirect github.com/Microsoft/hcsshim v0.9.0 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect - github.com/StackExchange/wmi v1.2.1 // indirect github.com/andybalholm/brotli v1.0.4 // indirect github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64 // indirect github.com/aws/aws-sdk-go-v2 v1.8.0 // indirect @@ -271,7 +270,7 @@ require ( github.com/go-asn1-ber/asn1-ber v1.5.1 // indirect github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3 // indirect github.com/go-logr/logr v1.2.0 // indirect - github.com/go-ole/go-ole v1.2.5 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect @@ -325,6 +324,7 @@ require ( github.com/klauspost/pgzip v1.2.5 // indirect github.com/lib/pq v1.10.6 // indirect github.com/linode/linodego v0.7.1 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mattn/go-ieproxy v0.0.1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/miekg/dns v1.1.41 // indirect @@ -349,6 +349,7 @@ require ( github.com/pierrec/lz4/v4 v4.1.8 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect @@ -358,10 +359,10 @@ require ( github.com/snowflakedb/gosnowflake v1.6.3 // indirect github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.2.0 // indirect + github.com/stretchr/objx v0.4.0 // indirect github.com/tencentcloud/tencentcloud-sdk-go v1.0.162 // indirect - github.com/tklauser/go-sysconf v0.3.9 // indirect - github.com/tklauser/numcpus v0.3.0 // indirect + github.com/tklauser/go-sysconf v0.3.10 // indirect + github.com/tklauser/numcpus v0.4.0 // indirect github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/vmware/govmomi v0.18.0 // indirect @@ -374,6 +375,7 @@ require ( github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect go.etcd.io/etcd/api/v3 v3.5.0 // indirect go.opencensus.io v0.23.0 // indirect go.opentelemetry.io/otel/metric v0.20.0 // indirect @@ -391,7 +393,7 @@ require ( gopkg.in/jcmturner/goidentity.v3 v3.0.0 // indirect gopkg.in/resty.v1 v1.12.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.22.2 // indirect k8s.io/apimachinery v0.22.2 // indirect k8s.io/client-go v0.22.2 // indirect diff --git a/go.sum b/go.sum index 412e7d9aca32d..146008c4195a8 100644 --- a/go.sum +++ b/go.sum @@ -200,8 +200,6 @@ github.com/Sectorbob/mlab-ns2 v0.0.0-20171030222938-d3aa0c295a8a/go.mod h1:D73UA github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/aerospike/aerospike-client-go/v5 v5.6.0 h1:tRxcUq0HY8fFPQEzF3EgrknF+w1xFO0YDfUb9Nm8yRI= @@ -636,8 +634,8 @@ github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= -github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -773,8 +771,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= @@ -1257,6 +1256,8 @@ github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/linode/linodego v0.7.1 h1:4WZmMpSA2NRwlPZcc0+4Gyn7rr99Evk9bnr0B3gXRKE= github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -1503,6 +1504,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/pquerna/cachecontrol v0.1.0 h1:yJMy84ti9h/+OEWa752kBTKv4XC30OtVVHYv/8cTqKc= github.com/pquerna/cachecontrol v0.1.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= @@ -1593,8 +1596,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/sethvargo/go-limiter v0.7.1 h1:wWNhTj0pxjyJ7wuJHpRJpYwJn+bUnjYfw2a85eu5w9U= github.com/sethvargo/go-limiter v0.7.1/go.mod h1:C0kbSFbiriE5k2FFOe18M1YZbAR2Fiwf72uGu0CXCcU= -github.com/shirou/gopsutil v3.21.5+incompatible h1:OloQyEerMi7JUrXiNzy8wQ5XN+baemxSl12QgIzt0jc= -github.com/shirou/gopsutil v3.21.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v3 v3.22.6 h1:FnHOFOh+cYAM0C30P+zysPISzlknLC5Z1G4EAElznfQ= +github.com/shirou/gopsutil/v3 v3.22.6/go.mod h1:EdIubSnZhbAvBS1yJ7Xi+AShB/hxwLHOMz4MCYz7yMs= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -1644,8 +1647,9 @@ github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1Sd github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1653,8 +1657,9 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q= +github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1663,10 +1668,10 @@ github.com/tencentcloud/tencentcloud-sdk-go v1.0.162 h1:8fDzz4GuVg4skjY2B0nMN7h6 github.com/tencentcloud/tencentcloud-sdk-go v1.0.162/go.mod h1:asUz5BPXxgoPGaRgZaVm1iGcUAuHyYUo1nXqKa83cvI= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo= -github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= -github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ= -github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= +github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= +github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= +github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= +github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -1723,6 +1728,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLCur2yWnJzwQEKRcAHXo6seXGuSwWw= github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= @@ -2077,6 +2084,7 @@ golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2100,7 +2108,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2119,8 +2126,8 @@ golang.org/x/sys v0.0.0-20220207234003-57398862261d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151150-f9599da83cde h1:ttKrTSEOImskD10FmFBoF40Aeu7QwHhZDU1st9oVtMM= -golang.org/x/sys v0.0.0-20220520151150-f9599da83cde/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2486,8 +2493,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/helper/hostutil/hostinfo.go b/helper/hostutil/hostinfo.go index ed8e648f6e628..57eafd92dddeb 100644 --- a/helper/hostutil/hostinfo.go +++ b/helper/hostutil/hostinfo.go @@ -8,10 +8,10 @@ import ( "time" "github.com/hashicorp/go-multierror" - "github.com/shirou/gopsutil/cpu" - "github.com/shirou/gopsutil/disk" - "github.com/shirou/gopsutil/host" - "github.com/shirou/gopsutil/mem" + "github.com/shirou/gopsutil/v3/cpu" + "github.com/shirou/gopsutil/v3/disk" + "github.com/shirou/gopsutil/v3/host" + "github.com/shirou/gopsutil/v3/mem" ) // HostInfo holds all the information that gets captured on the host. The diff --git a/physical/raft/bolt_linux.go b/physical/raft/bolt_linux.go index 03db74bc475c0..4ea13e2a39860 100644 --- a/physical/raft/bolt_linux.go +++ b/physical/raft/bolt_linux.go @@ -4,7 +4,7 @@ import ( "context" "os" - "github.com/shirou/gopsutil/mem" + "github.com/shirou/gopsutil/v3/mem" "golang.org/x/sys/unix" ) diff --git a/vault/diagnose/os_common.go b/vault/diagnose/os_common.go index 896a4df69a132..258c874e1c3ed 100644 --- a/vault/diagnose/os_common.go +++ b/vault/diagnose/os_common.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/dustin/go-humanize" - "github.com/shirou/gopsutil/disk" + "github.com/shirou/gopsutil/v3/disk" ) func diskUsage(ctx context.Context) error { From 7bc504a91741e0f3d69fe2d47ffbb6fb4368949b Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Mon, 18 Jul 2022 15:34:52 -0700 Subject: [PATCH 2/4] Adds v2 field names in host-info response to allow eventual deprecation in favor of v3 field names --- helper/hostutil/hostinfo.go | 45 +++++++++++++++++++++++----- helper/hostutil/hostinfo_util.go | 51 ++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 20 deletions(-) diff --git a/helper/hostutil/hostinfo.go b/helper/hostutil/hostinfo.go index 57eafd92dddeb..4e9ecb4a2e777 100644 --- a/helper/hostutil/hostinfo.go +++ b/helper/hostutil/hostinfo.go @@ -28,10 +28,10 @@ type HostInfo struct { Disk []*disk.UsageStat `json:"disk"` // Host returns general host information such as hostname, platform, uptime, // kernel version, etc. - Host *host.InfoStat `json:"host"` + Host *HostInfoStat `json:"host"` // Memory contains statistics about the memory such as total, available, and // used memory in number of bytes. - Memory *mem.VirtualMemoryStat `json:"memory"` + Memory *VirtualMemoryStat `json:"memory"` } // CollectHostInfo returns information on the host, which includes general @@ -44,13 +44,13 @@ func CollectHostInfo(ctx context.Context) (*HostInfo, error) { var retErr *multierror.Error info := &HostInfo{Timestamp: time.Now().UTC()} - if h, err := host.InfoWithContext(ctx); err != nil { + if h, err := CollectHostInfoStat(ctx); err != nil { retErr = multierror.Append(retErr, &HostInfoError{"host", err}) } else { info.Host = h } - if v, err := mem.VirtualMemoryWithContext(ctx); err != nil { + if v, err := CollectHostMemory(ctx); err != nil { retErr = multierror.Append(retErr, &HostInfoError{"memory", err}) } else { info.Memory = v @@ -96,9 +96,38 @@ func CollectHostMemory(ctx context.Context) (*VirtualMemoryStat, error) { } return &VirtualMemoryStat{ - Total: m.Total, - Available: m.Available, - Used: m.Used, - UsedPercent: m.UsedPercent, + VirtualMemoryStat: m, + // Fields below are added to maintain backwards compatibility with gopsutil v2 + CommitLimit: m.CommitLimit, + CommittedAS: m.CommittedAS, + HighFree: m.HighFree, + HighTotal: m.HighTotal, + HugePagesFree: m.HugePagesFree, + HugePageSize: m.HugePageSize, + HugePagesTotal: m.HugePagesTotal, + LowFree: m.LowFree, + LowTotal: m.LowTotal, + PageTables: m.PageTables, + SwapCached: m.SwapCached, + SwapFree: m.SwapFree, + SwapTotal: m.SwapTotal, + VMallocChunk: m.VmallocChunk, + VMallocTotal: m.VmallocTotal, + VMallocUsed: m.VmallocUsed, + Writeback: m.WriteBack, + WritebackTmp: m.WriteBackTmp, + }, nil +} + +func CollectHostInfoStat(ctx context.Context) (*HostInfoStat, error) { + h, err := host.InfoWithContext(ctx) + if err != nil { + return nil, err + } + + return &HostInfoStat{ + InfoStat: h, + // Fields below are added to maintain backwards compatibility with gopsutil v2 + HostID: h.HostID, }, nil } diff --git a/helper/hostutil/hostinfo_util.go b/helper/hostutil/hostinfo_util.go index 114f596f9abab..b3aeffebec307 100644 --- a/helper/hostutil/hostinfo_util.go +++ b/helper/hostutil/hostinfo_util.go @@ -1,24 +1,51 @@ package hostutil +import ( + "github.com/shirou/gopsutil/v3/host" + "github.com/shirou/gopsutil/v3/mem" +) + // VirutalMemoryStat holds commonly used memory measurements. We must have a // local type here in order to avoid building the gopsutil library on certain // arch types. type VirtualMemoryStat struct { - // Total amount of RAM on this system - Total uint64 + *mem.VirtualMemoryStat - // RAM available for programs to allocate + // A subset of JSON struct tags in mem.VirtualMemoryStat were changed in a backwards + // incompatible way in the v3 release of gopsutil. The fields below are copied from + // v2 of gopsutil to maintain backwards compatibility in the Vault host-info API. // - // This value is computed from the kernel specific values. - Available uint64 + // The following details the changed JSON struct tags between v2 and v3: + // https://github.com/shirou/gopsutil/blob/master/_tools/v3migration/v3migration.sh#L61 + CommitLimit uint64 `json:"commitlimit"` + CommittedAS uint64 `json:"committedas"` + HighFree uint64 `json:"highfree"` + HighTotal uint64 `json:"hightotal"` + HugePagesFree uint64 `json:"hugepagesfree"` + HugePageSize uint64 `json:"hugepagesize"` + HugePagesTotal uint64 `json:"hugepagestotal"` + LowFree uint64 `json:"lowfree"` + LowTotal uint64 `json:"lowtotal"` + PageTables uint64 `json:"pagetables"` + SwapCached uint64 `json:"swapcached"` + SwapFree uint64 `json:"swapfree"` + SwapTotal uint64 `json:"swaptotal"` + VMallocChunk uint64 `json:"vmallocchunk"` + VMallocTotal uint64 `json:"vmalloctotal"` + VMallocUsed uint64 `json:"vmallocused"` + Writeback uint64 `json:"writeback"` + WritebackTmp uint64 `json:"writebacktmp"` +} - // RAM used by programs - // - // This value is computed from the kernel specific values. - Used uint64 +// A HostInfoStat describes the host status. +type HostInfoStat struct { + *host.InfoStat - // Percentage of RAM used by programs + // A subset of JSON struct tags in host.InfoStat were changed in a backwards + // incompatible way in the v3 release of gopsutil. The fields below are copied from + // v2 of gopsutil to maintain backwards compatibility in the Vault host-info API. // - // This value is computed from the kernel specific values. - UsedPercent float64 + // The following details the changed JSON struct tags between v2 and v3: + // https://github.com/shirou/gopsutil/blob/master/_tools/v3migration/v3migration.sh#L72 + HostID string `json:"hostid"` } From 879df9ddca74dfffdf6df5e467ba93ef3bec4fd0 Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Wed, 20 Jul 2022 15:35:43 -0700 Subject: [PATCH 3/4] Map v3 to v2 field names to keep host-info api compat --- helper/hostutil/hostinfo.go | 57 +++++++++++----- helper/hostutil/hostinfo_util.go | 112 ++++++++++++++++++++++--------- 2 files changed, 120 insertions(+), 49 deletions(-) diff --git a/helper/hostutil/hostinfo.go b/helper/hostutil/hostinfo.go index 4e9ecb4a2e777..d35afb57d900a 100644 --- a/helper/hostutil/hostinfo.go +++ b/helper/hostutil/hostinfo.go @@ -96,26 +96,41 @@ func CollectHostMemory(ctx context.Context) (*VirtualMemoryStat, error) { } return &VirtualMemoryStat{ - VirtualMemoryStat: m, - // Fields below are added to maintain backwards compatibility with gopsutil v2 + Total: m.Total, + Available: m.Available, + Used: m.Used, + UsedPercent: m.UsedPercent, + Free: m.Free, + Active: m.Active, + Inactive: m.Inactive, + Wired: m.Wired, + Laundry: m.Laundry, + Buffers: m.Buffers, + Cached: m.Cached, + Writeback: m.WriteBack, + Dirty: m.Dirty, + WritebackTmp: m.WriteBackTmp, + Shared: m.Shared, + Slab: m.Slab, + SReclaimable: m.Sreclaimable, + SUnreclaim: m.Sunreclaim, + PageTables: m.PageTables, + SwapCached: m.SwapCached, CommitLimit: m.CommitLimit, CommittedAS: m.CommittedAS, - HighFree: m.HighFree, HighTotal: m.HighTotal, - HugePagesFree: m.HugePagesFree, - HugePageSize: m.HugePageSize, - HugePagesTotal: m.HugePagesTotal, - LowFree: m.LowFree, + HighFree: m.HighFree, LowTotal: m.LowTotal, - PageTables: m.PageTables, - SwapCached: m.SwapCached, - SwapFree: m.SwapFree, + LowFree: m.LowFree, SwapTotal: m.SwapTotal, - VMallocChunk: m.VmallocChunk, + SwapFree: m.SwapFree, + Mapped: m.Mapped, VMallocTotal: m.VmallocTotal, VMallocUsed: m.VmallocUsed, - Writeback: m.WriteBack, - WritebackTmp: m.WriteBackTmp, + VMallocChunk: m.VmallocChunk, + HugePagesTotal: m.HugePagesTotal, + HugePagesFree: m.HugePagesFree, + HugePageSize: m.HugePageSize, }, nil } @@ -126,8 +141,18 @@ func CollectHostInfoStat(ctx context.Context) (*HostInfoStat, error) { } return &HostInfoStat{ - InfoStat: h, - // Fields below are added to maintain backwards compatibility with gopsutil v2 - HostID: h.HostID, + Hostname: h.Hostname, + Uptime: h.Uptime, + BootTime: h.BootTime, + Procs: h.Procs, + OS: h.OS, + Platform: h.Platform, + PlatformFamily: h.PlatformFamily, + PlatformVersion: h.PlatformVersion, + KernelVersion: h.KernelVersion, + KernelArch: h.KernelArch, + VirtualizationSystem: h.VirtualizationSystem, + VirtualizationRole: h.VirtualizationRole, + HostID: h.HostID, }, nil } diff --git a/helper/hostutil/hostinfo_util.go b/helper/hostutil/hostinfo_util.go index b3aeffebec307..ddf763ea53e68 100644 --- a/helper/hostutil/hostinfo_util.go +++ b/helper/hostutil/hostinfo_util.go @@ -1,51 +1,97 @@ package hostutil -import ( - "github.com/shirou/gopsutil/v3/host" - "github.com/shirou/gopsutil/v3/mem" -) - -// VirutalMemoryStat holds commonly used memory measurements. We must have a +// VirtualMemoryStat holds commonly used memory measurements. We must have a // local type here in order to avoid building the gopsutil library on certain // arch types. +// +// This struct is copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/mem/mem.go#L15 +// to maintain backwards compatibility in the Vault host-info API. This is done because +// gopsutil changed JSON struct tags between its v2 and v3 releases. For details see +// https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. type VirtualMemoryStat struct { - *mem.VirtualMemoryStat + // Total amount of RAM on this system + Total uint64 `json:"total"` + + // RAM available for programs to allocate + // + // This value is computed from the kernel specific values. + Available uint64 `json:"available"` + + // RAM used by programs + // + // This value is computed from the kernel specific values. + Used uint64 `json:"used"` - // A subset of JSON struct tags in mem.VirtualMemoryStat were changed in a backwards - // incompatible way in the v3 release of gopsutil. The fields below are copied from - // v2 of gopsutil to maintain backwards compatibility in the Vault host-info API. + // Percentage of RAM used by programs // - // The following details the changed JSON struct tags between v2 and v3: - // https://github.com/shirou/gopsutil/blob/master/_tools/v3migration/v3migration.sh#L61 + // This value is computed from the kernel specific values. + UsedPercent float64 `json:"usedPercent"` + + // This is the kernel's notion of free memory; RAM chips whose bits nobody + // cares about the value of right now. For a human consumable number, + // Available is what you really want. + Free uint64 `json:"free"` + + // OS X / BSD specific numbers: + // http://www.macyourself.com/2010/02/17/what-is-free-wired-active-and-inactive-system-memory-ram/ + Active uint64 `json:"active"` + Inactive uint64 `json:"inactive"` + Wired uint64 `json:"wired"` + + // FreeBSD specific numbers: + // https://reviews.freebsd.org/D8467 + Laundry uint64 `json:"laundry"` + + // Linux specific numbers + // https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html + // https://www.kernel.org/doc/Documentation/filesystems/proc.txt + // https://www.kernel.org/doc/Documentation/vm/overcommit-accounting + Buffers uint64 `json:"buffers"` + Cached uint64 `json:"cached"` + Writeback uint64 `json:"writeback"` + Dirty uint64 `json:"dirty"` + WritebackTmp uint64 `json:"writebacktmp"` + Shared uint64 `json:"shared"` + Slab uint64 `json:"slab"` + SReclaimable uint64 `json:"sreclaimable"` + SUnreclaim uint64 `json:"sunreclaim"` + PageTables uint64 `json:"pagetables"` + SwapCached uint64 `json:"swapcached"` CommitLimit uint64 `json:"commitlimit"` CommittedAS uint64 `json:"committedas"` - HighFree uint64 `json:"highfree"` HighTotal uint64 `json:"hightotal"` - HugePagesFree uint64 `json:"hugepagesfree"` - HugePageSize uint64 `json:"hugepagesize"` - HugePagesTotal uint64 `json:"hugepagestotal"` - LowFree uint64 `json:"lowfree"` + HighFree uint64 `json:"highfree"` LowTotal uint64 `json:"lowtotal"` - PageTables uint64 `json:"pagetables"` - SwapCached uint64 `json:"swapcached"` - SwapFree uint64 `json:"swapfree"` + LowFree uint64 `json:"lowfree"` SwapTotal uint64 `json:"swaptotal"` - VMallocChunk uint64 `json:"vmallocchunk"` + SwapFree uint64 `json:"swapfree"` + Mapped uint64 `json:"mapped"` VMallocTotal uint64 `json:"vmalloctotal"` VMallocUsed uint64 `json:"vmallocused"` - Writeback uint64 `json:"writeback"` - WritebackTmp uint64 `json:"writebacktmp"` + VMallocChunk uint64 `json:"vmallocchunk"` + HugePagesTotal uint64 `json:"hugepagestotal"` + HugePagesFree uint64 `json:"hugepagesfree"` + HugePageSize uint64 `json:"hugepagesize"` } -// A HostInfoStat describes the host status. +// HostInfoStat describes the host status. +// +// This struct is copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/host/host.go#L17 +// to maintain backwards compatibility in the Vault host-info API. This is done because +// gopsutil changed JSON struct tags between its v2 and v3 releases. For details see +// https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. type HostInfoStat struct { - *host.InfoStat - - // A subset of JSON struct tags in host.InfoStat were changed in a backwards - // incompatible way in the v3 release of gopsutil. The fields below are copied from - // v2 of gopsutil to maintain backwards compatibility in the Vault host-info API. - // - // The following details the changed JSON struct tags between v2 and v3: - // https://github.com/shirou/gopsutil/blob/master/_tools/v3migration/v3migration.sh#L72 - HostID string `json:"hostid"` + Hostname string `json:"hostname"` + Uptime uint64 `json:"uptime"` + BootTime uint64 `json:"bootTime"` + Procs uint64 `json:"procs"` + OS string `json:"os"` + Platform string `json:"platform"` + PlatformFamily string `json:"platformFamily"` + PlatformVersion string `json:"platformVersion"` + KernelVersion string `json:"kernelVersion"` + KernelArch string `json:"kernelArch"` + VirtualizationSystem string `json:"virtualizationSystem"` + VirtualizationRole string `json:"virtualizationRole"` + HostID string `json:"hostid"` } From 1d40ffbcbf1c56412fd7a2e4d1d4eed827244326 Mon Sep 17 00:00:00 2001 From: Austin Gebauer Date: Wed, 20 Jul 2022 16:10:29 -0700 Subject: [PATCH 4/4] copy gopsutil license into source --- helper/hostutil/hostinfo_util.go | 43 ++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/helper/hostutil/hostinfo_util.go b/helper/hostutil/hostinfo_util.go index ddf763ea53e68..8811746fd8178 100644 --- a/helper/hostutil/hostinfo_util.go +++ b/helper/hostutil/hostinfo_util.go @@ -1,13 +1,41 @@ +// Copyright (c) 2014, WAKAYAMA Shirou +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the gopsutil authors nor the names of its contributors +// may be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/mem/mem.go#L15 +// Copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/host/host.go#L17 + package hostutil // VirtualMemoryStat holds commonly used memory measurements. We must have a // local type here in order to avoid building the gopsutil library on certain // arch types. // -// This struct is copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/mem/mem.go#L15 -// to maintain backwards compatibility in the Vault host-info API. This is done because -// gopsutil changed JSON struct tags between its v2 and v3 releases. For details see -// https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. +// This struct is copied to maintain backwards compatibility in the Vault host-info API. +// This is done because gopsutil changed JSON struct tags between its v2 and v3 releases. +// For details see https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. type VirtualMemoryStat struct { // Total amount of RAM on this system Total uint64 `json:"total"` @@ -76,10 +104,9 @@ type VirtualMemoryStat struct { // HostInfoStat describes the host status. // -// This struct is copied from https://github.com/shirou/gopsutil/blob/b49f37e9f30f49530cf2ad6038a4dac1b746c8f7/host/host.go#L17 -// to maintain backwards compatibility in the Vault host-info API. This is done because -// gopsutil changed JSON struct tags between its v2 and v3 releases. For details see -// https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. +// This struct is copied to maintain backwards compatibility in the Vault host-info API. +// This is done because gopsutil changed JSON struct tags between its v2 and v3 releases. +// For details see https://github.com/shirou/gopsutil/tree/master/_tools/v3migration. type HostInfoStat struct { Hostname string `json:"hostname"` Uptime uint64 `json:"uptime"`