Change in vdsm[master]: utils: Add changehash function for change detection
alitke at redhat.com
alitke at redhat.com
Mon Mar 14 13:46:21 UTC 2016
Adam Litke has posted comments on this change.
Change subject: utils: Add changehash function for change detection
......................................................................
Patch Set 4:
(2 comments)
https://gerrit.ovirt.org/#/c/33045/4/lib/vdsm/utils.py
File lib/vdsm/utils.py:
Line 1223: def changehash(*strings):
Line 1224: """
Line 1225: Returns a hash of strings, suitable for change detection.
Line 1226:
Line 1227: Tipically changehash(string) is sent to client frequently. When a client
Typically
Line 1228: detect that the hash changed, it ask for string itself, which is typically
Line 1229: much bigger.
Line 1230: """
Line 1231: h = hashlib.sha1()
Line 1231: h = hashlib.sha1()
Line 1232: for s in strings:
Line 1233: h.update(s)
Line 1234: # Engine stores this in varchar(30)
Line 1235: return h.hexdigest()[:30]
How likely are we to experience a hash collision since we're taking only the last 30 chars? That seems like a bug in engine to me. Why don't we let them truncate the hash if they want to misuse it.
--
To view, visit https://gerrit.ovirt.org/33045
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2242a594383e2d2fe64e3a581f18b8ac662648b0
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list