qemu: Update virtio-net-pci command line

In case of a network device, and specifically virtio-net-pci, we have
to update to what is expected by qemu. In this case, the driver name
should be prefixed with "driver=".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2017-08-16 10:07:00 -07:00
parent 25a2dc8f6e
commit 8d617ff5b9
2 changed files with 4 additions and 1 deletions

View File

@ -390,6 +390,9 @@ func (netdev NetDevice) QemuParams(config *Config) []string {
var deviceParams []string
var qemuParams []string
if netdev.Driver == VirtioNetPCI {
deviceParams = append(deviceParams, "driver=")
}
deviceParams = append(deviceParams, fmt.Sprintf("%s", netdev.Driver))
deviceParams = append(deviceParams, fmt.Sprintf(",netdev=%s", netdev.ID))
deviceParams = append(deviceParams, fmt.Sprintf(",mac=%s", netdev.MACAddress))

View File

@ -143,7 +143,7 @@ func TestAppendDeviceNetwork(t *testing.T) {
testAppend(netdev, deviceNetworkString, t)
}
var deviceNetworkPCIString = "-device virtio-net-pci,netdev=tap0,mac=01:02:de:ad:be:ef,bus=/pci-bus/pcie.0,addr=ff -netdev tap,id=tap0,ifname=ceth0,downscript=no,script=no,fds=3:4,vhost=on"
var deviceNetworkPCIString = "-device driver=virtio-net-pci,netdev=tap0,mac=01:02:de:ad:be:ef,bus=/pci-bus/pcie.0,addr=ff -netdev tap,id=tap0,ifname=ceth0,downscript=no,script=no,fds=3:4,vhost=on"
func TestAppendDeviceNetworkPCI(t *testing.T) {
foo, _ := ioutil.TempFile(os.TempDir(), "qemu-ciao-test")