)]}'
{"nova/api/openstack/placement/objects/resource_provider.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"cc1bfdaf2c58260ea6c829403e3849d5a21bf5cf","unresolved":false,"context_lines":[{"line_number":1084,"context_line":"            raise exception.ObjectActionError("},{"line_number":1085,"context_line":"                    action\u003d\u0027update\u0027,"},{"line_number":1086,"context_line":"                    reason\u003d_(\u0027parent provider UUID does not exist.\u0027))"},{"line_number":1087,"context_line":"        # We should also update the root providers of resource providers"},{"line_number":1088,"context_line":"        # originally in the same tree."},{"line_number":1089,"context_line":"        for rp in same_tree:"},{"line_number":1090,"context_line":"            rp.root_provider_uuid \u003d parent_ids.root_uuid"},{"line_number":1091,"context_line":"            db_rp \u003d context.session.query("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_c60dd535","line":1088,"range":{"start_line":1087,"start_character":1,"end_line":1088,"end_character":38},"updated":"2018-07-05 07:47:14.000000000","message":"same_tree contains the RPs in the tree of the updated RP _before_ the parent update. Today it contains only the RP being updated and every descendants as the RP cannot have any parent before the update. So today same_tree contains the RPs that are moved to a new parent by the update. So this is OK today.\nBUT as soon as we allow re-parenting (if ever) this code will break as it will update the root of the ancestors of the RP being re-parented as well. \nI suggest to add a note here for the future reader about this.","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"e8f201402e004ee3001d1954b6d09129932fb7ba","unresolved":false,"context_lines":[{"line_number":1084,"context_line":"            raise exception.ObjectActionError("},{"line_number":1085,"context_line":"                    action\u003d\u0027update\u0027,"},{"line_number":1086,"context_line":"                    reason\u003d_(\u0027parent provider UUID does not exist.\u0027))"},{"line_number":1087,"context_line":"        # We should also update the root providers of resource providers"},{"line_number":1088,"context_line":"        # originally in the same tree."},{"line_number":1089,"context_line":"        for rp in same_tree:"},{"line_number":1090,"context_line":"            rp.root_provider_uuid \u003d parent_ids.root_uuid"},{"line_number":1091,"context_line":"            db_rp \u003d context.session.query("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_cb338712","line":1088,"range":{"start_line":1087,"start_character":1,"end_line":1088,"end_character":38},"in_reply_to":"5f7c97a3_c60dd535","updated":"2018-07-06 06:51:13.000000000","message":"Good suggestion. Done.","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"cc1bfdaf2c58260ea6c829403e3849d5a21bf5cf","unresolved":false,"context_lines":[{"line_number":1086,"context_line":"                    reason\u003d_(\u0027parent provider UUID does not exist.\u0027))"},{"line_number":1087,"context_line":"        # We should also update the root providers of resource providers"},{"line_number":1088,"context_line":"        # originally in the same tree."},{"line_number":1089,"context_line":"        for rp in same_tree:"},{"line_number":1090,"context_line":"            rp.root_provider_uuid \u003d parent_ids.root_uuid"},{"line_number":1091,"context_line":"            db_rp \u003d context.session.query("},{"line_number":1092,"context_line":"                models.ResourceProvider).filter_by(id\u003drp.id).first()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_662f2189","line":1089,"updated":"2018-07-05 07:47:14.000000000","message":"This now placed in a way that this loop runs for every update even if parent is not updated. Still it works correctly as same_tree will be [] for cases when the parent is not updated. However this makes this code convoluted. To help the reader I would add a note about this.","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"e8f201402e004ee3001d1954b6d09129932fb7ba","unresolved":false,"context_lines":[{"line_number":1086,"context_line":"                    reason\u003d_(\u0027parent provider UUID does not exist.\u0027))"},{"line_number":1087,"context_line":"        # We should also update the root providers of resource providers"},{"line_number":1088,"context_line":"        # originally in the same tree."},{"line_number":1089,"context_line":"        for rp in same_tree:"},{"line_number":1090,"context_line":"            rp.root_provider_uuid \u003d parent_ids.root_uuid"},{"line_number":1091,"context_line":"            db_rp \u003d context.session.query("},{"line_number":1092,"context_line":"                models.ResourceProvider).filter_by(id\u003drp.id).first()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_6b34b3fa","line":1089,"in_reply_to":"5f7c97a3_662f2189","updated":"2018-07-06 06:51:13.000000000","message":"Noted that this is skipped when the parent is not updated.","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"cc1bfdaf2c58260ea6c829403e3849d5a21bf5cf","unresolved":false,"context_lines":[{"line_number":1092,"context_line":"                models.ResourceProvider).filter_by(id\u003drp.id).first()"},{"line_number":1093,"context_line":"            data \u003d {\u0027root_provider_id\u0027: parent_ids.root_id}"},{"line_number":1094,"context_line":"            db_rp.update(data)"},{"line_number":1095,"context_line":"            db_rp.save(context.session)"},{"line_number":1096,"context_line":""},{"line_number":1097,"context_line":"    @staticmethod"},{"line_number":1098,"context_line":"    @db_api.placement_context_manager.writer  # For online data migration"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ab22e2b8","line":1095,"updated":"2018-07-05 07:47:14.000000000","message":"Does everything under a @db_api.placement_context_manager.writer decorator runs in the same db transaction? If not then this second save makes the parenting update call non-atomic (e.g. a new descendant RP might be created after L1055 but before L1095).","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"e8f201402e004ee3001d1954b6d09129932fb7ba","unresolved":false,"context_lines":[{"line_number":1092,"context_line":"                models.ResourceProvider).filter_by(id\u003drp.id).first()"},{"line_number":1093,"context_line":"            data \u003d {\u0027root_provider_id\u0027: parent_ids.root_id}"},{"line_number":1094,"context_line":"            db_rp.update(data)"},{"line_number":1095,"context_line":"            db_rp.save(context.session)"},{"line_number":1096,"context_line":""},{"line_number":1097,"context_line":"    @staticmethod"},{"line_number":1098,"context_line":"    @db_api.placement_context_manager.writer  # For online data migration"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ab172b54","line":1095,"in_reply_to":"5f7c97a3_ab22e2b8","updated":"2018-07-06 06:51:13.000000000","message":"Changed this save() to add() and flush() to have DB rollback in case one of them fails.","commit_id":"d8607add65032ce44313ea0c4ab4e4cc28178679"}]}
