diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 405ea9e092..594be39399 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -1076,7 +1076,7 @@ func (clh *cloudHypervisor) addVSock(cid int64, path string) { "cid": cid, }).Info("Adding HybridVSock") - clh.vmconfig.Vsock = append(clh.vmconfig.Vsock, chclient.VsockConfig{Cid: cid, Sock: path}) + clh.vmconfig.Vsock = chclient.VsockConfig{Cid: cid, Sock: path} } func (clh *cloudHypervisor) addNet(e Endpoint) error { diff --git a/src/runtime/virtcontainers/clh_test.go b/src/runtime/virtcontainers/clh_test.go index af9e966ed5..5f2e6b2811 100644 --- a/src/runtime/virtcontainers/clh_test.go +++ b/src/runtime/virtcontainers/clh_test.go @@ -103,12 +103,8 @@ func TestCloudHypervisorAddVSock(t *testing.T) { clh := cloudHypervisor{} clh.addVSock(1, "path") - assert.Equal(clh.vmconfig.Vsock[0].Cid, int64(1)) - assert.Equal(clh.vmconfig.Vsock[0].Sock, "path") - - clh.addVSock(2, "path2") - assert.Equal(clh.vmconfig.Vsock[1].Cid, int64(2)) - assert.Equal(clh.vmconfig.Vsock[1].Sock, "path2") + assert.Equal(clh.vmconfig.Vsock.Cid, int64(1)) + assert.Equal(clh.vmconfig.Vsock.Sock, "path") } // Check addNet appends to the network config list new configurations.