Commit Graph

12 Commits

Author SHA1 Message Date
Samuel Ortiz
e543c3383d qemu: Probe each qemu device with a driver
Having separate structures for the qemu driver definitions
and each possible device definitions is confusing and error prone as one
needs to be very careful using matching IDs and names in both
structures.

As the driver parameter can be derived from the device
ones, this patch changes the Device and Driver structures to be linked
together, i.e. each driver needs to have its corresponding device.

For example this allows us to build the following 9pfs qemu parameters:

"-fsdev local,id=foo,path=/bar/foo,security-model=none -device virtio-9p-pci,fsdev=foo,mount_tag=rootfs"

from these structures:

	fsdev := FSDevice{
		Driver:        Local,
		ID:            "foo",
		Path:          "/bar/foo",
		MountTag:      "rootfs",
		SecurityModel: None,
	}

	driver := Driver{
		Driver: Virtio9P,
		Device: fsdev,
	}

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
eda8607cc6 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>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
4780e2371f qemu: Add multi-queue and vhost definitions to NetDevice
We can now specify if we want vhost to be enabled and wich fds we should
use for multiqueue support.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
137e7c7242 qemu: Add a NetDevice slice to the Config structure
The NetDevice structure represents a network device to be emulated by
qemu.
We also add the corresponding unit test.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
c0e2aacad2 qemu: Add one unit test for the Config strings
Here we test that name, UUID and the CPU model are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
5ba8ef79df qemu: Add QMP socket unit tests
We test that the QMP socket parameter is properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
7b2f7eb5d8 qemu: Add Memory and SMP unit tests
We test that the memory and SMP configuration parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
2ea9b9a385 qemu: Add a Kernel unit test
We test that the kernel path and the kernel parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8e495f6eff qemu: Add a Knobs unit test
We test that all true and all false knobs parameters are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8aeb3d45aa qemu: Add an Object unit test
We test that memory-backend-file and empty objects parameters are
properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
38e041dc9d qemu: Add Device unit tests
We add a NVDIMM, a filesystem and an empty device.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
54d32c2414 qemu: Add parameters adding unit tests
We only test the Machine parameters for now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00