clh: vsock: Supply the right VsockConfig to Vmconfig

With the new HTTP API from CLH, it removes the support of multiple
virtio-vsock devices, as the Linux kernel does not support it.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Bo Chen
2020-05-26 00:38:16 -07:00
committed by Peng Tao
parent 4887ce059c
commit 48b20e75f8
2 changed files with 3 additions and 7 deletions

View File

@@ -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 {

View File

@@ -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.