-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqemu_s390x_test.go
109 lines (93 loc) · 4.21 KB
/
qemu_s390x_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//go:build s390x
// +build s390x
/*
// Copyright contributors to the Virtual Machine Manager for Go project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
package qcli
import "testing"
// -pci devices don't play well with Z hence replace them with corresponding -ccw devices
// See https://wiki.qemu.org/Documentation/Platforms/S390X
var (
deviceFSString = "-device virtio-9p-ccw,fsdev=workload9p,mount_tag=rootfs,devno=" + DevNo + " -fsdev local,id=workload9p,path=/var/lib/docker/devicemapper/mnt/e31ebda2,security_model=none,multidevs=remap"
deviceFSIOMMUString = "-device virtio-9p-ccw,fsdev=workload9p,mount_tag=rootfs,iommu_platform=on,devno=" + DevNo + " -fsdev local,id=workload9p,path=/var/lib/docker/devicemapper/mnt/e31ebda2,security_model=none,multidevs=remap"
deviceNetworkString = "-netdev tap,id=tap0,vhost=on,ifname=ceth0,downscript=no,script=no -device driver=virtio-net-ccw,netdev=tap0,mac=01:02:de:ad:be:ef,devno=" + DevNo
deviceNetworkStringMq = "-netdev tap,id=tap0,vhost=on,fds=3:4 -device driver=virtio-net-ccw,netdev=tap0,mac=01:02:de:ad:be:ef,mq=on,devno=" + DevNo
deviceSerialString = "-device virtio-serial-ccw,id=serial0,devno=" + DevNo
deviceVSOCKString = "-device vhost-vsock-ccw,id=vhost-vsock-pci0,guest-cid=4,devno=" + DevNo
deviceVFIOString = "-device vfio-ccw,host=02:10.0,devno=" + DevNo
deviceSCSIControllerStr = "-device virtio-scsi-ccw,id=foo,devno=" + DevNo
deviceSCSIControllerBusAddrStr = "-device virtio-scsi-ccw,id=foo,bus=pci.0,addr=00:04.0,iothread=iothread1,devno=" + DevNo
deviceBlockString = "-device virtio-blk-ccw,drive=hd0,scsi=off,config-wce=off,devno=" + DevNo + ",share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly"
devicePCIBridgeString = "-device pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,chassis_nr=5,shpc=on,addr=ff"
devicePCIEBridgeString = "-device pcie-pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,addr=ff"
romfile = ""
)
func TestAppendVirtioBalloon(t *testing.T) {
balloonDevice := BalloonDevice{
ID: "balloon",
}
var deviceString = "-device " + string(VirtioBalloon) + "-" + string(TransportCCW)
deviceString += ",id=" + balloonDevice.ID
balloonDevice.DevNo = DevNo
devnoOptios := ",devno=" + DevNo
var OnDeflateOnOMM = ",deflate-on-oom=on"
var OffDeflateOnOMM = ",deflate-on-oom=off"
testAppend(balloonDevice, deviceString+devnoOptios+OffDeflateOnOMM, t)
balloonDevice.DeflateOnOOM = true
testAppend(balloonDevice, deviceString+devnoOptios+OnDeflateOnOMM, t)
}
func TestAppendDeviceFSCCW(t *testing.T) {
defaultKnobs := Knobs{
NoUserConfig: true,
}
fsdev := FSDevice{
Driver: Virtio9P,
FSDriver: Local,
ID: "workload9p",
Path: "/var/lib/docker/devicemapper/mnt/e31ebda2",
MountTag: "rootfs",
SecurityModel: None,
DisableModern: true,
ROMFile: "efi-virtio.rom",
Multidev: Remap,
Transport: TransportCCW,
DevNo: DevNo,
}
var config Config
config.Knobs = defaultKnobs
testConfigAppend(&config, fsdev, deviceFSString, t)
}
func TestAppendDeviceFSCCWIOMMU(t *testing.T) {
defaultKnobs := Knobs{
NoUserConfig: true,
IOMMUPlatform: true,
}
fsdev := FSDevice{
Driver: Virtio9P,
FSDriver: Local,
ID: "workload9p",
Path: "/var/lib/docker/devicemapper/mnt/e31ebda2",
MountTag: "rootfs",
SecurityModel: None,
DisableModern: true,
ROMFile: "efi-virtio.rom",
Multidev: Remap,
Transport: TransportCCW,
DevNo: DevNo,
}
var config Config
config.Knobs = defaultKnobs
testConfigAppend(&config, fsdev, deviceFSIOMMUString, t)
}