John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 1 | .. toctree:: |
| 2 | |
| 3 | .. _vhost01: |
| 4 | |
| 5 | Prerequisites |
| 6 | ------------- |
| 7 | |
| 8 | For this use case we will assume FD.io VPP is installed. We will also assume the user can create and start |
| 9 | basic virtual machines. This use case will use the linux virsh commands. For more information on virsh |
| 10 | refer to `virsh man page <https://linux.die.net/man/1/virsh>`_. |
| 11 | |
| 12 | The image that we use is based on an Ubuntu cloud image downloaded from: |
| 13 | `Ubuntu Cloud Images <https://cloud-images.ubuntu.com/xenial/current>`_. |
| 14 | |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 15 | All FD.io VPP commands are being run from a su shell. |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 16 | |
| 17 | .. _vhosttopo: |
| 18 | |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 19 | Topology |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 20 | --------- |
| 21 | |
| 22 | In this case we will use 2 systems. One system we will be running standard linux, the other will |
| 23 | be running FD.io VPP. |
| 24 | |
| 25 | .. figure:: /_images/vhost-topo.png |
| 26 | :alt: |
| 27 | |
| 28 | Vhost Use Case Topology |
| 29 | |
| 30 | Creating The Virtual Interface |
| 31 | ------------------------------ |
| 32 | |
| 33 | We will start on the system running FD.io VPP and show that no Virtual interfaces have been created. |
| 34 | We do this using the :ref:`showintcommand` command. |
| 35 | |
| 36 | Notice we do not have any virtual interfaces. We do have an interface (TenGigabitEthernet86/0/0) that |
| 37 | is up. This interface is connected to a system running, in our example standard linux. We will use |
| 38 | this system to verify our connectivity to our VM with ping. |
| 39 | |
| 40 | .. code-block:: console |
| 41 | |
| 42 | $ sudo bash |
| 43 | # vppctl |
| 44 | _______ _ _ _____ ___ |
| 45 | __/ __/ _ \ (_)__ | | / / _ \/ _ \ |
| 46 | _/ _// // / / / _ \ | |/ / ___/ ___/ |
| 47 | /_/ /____(_)_/\___/ |___/_/ /_/ |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 48 | |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 49 | vpp# clear interfaces |
| 50 | vpp# show int |
| 51 | Name Idx State Counter Count |
| 52 | TenGigabitEthernet86/0/0 1 up |
| 53 | TenGigabitEthernet86/0/1 2 down |
| 54 | local0 0 down |
| 55 | vpp# |
| 56 | |
| 57 | For more information on the interface commands refer to: :ref:`intcommands` |
| 58 | |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 59 | The next step will be to create the virtual port using the ``createvhostuser`` command. |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 60 | This command will create the virtual port in VPP and create a linux socket that the VM will |
| 61 | use to connect to VPP. |
| 62 | |
| 63 | The port can be created using VPP as the socket server or client. |
| 64 | |
| 65 | Creating the VPP port: |
| 66 | |
| 67 | .. code-block:: console |
| 68 | |
| 69 | vpp# create vhost socket /tmp/vm00.sock |
| 70 | VirtualEthernet0/0/0 |
| 71 | vpp# show int |
| 72 | Name Idx State Counter Count |
| 73 | TenGigabitEthernet86/0/0 1 up |
| 74 | TenGigabitEthernet86/0/1 2 down |
| 75 | VirtualEthernet0/0/0 3 down |
| 76 | local0 0 down |
| 77 | vpp# |
| 78 | |
| 79 | Notice the interface **VirtualEthernet0/0/0**. In this example we created the virtual interface as |
| 80 | a client. |
| 81 | |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 82 | We can get more detail on the vhost connection with the ``showvhost`` command. |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 83 | |
| 84 | .. code-block:: console |
| 85 | |
| 86 | vpp# show vhost |
| 87 | Virtio vhost-user interfaces |
| 88 | Global: |
| 89 | coalesce frames 32 time 1e-3 |
| 90 | number of rx virtqueues in interrupt mode: 0 |
| 91 | Interface: VirtualEthernet0/0/0 (ifindex 3) |
| 92 | virtio_net_hdr_sz 12 |
| 93 | features mask (0xffffffffffffffff): |
| 94 | features (0x58208000): |
| 95 | VIRTIO_NET_F_MRG_RXBUF (15) |
| 96 | VIRTIO_NET_F_GUEST_ANNOUNCE (21) |
| 97 | VIRTIO_F_ANY_LAYOUT (27) |
| 98 | VIRTIO_F_INDIRECT_DESC (28) |
| 99 | VHOST_USER_F_PROTOCOL_FEATURES (30) |
| 100 | protocol features (0x3) |
| 101 | VHOST_USER_PROTOCOL_F_MQ (0) |
| 102 | VHOST_USER_PROTOCOL_F_LOG_SHMFD (1) |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 103 | |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 104 | socket filename /tmp/vm00.sock type client errno "No such file or directory" |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 105 | |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 106 | rx placement: |
| 107 | tx placement: spin-lock |
| 108 | thread 0 on vring 0 |
| 109 | thread 1 on vring 0 |
Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 110 | |
John DeNisco | 06dcd45 | 2018-07-26 12:45:10 -0400 | [diff] [blame] | 111 | Memory regions (total 0) |
| 112 | |
| 113 | Notice **No such file or directory** and **Memory regions (total 0)**. This is because the |
| 114 | VM has not been created yet. |
| 115 | |