From 171eb70564b9b64a271772b92c0cc1b8beea8c0d Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 25 Feb 2020 23:39:21 -0800 Subject: [PATCH] qemu: use govmm vhost user device types directly For one thing, we should not make kata's internal device type exactly as govmm string by string. For another thing, latest govmm changes the device driver strings and it breaks kata in such a way but the fault is on kata side IMHO. Signed-off-by: Peng Tao --- virtcontainers/qemu_arch_base.go | 5 ++++- virtcontainers/qemu_arch_base_test.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/virtcontainers/qemu_arch_base.go b/virtcontainers/qemu_arch_base.go index 5c9e1fb2eb..a2af89f8b3 100644 --- a/virtcontainers/qemu_arch_base.go +++ b/virtcontainers/qemu_arch_base.go @@ -624,16 +624,19 @@ func (q *qemuArchBase) appendVhostUserDevice(devices []govmmQemu.Device, attr co case config.VhostUserNet: qemuVhostUserDevice.TypeDevID = utils.MakeNameID("net", attr.DevID, maxDevIDSize) qemuVhostUserDevice.Address = attr.MacAddress + qemuVhostUserDevice.VhostUserType = govmmQemu.VhostUserNet case config.VhostUserSCSI: qemuVhostUserDevice.TypeDevID = utils.MakeNameID("scsi", attr.DevID, maxDevIDSize) + qemuVhostUserDevice.VhostUserType = govmmQemu.VhostUserSCSI case config.VhostUserBlk: + qemuVhostUserDevice.VhostUserType = govmmQemu.VhostUserBlk case config.VhostUserFS: qemuVhostUserDevice.TypeDevID = utils.MakeNameID("fs", attr.DevID, maxDevIDSize) qemuVhostUserDevice.Tag = attr.Tag qemuVhostUserDevice.CacheSize = attr.CacheSize + qemuVhostUserDevice.VhostUserType = govmmQemu.VhostUserFS } - qemuVhostUserDevice.VhostUserType = govmmQemu.DeviceDriver(attr.Type) qemuVhostUserDevice.SocketPath = attr.SocketPath qemuVhostUserDevice.CharDevID = utils.MakeNameID("char", attr.DevID, maxDevIDSize) diff --git a/virtcontainers/qemu_arch_base_test.go b/virtcontainers/qemu_arch_base_test.go index e3edad17de..169e002eaa 100644 --- a/virtcontainers/qemu_arch_base_test.go +++ b/virtcontainers/qemu_arch_base_test.go @@ -427,7 +427,7 @@ func TestQemuArchBaseAppendVhostUserDevice(t *testing.T) { CharDevID: fmt.Sprintf("char-%s", id), TypeDevID: fmt.Sprintf("net-%s", id), Address: macAddress, - VhostUserType: config.VhostUserNet, + VhostUserType: govmmQemu.VhostUserNet, }, }