s390x: add appendVSock with devno

Reimplementation of appendVSock in order to assign the devno to the
vsock device.

Fixes: #2033

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
This commit is contained in:
Alice Frosi 2019-08-26 14:21:13 +02:00
parent 6b2a90a9e5
commit a0e09df1df

View File

@ -7,11 +7,10 @@ package virtcontainers
import (
"fmt"
"time"
govmmQemu "github.com/intel/govmm/qemu"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/types"
"time"
)
type qemuS390x struct {
@ -257,3 +256,28 @@ func (q *qemuS390x) appendSCSIController(devices []govmmQemu.Device, enableIOThr
devices = append(devices, d)
return devices, t
}
func (q *qemuS390x) appendVSock(devices []govmmQemu.Device, vsock kataVSOCK) ([]govmmQemu.Device, error) {
var devno string
id := fmt.Sprintf("vsock-%d", vsock.contextID)
addr, b, err := q.addDeviceToBridge(id, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append VSock: %v", err)
}
devno, err = b.AddressFormatCCW(addr)
if err != nil {
return devices, fmt.Errorf("Failed to append VSock: %v", err)
}
devices = append(devices,
govmmQemu.VSOCKDevice{
ID: id,
ContextID: vsock.contextID,
VHostFD: vsock.vhostFd,
DisableModern: false,
DevNo: devno,
},
)
return devices, nil
}