[libvirt] [tck PATCH] Set cache=none for KVM guests

Daniel P. Berrangé berrange at redhat.com
Mon Feb 11 14:43:32 UTC 2019


QEMU will refuse to live migrate with the default caching mode, so we
must explicitly set cache=none for the migration tests to pass.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 lib/Sys/Virt/TCK/DomainBuilder.pm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/Sys/Virt/TCK/DomainBuilder.pm b/lib/Sys/Virt/TCK/DomainBuilder.pm
index 7a25d42..399534c 100644
--- a/lib/Sys/Virt/TCK/DomainBuilder.pm
+++ b/lib/Sys/Virt/TCK/DomainBuilder.pm
@@ -396,11 +396,16 @@ sub as_xml {
                      type => $disk->{type},
                      $disk->{device} ? (device => $disk->{device}) : ());
 
+        my @driver = ();
+        if ($self->{type} eq "qemu" ||
+            $self->{type} eq "kvm") {
+            push @driver, "cache", "none";
+        }
         if ($disk->{format}) {
-            $w->emptyTag("driver",
-                         name => $disk->{format}->{name},
-                         type => $disk->{format}->{type});
+            push @driver, "name", $disk->{format}->{name},
+                "type", $disk->{format}->{type};
         }
+        $w->emptyTag("driver", @driver);
 
         if ($disk->{type} eq "block") {
             $w->emptyTag("source",
-- 
2.20.1




More information about the libvir-list mailing list