3 Creating the Virtual Machine
4 ----------------------------
6 We will now create the virtual machine. We use the "virsh create command". For the complete file we
7 use refer to :ref:`xmlexample`.
9 It is important to note that in the XML file we specify the socket path that is used to connect to
12 This is done with a section that looks like this
14 .. code-block:: console
16 <interface type='vhostuser'>
17 <mac address='52:54:00:4c:47:f2'/>
18 <source type='unix' path='/tmp//vm00.sock' mode='server'/>
19 <model type='virtio'/>
21 <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
24 Notice the **interface type** and the **path** to the socket.
26 Now we create the VM. The virsh list command shows the VMs that have been created. We start with no VMs.
28 .. code-block:: console
32 ----------------------------------------------------
34 Create the VM with the virsh create command specifying our xml file.
36 .. code-block:: console
38 $ virsh create ./iperf3-vm.xml
39 Domain iperf-server3 created from ./iperf3-vm.xml
43 ----------------------------------------------------
44 65 iperf-server3 running
46 The VM is now created.
50 After a VM is created an xml file can created with "virsh dumpxml".
52 .. code-block:: console
54 $ virsh dumpxml iperf-server3
55 <domain type='kvm' id='65'>
56 <name>iperf-server3</name>
57 <uuid>e23d37c1-10c3-4a6e-ae99-f315a4165641</uuid>
58 <memory unit='KiB'>262144</memory>
61 Once the virtual machine is created notice the socket filename shows **Success** and
62 there are **Memory Regions**. At this point the VM and FD.io VPP are connected. Also
63 notice **qsz 256**. This system is running an older version of qemu. A queue size of 256
64 will affect vhost throughput. The qsz should be 1024. On the web you should be able to
65 find ways to install a newer version of qemu or change the queue size.
67 .. code-block:: console
70 Virtio vhost-user interfaces
72 coalesce frames 32 time 1e-3
73 number of rx virtqueues in interrupt mode: 0
74 Interface: VirtualEthernet0/0/0 (ifindex 3)
76 features mask (0xffffffffffffffff):
77 features (0x58208000):
78 VIRTIO_NET_F_MRG_RXBUF (15)
79 VIRTIO_NET_F_GUEST_ANNOUNCE (21)
80 VIRTIO_F_ANY_LAYOUT (27)
81 VIRTIO_F_INDIRECT_DESC (28)
82 VHOST_USER_F_PROTOCOL_FEATURES (30)
83 protocol features (0x3)
84 VHOST_USER_PROTOCOL_F_MQ (0)
85 VHOST_USER_PROTOCOL_F_LOG_SHMFD (1)
87 socket filename /tmp/vm00.sock type client errno "Success"
90 thread 1 on vring 1, polling
91 tx placement: spin-lock
95 Memory regions (total 2)
96 region fd guest_phys_addr memory_size userspace_addr mmap_offset mmap_addr
97 ====== ===== ================== ================== ================== ================== =============== ===
98 0 31 0x0000000000000000 0x00000000000a0000 0x00007f1db9c00000 0x0000000000000000 0x00007f7db0400 000
99 1 32 0x00000000000c0000 0x000000000ff40000 0x00007f1db9cc0000 0x00000000000c0000 0x00007f7d94ec0 000
102 qsz 256 last_avail_idx 0 last_used_idx 0
103 avail.flags 0 avail.idx 256 used.flags 1 used.idx 0
104 kickfd 33 callfd 34 errfd -1
107 qsz 256 last_avail_idx 8 last_used_idx 8
108 avail.flags 0 avail.idx 8 used.flags 1 used.idx 8
109 kickfd 29 callfd 35 errfd -1