mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 12:29:49 +00:00
qemu: Add netdev options to the Device structure
With the NetDev and MACAddress strings, we can now create networking device drivers. We also add a unit test for netdev Device creation. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
16
qemu_test.go
16
qemu_test.go
@@ -117,7 +117,7 @@ var deviceNVDIMMString = "-device nvdimm,id=nv0,memdev=mem0"
|
||||
|
||||
func TestAppendDeviceNVDIMM(t *testing.T) {
|
||||
device := Device{
|
||||
Type: "nvdimm",
|
||||
Driver: "nvdimm",
|
||||
ID: "nv0",
|
||||
MemDev: "mem0",
|
||||
}
|
||||
@@ -129,7 +129,7 @@ var deviceFSString = "-device virtio-9p-pci,fsdev=workload9p,mount_tag=rootfs"
|
||||
|
||||
func TestAppendDeviceFS(t *testing.T) {
|
||||
device := Device{
|
||||
Type: "virtio-9p-pci",
|
||||
Driver: "virtio-9p-pci",
|
||||
FSDev: "workload9p",
|
||||
MountTag: "rootfs",
|
||||
}
|
||||
@@ -137,6 +137,18 @@ func TestAppendDeviceFS(t *testing.T) {
|
||||
testAppend(device, deviceFSString, t)
|
||||
}
|
||||
|
||||
var deviceNetworkString = "-device virtio-net-pci,netdev=eth0,mac=01:02:de:ad:be:ef"
|
||||
|
||||
func TestAppendDeviceNetwork(t *testing.T) {
|
||||
device := Device{
|
||||
Driver: "virtio-net-pci",
|
||||
NetDev: "eth0",
|
||||
MACAddress: "01:02:de:ad:be:ef",
|
||||
}
|
||||
|
||||
testAppend(device, deviceNetworkString, t)
|
||||
}
|
||||
|
||||
func TestAppendEmptyDevice(t *testing.T) {
|
||||
device := Device{}
|
||||
|
||||
|
Reference in New Issue
Block a user