Jiří Moskovčák has uploaded a new change for review. Change subject: don't use direct io on block devices ......................................................................
don't use direct io on block devices In python the O_DIRECT flag doesn't work properly, because it needs the buffer alligned to 512B to read into and in python it's not possible to control the size so the attempt to read from file using O_DIRECT fails with an os exception. It's also doubtful if it ever worked as intended because the code used direct_io only to read, but not write. Change-Id: Ie5264e1757e43f22e860af3869495ebab15e0d85 Signed-off-by: Jiri Moskovcak <[email protected]> --- M ovirt_hosted_engine_ha/broker/storage_broker.py M ovirt_hosted_engine_ha/env/constants.py.in M ovirt_hosted_engine_ha/lib/storage_backends.py 3 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha refs/changes/71/27971/1 diff --git a/ovirt_hosted_engine_ha/broker/storage_broker.py b/ovirt_hosted_engine_ha/broker/storage_broker.py index 5ffe238..5ee8660 100644 --- a/ovirt_hosted_engine_ha/broker/storage_broker.py +++ b/ovirt_hosted_engine_ha/broker/storage_broker.py @@ -112,7 +112,7 @@ # from hiding metadata file updates from other hosts. For NFS, we # don't have to worry about alignment; see man open(2) for details. # TODO it would be better if this was configurable - direct_flag = (os.O_DIRECT if constants.USE_DIRECT_IO else 0) + direct_flag = (os.O_DIRECT if self._backends[client].direct_io else 0) bs = constants.HOST_SEGMENT_BYTES # TODO it would be better if this was configurable diff --git a/ovirt_hosted_engine_ha/env/constants.py.in b/ovirt_hosted_engine_ha/env/constants.py.in index 3fefd40..1a3064a 100644 --- a/ovirt_hosted_engine_ha/env/constants.py.in +++ b/ovirt_hosted_engine_ha/env/constants.py.in @@ -26,7 +26,6 @@ HOST_SEGMENT_BYTES = 4096 METADATA_BLOCK_BYTES = 512 SERVICE_TYPE = 'hosted-engine' -USE_DIRECT_IO = True HOST_ALIVE_TIMEOUT_SECS = 60 # See http://www.gnu.org/software/automake/manual/html_node/Scripts.html diff --git a/ovirt_hosted_engine_ha/lib/storage_backends.py b/ovirt_hosted_engine_ha/lib/storage_backends.py index b6c1305..37db6f7 100644 --- a/ovirt_hosted_engine_ha/lib/storage_backends.py +++ b/ovirt_hosted_engine_ha/lib/storage_backends.py @@ -31,6 +31,7 @@ __metaclass__ = ABCMeta def __init__(self): + self.direct_io = True # the atomic block size of the underlying storage self._blocksize = constants.METADATA_BLOCK_BYTES @@ -317,6 +318,8 @@ def __init__(self, block_dev_name, dm_prefix): super(BlockBackend, self).__init__() + # direct io doesn't work for block devices + self.direct_io = False self._block_dev_name = block_dev_name self._dm_prefix = dm_prefix.replace("-", "--") self._services = {} -- To view, visit http://gerrit.ovirt.org/27971 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie5264e1757e43f22e860af3869495ebab15e0d85 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-ha Gerrit-Branch: master Gerrit-Owner: Jiří Moskovčák <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
