Skip to content

Commit c4a7a49

Browse files
committed
Bump microsoft/wmi
1 parent 605d478 commit c4a7a49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+866
-193
lines changed

.github/workflows/windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
integration_tests:
55
strategy:
66
matrix:
7-
go: ['1.22']
7+
go: ['1.24']
88
platform: [windows-latest]
99
runs-on: ${{ matrix.platform }}
1010
steps:
@@ -51,7 +51,7 @@ jobs:
5151
unit_tests:
5252
strategy:
5353
matrix:
54-
go: ['1.22']
54+
go: ['1.24']
5555
platform: [windows-latest]
5656
runs-on: ${{ matrix.platform }}
5757
steps:
@@ -69,7 +69,7 @@ jobs:
6969
bump_version_test:
7070
strategy:
7171
matrix:
72-
go: ['1.22']
72+
go: ['1.24']
7373
platform: [ubuntu-latest]
7474
runs-on: ${{ matrix.platform }}
7575
steps:

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ CSI_PROXY_API_GEN = $(BUILD_DIR)/csi-proxy-api-gen
1515
# overrides the $(CMDS:%=build-%) rule in release-tools/build.make because this project is not compatible with go >1.23
1616
# TODO: remove this override as part of https://github.com/kubernetes-csi/csi-proxy/issues/361
1717
build-csi-proxy: check-go-version-go
18-
# Checks that the go version is 1.22 or lower
19-
if (( "$$(go version | awk '{print $3}' | sed 's/go//' | cut -d'.' -f2)" > 22 )); then echo "This project requires go 1.22 or lower"; exit 1; fi;
2018
mkdir -p bin
2119
# os_arch_seen captures all of the $$os-$$arch-$$buildx_platform seen for the current binary
2220
# that we want to build, if we've seen an $$os-$$arch-$$buildx_platform before it means that

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/kubernetes-csi/csi-proxy
33
// NOTE: This project must be built with go < 1.23
44
// `make build` will error if go1.23 or higher is used.
55

6-
go 1.22.0
6+
go 1.24.3
77

8-
toolchain go1.22.3
8+
toolchain go1.24.4
99

