)]}'
{"ovsdbapp/backend/ovs_idl/command.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e17884dbdaddbab8fe44ecdfce1e1136f975ff3d","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        # If get_insert_uuid fails, self.result was not a result of a"},{"line_number":75,"context_line":"        # recent insert. Most likely we are post_commit after a lookup()"},{"line_number":76,"context_line":"        real_uuid \u003d (txn.get_insert_uuid(self.result) or"},{"line_number":77,"context_line":"                     getattr(self.result, \u0027uuid\u0027, self.result))"},{"line_number":78,"context_line":"        row \u003d self.api.tables[self.table_name].rows[real_uuid]"},{"line_number":79,"context_line":"        self.result \u003d rowview.RowView(row)"},{"line_number":80,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_0a1bf11a","line":77,"updated":"2020-04-07 16:37:57.000000000","message":"Hi Terry:\n\nExcuse if this comment has no sense. If self.result if going to be a row or a rowview, why don\u0027t retrieve first the UUID from this object and then try to \"get_insert_uuid\"?\n\nSomething like:\n_uuid \u003d getattr(self.result, \u0027uuid\u0027, self.result)\nreal_uuid \u003d txn.get_insert_uuid(_uuid) or _uuid","commit_id":"da4270d2ce208135f90fa33cee4a6cbff1ea0379"},{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"20c50b4ef031c67d53dacacfa9666ba999fb0fdc","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        # If get_insert_uuid fails, self.result was not a result of a"},{"line_number":75,"context_line":"        # recent insert. Most likely we are post_commit after a lookup()"},{"line_number":76,"context_line":"        real_uuid \u003d (txn.get_insert_uuid(self.result) or"},{"line_number":77,"context_line":"                     getattr(self.result, \u0027uuid\u0027, self.result))"},{"line_number":78,"context_line":"        row \u003d self.api.tables[self.table_name].rows[real_uuid]"},{"line_number":79,"context_line":"        self.result \u003d rowview.RowView(row)"},{"line_number":80,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_7080b047","line":77,"in_reply_to":"df33271e_0a1bf11a","updated":"2020-04-07 18:08:03.000000000","message":"Because get_insert_uuid() in python-ovs returns the permanent uuid assigned by ovsdb-server based on the temporary uuid that was returned by txn.insert(). If that lookup fails, it returns None. We don\u0027t want to possibly try to return .rows[None], we want to return either a) The row from memory based on the new permanent UUID or b) a RowView based on the whatever self.result is set to because the Command looked up a row and returned it due to may_exist or something instead of creating a new row.\n\nWith that said, taking the Row/RowView, grabbing the uuid, then looking up the in-memory version of the Row by that uuid just to get back that same Row and convert it to a RowView is a little silly. An alternative, which may be better, is doing something like:\n\n real_uuid \u003d txn.get_insert_uuid(self.result)\n if real_uuid:\n     row \u003d self.api.tables[self.table_name].rows[real_uuid]\n elif isinstance(self.result, ovs.db.idl.Row):\n     row \u003d self.result\n elif isinstance(self.result, rowview.RowView):\n     return\n self.result \u003d rowview.RowView(row)\n\nAs an aside...The only way I can think of that we\u0027d end up in post_commit() with a non-uuid (from QoSAddCommand anyway) is either a) may_exist\u003dTrue and RowView() is set as the result AND we have multiple commands in the transaction--because if QoSAddCommand was the only command, no change would be made, so txn status would be UNCHANGED, and post_commit is only run for SUCCESS or b) the QoSAddCommand object is run twice, and the previous result is already stored on the command, and somehow we fall through before setting a new result (seems impossible).\n\nSo I\u0027m still really confused how a RowView is our key since we aren\u0027t passing may_exist\u003dTrue. I thought maybe the arguments ended up shifted and may_exist might be one of the other arguments and evaluate to True...but it doesn\u0027t look like that is possible. It\u0027s still a mystery.","commit_id":"da4270d2ce208135f90fa33cee4a6cbff1ea0379"},{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"ca0217f29949ea106da40499998cf0bcc7c018ec","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        # If get_insert_uuid fails, self.result was not a result of a"},{"line_number":75,"context_line":"        # recent insert. Most likely we are post_commit after a lookup()"},{"line_number":76,"context_line":"        real_uuid \u003d (txn.get_insert_uuid(self.result) or"},{"line_number":77,"context_line":"                     getattr(self.result, \u0027uuid\u0027, self.result))"},{"line_number":78,"context_line":"        row \u003d self.api.tables[self.table_name].rows[real_uuid]"},{"line_number":79,"context_line":"        self.result \u003d rowview.RowView(row)"},{"line_number":80,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_5b802d47","line":77,"in_reply_to":"df33271e_3030e89e","updated":"2020-04-07 18:47:23.000000000","message":"without the 3rd branch, wouldn\u0027t I possibly try to do a rowview.RowView(row) where row is already a RowView? I could move it before the real_uuid evaluation since we know if result isn\u0027t a UUID, get_insert_uuid will return None.","commit_id":"da4270d2ce208135f90fa33cee4a6cbff1ea0379"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"09ce2275ea4f6b78f25e157c659bac6995f2501b","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        # If get_insert_uuid fails, self.result was not a result of a"},{"line_number":75,"context_line":"        # recent insert. Most likely we are post_commit after a lookup()"},{"line_number":76,"context_line":"        real_uuid \u003d (txn.get_insert_uuid(self.result) or"},{"line_number":77,"context_line":"                     getattr(self.result, \u0027uuid\u0027, self.result))"},{"line_number":78,"context_line":"        row \u003d self.api.tables[self.table_name].rows[real_uuid]"},{"line_number":79,"context_line":"        self.result \u003d rowview.RowView(row)"},{"line_number":80,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"df33271e_3030e89e","line":77,"in_reply_to":"df33271e_7080b047","updated":"2020-04-07 18:15:55.000000000","message":"I\u0027m still scratching the surface of this project so I can\u0027t reply to this hehehe.\n\nBTW, the code above (in your comment) looks more explicit (and better for someone like me still learning on this code). I think you don\u0027t need the third \"if\" branch.","commit_id":"da4270d2ce208135f90fa33cee4a6cbff1ea0379"}]}
