Currently, if romfile field is empty, the commandline will
shows like below:
-device driver=virtio-net-pci,...,mq=on,vectors=4,romfile=
This does not make sense, just remove this field in commandline
Add unittest support.
Signed-off-by: Michael Qiu <qiudayu@huayun.com>
multidevs specifies how to deal with multiple devices being shared with a 9p
export. `multidevs=remap` fixes the following warning:
```
9p: Multiple devices detected in same VirtFS export, which might lead to file
ID collisions and severe misbehaviours on guest!
You should either use a separate export for each device shared from host or
use virtfs option 'multidevs=remap'!
```
Signed-off-by: Julio Montes <julio.montes@intel.com>
Allow API consumers to change the maximum number of ports in the virtio-serial
devices, setting a lower number of ports can improve the boot time and
reduce the attack surface.
fixes#120
Signed-off-by: Julio Montes <julio.montes@intel.com>
Currently, virtio transports for each device are determined with
architecture dependent build time conditionals. This isn't the ideal
solution, as virtio transports aren't exactly tied to the host's
architecture.
For example, aarch64 VMs do support both PCI and MMIO devices, and
after the recent introduction of the microvm machine type, that's also
the case for x86_64.
This patch extends each device that supports multiple transports with
a VirtioTransport field, so users of the library can manually specify
a transport for each device. To avoid breaking the compatibility, if
VirtioTransport is empty a behavior equivalent to the legacy one is
achieved by checking runtime.GOARCH and Config.Machine.Type.
Keeping support for isVirtioPCI/isVirtioCCW in qmp.go is a bit
tricky. Eventually, the hot-plug API should be extended so callers
must manually specify the transport for the device.
Signed-off-by: Sergio Lopez <slp@redhat.com>
since some vendor id like 1ded can not be identified by virtio-pci
driver, so upper level need to pass a specified vendor id to qemu.
the upper level will change unavailable id and pass it to qemu.
Signed-off-by: Ace-Tang <aceapril@126.com>
It turns out it is possible to run the unit tests for the s390x build
on travis by renaming the s390x specific files, so that their
inclusion in the build is determined only by tags and not by filename,
and by introducing a new tag s390x_test that we can use to force
their inclusion into a build by using this tag. The .travis file is
then updated to include the line
go test --tags s390x_test ./...
This creates a build on travis that includes the s390x specific
files and runs the unit tests.
Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
This commit updates the headers in the Go source files to adhere
to the new guidelines in the CONTRIBUTING.md file.
Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
This PR prepares for the s390x support. It introduces:
- a generalization of ccw and pci devices. The variables for the pci devices
have been renamed by removing the Pci suffix. They have been moved to the
qemu_arch_base.go
- the mapping isVirtioPCI has been move to qemu_arch_base.go because in
this way a different mapping can be added for other architecture (e.g
s390x)
- the functions QemuNetdevParam and QemuDeviceParam have been moved to
qemu_arch_base.go. In this way, they could be reimplemented for other
architecture for the case VHOSTUSER
- a function disableModern has been introduced to check if the device is
a pci device and then returns the right parameters. In the case of ccw
devices, they don't have the disable-modern flag
- a function mqParameter has been introduced to return the right
parameters for the mq case. The virtio-net-ccw device doesn't have the
vectors flag
- in qemu_arch_base_test.go contains the test and strings that can be
overwritten for other architectures (e.g s390). The devices names and
the flags for the devices can be overwritten.
- the string for the romfile has been replaced by a variable romfile
that could be left empty if the devices doesn't support a romfile as
for the ccw devices for s390.
- clean-up: the disable-modern=on/off options have been changed to
disable-modern=true/false. In the code there was a mixture of on/true
off/false
Fixes: #61
Co-authored-by: Yash D Jain <ydjainopensource@gmail.com>
Signed-off-by: Alice Frosi <afrosi@de.ibm.com>