Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan Kenigsberg,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: enable task tag as list of strings ......................................................................
enable task tag as list of strings
Multiple tags are stored as space-separated string and search is done an in-string search instead of a proper set membership. This approach enables tag as list of strings and supports backward compatibility
Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Signed-off-by: Bala.FA barumuga@redhat.com --- M vdsm/storage/task.py 1 file changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/8899/1
diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py index a596494..6c79c85 100644 --- a/vdsm/storage/task.py +++ b/vdsm/storage/task.py @@ -49,6 +49,7 @@ import logging import threading import types +import ast
import storage_exception as se import uuid @@ -411,13 +412,22 @@ high = "high"
+class TagList(list): + def __init__(self, s): + if s.startswith('[') and s.endswith(']'): + l = ast.literal_eval(s) + else: + l = s.split(' ') + list.__init__(self, l) + + class Task: # External Task info fields = { # field_name: type "id": str, "name": unicode, - "tag": unicode, + "tag": TagList, "store": unicode, "recoveryPolicy": TaskRecoveryType, "persistPolicy": TaskPersistType, @@ -448,7 +458,7 @@ self.callbackLock = threading.Lock() self.id = str(id) self.name = name - self.tag = tag + self.tag = TagList(tag) self.priority = priority self.recoveryPolicy = recovery self.persistPolicy = TaskPersistType.none @@ -972,7 +982,7 @@ def setTag(self, tag): if KEY_SEPERATOR in tag: raise ValueError("tag cannot include %s character" % KEY_SEPERATOR) - self.tag = unicode(tag) + self.tag = TagList(unicode(tag))
def isDone(self): return self.state.isDone() @@ -1257,7 +1267,7 @@ "code": self.result.code, "message": self.result.message, "result": self.result.result, - "tag": self.tag + "tag": str(self.tag) }
def getID(self):
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com
Saggi Mizrahi has posted comments on this change.
Change subject: enable task tag as list of strings ......................................................................
Patch Set 1: Do not submit
I don't understand why this feature is even necessary and in any case this is the most convoluted way to accomplish it.
In any case:
Inheritance is counter productive. Especially from stuff like list, dict or thread.
def parseTagList(str): "Gets a string and returns a list of tags"
Would have been as effective without making everything needlessly complicated.
Don't use eval and it's friend to parse data handed of from outside vdsm, it's dangerous.
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Shireesh Anjal sanjal@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Bala.FA has posted comments on this change.
Change subject: enable task tag as list of strings ......................................................................
Patch Set 1:
Ok. I will do the change and send new patch accordingly.
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Shireesh Anjal sanjal@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: enable task tag as list of unique strings ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/15/
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Shireesh Anjal sanjal@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: enable task tag as list of unique strings ......................................................................
Patch Set 2: Verified
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/15/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Shireesh Anjal sanjal@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Bala.FA has abandoned this change.
Change subject: enable task tag as list of unique strings ......................................................................
Patch Set 2: Abandoned
This approach is not valid for new design tracked at http://gerrit.ovirt.org/#/c/10200/
-- To view, visit http://gerrit.ovirt.org/8899 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: abandon Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Bala.FA barumuga@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Shireesh Anjal sanjal@redhat.com Gerrit-Reviewer: Timothy Asir tjeyasin@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org