1010
require (
1111
github.com/Microsoft/go-winio v0.6.2
@@ -14,13 +14,13 @@ require (
1414
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
1515
github.com/iancoleman/strcase v0.3.0
1616
github.com/kubernetes-csi/csi-proxy/client v1.1.3
17-
github.com/microsoft/wmi v0.25.1
17+
github.com/microsoft/wmi v0.31.2
1818
github.com/pkg/errors v0.9.1
1919
github.com/prometheus/client_golang v1.20.5
2020
github.com/sergi/go-diff v1.3.1
2121
github.com/spf13/pflag v1.0.5
2222
github.com/stretchr/testify v1.10.0
23-
golang.org/x/sys v0.28.0
23+
golang.org/x/sys v0.32.0
2424
google.golang.org/grpc v1.69.2
2525
google.golang.org/protobuf v1.36.0
2626
k8s.io/component-base v0.28.4

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
7171
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
7272
github.com/mauriciopoppe/gengo v0.0.0-20210525224835-9c78f58f3486 h1:+l047vEi0SyAzdVToIaAcfoY5DwwGW+OyqTdH/P3TTg=
7373
github.com/mauriciopoppe/gengo v0.0.0-20210525224835-9c78f58f3486/go.mod h1:xXv3T4UXTLta31wMhVezwVkc26OLei4hMbLeBJbPmxc=
74-
github.com/microsoft/wmi v0.25.1 h1:sQv9hCEHtW5K6yEVL78T6XGRMGxk4aTpcJwCiB5rLN0=
75-
github.com/microsoft/wmi v0.25.1/go.mod h1:1zbdSF0A+5OwTUII5p3hN7/K6KF2m3o27pSG6Y51VU8=
74+
github.com/microsoft/wmi v0.31.2 h1:yRu5Jys/vedyV7aHb/mR2HA0n9WECi3CFw+af4CdR5k=
75+
github.com/microsoft/wmi v0.31.2/go.mod h1:uImvBuQss3NEnzU5bcwq0DsUh54seU3Sl//oBn62LDw=
7676
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
7777
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
7878
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -139,8 +139,8 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h
139139
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
140140
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
141141
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
142-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
143-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
142+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
143+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
144144
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
145145
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
146146
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=

pkg/cim/wmi.go

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"runtime"
1010

1111
"github.com/go-ole/go-ole"
12-
"github.com/go-ole/go-ole/oleutil"
1312
"github.com/microsoft/wmi/pkg/base/query"
1413
wmierrors "github.com/microsoft/wmi/pkg/errors"
1514
cim "github.com/microsoft/wmi/pkg/wmiinstance"
@@ -91,105 +90,6 @@ func QueryInstances(namespace string, query *query.WmiQuery) ([]*cim.WmiInstance
9190
return instances, err
9291
}
9392

94-
// TODO: fix the panic in microsoft/wmi library and remove this workaround
95-
// Refer to https://github.com/microsoft/wmi/issues/167
96-
func executeClassMethodParam(classInst *cim.WmiInstance, method *cim.WmiMethod, inParam, outParam cim.WmiMethodParamCollection) (result *cim.WmiMethodResult, err error) {
97-
klog.V(6).Infof("[WMI] - Executing Method [%s]\n", method.Name)
98-
99-
iDispatchInstance := classInst.GetIDispatch()
100-
if iDispatchInstance == nil {
101-
return nil, wmierrors.Wrapf(wmierrors.InvalidInput, "InvalidInstance")
102-
}
103-
rawResult, err := iDispatchInstance.GetProperty("Methods_")
104-
if err != nil {
105-
return nil, err
106-
}
107-
defer rawResult.Clear()
108-
// Retrieve the method
109-
rawMethod, err := rawResult.ToIDispatch().CallMethod("Item", method.Name)
110-
if err != nil {
111-
return nil, err
112-
}
113-
defer rawMethod.Clear()
114-
115-
addInParam := func(inparamVariant *ole.VARIANT, paramName string, paramValue interface{}) error {
116-
rawProperties, err := inparamVariant.ToIDispatch().GetProperty("Properties_")
117-
if err != nil {
118-
return err
119-
}
120-
defer rawProperties.Clear()
121-
rawProperty, err := rawProperties.ToIDispatch().CallMethod("Item", paramName)
122-
if err != nil {
123-
return err
124-
}
125-
defer rawProperty.Clear()
126-
127-
p, err := rawProperty.ToIDispatch().PutProperty("Value", paramValue)
128-
if err != nil {
129-
return err
130-
}
131-
defer p.Clear()
132-
return nil
133-
}
134-
135-
params := []interface{}{method.Name}
136-
if len(inParam) > 0 {
137-
inparamsRaw, err := rawMethod.ToIDispatch().GetProperty("InParameters")
138-
if err != nil {
139-
return nil, err
140-
}
141-
defer inparamsRaw.Clear()
142-
143-
inparams, err := oleutil.CallMethod(inparamsRaw.ToIDispatch(), "SpawnInstance_")
144-
if err != nil {
145-
return nil, err
146-
}
147-
defer inparams.Clear()
148-
149-
for _, inp := range inParam {
150-
addInParam(inparams, inp.Name, inp.Value)
151-
}
152-
153-
params = append(params, inparams)
154-
}
155-
156-
result = &cim.WmiMethodResult{
157-
OutMethodParams: map[string]*cim.WmiMethodParam{},
158-
}
159-
outparams, err := classInst.GetIDispatch().CallMethod("ExecMethod_", params...)
160-
if err != nil {
161-
return
162-
}
163-
defer outparams.Clear()
164-
returnRaw, err := outparams.ToIDispatch().GetProperty("ReturnValue")
165-
if err != nil {
166-
return
167-
}
168-
defer returnRaw.Clear()
169-
if returnRaw.Value() != nil {
170-
result.ReturnValue = returnRaw.Value().(int32)
171-
klog.V(6).Infof("[WMI] - Return [%d] ", result.ReturnValue)
172-
}
173-
174-
for _, outp := range outParam {
175-
returnRawIn, err1 := outparams.ToIDispatch().GetProperty(outp.Name)
176-
if err1 != nil {
177-
err = err1
178-
return
179-
}
180-
defer returnRawIn.Clear()
181-
182-
value, err1 := cim.GetVariantValue(returnRawIn)
183-
if err1 != nil {
184-
err = err1
185-
return
186-
}
187-
188-
result.OutMethodParams[outp.Name] = cim.NewWmiMethodParam(outp.Name, value)
189-
}
190-
return
191-
}
192-
19393
// InvokeCimMethod calls a static method on a specific WMI class with given input parameters,
19494
// returning the method's return value, output parameters, and any error encountered.
19595
func InvokeCimMethod(namespace, class, methodName string, inputParameters map[string]interface{}) (int, map[string]interface{}, error) {
@@ -225,7 +125,7 @@ func InvokeCimMethod(namespace, class, methodName string, inputParameters map[st
225125

226126
var outParam cim.WmiMethodParamCollection
227127
var result *cim.WmiMethodResult
228-
result, err = executeClassMethodParam(classInst, method, inParam, outParam)
128+
result, err = method.Execute(inParam, outParam)
229129
if err != nil {
230130
return -1, nil, err
231131
}

scripts/run-integration.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ pkgdir=${GOPATH}/src/github.com/kubernetes-csi/csi-proxy
1818
source $pkgdir/scripts/utils.sh
1919

2020
main() {
21-
# TODO: remove go version pin as part of https://github.com/kubernetes-csi/csi-proxy/issues/361
22-
wget -q https://go.dev/dl/go1.22.12.linux-amd64.tar.gz
23-
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz
24-
2521
compile_csi_proxy
2622
compile_csi_proxy_integration_tests
2723
sync_csi_proxy

vendor/github.com/microsoft/wmi/pkg/base/instance/instancemanager.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/microsoft/wmi/pkg/errors/errors.go

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/microsoft/wmi/pkg/wmiinstance/WmiMethod.go

Lines changed: 24 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/auxv.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/auxv_unsupported.go

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)