)]}'
{"nova/objects/instance.py":[{"author":{"_account_id":11189,"name":"yuntongjin","email":"yuntong.jin@intel.com","username":"yuntong"},"change_message_id":"43a989b1728af2278f0b343d375c5336a313f6ef","unresolved":false,"context_lines":[{"line_number":702,"context_line":""},{"line_number":703,"context_line":"    def _save_new_flavor(self, context):"},{"line_number":704,"context_line":"        #  _save_flavor will handle this"},{"line_number":705,"context_line":"        pass"},{"line_number":706,"context_line":""},{"line_number":707,"context_line":"    def _save_vcpu_model(self, context):"},{"line_number":708,"context_line":"        # TODO(yjiang5): should merge the db accesses for all the extra"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba7be1f8_7ad0be53","line":705,"updated":"2015-02-28 08:10:24.000000000","message":"where _save_flavor/_save_old_flavor/_save_new_flavor get called ?","commit_id":"2014d8fa6a65f586deb378c9399fc2e1c0f58b59"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"f28214d1341c3bf54dcd3ed4fd6feef8e3691dff","unresolved":false,"context_lines":[{"line_number":793,"context_line":"            # helper method like self._save_$attrname()"},{"line_number":794,"context_line":"            if (self.obj_attr_is_set(field) and"},{"line_number":795,"context_line":"                    isinstance(self.fields[field], fields.ObjectField)):"},{"line_number":796,"context_line":"                try:"},{"line_number":797,"context_line":"                    getattr(self, \u0027_save_%s\u0027 % field)(context)"},{"line_number":798,"context_line":"                except AttributeError:"},{"line_number":799,"context_line":"                    LOG.exception(_LE(\u0027No save handler for %s\u0027), field,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba7be1f8_ba41560d","line":796,"updated":"2015-02-28 08:13:48.000000000","message":"hi yuntong , here","commit_id":"2014d8fa6a65f586deb378c9399fc2e1c0f58b59"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"366863e8cff1fa49dd09e576ce6a008bc86c6e83","unresolved":false,"context_lines":[{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _save_old_flavor(self, context):"},{"line_number":700,"context_line":"        if \u0027old_flavor\u0027 in self.obj_what_changed():"},{"line_number":701,"context_line":"            self._save_flavor(context)"},{"line_number":702,"context_line":""},{"line_number":703,"context_line":"    def _save_new_flavor(self, context):"},{"line_number":704,"context_line":"        if \u0027new_flavor\u0027 in self.obj_what_changed():"}],"source_content_type":"text/x-python","patch_set":2,"id":"dac4157f_c0f2346f","side":"PARENT","line":701,"updated":"2015-04-21 20:27:44.000000000","message":"Note that this protects us from doing this multiple times in a single save() operation. Thus, we only do one save regardless of which is changed.","commit_id":"a911cadfdc6b5ffa9b13dda00b7f8368fe67b17a"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"8fb0763b1edbb3aef57fd1d4556040f1b68cc50e","unresolved":false,"context_lines":[{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _save_old_flavor(self, context):"},{"line_number":700,"context_line":"        if \u0027old_flavor\u0027 in self.obj_what_changed():"},{"line_number":701,"context_line":"            self._save_flavor(context)"},{"line_number":702,"context_line":""},{"line_number":703,"context_line":"    def _save_new_flavor(self, context):"},{"line_number":704,"context_line":"        if \u0027new_flavor\u0027 in self.obj_what_changed():"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aca2d91_60423212","side":"PARENT","line":701,"in_reply_to":"dac4157f_1c5bf055","updated":"2015-05-08 13:50:32.000000000","message":"Because what if old_flavor has changed and not new_flavor? Or just old_flavor and not flavor? We check all three, and save on the first one we find. Then any others we find that are changed, we skip because we already saved.","commit_id":"a911cadfdc6b5ffa9b13dda00b7f8368fe67b17a"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"7e5c73be5e80a6616ce2d87c9006e4b8deeb4a80","unresolved":false,"context_lines":[{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _save_old_flavor(self, context):"},{"line_number":700,"context_line":"        if \u0027old_flavor\u0027 in self.obj_what_changed():"},{"line_number":701,"context_line":"            self._save_flavor(context)"},{"line_number":702,"context_line":""},{"line_number":703,"context_line":"    def _save_new_flavor(self, context):"},{"line_number":704,"context_line":"        if \u0027new_flavor\u0027 in self.obj_what_changed():"}],"source_content_type":"text/x-python","patch_set":2,"id":"dac4157f_1c5bf055","side":"PARENT","line":701,"in_reply_to":"dac4157f_c0f2346f","updated":"2015-04-22 02:11:58.000000000","message":"hi Dan, thanks for your reviewing.\neven I read the code carefully, I can not get what your mean, can you talk a bit little?\n\nfrom my understanding:\nif we call instance.save(), \nthen we will call each private save function in a loop: \n\nfor field in self.fields:\n            # NOTE(danms): For object fields, we construct and call a\n            # helper method like self._save_$attrname()\n            if (self.obj_attr_is_set(field) and\n                    isinstance(self.fields[field], fields.ObjectField)):\n                try:\n                    getattr(self, \u0027_save_%s\u0027 % field)(context)\n\n...\n\n\nso we will call\n_save_flavor, _save_old_flavor, _save_new_flavor in sequence.\n\nbut in _save_flavor, we already saved flavor_info (include flavor, old_flavor, new_flavor) into db, and then do an obj_reset_changes(...)\nnext time if we call _save_old_flavor or _save_new_flavor, there is no \u0027old_flavor\u0027 and \u0027new_flavor\u0027 in obj_what_changed(), that is to say, there is no chance to call self._save_flavor(context) again, so I wonder why we still need save_old_flavor and _save_new_flavor ?\n\nEli.","commit_id":"a911cadfdc6b5ffa9b13dda00b7f8368fe67b17a"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"366863e8cff1fa49dd09e576ce6a008bc86c6e83","unresolved":false,"context_lines":[{"line_number":684,"context_line":"    def _save_flavor(self, context):"},{"line_number":685,"context_line":"        # FIXME(danms): We can do this smarterly by updating this"},{"line_number":686,"context_line":"        # with all the other extra things at the same time"},{"line_number":687,"context_line":"        if (\u0027old_flavor\u0027 in self.obj_what_changed() or"},{"line_number":688,"context_line":"            \u0027new_flavor\u0027 in self.obj_what_changed() or"},{"line_number":689,"context_line":"            \u0027flavor\u0027 in self.obj_what_changed()):"},{"line_number":690,"context_line":"            flavor_info \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"dac4157f_40518461","line":687,"updated":"2015-04-21 20:27:44.000000000","message":"This is actually not good enough, I think, because the flavor itself could be changed. If you didn\u0027t replace it on the instance, then you won\u0027t get the indication here that it should be saved. We never tweak old_flavor and new_flavor since they\u0027re just temporary storage, but if you\u0027re going to make the change, checking them as well would be good.\n\nIf you want to optimize this, I think you need to check the changed-ness of the flavors too.","commit_id":"649e8088889bcfc2636d6f1d4fc078928c1edc9f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"8fb0763b1edbb3aef57fd1d4556040f1b68cc50e","unresolved":false,"context_lines":[{"line_number":684,"context_line":"    def _save_flavor(self, context):"},{"line_number":685,"context_line":"        # FIXME(danms): We can do this smarterly by updating this"},{"line_number":686,"context_line":"        # with all the other extra things at the same time"},{"line_number":687,"context_line":"        if (\u0027old_flavor\u0027 in self.obj_what_changed() or"},{"line_number":688,"context_line":"            \u0027new_flavor\u0027 in self.obj_what_changed() or"},{"line_number":689,"context_line":"            \u0027flavor\u0027 in self.obj_what_changed()):"},{"line_number":690,"context_line":"            flavor_info \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aca2d91_20e9dae6","line":687,"in_reply_to":"dac4157f_3f6fc62c","updated":"2015-05-08 13:50:32.000000000","message":"I mean you should, for each one, do this:\n\n if \u0027old_flavor\u0027 in self.obj_what_changed() or self.old_flavor.obj_what_changed() or\n     \u0027new_flavor\u0027 in self.obj_what_changed() or self.new_flavor.obj_what_changed() or \n ... etc\n\nCheck not only that instance thinks it changed, but also that the flavor object itself is clean to determine if you should save it.","commit_id":"649e8088889bcfc2636d6f1d4fc078928c1edc9f"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"7e5c73be5e80a6616ce2d87c9006e4b8deeb4a80","unresolved":false,"context_lines":[{"line_number":684,"context_line":"    def _save_flavor(self, context):"},{"line_number":685,"context_line":"        # FIXME(danms): We can do this smarterly by updating this"},{"line_number":686,"context_line":"        # with all the other extra things at the same time"},{"line_number":687,"context_line":"        if (\u0027old_flavor\u0027 in self.obj_what_changed() or"},{"line_number":688,"context_line":"            \u0027new_flavor\u0027 in self.obj_what_changed() or"},{"line_number":689,"context_line":"            \u0027flavor\u0027 in self.obj_what_changed()):"},{"line_number":690,"context_line":"            flavor_info \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"dac4157f_3f6fc62c","line":687,"in_reply_to":"dac4157f_40518461","updated":"2015-04-22 02:11:58.000000000","message":"hi Dan, the changed-ness of flavors are projects and extra_specs, are you mean that we should check if flavors(cur, old, new)\u0027s projects or extra_specs changed, and we need to take care of them?","commit_id":"649e8088889bcfc2636d6f1d4fc078928c1edc9f"}]}
