)]}'
{"nova/objects/aggregate.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"ceae25762df667681062b0bee7c26ce9f30b66c6","unresolved":false,"context_lines":[{"line_number":563,"context_line":"            aggregate \u003d Aggregate.get_by_id(ctxt, aggregate_id)"},{"line_number":564,"context_line":"            remove \u003d [\u0027metadata\u0027, \u0027hosts\u0027]"},{"line_number":565,"context_line":"            values \u003d {field: getattr(aggregate, field)"},{"line_number":566,"context_line":"                      for field in aggregate.fields if field not in remove}"},{"line_number":567,"context_line":"            _aggregate_create_in_db(ctxt, values, metadata\u003daggregate.metadata)"},{"line_number":568,"context_line":"            for host in aggregate.hosts:"},{"line_number":569,"context_line":"                _host_add_to_db(ctxt, aggregate_id, host)"}],"source_content_type":"text/x-python","patch_set":14,"id":"3aaa91ec_2a148142","line":566,"updated":"2016-06-22 20:44:10.000000000","message":"OK, so here we *will* include the \"id\" field in the values parameter passed to _aggregate_create_in_db() and therefore the id field value will match between the cell DB and the API DB.\n\nThe issue is that migrate_aggregates() isn\u0027t the only way that the API DB\u0027s aggregates table is populated. In the patch prior to this one, you change Aggregate.create() to call _aggregate_create_in_db() and therefore create a new record for an aggregate in the API DB:\n\nhttps://review.openstack.org/#/c/314781/14/nova/objects/aggregate.py\n\nIf an admin does an upgrade of the controller services, creates an aggregate, and *then* runs the online DB migrations, the migrations will fail because there will already be an aggregate record with ID of 1 in the API DB\u0027s aggregates table...","commit_id":"426f36980c4c7388b508262207ef536548a70929"},{"author":{"_account_id":18247,"name":"Mark Doffman","email":"mdoffman@linux.vnet.ibm.com","username":"doffm"},"change_message_id":"d57fafa9b37363eab30edc12abc0d4adc53e1dfa","unresolved":false,"context_lines":[{"line_number":563,"context_line":"            aggregate \u003d Aggregate.get_by_id(ctxt, aggregate_id)"},{"line_number":564,"context_line":"            remove \u003d [\u0027metadata\u0027, \u0027hosts\u0027]"},{"line_number":565,"context_line":"            values \u003d {field: getattr(aggregate, field)"},{"line_number":566,"context_line":"                      for field in aggregate.fields if field not in remove}"},{"line_number":567,"context_line":"            _aggregate_create_in_db(ctxt, values, metadata\u003daggregate.metadata)"},{"line_number":568,"context_line":"            for host in aggregate.hosts:"},{"line_number":569,"context_line":"                _host_add_to_db(ctxt, aggregate_id, host)"}],"source_content_type":"text/x-python","patch_set":14,"id":"dada55a8_8a063ecc","line":566,"in_reply_to":"3aaa91ec_2a148142","updated":"2016-07-19 17:51:10.000000000","message":"See the last patch in this series. We explicitly block creation of aggregates until the migration is completed. This is acceptable because admins should be the only people who are creating aggregates, they should have some awareness that data migrations are taking place.\n\nhttps://review.openstack.org/#/c/315235/15/nova/objects/aggregate.py","commit_id":"426f36980c4c7388b508262207ef536548a70929"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"2dedadec0d0494f01de66cb6d9356f32935f126b","unresolved":false,"context_lines":[{"line_number":602,"context_line":"def _adjust_autoincrement(context, value):"},{"line_number":603,"context_line":"    engine \u003d db_api.get_api_engine()"},{"line_number":604,"context_line":"    if engine.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":605,"context_line":"        # NOTE(danms): If we migrated some flavors in the above function,"},{"line_number":606,"context_line":"        # then we will have confused postgres\u0027 sequence for the autoincrement"},{"line_number":607,"context_line":"        # primary key. MySQL does not care about this, but since postgres does,"},{"line_number":608,"context_line":"        # we need to reset this to avoid a failure on the next flavor creation."}],"source_content_type":"text/x-python","patch_set":22,"id":"bacf61ea_a3be31fd","line":605,"range":{"start_line":605,"start_character":43,"end_line":605,"end_character":50},"updated":"2016-07-27 17:21:44.000000000","message":"should be \"aggregates\"","commit_id":"6bb8c54d7ceb47f3d7b535e39b00a284d2808d0d"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"0ec72042325af748ee0bfaf5fd652157e234d67d","unresolved":false,"context_lines":[{"line_number":602,"context_line":"def _adjust_autoincrement(context, value):"},{"line_number":603,"context_line":"    engine \u003d db_api.get_api_engine()"},{"line_number":604,"context_line":"    if engine.name \u003d\u003d \u0027postgresql\u0027:"},{"line_number":605,"context_line":"        # NOTE(danms): If we migrated some flavors in the above function,"},{"line_number":606,"context_line":"        # then we will have confused postgres\u0027 sequence for the autoincrement"},{"line_number":607,"context_line":"        # primary key. MySQL does not care about this, but since postgres does,"},{"line_number":608,"context_line":"        # we need to reset this to avoid a failure on the next flavor creation."}],"source_content_type":"text/x-python","patch_set":25,"id":"bacf61ea_ecfdf86e","line":605,"range":{"start_line":605,"start_character":43,"end_line":605,"end_character":50},"updated":"2016-08-01 15:22:55.000000000","message":"aggregates","commit_id":"3bceedafaf2ee0c49a26cb82a108c8a44514a6a5"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"0ec72042325af748ee0bfaf5fd652157e234d67d","unresolved":false,"context_lines":[{"line_number":605,"context_line":"        # NOTE(danms): If we migrated some flavors in the above function,"},{"line_number":606,"context_line":"        # then we will have confused postgres\u0027 sequence for the autoincrement"},{"line_number":607,"context_line":"        # primary key. MySQL does not care about this, but since postgres does,"},{"line_number":608,"context_line":"        # we need to reset this to avoid a failure on the next flavor creation."},{"line_number":609,"context_line":"        engine.execute("},{"line_number":610,"context_line":"            text(\u0027ALTER SEQUENCE flavors_id_seq RESTART WITH %i;\u0027 % ("},{"line_number":611,"context_line":"                value)))"}],"source_content_type":"text/x-python","patch_set":25,"id":"bacf61ea_4ced24b6","line":608,"range":{"start_line":608,"start_character":63,"end_line":608,"end_character":69},"updated":"2016-08-01 15:22:55.000000000","message":"aggregate","commit_id":"3bceedafaf2ee0c49a26cb82a108c8a44514a6a5"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"0ec72042325af748ee0bfaf5fd652157e234d67d","unresolved":false,"context_lines":[{"line_number":607,"context_line":"        # primary key. MySQL does not care about this, but since postgres does,"},{"line_number":608,"context_line":"        # we need to reset this to avoid a failure on the next flavor creation."},{"line_number":609,"context_line":"        engine.execute("},{"line_number":610,"context_line":"            text(\u0027ALTER SEQUENCE flavors_id_seq RESTART WITH %i;\u0027 % ("},{"line_number":611,"context_line":"                value)))"},{"line_number":612,"context_line":""},{"line_number":613,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"bacf61ea_8c18bcd4","line":610,"range":{"start_line":610,"start_character":33,"end_line":610,"end_character":47},"updated":"2016-08-01 15:22:55.000000000","message":"This isn\u0027t the right sequence to modify.","commit_id":"3bceedafaf2ee0c49a26cb82a108c8a44514a6a5"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b1d585d98caaefa1105ed0500870b1955bd8931b","unresolved":false,"context_lines":[{"line_number":593,"context_line":"            LOG.warning("},{"line_number":594,"context_line":"                _LW(\u0027Aggregate id %(id)i disappeared during migration\u0027),"},{"line_number":595,"context_line":"                {\u0027id\u0027: aggregate_id})"},{"line_number":596,"context_line":"        except (exception.AggregateNameExists) as e:"},{"line_number":597,"context_line":"            LOG.error(str(e))"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"    return count_all, count_hit"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_133492dc","line":596,"updated":"2016-08-03 00:04:22.000000000","message":"meh: unnecessary parens.","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"0aeb5c12ae28d139df9ac1240d4083648031a59d","unresolved":false,"context_lines":[{"line_number":593,"context_line":"            LOG.warning("},{"line_number":594,"context_line":"                _LW(\u0027Aggregate id %(id)i disappeared during migration\u0027),"},{"line_number":595,"context_line":"                {\u0027id\u0027: aggregate_id})"},{"line_number":596,"context_line":"        except (exception.AggregateNameExists) as e:"},{"line_number":597,"context_line":"            LOG.error(str(e))"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"    return count_all, count_hit"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_d824d9c7","line":596,"updated":"2016-08-03 00:01:52.000000000","message":"meh: unnecessary parens.","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"867e44b97475b11ac09e1d0b457752112c460ffb","unresolved":false,"context_lines":[{"line_number":593,"context_line":"            LOG.warning("},{"line_number":594,"context_line":"                _LW(\u0027Aggregate id %(id)i disappeared during migration\u0027),"},{"line_number":595,"context_line":"                {\u0027id\u0027: aggregate_id})"},{"line_number":596,"context_line":"        except (exception.AggregateNameExists) as e:"},{"line_number":597,"context_line":"            LOG.error(str(e))"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"    return count_all, count_hit"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_13b9322f","line":596,"in_reply_to":"bacf61ea_133492dc","updated":"2016-08-03 00:10:47.000000000","message":"Yeah, I dunno why he did that. Maybe there were more than one here initially. I\u0027ll fix if I have to respin.","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b60c98bf2eecc00e190c208310225a93be1239b2","unresolved":false,"context_lines":[{"line_number":620,"context_line":"def migrate_aggregate_reset_autoincrement(ctxt, count):"},{"line_number":621,"context_line":"    max_id \u003d _get_max_aggregate_id(ctxt) or 0"},{"line_number":622,"context_line":"    _adjust_autoincrement(ctxt, max_id + 1)"},{"line_number":623,"context_line":"    return 0, 0"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_333b969e","line":623,"updated":"2016-08-03 00:15:16.000000000","message":"@dansmith: doh, that makes sense. totally missed that...","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"0aeb5c12ae28d139df9ac1240d4083648031a59d","unresolved":false,"context_lines":[{"line_number":620,"context_line":"def migrate_aggregate_reset_autoincrement(ctxt, count):"},{"line_number":621,"context_line":"    max_id \u003d _get_max_aggregate_id(ctxt) or 0"},{"line_number":622,"context_line":"    _adjust_autoincrement(ctxt, max_id + 1)"},{"line_number":623,"context_line":"    return 0, 0"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_b82125b7","line":623,"updated":"2016-08-03 00:01:52.000000000","message":"I believe the above needs to be something other than hard-coded (0, 0) right? I think you meant to return max_id maybe?","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b1d585d98caaefa1105ed0500870b1955bd8931b","unresolved":false,"context_lines":[{"line_number":620,"context_line":"def migrate_aggregate_reset_autoincrement(ctxt, count):"},{"line_number":621,"context_line":"    max_id \u003d _get_max_aggregate_id(ctxt) or 0"},{"line_number":622,"context_line":"    _adjust_autoincrement(ctxt, max_id + 1)"},{"line_number":623,"context_line":"    return 0, 0"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_f330deea","line":623,"updated":"2016-08-03 00:04:22.000000000","message":"I believe the above needs to be something other than hard-coded (0, 0) right? I think you meant to return max_id maybe?","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"867e44b97475b11ac09e1d0b457752112c460ffb","unresolved":false,"context_lines":[{"line_number":620,"context_line":"def migrate_aggregate_reset_autoincrement(ctxt, count):"},{"line_number":621,"context_line":"    max_id \u003d _get_max_aggregate_id(ctxt) or 0"},{"line_number":622,"context_line":"    _adjust_autoincrement(ctxt, max_id + 1)"},{"line_number":623,"context_line":"    return 0, 0"}],"source_content_type":"text/x-python","patch_set":28,"id":"bacf61ea_b3ab06d6","line":623,"in_reply_to":"bacf61ea_f330deea","updated":"2016-08-03 00:10:47.000000000","message":"Mmm, no. This is the return protocol for anything in the nova-manage online_data_migrations list. 0,0 means \"zero matched, zero completed\". nova-manage uses this to determine its return value and/or know if we need to run this again. That doesn\u0027t really have any meaning for this function, unlike ones that actually migrate records, so just returning zero makes sense here to me. It also mirrors what we did for flavors:\n\n https://github.com/openstack/nova/blob/master/nova/objects/flavor.py#L749-L752\n\nWe have to return the tuple because of the calling convention expectation of nova-manage:\n\n https://github.com/openstack/nova/blob/master/nova/cmd/manage.py#L867\n\nWhat do you think makes more sense?","commit_id":"d55ffba3918b603c29bf2f91cb8d27f3435dffb9"}],"nova/tests/functional/db/test_aggregate.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"0ec72042325af748ee0bfaf5fd652157e234d67d","unresolved":false,"context_lines":[{"line_number":624,"context_line":"        match, done \u003d aggregate_obj.migrate_aggregates(self.context, 50)"},{"line_number":625,"context_line":"        self.assertEqual(main_aggregates_len, match)"},{"line_number":626,"context_line":"        self.assertEqual(main_aggregates_len, done)"},{"line_number":627,"context_line":"        self.assertEqual(0, len(db.flavor_get_all(self.context)))"},{"line_number":628,"context_line":"        self.assertEqual(main_aggregates_len,"},{"line_number":629,"context_line":"                         len(aggregate_obj.AggregateList.get_all("},{"line_number":630,"context_line":"                                                                self.context)))"}],"source_content_type":"text/x-python","patch_set":25,"id":"bacf61ea_ac630041","line":627,"range":{"start_line":627,"start_character":35,"end_line":627,"end_character":41},"updated":"2016-08-01 15:22:55.000000000","message":"aggregate","commit_id":"3bceedafaf2ee0c49a26cb82a108c8a44514a6a5"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"0ec72042325af748ee0bfaf5fd652157e234d67d","unresolved":false,"context_lines":[{"line_number":629,"context_line":"                         len(aggregate_obj.AggregateList.get_all("},{"line_number":630,"context_line":"                                                                self.context)))"},{"line_number":631,"context_line":""},{"line_number":632,"context_line":"    def _test_migrate_aggregate_reset_autoincrement(self):"},{"line_number":633,"context_line":"        match, done \u003d aggregate_obj.migrate_aggregate_reset_autoincrement("},{"line_number":634,"context_line":"            self.context, 0)"},{"line_number":635,"context_line":"        self.assertEqual(0, match)"}],"source_content_type":"text/x-python","patch_set":25,"id":"bacf61ea_ece7b8a9","line":632,"updated":"2016-08-01 15:22:55.000000000","message":"This isn\u0027t used anywhere that I can see.","commit_id":"3bceedafaf2ee0c49a26cb82a108c8a44514a6a5"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"f9b77484abd7d28f9410231772511de653b872e8","unresolved":false,"context_lines":[{"line_number":629,"context_line":"                         len(aggregate_obj.AggregateList.get_all("},{"line_number":630,"context_line":"                                                                self.context)))"},{"line_number":631,"context_line":""},{"line_number":632,"context_line":"    def _test_migrate_aggregate_reset_autoincrement(self):"},{"line_number":633,"context_line":"        match, done \u003d aggregate_obj.migrate_aggregate_reset_autoincrement("},{"line_number":634,"context_line":"            self.context, 0)"},{"line_number":635,"context_line":"        self.assertEqual(0, match)"}],"source_content_type":"text/x-python","patch_set":27,"id":"bacf61ea_59695af8","line":632,"range":{"start_line":632,"start_character":8,"end_line":632,"end_character":9},"updated":"2016-08-01 18:03:05.000000000","message":"The leading _ should be removed.","commit_id":"867cacb08fedb1a511371d8f7f73eb2f90d36f7a"}]}
