Yaniv Bronhaim has posted comments on this change. Change subject: utils: atomic file write ......................................................................
Patch Set 3: Code-Review+2 (2 comments) https://gerrit.ovirt.org/#/c/61950/3/lib/vdsm/utils.py File lib/vdsm/utils.py: Line 949: prefix=os.path.basename(filename) + '.', Line 950: suffix='.tmp') Line 951: os.close(fd) Line 952: try: Line 953: if os.path.exists(filename): > race between this line and the next line? this is not so bad, it just copies the current content, if in parallel someone else opens the file with that function, the newer state will received. but the writing ("renaming"), happens at the end in atomic call Line 954: shutil.copyfile(filename, tmp_filename) Line 955: with open(tmp_filename, flag) as f: Line 956: yield f Line 957: except: Line 956: yield f Line 957: except: Line 958: rmFile(tmp_filename) Line 959: raise Line 960: else: > else of what if statement? else of the try statement. it runs if except was not called -- To view, visit https://gerrit.ovirt.org/61950 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icbb5a2d3ac439a334db2c9075376f219c356762c Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Petr Horáček <phora...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Edward Haas <edwa...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček <phora...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: Yaniv Kaul <yk...@redhat.com> Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org