diff options
| author | Daniel P. Berrange <berrange@redhat.com> | 2012-03-09 06:01:35 -0500 |
|---|---|---|
| committer | Daniel P. Berrange <berrange@redhat.com> | 2012-03-09 07:59:50 -0500 |
| commit | 2d11e87d2332577170cb983d6f41441bc534cd7e (patch) | |
| tree | ffcd710aceededcc41488ca8b47044239edda0b0 /nova/virt | |
| parent | 17396f6a08b694b28538462baca582266152da86 (diff) | |
Use cache='none' for all disks
The default QEMU disk cache mode has changed several times in
QEMU's history. This means OpenStack launched VMs have unpredictable
data consistency guarantees and performance characteristics. Using
cache=none bypasses the host page cache by using direct IO. This
ensures:
- Consistent I/O performance for VMs
- Avoids data loss on a host OS crash
- Avoids data corruption of images during migration
Change-Id: I099dac55b8cfa1f0ec5d0e49d1d9ffbe4ae2560d
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/libvirt.xml.template | 12 | ||||
| -rw-r--r-- | nova/virt/libvirt/volume.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/nova/virt/libvirt.xml.template b/nova/virt/libvirt.xml.template index ef024c3dd..a3c6cc691 100644 --- a/nova/virt/libvirt.xml.template +++ b/nova/virt/libvirt.xml.template @@ -66,40 +66,40 @@ #else #if $getVar('rescue', False) <disk type='file'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source file='${basepath}/disk.rescue'/> <target dev='${disk_prefix}a' bus='${ephemeral_disk_bus}'/> </disk> <disk type='file'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source file='${basepath}/disk'/> <target dev='${disk_prefix}b' bus='${ephemeral_disk_bus}'/> </disk> #else #if not ($getVar('ebs_root', False)) <disk type='file' device='${root_device_type}'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source file='${basepath}/disk'/> <target dev='${root_device}' bus='${root_disk_bus}'/> </disk> #end if #if $getVar('ephemeral_device', False) <disk type='file'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source file='${basepath}/disk.local'/> <target dev='${ephemeral_device}' bus='${ephemeral_disk_bus}'/> </disk> #end if #for $eph in $ephemerals <disk type='block'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source dev='${basepath}/${eph.device_path}'/> <target dev='${eph.device}' bus='${ephemeral_disk_bus}'/> </disk> #end for #if $getVar('swap_device', False) <disk type='file'> - <driver type='${driver_type}'/> + <driver type='${driver_type}' cache='none'/> <source file='${basepath}/disk.swap'/> <target dev='${swap_device}' bus='${ephemeral_disk_bus}'/> </disk> diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py index 055e34abc..784867eaf 100644 --- a/nova/virt/libvirt/volume.py +++ b/nova/virt/libvirt/volume.py @@ -44,7 +44,7 @@ class LibvirtVolumeDriver(object): driver = self._pick_volume_driver() device_path = connection_info['data']['device_path'] xml = """<disk type='block'> - <driver name='%s' type='raw'/> + <driver name='%s' type='raw' cache='none'/> <source dev='%s'/> <target dev='%s' bus='virtio'/> </disk>""" % (driver, device_path, mount_device) @@ -62,7 +62,7 @@ class LibvirtFakeVolumeDriver(LibvirtVolumeDriver): protocol = 'fake' name = 'fake' xml = """<disk type='network'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='raw' cache='none'/> <source protocol='%s' name='%s'/> <target dev='%s' bus='virtio'/> </disk>""" % (protocol, name, mount_device) @@ -77,7 +77,7 @@ class LibvirtNetVolumeDriver(LibvirtVolumeDriver): protocol = connection_info['driver_volume_type'] name = connection_info['data']['name'] xml = """<disk type='network'> - <driver name='%s' type='raw'/> + <driver name='%s' type='raw' cache='none'/> <source protocol='%s' name='%s'/> <target dev='%s' bus='virtio'/> </disk>""" % (driver, protocol, name, mount_device) |
