Blame SOURCES/0004-v2v-o-libvirt-Remove-cache-none-RHBZ-1837453.patch

62f9b7
From 939d57ef4d5bcfa31e9b98104822962b89572481 Mon Sep 17 00:00:00 2001
62f9b7
From: "Richard W.M. Jones" <rjones@redhat.com>
62f9b7
Date: Tue, 19 May 2020 14:40:01 +0100
62f9b7
Subject: [PATCH] v2v: -o libvirt: Remove cache=none (RHBZ#1837453).
62f9b7
62f9b7
Traditionally if you did live migration (KVM to KVM), you had to
62f9b7
ensure that cache=none was set on all disks of the guest up front.
62f9b7
This was because of quirks in how NFS works (I think the close-to-open
62f9b7
consistency and the fact that during live migration both qemus have
62f9b7
the file open), and we had to assume the worst case that a guest might
62f9b7
be backed by NFS.
62f9b7
62f9b7
Because of this when virt-v2v converts a guest to run on KVM using
62f9b7
libvirt it sets cache=none.
62f9b7
62f9b7
This is not necessary with modern qemu.  If qemu supports the
62f9b7
drop-cache property of the file block driver, which libvirt will
62f9b7
automatically detect for us, then libvirt live migration is able to
62f9b7
tell qemu to drop cached data at the right time even if the backing is
62f9b7
NFS.
62f9b7
62f9b7
It also had a significant performance impact.  In some synthetic
62f9b7
benchmarks it could show 2 or 3 times slower performance.
62f9b7
62f9b7
Thanks: Ming Xie, Peter Krempa.
62f9b7
(cherry picked from commit 9720f45e0cd9283739fd2a67c19e66912489dfc7)
62f9b7
---
62f9b7
 docs/virt-v2v-output-local.pod | 2 +-
62f9b7
 tests/test-v2v-cdrom.expected  | 2 +-
62f9b7
 tests/test-v2v-floppy.expected | 2 +-
62f9b7
 tests/test-v2v-i-ova.xml       | 2 +-
62f9b7
 v2v/create_libvirt_xml.ml      | 1 -
62f9b7
 5 files changed, 4 insertions(+), 5 deletions(-)
62f9b7
62f9b7
diff --git a/docs/virt-v2v-output-local.pod b/docs/virt-v2v-output-local.pod
62f9b7
index 38df007d..a5f155cb 100644
62f9b7
--- a/docs/virt-v2v-output-local.pod
62f9b7
+++ b/docs/virt-v2v-output-local.pod
62f9b7
@@ -127,7 +127,7 @@ Edit F to change F to the pool
62f9b7
 name.  In other words, locate the following bit of XML:
62f9b7
 
62f9b7
  <disk type='file' device='disk'>
62f9b7
-   <driver name='qemu' type='raw' cache='none' />
62f9b7
+   <driver name='qemu' type='raw' />
62f9b7
    <source file='/var/tmp/NAME-sda' />
62f9b7
    <target dev='hda' bus='ide' />
62f9b7
  </disk>
62f9b7
diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected
62f9b7
index e18ea6f2..34d2bf59 100644
62f9b7
--- a/tests/test-v2v-cdrom.expected
62f9b7
+++ b/tests/test-v2v-cdrom.expected
62f9b7
@@ -1,5 +1,5 @@
62f9b7
     <disk type='file' device='disk'>
62f9b7
-      <driver name='qemu' type='raw' cache='none'/>
62f9b7
+      <driver name='qemu' type='raw'/>
62f9b7
       <target dev='vda' bus='virtio'/>
62f9b7
     </disk>
62f9b7
     <disk device='cdrom' type='file'>
62f9b7
diff --git a/tests/test-v2v-floppy.expected b/tests/test-v2v-floppy.expected
62f9b7
index dd74ed94..a718c21f 100644
62f9b7
--- a/tests/test-v2v-floppy.expected
62f9b7
+++ b/tests/test-v2v-floppy.expected
62f9b7
@@ -1,5 +1,5 @@
62f9b7
     <disk type='file' device='disk'>
62f9b7
-      <driver name='qemu' type='raw' cache='none'/>
62f9b7
+      <driver name='qemu' type='raw'/>
62f9b7
       <target dev='vda' bus='virtio'/>
62f9b7
     </disk>
62f9b7
     <disk device='floppy' type='file'>
62f9b7
diff --git a/tests/test-v2v-i-ova.xml b/tests/test-v2v-i-ova.xml
62f9b7
index 7c198283..e26f4f83 100644
62f9b7
--- a/tests/test-v2v-i-ova.xml
62f9b7
+++ b/tests/test-v2v-i-ova.xml
62f9b7
@@ -22,7 +22,7 @@
62f9b7
   <on_crash>restart</on_crash>
62f9b7
   <devices>
62f9b7
     <disk type='file' device='disk'>
62f9b7
-      <driver name='qemu' type='raw' cache='none'/>
62f9b7
+      <driver name='qemu' type='raw'/>
62f9b7
       <source file='TestOva-sda'/>
62f9b7
       <target dev='vda' bus='virtio'/>
62f9b7
     </disk>
62f9b7
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
62f9b7
index 05553c4f..5a1fba0f 100644
62f9b7
--- a/v2v/create_libvirt_xml.ml
62f9b7
+++ b/v2v/create_libvirt_xml.ml
62f9b7
@@ -336,7 +336,6 @@ let create_libvirt_xml ?pool source targets target_buses guestcaps
62f9b7
           e "driver" [
62f9b7
             "name", "qemu";
62f9b7
             "type", t.target_format;
62f9b7
-            "cache", "none"
62f9b7
           ] [];
62f9b7
           (match pool with
62f9b7
           | None ->