124 lines
8.9 KiB
Plaintext
124 lines
8.9 KiB
Plaintext
<section id="setting-the-nic-model">
|
|
<h5><a class="toc-backref" href="#toc-entry-58" role="doc-backlink">Setting the NIC model</a><a class="headerlink" href="#setting-the-nic-model" title="Link to this headline">¶</a></h5>
|
|
<pre class="literal-block">...
|
|
<devices>
|
|
<interface type='network'>
|
|
<source network='default'/>
|
|
<target dev='vnet1'/>
|
|
<model type='ne2k_pci'/>
|
|
</interface>
|
|
</devices>
|
|
...</pre>
|
|
<p>For hypervisors which support this, you can set the model of emulated network
|
|
interface card via the <span class="docutils literal">model</span> element.</p>
|
|
<p>While libvirt accepts any value as the <span class="docutils literal">type</span> and passes it to the
|
|
hypervisor to preserve compatibility, most devices nowadays have additional
|
|
handling and address allocation which may not work properly unless the model
|
|
is known by libvirt.</p>
|
|
<p>Libvirt supports natively the following network device models:
|
|
<span class="docutils literal">virtio</span>, <span class="docutils literal"><span class="pre">virtio-transitional</span></span> (<span class="since">Since 5.2.0</span>),
|
|
<span class="docutils literal"><span class="pre">virtio-non-transitional</span></span> (<span class="since">Since 5.2.0</span>), <span class="docutils literal">e1000</span>, <span class="docutils literal">e1000e</span>,
|
|
<span class="docutils literal">igb</span> (<span class="since">Since 9.3.0</span>), <span class="docutils literal">rtl8139</span>, <span class="docutils literal">netfront</span>,
|
|
<span class="docutils literal"><span class="pre">usb-net</span></span> (<span class="since">Since 10.3.0</span>), <span class="docutils literal"><span class="pre">spapr-vlan</span></span>, <span class="docutils literal">lan9118</span>, <span class="docutils literal">scm91c111</span>,
|
|
<span class="docutils literal">vlance</span>, <span class="docutils literal">vmxnet</span>, <span class="docutils literal">vmxnet2</span>, <span class="docutils literal">vmxnet3</span>, <span class="docutils literal">Am79C970A</span>, <span class="docutils literal">Am79C973</span>,
|
|
<span class="docutils literal">82540EM</span>, <span class="docutils literal">82545EM</span>, <span class="docutils literal">82543GC</span>.</p>
|
|
<p>For QEMU you can get a list of supported models with this command:</p>
|
|
<pre class="literal-block">qemu-system-x86_64 -net nic,model=?</pre>
|
|
</section>
|
|
<section id="setting-nic-driver-specific-options">
|
|
<h5><a class="toc-backref" href="#toc-entry-59" role="doc-backlink">Setting NIC driver-specific options</a><a class="headerlink" href="#setting-nic-driver-specific-options" title="Link to this headline">¶</a></h5>
|
|
<pre class="literal-block">...
|
|
<devices>
|
|
<interface type='network'>
|
|
<source network='default'/>
|
|
<target dev='vnet1'/>
|
|
<model type='virtio'/>
|
|
<driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256' tx_queue_size='256'>
|
|
<host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/>
|
|
<guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
</driver>
|
|
</interface>
|
|
</devices>
|
|
...</pre>
|
|
<p>Some NICs may have tunable driver-specific options. These are set as attributes
|
|
of the <span class="docutils literal">driver</span> sub-element of the interface definition. Currently the
|
|
following attributes are available for the <span class="docutils literal">virtio</span> NIC driver:</p>
|
|
<dl class="simple">
|
|
<dt><span class="docutils literal">name</span></dt>
|
|
<dd><p>The optional <span class="docutils literal">name</span> attribute forces which type of backend driver to use.
|
|
The value can be either 'qemu' (a user-space backend) or 'vhost' (a kernel
|
|
backend, which requires the vhost module to be provided by the kernel); an
|
|
attempt to require the vhost driver without kernel support will be rejected.
|
|
If this attribute is not present, then the domain defaults to 'vhost' if
|
|
present, but silently falls back to 'qemu' without error.
|
|
<span class="since">Since 0.8.8 (QEMU and KVM only)</span>
|
|
For interfaces of type='hostdev' (PCI passthrough devices) the <span class="docutils literal">name</span>
|
|
attribute can optionally be set to "vfio" or "kvm". "vfio" tells libvirt to
|
|
use VFIO device assignment rather than traditional KVM device assignment
|
|
(VFIO is a new method of device assignment that is compatible with UEFI
|
|
Secure Boot), and "kvm" tells libvirt to use the legacy device assignment
|
|
performed directly by the kvm kernel module (the default is currently "kvm",
|
|
but is subject to change).
|
|
<span class="since">Since 1.0.5 (QEMU and KVM only, requires kernel 3.6 or newer)</span>
|
|
For interfaces of type='vhostuser', the <span class="docutils literal">name</span> attribute is ignored. The
|
|
backend driver used is always vhost-user.</p>
|
|
</dd>
|
|
<dt><span class="docutils literal">txmode</span></dt>
|
|
--- around driver qemu example ---
|
|
<dt><span class="docutils literal">socket</span> <span class="since">since 2.0.0 (QEMU only)</span></dt>
|
|
<dd><p>This listen type tells a graphics server to listen on unix socket. Attribute
|
|
<span class="docutils literal">socket</span> contains a path to unix socket. If this attribute is omitted
|
|
libvirt will generate this path for you. Supported by graphics type <span class="docutils literal">vnc</span>
|
|
and <span class="docutils literal">spice</span>.</p>
|
|
<p>For <span class="docutils literal">vnc</span> graphics be backward compatible the <span class="docutils literal">socket</span> attribute of first
|
|
<span class="docutils literal">listen</span> element is duplicated as <span class="docutils literal">socket</span> attribute in <span class="docutils literal">graphics</span>
|
|
element. If <span class="docutils literal">graphics</span> element contains a <span class="docutils literal">socket</span> attribute all
|
|
<span class="docutils literal">listen</span> elements are ignored.</p>
|
|
</dd>
|
|
<dt><span class="docutils literal">none</span> <span class="since">since 2.0.0 (QEMU only)</span></dt>
|
|
<dd><p>This listen type doesn't have any other attribute. Libvirt supports passing a
|
|
file descriptor through our APIs virDomainOpenGraphics() and
|
|
virDomainOpenGraphicsFD(). No other listen types are allowed if this one is
|
|
used and the graphics device doesn't listen anywhere. You need to use one of
|
|
the two APIs to pass a FD to QEMU in order to connect to this graphics
|
|
device. Supported by graphics type <span class="docutils literal">vnc</span> and <span class="docutils literal">spice</span>.</p>
|
|
</dd>
|
|
</dl>
|
|
</section>
|
|
<section id="video-devices">
|
|
<h4><a class="toc-backref" href="#toc-entry-78" role="doc-backlink">Video devices</a><a class="headerlink" href="#video-devices" title="Link to this headline">¶</a></h4>
|
|
<p>A video device.</p>
|
|
<pre class="literal-block">...
|
|
<devices>
|
|
<video>
|
|
<model type='vga' vram='16384' heads='1'>
|
|
<acceleration accel3d='yes' accel2d='yes'/>
|
|
</model>
|
|
<driver name='qemu'/>
|
|
</video>
|
|
</devices>
|
|
...</pre>
|
|
<dl>
|
|
<dt><span class="docutils literal">video</span></dt>
|
|
<dd><p>The <span class="docutils literal">video</span> element is the container for describing video devices. For
|
|
backwards compatibility, if no <span class="docutils literal">video</span> is set but there is a <span class="docutils literal">graphics</span>
|
|
in domain xml, then libvirt will add a default <span class="docutils literal">video</span> according to the
|
|
guest type.</p>
|
|
<p>For a guest of type "kvm", the default <span class="docutils literal">video</span> is: <span class="docutils literal">type</span> with value
|
|
"cirrus", <span class="docutils literal">vram</span> with value "16384" and <span class="docutils literal">heads</span> with value "1". By
|
|
default, the first video device in domain xml is the primary one, but the
|
|
optional attribute <span class="docutils literal">primary</span> ( <span class="since">since 1.0.2</span> ) with value 'yes' can
|
|
be used to mark the primary in cases of multiple video device. The
|
|
non-primary must be type of "qxl" or ( <span class="since">since 2.4.0</span> ) "virtio".</p>
|
|
</dd>
|
|
<dt><span class="docutils literal">model</span></dt>
|
|
<dd><p>The <span class="docutils literal">model</span> element has a mandatory <span class="docutils literal">type</span> attribute which takes the
|
|
value "vga", "cirrus", "vmvga", "xen", "vbox", "qxl" ( <span class="since">since 0.8.6</span>
|
|
), "virtio" ( <span class="since">since 1.3.0</span> ), "gop" ( <span class="since">since 3.2.0</span> ), "bochs"
|
|
( <span class="since">since 5.6.0</span> ), "ramfb" ( <span class="since">since 5.9.0</span> ), or "none" (
|
|
<span class="since">since 4.6.0</span> ), depending on the hypervisor features available.</p>
|
|
<p>Note: The purpose of the type <span class="docutils literal">none</span> is to instruct libvirt not to add a
|
|
default video device in the guest (see the <span class="docutils literal">video</span> element description
|
|
above), since such behaviour is inconvenient in cases where GPU mediated
|
|
devices are meant to be the only rendering device within a guest. If this
|