Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 13: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 12: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 12 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 11: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 11 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 10: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 9: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 9 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 8: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 8 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
Dan Kenigsberg has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 7: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 7: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
Adam Litke has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 6: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 5: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 4: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 3: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 2: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
Nir Soffer has uploaded a new change for review. Change subject: directio: Introduce vdsm.storage.directio module .. directio: Introduce vdsm.storage.directio module Move DirectFile class from storage.fileUtils to new vdsm.storage.directio module. Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Signed-off-by: Nir Soffer --- M debian/vdsm-python.install M lib/vdsm/storage/Makefile.am A lib/vdsm/storage/directio.py M tests/Makefile.am M tests/fileUtilTests.py A tests/storage_directio_test.py M vdsm.spec.in M vdsm/storage/fileUtils.py M vdsm/storage/remoteFileHandler.py 9 files changed, 264 insertions(+), 208 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/54690/1 diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install index 1faf48e..fae988c 100644 --- a/debian/vdsm-python.install +++ b/debian/vdsm-python.install @@ -63,6 +63,7 @@ ./usr/lib/python2.7/dist-packages/vdsm/storage/__init__.py ./usr/lib/python2.7/dist-packages/vdsm/storage/constants.py ./usr/lib/python2.7/dist-packages/vdsm/storage/securable.py +./usr/lib/python2.7/dist-packages/vdsm/storage/directio.py ./usr/lib/python2.7/dist-packages/vdsm/storage/exception.py ./usr/lib/python2.7/dist-packages/vdsm/supervdsm.py ./usr/lib/python2.7/dist-packages/vdsm/taskset.py diff --git a/lib/vdsm/storage/Makefile.am b/lib/vdsm/storage/Makefile.am index 5970de6..b6f1ac9 100644 --- a/lib/vdsm/storage/Makefile.am +++ b/lib/vdsm/storage/Makefile.am @@ -25,5 +25,6 @@ __init__.py \ constants.py \ securable.py \ + directio.py \ exception.py \ $(NULL) diff --git a/lib/vdsm/storage/directio.py b/lib/vdsm/storage/directio.py new file mode 100644 index 000..f72a9f5 --- /dev/null +++ b/lib/vdsm/storage/directio.py @@ -0,0 +1,184 @@ +# Copyright 2012-2016 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +from __future__ import absolute_import + +import ctypes +import logging +import os + +from StringIO import StringIO +from contextlib import closing +from contextlib import contextmanager + +log = logging.getLogger('storage.directio') + +libc = ctypes.CDLL("libc.so.6", use_errno=True) +CharPointer = ctypes.POINTER(ctypes.c_char) + +_PC_REC_XFER_ALIGN = 17 +_PC_REC_MIN_XFER_SIZE = 16 + + +class DirectFile(object): + +def __init__(self, path, mode): +self._writable = True +flags = os.O_DIRECT + +if "r" in mode: +if "+" in mode: +flags |= os.O_RDWR +else: +flags |= os.O_RDONLY +self._writable = False +elif "w" in mode: +flags |= os.O_CREAT | os.O_TRUNC +if "+" in mode: +flags |= os.O_RDWR +else: +flags |= os.O_WRONLY + +elif "a" in mode: +flags |= os.O_APPEND +else: +raise ValueError("Invalid mode parameter") + +self._mode = mode +self._fd = os.open(path, flags) +self._closed = False + +def __enter__(self): +return self + +def __exit__(self, exc_type, exc_value, traceback): +self.close() + +def fileno(self): +return self._fd + +@property +def closed(self): +return self._closed + +@property +def mode(self): +return self._mode + +def seekable(self): +return True + +def readable(self): +return True + +def writable(self): +return self._writable + +def readlines(self): +return self.readall().splitlines() + +def writelines(self, lines): +data = ''.join([l if l.endswith('\n') else l + '\n' for l in lines]) +self.write(data) + +def tell(self): +return self.seek(0, os.SEEK_CUR) + +@contextmanager +def _createAlignedBuffer(self, size): +pbuff = ctypes.c_char_p(0) +ppbuff = ctypes.pointer(pbuff) +# Because we usually have fixed sizes for our reads, caching +# buffers might give a slight performance boost. +alignment = libc.fpathconf(self.fileno(), _PC_REC_XFER_ALIGN) +minXferSize = libc.fpathconf(self.fileno(), _PC_REC_MIN_XFER_S
Change in vdsm[master]: directio: Introduce vdsm.storage.directio module
gerrit-hooks has posted comments on this change. Change subject: directio: Introduce vdsm.storage.directio module .. Patch Set 1: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/54690 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8557095df26d5a253088be07d0fdeb668ba59e58 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches