-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
teuthology: Add support for seek and sync in write_file #2010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea, I would suggest to address the comments and maybe add unit tests.
8b5e772
to
824260d
Compare
Thanks for the review. Comments addressed and tests added. PTAL |
|
||
@patch("teuthology.orchestra.remote.RemoteShell.write_file") | ||
def test_write_file_offset(self, m_write_file): | ||
self.c.write_file("filename", "content", bs=1, offset=1024) | ||
m_write_file.assert_called_with("filename", "content", bs=1, offset=1024) | ||
|
||
@patch("teuthology.orchestra.remote.RemoteShell.write_file") | ||
def test_write_file_sync(self, m_write_file): | ||
self.c.write_file("filename", "content", sync=True) | ||
m_write_file.assert_called_with("filename", "content", sync=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are test not for the remote.write_file
but for cluster.remote_write
, I guess there should be new tests added to test/test_remote.py
module instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
teuthology/orchestra/remote.py
Outdated
@@ -276,11 +277,20 @@ def write_file(self, path, data, sudo=False, mode=None, owner=None, | |||
:param owner: set file owner if provided | |||
:param mkdir: preliminary create the file directory, defaults False | |||
:param append: append data to the file, defaults False | |||
:param bs: write up to N bytes at a time, defaults 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess default is None, maybe just give a reference to dd
, just add another line right after Write data to remote file
above, like:
The data written in 512-byte blocks, provide `bs` to use bigger blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Signed-off-by: Christopher Hoffman <[email protected]>
Signed-off-by: Christopher Hoffman <[email protected]>
824260d
to
0e0d40a
Compare
Add support for seek and sync in write_file.
This patch will allow for partial writes and sync on completion of write.
This is to support strided writes for cephfs on a multi-mount system.