Skip to content

Commit 85651f1

Browse files
authored
upgrade go-libvirt to latest revision (@8648fbd) (digitalocean#180)
This involves some additional changes to overcome breaking changes from go-libvirt. These are the new changes in this revision of go-libvirt since the last release go-qemu has been using: * remove invitation to empty IRC channel * rpc_test: use Libvirt.addStream to add streams * MockLibvirt: deep-copy response before adding ID * monitor socket conn state in initLibvirtComms * libvirttest: use atomic to read "serial" * integration: wait for Disconnected before assert * add CODEOWNERS * Merge pull request digitalocean#152 from clarkwalcott/readme_update_rpc_link * Docs: Update README with working link * expose Libvirt.Disconnected method * Add NetworkUpdateCompat * update libvirt configuration step for new releases * search generated include directory for header files * ci updates (digitalocean#142) * integration tests (digitalocean#141) * take dialer as input instead of already existing connection (digitalocean#140) * support authentication via polkit (digitalocean#138) * fix some stream problems (digitalocean#137) * Merge pull request digitalocean#136 from digitalocean/jenni/fix_potential_segfault * write lock only needed for actual write * rm unneeded nil'ing of reader and writer * socket Disconnect close can race with nil of conn * Merge pull request digitalocean#135 from digitalocean/jenni/update_cgo * run go get golang.org/x/tools/go/internal/[email protected] * Merge pull request digitalocean#134 from digitalocean/jenni/add_socket_type * change socket to pointer ref * Merge branch 'master' of github.com:digitalocean/go-libvirt into jenni/add_socket_type * Merge pull request digitalocean#133 from digitalocean/jenni/fix_event_unsubscribe_race * reorder stream shutdown/delete * fix race in disconnect of event stream cleanup * add socket type to handle socket connection management * Merge pull request digitalocean#132 from digitalocean/jenni/fix_client_deadlock * fix typo and func conciseness * move listen and cleanup into a func * add timeout on waiting for disconnected * move temporary read error check to a function * Libvirt chan socketCleanupDone -> disconnected * fix accidental go fmt of generated files * add connect/disconnect to unit tests * add tests for callback cleanup on connection disconnect * fix rpc lookup test * fix deadlocked clients on lack of libvirt response * add more robust connection error checking * Merge pull request digitalocean#131 from digitalocean/jenni/fix_invalid_test_data * fix incorrect test data * Merge pull request digitalocean#130 from digitalocean/jenni/stream_shutdown * fix missing stream shutdown in lifecycle subscribe * Merge pull request digitalocean#129 from digitalocean/geoff/vet-cleanup * remove travis config file * Clean up some linter errors * Merge pull request digitalocean#125 from dmacvicar/dmacvicar_puberror * Run generators against libvirt 7.2.0 * Unexport From* (ErrorDomain) * golint * go fmt * libvirt.Error: expose only Code and Message * Run generators against libvirt 7.1.0 * go fmt * Make libvirtError public (libvirt.Error) * github actions (digitalocean#128) * internal/event/stream: fixes unsafe queue access (digitalocean#127) * Merge pull request digitalocean#124 from sam-github/check-wrapped-errors * Check wrapped errors for IsNotFound() * Fix two race conditions related to Disconnect (digitalocean#120) * Merge pull request digitalocean#119 from weizhouapache/readme-add-tls-port * README: Add missing tls port in example * README: Add example connect to libvirt via TLS over TCP (digitalocean#118) * Add overload for Connect() to allow other libvirt drivers (digitalocean#117)
1 parent 9bde4c7 commit 85651f1

File tree

4 files changed

+65
-27
lines changed

4 files changed

+65
-27
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/digitalocean/go-qemu
33
go 1.15
44

55
require (
6-
github.com/digitalocean/go-libvirt v0.0.0-20201209184759-e2a69bcd5bd1
6+
github.com/digitalocean/go-libvirt v0.0.0-20220804181439-8648fbde413e
77
github.com/fatih/camelcase v1.0.0
8-
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
8+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007
99
)

go.sum

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/digitalocean/go-libvirt v0.0.0-20201209184759-e2a69bcd5bd1 h1:j6vGflaQ2T7yOWqVgPdiRF73j/U2Zmpbbzab8nyDCRQ=
4-
github.com/digitalocean/go-libvirt v0.0.0-20201209184759-e2a69bcd5bd1/go.mod h1:QS1XzqZLcDniNYrN7EZefq3wIyb/M2WmJbql4ZKoc1Q=
3+
github.com/digitalocean/go-libvirt v0.0.0-20220704152101-6d260d9c16a3 h1:Xo40yaf991bC6M6cPWGmmoWyP67JxtKd9PpBv01rivY=
4+
github.com/digitalocean/go-libvirt v0.0.0-20220704152101-6d260d9c16a3/go.mod h1:o129ljs6alsIQTc8d6eweihqpmmrbxZ2g1jhgjhPykI=
5+
github.com/digitalocean/go-libvirt v0.0.0-20220802191312-ca9ffa5e873e h1:n2CI8AXLnveCM2KuI10OKN4GRyEdEm4217vYueKpTmo=
6+
github.com/digitalocean/go-libvirt v0.0.0-20220802191312-ca9ffa5e873e/go.mod h1:o129ljs6alsIQTc8d6eweihqpmmrbxZ2g1jhgjhPykI=
7+
github.com/digitalocean/go-libvirt v0.0.0-20220804180232-c811be39ab76 h1:HawPl7MaY81IvYgjeR3ND/9an0zCvnGf81sglNb3ePc=
8+
github.com/digitalocean/go-libvirt v0.0.0-20220804180232-c811be39ab76/go.mod h1:o129ljs6alsIQTc8d6eweihqpmmrbxZ2g1jhgjhPykI=
9+
github.com/digitalocean/go-libvirt v0.0.0-20220804181439-8648fbde413e h1:SCnqm8SjSa0QqRxXbo5YY//S+OryeJioe17nK+iDZpg=
10+
github.com/digitalocean/go-libvirt v0.0.0-20220804181439-8648fbde413e/go.mod h1:o129ljs6alsIQTc8d6eweihqpmmrbxZ2g1jhgjhPykI=
511
github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
612
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
713
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
814
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
915
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
1016
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
1117
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
12-
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
18+
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
1319
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1420
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
15-
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
16-
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
17-
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
21+
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
1822
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
1923
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
20-
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
24+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
2125
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
22-
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
26+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
2327
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2428
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
25-
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
26-
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
27-
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
28-
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
29+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
30+
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
31+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
32+
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
33+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
2934
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
35+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
36+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
3037
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
31-
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d h1:F3OmlXCzYtG9YE6tXDnUOlJBzVzHF8EcmZ1yTJlcgIk=
32-
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
38+
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
3339
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3440
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
35-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
36-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
41+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3742
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3843
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3944
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=

hypervisor/rpc_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import (
2424

2525
var hvConn = func() (net.Conn, error) {
2626
m := libvirttest.New()
27-
return m, nil
27+
conn, err := m.Dial()
28+
return conn, err
2829
}
2930

3031
func TestRPCDriverDomainNames(t *testing.T) {

qmp/rpc_test.go

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ var testEvent = []byte{
6969
}
7070

7171
func TestNewLibvirtRPCMonitor(t *testing.T) {
72-
conn := libvirttest.New()
72+
lv := libvirttest.New()
73+
conn, err := lv.Dial()
74+
if err != nil {
75+
t.Error(err)
76+
}
7377

7478
domain := "test-1"
7579
rpc := NewLibvirtRPCMonitor(domain, conn)
@@ -118,29 +122,47 @@ func TestQMPEvent(t *testing.T) {
118122
}
119123

120124
func TestLibvirtRPCMonitorConnect(t *testing.T) {
121-
conn := libvirttest.New()
125+
lv := libvirttest.New()
126+
conn, err := lv.Dial()
127+
if err != nil {
128+
t.Error(err)
129+
}
122130
mon := NewLibvirtRPCMonitor("test", conn)
123131

124-
err := mon.Connect()
132+
err = mon.Connect()
125133
if err != nil {
126134
t.Error(err)
127135
}
128136
}
129137

130138
func TestLibvirtRPCMonitorDisconnect(t *testing.T) {
131-
conn := libvirttest.New()
139+
lv := libvirttest.New()
140+
conn, err := lv.Dial()
141+
if err != nil {
142+
t.Error(err)
143+
}
132144
mon := NewLibvirtRPCMonitor("test", conn)
133145

134-
err := mon.Disconnect()
146+
err = mon.Disconnect()
135147
if err != nil {
136148
t.Error(err)
137149
}
138150
}
139151

140152
func TestLibvirtRPCMonitorRun(t *testing.T) {
141-
conn := libvirttest.New()
153+
lv := libvirttest.New()
154+
conn, err := lv.Dial()
155+
if err != nil {
156+
t.Error(err)
157+
}
142158
mon := NewLibvirtRPCMonitor("test", conn)
143159

160+
err = mon.Connect()
161+
if err != nil {
162+
t.Error(err)
163+
}
164+
defer mon.Disconnect()
165+
144166
res, err := mon.Run([]byte(`{"query-version"}`))
145167
if err != nil {
146168
t.Error(err)
@@ -171,8 +193,18 @@ func TestLibvirtRPCMonitorRun(t *testing.T) {
171193

172194
func TestLibvirtRPCMonitorEvents(t *testing.T) {
173195
ctx := context.Background()
174-
conn := libvirttest.New()
196+
lv := libvirttest.New()
197+
conn, err := lv.Dial()
198+
if err != nil {
199+
t.Error(err)
200+
}
175201
mon := NewLibvirtRPCMonitor("test", conn)
202+
err = mon.Connect()
203+
if err != nil {
204+
t.Error(err)
205+
}
206+
defer mon.Disconnect()
207+
176208
done := make(chan struct{})
177209

178210
stream, err := mon.Events(ctx)
@@ -191,7 +223,7 @@ func TestLibvirtRPCMonitorEvents(t *testing.T) {
191223
}()
192224

193225
// send an event to the listener goroutine
194-
_, _ = conn.Test.Write(testEvent)
226+
_, _ = lv.Test.Write(testEvent)
195227

196228
// wait for completion
197229
<-done

0 commit comments

Comments
 (0)