diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-09 05:21:11 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-09 05:21:11 +0000 |
| commit | de9991b6eb2b4c745bfeaf4ac42f5e00aa8c6e0a (patch) | |
| tree | 6e87072d2b5a1941478b23eef9c2052d51d74ce6 | |
| parent | 96dc558542a7ae736efac339cc9f857d4d8490cc (diff) | |
| parent | df749aea97cd8578952cc21b5289ae9c32f73c98 (diff) | |
Merge "ensure zeros are written out when clearing volumes"
| -rwxr-xr-x | nova/virt/libvirt/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index 1830cac33..b8e0cafec 100755 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -237,6 +237,7 @@ def clear_logical_volume(path): vol_size = logical_volume_size(path) bs = 1024 * 1024 direct_flags = ('oflag=direct',) + sync_flags = () remaining_bytes = vol_size # The loop caters for versions of dd that @@ -248,11 +249,14 @@ def clear_logical_volume(path): 'if=/dev/zero', 'of=%s' % path, 'seek=%s' % seek_blocks, 'count=%s' % zero_blocks) zero_cmd += direct_flags + zero_cmd += sync_flags if zero_blocks: utils.execute(*zero_cmd, run_as_root=True) remaining_bytes %= bs bs /= 1024 # Limit to 3 iterations - direct_flags = () # Only use O_DIRECT with initial block size + # Use O_DIRECT with initial block size and fdatasync otherwise + direct_flags = () + sync_flags = ('conv=fdatasync',) def remove_logical_volumes(*paths): |
