Skip to content

Commit

Permalink
virtcontainer: rename appendVSockPCI
Browse files Browse the repository at this point in the history
Rename function appendVSockPCI to appendVSock to be general. The
function could use PCI or CCW devices.
Added return error to appendVSock.

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
  • Loading branch information
Alice Frosi committed Sep 5, 2019
1 parent 94c47dc commit 6b2a90a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion virtcontainers/qemu.go
Expand Up @@ -1584,7 +1584,7 @@ func (q *qemu) addDevice(devInfo interface{}, devType deviceType) error {
q.qemuConfig.Devices = q.arch.appendSocket(q.qemuConfig.Devices, v)
case kataVSOCK:
q.fds = append(q.fds, v.vhostFd)
q.qemuConfig.Devices = q.arch.appendVSockPCI(q.qemuConfig.Devices, v)
q.qemuConfig.Devices, err = q.arch.appendVSock(q.qemuConfig.Devices, v)
case Endpoint:
q.qemuConfig.Devices = q.arch.appendNetwork(q.qemuConfig.Devices, v)
case config.BlockDrive:
Expand Down
8 changes: 4 additions & 4 deletions virtcontainers/qemu_arch_base.go
Expand Up @@ -79,8 +79,8 @@ type qemuArch interface {
// appendSocket appends a socket to devices
appendSocket(devices []govmmQemu.Device, socket types.Socket) []govmmQemu.Device

// appendVSockPCI appends a vsock PCI to devices
appendVSockPCI(devices []govmmQemu.Device, vsock kataVSOCK) []govmmQemu.Device
// appendVSock appends a vsock PCI to devices
appendVSock(devices []govmmQemu.Device, vsock kataVSOCK) ([]govmmQemu.Device, error)

// appendNetwork appends a endpoint device to devices
appendNetwork(devices []govmmQemu.Device, endpoint Endpoint) []govmmQemu.Device
Expand Down Expand Up @@ -447,7 +447,7 @@ func (q *qemuArchBase) appendSocket(devices []govmmQemu.Device, socket types.Soc
return devices
}

func (q *qemuArchBase) appendVSockPCI(devices []govmmQemu.Device, vsock kataVSOCK) []govmmQemu.Device {
func (q *qemuArchBase) appendVSock(devices []govmmQemu.Device, vsock kataVSOCK) ([]govmmQemu.Device, error) {
devices = append(devices,
govmmQemu.VSOCKDevice{
ID: fmt.Sprintf("vsock-%d", vsock.contextID),
Expand All @@ -457,7 +457,7 @@ func (q *qemuArchBase) appendVSockPCI(devices []govmmQemu.Device, vsock kataVSOC
},
)

return devices
return devices, nil

}

Expand Down

0 comments on commit 6b2a90a

Please sign in to comment.