All file descriptors will come from specific devices configurations, so
this patch:
1) Make the Config FDs file private
2) Provide an appendFDs() method for Config, that takes a slice of
os.File pointers and
a) Adds them to the Config private fd slice
b) Return a slice of ints that represent the file descriptors for
these device specific files, as seen by the qemu process.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
It is a private field now, and all append*() routines are now
Config methods instead of private qemu functions.
Since we will have to carry a kernelParams private field as well,
this change will keep all built parameters internal and make things
consistent.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
By adding QemuParams() to the Device interface, we can get rid of the
driver structure and simplify further the appendDevices() routine.
With that implementation we can generate the following qemu parameters:
"-device virtio-9p-pci,fsdev=foo,mount_tag=rootfs -fsdev local,id=foo,path=/bar/foo,security-model=none"
from these single structures:
fsdev := FSDevice{
Driver: Virtio9P
FSDriver: Local,
ID: "foo",
Path: "/bar/foo",
MountTag: "rootfs",
SecurityModel: None,
}
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Instead of open coding the RTC fields, we now have specific types for
it.
We also have a RTC unit test now.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
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>
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>
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>
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>