Dan Kenigsberg has posted comments on this change.
Change subject: Added utility to ensure that files written to the file system happen atomically. ......................................................................
Patch Set 2: (1 inline comment)
.................................................... File vdsm/utils.py Line 860: '''Context manager that makes the write happen to a temporary file and if Line 861: and only it is successful, overwrites the original file. It creates the Line 862: temporary file in the same directory of the destination file, as rename is Line 863: only atomic within the same filesystem.''' Line 864: tempFile = targetFile+'_vdsm_'+randomStr(6) nitpick, before I forget: new code should bet pep8 ready. surround "+" with spaces. Line 865: f = open(tempFile, 'w') Line 866: yield f Line 867: f.flush() Line 868: os.fsync(f.fileno())
-- To view, visit http://gerrit.ovirt.org/7656 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ibecd61d6746231a5a8cb17bad9a3302b01454f27 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Igor Lvovsky ilvovsky@redhat.com Gerrit-Reviewer: Livnat Peer lpeer@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server