+ u"initrd", f"{self._opt.get(u'initrd')}"
+ )
+ self._params.add_with_value(
+ u"append", f"'ro rootfstype=9p rootflags=trans=virtio "
+ f"root=virtioroot console={self._opt.get(u'console')} "
+ f"tsc=reliable hugepages={hugepages} "
+ f"hugepagesz={self._opt.get(u'page_size')} "
+ f"init={self._temp.get(u'ini')} fastboot'"
+ )
+
+ def add_vhost_user_if(
+ self, socket, server=True, jumbo_frames=False, queue_size=None,
+ queues=1, virtio_feature_mask=None):
+ """Add Vhost-user interface.
+
+ :param socket: Path of the unix socket.
+ :param server: If True the socket shall be a listening socket.
+ :param jumbo_frames: Set True if jumbo frames are used in the test.
+ :param queue_size: Vring queue size.
+ :param queues: Number of queues.
+ :param virtio_feature_mask: Mask of virtio features to be enabled.
+ :type socket: str
+ :type server: bool
+ :type jumbo_frames: bool
+ :type queue_size: int
+ :type queues: int
+ :type virtio_feature_mask: int
+ """
+ self._nic_id += 1
+ if jumbo_frames:
+ logger.debug(u"Jumbo frames temporarily disabled!")
+ self._params.add_with_value(
+ u"chardev", f"socket,id=char{self._nic_id},"
+ f"path={socket}{u',server' if server is True else u''}"
+ )
+ self._params.add_with_value(
+ u"netdev", f"vhost-user,id=vhost{self._nic_id},"
+ f"chardev=char{self._nic_id},queues={queues}"
+ )
+ mac = f"52:54:00:00:{self._opt.get(u'qemu_id'):02x}:" \
+ f"{self._nic_id:02x}"
+ queue_size = f"rx_queue_size={queue_size},tx_queue_size={queue_size}" \
+ if queue_size else u""
+ gso = VirtioFeatureMask.is_feature_enabled(
+ virtio_feature_mask, VirtioFeaturesFlags.VIRTIO_NET_F_API_GSO)
+ csum = VirtioFeatureMask.is_feature_enabled(
+ virtio_feature_mask, VirtioFeaturesFlags.VIRTIO_NET_F_API_CSUM)
+
+ self._params.add_with_value(
+ u"device", f"virtio-net-pci,netdev=vhost{self._nic_id},mac={mac},"
+ f"addr={self._nic_id+5}.0,mq=on,vectors={2 * queues + 2},"
+ f"csum={u'on' if csum else u'off'},"
+ f"gso={u'on' if gso else u'off'},"
+ f"guest_tso4={u'on' if gso else u'off'},"
+ f"guest_tso6={u'on' if gso else u'off'},"
+ f"guest_ecn={u'on' if gso else u'off'},"
+ f"{queue_size}"
+ )
+
+ # Add interface MAC and socket to the node dict.
+ if_data = {u"mac_address": mac, u"socket": socket}
+ if_name = f"vhost{self._nic_id}"
+ self._vm_info[u"interfaces"][if_name] = if_data
+ # Add socket to temporary file list.
+ self._temp[if_name] = socket
+
+ def add_vfio_pci_if(self, pci):
+ """Add VFIO PCI interface.
+
+ :param pci: PCI address of interface.
+ :type pci: str
+ """
+ self._nic_id += 1
+ self._params.add_with_value(
+ u"device", f"vfio-pci,host={pci},addr={self._nic_id+5}.0"
+ )