Antoni Segura Puimedon has posted comments on this change.

Change subject: Added utility to ensure that files written to the file system 
happen atomically.
......................................................................


Patch Set 1: (3 inline comments)

I agree that there is no hurry for this. I just thought that it is a good way 
to increase the robustness when writing configuration files that will maybe 
avoid us some rollback in crash scenarios.

....................................................
File vdsm/utils.py
Line 831:     def __unicode__(self):
Line 832:         return unicode(self.cmd)
Line 833: 
Line 834: @contextmanager
Line 835: def atomicWrite(file):
Agreed. How about 'targetFile'?
Line 836:     '''Context manager that makes the write happen to a temporary 
file and if
Line 837:     and only it is successful, overwrites the original file. It 
creates the
Line 838:     temporary file in the same directory of the destination file, as 
rename is
Line 839:     only atomic within the same filesystem.'''


Line 836:     '''Context manager that makes the write happen to a temporary 
file and if
Line 837:     and only it is successful, overwrites the original file. It 
creates the
Line 838:     temporary file in the same directory of the destination file, as 
rename is
Line 839:     only atomic within the same filesystem.'''
Line 840:     tempFile = file+'vdsm_temp'
Done
Line 841:     f = open(tempFile, 'w')
Line 842:     yield f
Line 843:     f.flush()
Line 844:     os.fsync(f.fileno())


Line 842:     yield f
Line 843:     f.flush()
Line 844:     os.fsync(f.fileno())
Line 845:     f.close()
Line 846:     os.rename(tempFile, file)
When I finish with the bug I'll setup an oVirt node to test it. By bind-mounted 
do you refer to mount -o bind?


--
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: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Igor Lvovsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to