)]}'
{"nova/objects/instance.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"a11b9eb5f3d884e2a1a548dc745b48bd3267cd37","unresolved":false,"context_lines":[{"line_number":266,"context_line":"        \u0027vcpu_model\u0027: [(\u00271.19\u0027, \u00271.0\u0027)],"},{"line_number":267,"context_line":"    }"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    extra_db_updates \u003d {}"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":272,"context_line":"        super(Instance, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aaa499b_550520c0","line":269,"updated":"2015-04-11 23:30:04.000000000","message":"I think it would be simpler to use a local variable in save() to pass to private functions to collect extra updates instead setting and clearing a member variable. Concerns around it not being cleared if an exception is raised in the middle of a save() before it\u0027s cleared, etc.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"6e14e7fa23f4254887654ae9d6f801198be8f8ee","unresolved":false,"context_lines":[{"line_number":266,"context_line":"        \u0027vcpu_model\u0027: [(\u00271.19\u0027, \u00271.0\u0027)],"},{"line_number":267,"context_line":"    }"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    extra_db_updates \u003d {}"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":272,"context_line":"        super(Instance, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"dac4157f_56319ceb","line":269,"in_reply_to":"7aaa499b_550520c0","updated":"2015-04-20 09:48:00.000000000","message":"then we need to add a new parameter to each _save_xxx function?\nthat changes lots... I am afraid. \n\nfor you concerns, my explanation is self.extra_db_updates.clear is called in the beginning of save(), it\u0027s before db operation, so even exception is raised in the middle of a save, it is kept, but next save will clear them first.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b23e42fc68556647317bcebce638809510ebf5ba","unresolved":false,"context_lines":[{"line_number":266,"context_line":"        \u0027vcpu_model\u0027: [(\u00271.19\u0027, \u00271.0\u0027)],"},{"line_number":267,"context_line":"    }"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    extra_db_updates \u003d {}"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":272,"context_line":"        super(Instance, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"dac4157f_8cb6e088","line":269,"in_reply_to":"dac4157f_56319ceb","updated":"2015-04-21 01:09:45.000000000","message":"I see your point. And the more I think about it, it wouldn\u0027t be good to mutate a dict we pass into the functions anyway.\n\nThat said, I think we need to move this to be a private instance variable instead of a public static one. Like _extra_db_updates \u003d {} in __init__. Otherwise these updates won\u0027t be kept per-instance and will overwrite each other.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"833172014db7bdcc0f7da7f63ba06ee37eaf08b9","unresolved":false,"context_lines":[{"line_number":266,"context_line":"        \u0027vcpu_model\u0027: [(\u00271.19\u0027, \u00271.0\u0027)],"},{"line_number":267,"context_line":"    }"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"    extra_db_updates \u003d {}"},{"line_number":270,"context_line":""},{"line_number":271,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":272,"context_line":"        super(Instance, self).__init__(*args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"dac4157f_cf372aaf","line":269,"in_reply_to":"dac4157f_8cb6e088","updated":"2015-04-21 01:19:20.000000000","message":"Correction: I see because you used self.extra_db_updates they wouldn\u0027t overwrite. Still I think it doesn\u0027t make sense to have a static version.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"a11b9eb5f3d884e2a1a548dc745b48bd3267cd37","unresolved":false,"context_lines":[{"line_number":694,"context_line":"            # NOTE(eliqiao): save extra db updates fields to extra_db_updates"},{"line_number":695,"context_line":"            self.extra_db_updates.update("},{"line_number":696,"context_line":"                {\u0027flavor\u0027: jsonutils.dumps(flavor_info)})"},{"line_number":697,"context_line":"            self.obj_reset_changes([\u0027flavor\u0027, \u0027old_flavor\u0027, \u0027new_flavor\u0027])"},{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _save_old_flavor(self, context):"},{"line_number":700,"context_line":"        #  _save_flavor will handle this"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aaa499b_75001cab","line":697,"updated":"2015-04-11 23:30:04.000000000","message":"It doesn\u0027t seem right to reset the changes in the object before the updates have actually been saved in the database. The way I can think to address this is move it to _save_extra_fields after the db update, if \u0027flavor\u0027 was part of the updates.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"6e14e7fa23f4254887654ae9d6f801198be8f8ee","unresolved":false,"context_lines":[{"line_number":694,"context_line":"            # NOTE(eliqiao): save extra db updates fields to extra_db_updates"},{"line_number":695,"context_line":"            self.extra_db_updates.update("},{"line_number":696,"context_line":"                {\u0027flavor\u0027: jsonutils.dumps(flavor_info)})"},{"line_number":697,"context_line":"            self.obj_reset_changes([\u0027flavor\u0027, \u0027old_flavor\u0027, \u0027new_flavor\u0027])"},{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _save_old_flavor(self, context):"},{"line_number":700,"context_line":"        #  _save_flavor will handle this"}],"source_content_type":"text/x-python","patch_set":1,"id":"dac4157f_3674e89a","line":697,"in_reply_to":"7aaa499b_75001cab","updated":"2015-04-20 09:48:00.000000000","message":"thanks, make sense.","commit_id":"b6c3c651d502a3cba391317345f4c0826561b644"}]}
