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

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