Skip to content

Commit

Permalink
disk cache modes finished
Browse files Browse the repository at this point in the history
  • Loading branch information
tbazant committed Jan 15, 2024
1 parent ac981f9 commit f18f33e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
31 changes: 17 additions & 14 deletions references/virtual-disk-cache-modes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@
guests are ignored. Using this mode implies that the user prioritizes performance gain
over data security.
</para>
<warning>
<para>
Using the <emphasis>unsafe</emphasis> mode can cause data loss in case of a host
failure. Do not use this mode for production workloads.
</para>
</warning>
<xi:include href="../snippets/unsafe-cache-mode-warning.xml"/>
</listitem>
</varlistentry>
<varlistentry xml:id="cache-default">
Expand Down Expand Up @@ -123,7 +118,7 @@
<para>
This mode informs the guest of the presence of a write cache, and it relies on the
guest to send flush commands as needed to maintain data integrity within its disk
image.
image.
</para>
<warning>
<para>
Expand All @@ -139,8 +134,9 @@
<listitem>
<para>
This mode is similar to <emphasis>writeback</emphasis> caching, except the guest flush
commands are ignored. This means a higher risk of data loss due to host failure.
commands are ignored.
</para>
<xi:include href="../snippets/unsafe-cache-mode-warning.xml"/>
</listitem>
</varlistentry>
</variablelist>
Expand All @@ -159,16 +155,23 @@
factors. If the guest storage is hosted on a clustered file system, is read-only, or is
marked shareable, then the cache mode is ignored when determining if migration can be
allowed. Otherwise, &libvirt; does not allow migration unless the cache mode is set to
<literal>none</literal>. However, this restriction can be overridden with the
<option>--unsafe</option> option to the migration APIs, which is also supported by
<command>virsh</command>. For example:
<literal>none</literal>.
</para>
<warning>
<para>
If you need to do a live migration with a different cache mode than
<literal>none</literal>, use the <option>--unsafe</option> option, for example:
</para>
<screen>&prompt.user;virsh migrate --live --unsafe</screen>
<para>
Be aware that this option may cause loss of data that the migrated VM is caching.
</para>
</warning>
<tip>
<para>
The cache mode <literal>none</literal> is required for the AIO mode setting
<literal>native</literal>. If another cache mode is used, the AIO mode is silently switched
back to the default <literal>threads</literal>.
When using the <literal>native</literal> asynchronous I/O mode (AIO) in &libvirt;, the
cache mode <literal>none</literal> is required. Using a different caching mode switches the
AIO mode back to the default <literal>threads</literal>.
</para>
</tip>
</section>
Expand Down
9 changes: 2 additions & 7 deletions tasks/virtual-disk-cache-mode-configure-using-virsh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Id Name State
<screen>&prompt.sudo;<command>virsh domblklist sle15sp5</command>
Target Source
------------------------------------------
vda /home/tbazant/virt/sle15.qcow2
vda /home/example-user/virt/sle15.qcow2
sda -</screen>
</step>
<step>
Expand All @@ -57,7 +57,7 @@ sda -</screen>
</para>
<screen>&lt;disk type='file' device='disk'>
&lt;driver name='qemu' type='qcow2' cache='writethrough'/>
&lt;source file='/home/tbazant/virt/sle15.qcow2'/>
&lt;source file='/home/example-user/virt/sle15.qcow2'/>
&lt;target dev='vda' bus='virtio'/>
&lt;address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
&lt;/disk></screen>
Expand All @@ -77,11 +77,6 @@ sda -</screen>
</para>
<screen>&prompt.sudo;<command>sudo virsh define virt/sle15sp5.xml</command>
Domain 'sle15sp5' defined from virt/sle15sp5.xml</screen>
<note>
<para>
You may have to restart a running VM for the changes to take effect.
</para>
</note>
</step>
</procedure>
</topic>
5 changes: 0 additions & 5 deletions tasks/virtual-disk-cache-mode-configure-using-vmm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@
<para>
Confirm with <guimenu>Apply</guimenu>.
</para>
<note>
<para>
You may have to restart a running VM for the changes to take effect.
</para>
</note>
</step>
</procedure>
</topic>

0 comments on commit f18f33e

Please sign in to comment.