From fb7868db19a0f9b6e6a09fa6ebd264261a2e5e5f Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 2 Oct 2013 16:09:05 -0400 Subject: [PATCH] Enable cache=None and io=native by default for block devices This is where performance issues hit the most. This changes the RHEL default to remove cache=None for all file volumes. If anyone cares they can speak up, but it seems an overly unnecessary deviation from upstream qemu. --- tests/utils.py | 3 +- tests/xmlconfig-xml/install-f10.xml | 2 +- tests/xmlconfig-xml/install-f11-ac97.xml | 2 +- tests/xmlconfig-xml/install-f11-noac97.xml | 2 +- .../install-f11-norheldefaults.xml | 2 +- tests/xmlconfig-xml/install-f11-qemu.xml | 2 +- .../install-f11-rheldefaults.xml | 2 +- tests/xmlconfig-xml/install-f11.xml | 2 +- tests/xmlconfig-xml/misc-qemu-driver-name.xml | 2 +- tests/xmlconfig-xml/misc-qemu-driver-type.xml | 2 +- tests/xmlconfig-xml/rhel6-kvm-stage1.xml | 2 +- tests/xmlconfig-xml/rhel6-kvm-stage2.xml | 2 +- tests/xmlconfig-xml/winxp-kvm-stage1.xml | 2 +- tests/xmlconfig-xml/winxp-kvm-stage2.xml | 2 +- tests/xmlconfig-xml/winxp-kvm-stage3.xml | 2 +- virtinst/devicedisk.py | 31 +++++++++---------- 16 files changed, 30 insertions(+), 32 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index 1cff29d2f..d9c12beaa 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -206,7 +206,8 @@ def read_file(filename): def diff_compare(actual_out, filename=None, expect_out=None): """Compare passed string output to contents of filename""" if not expect_out: - #file(filename, "w").write(actual_out) + #if filename: + # file(filename, "w").write(actual_out) expect_out = read_file(filename) diff = "".join(difflib.unified_diff(expect_out.splitlines(1), diff --git a/tests/xmlconfig-xml/install-f10.xml b/tests/xmlconfig-xml/install-f10.xml index 6de2d2ed0..f6cca7c2e 100644 --- a/tests/xmlconfig-xml/install-f10.xml +++ b/tests/xmlconfig-xml/install-f10.xml @@ -25,7 +25,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11-ac97.xml b/tests/xmlconfig-xml/install-f11-ac97.xml index 7f0eb964a..0b2d7fb53 100644 --- a/tests/xmlconfig-xml/install-f11-ac97.xml +++ b/tests/xmlconfig-xml/install-f11-ac97.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11-noac97.xml b/tests/xmlconfig-xml/install-f11-noac97.xml index ae5fd5d09..2531b8949 100644 --- a/tests/xmlconfig-xml/install-f11-noac97.xml +++ b/tests/xmlconfig-xml/install-f11-noac97.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11-norheldefaults.xml b/tests/xmlconfig-xml/install-f11-norheldefaults.xml index 7f0eb964a..0b2d7fb53 100644 --- a/tests/xmlconfig-xml/install-f11-norheldefaults.xml +++ b/tests/xmlconfig-xml/install-f11-norheldefaults.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11-qemu.xml b/tests/xmlconfig-xml/install-f11-qemu.xml index d8ba5ad25..79aa3fa06 100644 --- a/tests/xmlconfig-xml/install-f11-qemu.xml +++ b/tests/xmlconfig-xml/install-f11-qemu.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11-rheldefaults.xml b/tests/xmlconfig-xml/install-f11-rheldefaults.xml index f3218bcd2..936a1ea92 100644 --- a/tests/xmlconfig-xml/install-f11-rheldefaults.xml +++ b/tests/xmlconfig-xml/install-f11-rheldefaults.xml @@ -24,7 +24,7 @@ - + diff --git a/tests/xmlconfig-xml/install-f11.xml b/tests/xmlconfig-xml/install-f11.xml index 120e34773..8bb2f38c1 100644 --- a/tests/xmlconfig-xml/install-f11.xml +++ b/tests/xmlconfig-xml/install-f11.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/misc-qemu-driver-name.xml b/tests/xmlconfig-xml/misc-qemu-driver-name.xml index 7e4e687f8..791834fb9 100644 --- a/tests/xmlconfig-xml/misc-qemu-driver-name.xml +++ b/tests/xmlconfig-xml/misc-qemu-driver-name.xml @@ -21,7 +21,7 @@ /usr/lib/xen/bin/qemu-dm - + diff --git a/tests/xmlconfig-xml/misc-qemu-driver-type.xml b/tests/xmlconfig-xml/misc-qemu-driver-type.xml index fde634fe5..8d88b3eec 100644 --- a/tests/xmlconfig-xml/misc-qemu-driver-type.xml +++ b/tests/xmlconfig-xml/misc-qemu-driver-type.xml @@ -26,7 +26,7 @@ - + diff --git a/tests/xmlconfig-xml/rhel6-kvm-stage1.xml b/tests/xmlconfig-xml/rhel6-kvm-stage1.xml index e9c2a35b5..4528befb1 100644 --- a/tests/xmlconfig-xml/rhel6-kvm-stage1.xml +++ b/tests/xmlconfig-xml/rhel6-kvm-stage1.xml @@ -31,7 +31,7 @@ - + diff --git a/tests/xmlconfig-xml/rhel6-kvm-stage2.xml b/tests/xmlconfig-xml/rhel6-kvm-stage2.xml index b93dbbc9a..e1c12d8e6 100644 --- a/tests/xmlconfig-xml/rhel6-kvm-stage2.xml +++ b/tests/xmlconfig-xml/rhel6-kvm-stage2.xml @@ -29,7 +29,7 @@ - + diff --git a/tests/xmlconfig-xml/winxp-kvm-stage1.xml b/tests/xmlconfig-xml/winxp-kvm-stage1.xml index 468560d59..130c4c3c7 100644 --- a/tests/xmlconfig-xml/winxp-kvm-stage1.xml +++ b/tests/xmlconfig-xml/winxp-kvm-stage1.xml @@ -25,7 +25,7 @@ - + diff --git a/tests/xmlconfig-xml/winxp-kvm-stage2.xml b/tests/xmlconfig-xml/winxp-kvm-stage2.xml index e09f8e398..ad75da17d 100644 --- a/tests/xmlconfig-xml/winxp-kvm-stage2.xml +++ b/tests/xmlconfig-xml/winxp-kvm-stage2.xml @@ -24,7 +24,7 @@ - + diff --git a/tests/xmlconfig-xml/winxp-kvm-stage3.xml b/tests/xmlconfig-xml/winxp-kvm-stage3.xml index 9d1727ecd..10d96cf7a 100644 --- a/tests/xmlconfig-xml/winxp-kvm-stage3.xml +++ b/tests/xmlconfig-xml/winxp-kvm-stage3.xml @@ -24,7 +24,7 @@ - + diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py index 79e92a817..2d962ee2c 100644 --- a/virtinst/devicedisk.py +++ b/virtinst/devicedisk.py @@ -28,7 +28,6 @@ import re import urlgrabber.progress as progress -import virtinst from virtinst import diskbackend from virtinst import util from virtinst import VirtualDevice @@ -716,26 +715,24 @@ class VirtualDisk(VirtualDevice): if volobj: self._change_backend(None, volobj) - def _set_rhel_defaults(self): - if not self.conn.is_qemu(): - return - if not self.is_disk(): - return - - # Enable cache=none for disk devs - if not self.driver_cache: - self.driver_cache = self.CACHE_MODE_NONE - - # Enable AIO native for block devices - if (not self.driver_io and self.type == self.TYPE_BLOCK): - self.driver_io = self.IO_MODE_NATIVE - def set_defaults(self): if self.is_cdrom(): self.read_only = True - if virtinst.enable_rhel_defaults: - self._set_rhel_defaults() + if not self.conn.is_qemu(): + return + if not self.is_disk(): + return + if not self.type == self.TYPE_BLOCK: + return + + # Enable cache=none and io=native for block devices. Would + # be nice if qemu did this for us but that time has long passed. + if not self.driver_cache: + self.driver_cache = self.CACHE_MODE_NONE + if not self.driver_io: + self.driver_io = self.IO_MODE_NATIVE + def is_size_conflict(self): """