)]}'
{"nova/cells/messaging.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"5b76c46eb3adfb5a131c93d7b4b0b44b0840f582","unresolved":false,"context_lines":[{"line_number":1167,"context_line":"        if create is None:"},{"line_number":1168,"context_line":"            # If the BDM has a uuid, check to see if any already exist in the"},{"line_number":1169,"context_line":"            # database by that key, if not, we create, else we update."},{"line_number":1170,"context_line":"            if bdm.get(\u0027uuid\u0027):"},{"line_number":1171,"context_line":"                existing_bdm \u003d self.db.block_device_mapping_get_by_uuid("},{"line_number":1172,"context_line":"                                    message.ctxt, bdm[\u0027uuid\u0027])"},{"line_number":1173,"context_line":"                # If we already have a BDM with that uuid, update it, else"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_979e2c06","line":1170,"updated":"2015-11-06 22:22:56.000000000","message":"Based on the object patch before this one this should always be set.","commit_id":"0e77905b8cbd09f742638c7ea25c72690300a926"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"5b76c46eb3adfb5a131c93d7b4b0b44b0840f582","unresolved":false,"context_lines":[{"line_number":1178,"context_line":"                # so we let the DB API try to figure it out."},{"line_number":1179,"context_line":"                LOG.debug(\u0027Calling db.block_device_mapping_update_or_create \u0027"},{"line_number":1180,"context_line":"                          \u0027from API cell with values: %s\u0027, bdm)"},{"line_number":1181,"context_line":"                self.db.block_device_mapping_update_or_create(message.ctxt,"},{"line_number":1182,"context_line":"                                                              bdm,"},{"line_number":1183,"context_line":"                                                              legacy\u003dFalse)"},{"line_number":1184,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_575e8446","line":1181,"updated":"2015-11-06 22:22:56.000000000","message":"I don\u0027t think this patch on its own protects against the race, but having the uuid means we can remove the noop _create_block_device_mapping method in compute/cells_api.py which means existing_bdm should always be not None.  However given the complexity of bdm code I\u0027m not sure if we can assume that right now, but it will at least more often be true.","commit_id":"0e77905b8cbd09f742638c7ea25c72690300a926"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b6628052606999e0186dd7fb05f3c1bd498a36c8","unresolved":false,"context_lines":[{"line_number":1183,"context_line":"        instance_bdm \u003d self.db.block_device_mapping_get_by_uuid("},{"line_number":1184,"context_line":"                            message.ctxt, bdm[\u0027uuid\u0027])"},{"line_number":1185,"context_line":"        if not instance_bdm:"},{"line_number":1186,"context_line":"            LOG.warning(_LW(\"No match when trying to update BDM: %(bdm)s\"),"},{"line_number":1187,"context_line":"                        dict(bdm\u003dbdm))"},{"line_number":1188,"context_line":"            return"},{"line_number":1189,"context_line":"        LOG.debug(\u0027Calling db.block_device_mapping_update from API cell with \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"da85f559_d8f34109","line":1186,"updated":"2015-11-09 18:22:37.000000000","message":"Hitting this a ton:\n\nhttp://logs.openstack.org/98/242698/3/check/gate-tempest-dsvm-cells/45d0b58//logs/screen-n-cell-region.txt.gz?level\u003dTRACE","commit_id":"4382ba335ee92536d0f6dfad5e9dc3d1ddf36e20"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c378599286f8691a542bbd65d96f727ed063ce4d","unresolved":false,"context_lines":[{"line_number":1197,"context_line":"                          \u0027cell with values: %s\u0027, bdm)"},{"line_number":1198,"context_line":"                self.db.block_device_mapping_create(message.ctxt, bdm,"},{"line_number":1199,"context_line":"                                                    legacy\u003dFalse)"},{"line_number":1200,"context_line":"                return"},{"line_number":1201,"context_line":""},{"line_number":1202,"context_line":"        # We either get here because:"},{"line_number":1203,"context_line":"        # 1. we were called with create\u003dTrue and a BDM that already exists with"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_210d7137","line":1200,"updated":"2015-11-09 21:16:33.000000000","message":"Can\u0027t we collapse all of the above into:\n\n elif create:\n     try:\n         self.db.block_device_mapping_create()\n     except:\n         # Handle conflict case log\n\nI\u0027m not really sure we should just quietly let this happen either, especially if there is a uuid.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"836179209d30a1d202643046e9febdd792e0f7cf","unresolved":false,"context_lines":[{"line_number":1197,"context_line":"                          \u0027cell with values: %s\u0027, bdm)"},{"line_number":1198,"context_line":"                self.db.block_device_mapping_create(message.ctxt, bdm,"},{"line_number":1199,"context_line":"                                                    legacy\u003dFalse)"},{"line_number":1200,"context_line":"                return"},{"line_number":1201,"context_line":""},{"line_number":1202,"context_line":"        # We either get here because:"},{"line_number":1203,"context_line":"        # 1. we were called with create\u003dTrue and a BDM that already exists with"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_2187b1d8","line":1200,"in_reply_to":"da85f559_210d7137","updated":"2015-11-09 21:33:17.000000000","message":"There is no unique constraint on BDM so we wouldn\u0027t get a conflict failure.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"0d58084abf862faa4c4c61e46260b7fdf171e92e","unresolved":false,"context_lines":[{"line_number":1197,"context_line":"                          \u0027cell with values: %s\u0027, bdm)"},{"line_number":1198,"context_line":"                self.db.block_device_mapping_create(message.ctxt, bdm,"},{"line_number":1199,"context_line":"                                                    legacy\u003dFalse)"},{"line_number":1200,"context_line":"                return"},{"line_number":1201,"context_line":""},{"line_number":1202,"context_line":"        # We either get here because:"},{"line_number":1203,"context_line":"        # 1. we were called with create\u003dTrue and a BDM that already exists with"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_611cd977","line":1200,"in_reply_to":"da85f559_2187b1d8","updated":"2015-11-09 21:37:10.000000000","message":"Right, right.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c378599286f8691a542bbd65d96f727ed063ce4d","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"                  \u0027bdm id %s and values: %s\u0027, instance_bdm[\u0027id\u0027], bdm)"},{"line_number":1217,"context_line":"        self.db.block_device_mapping_update(message.ctxt,"},{"line_number":1218,"context_line":"                                            instance_bdm[\u0027id\u0027], bdm,"},{"line_number":1219,"context_line":"                                            legacy\u003dFalse)"},{"line_number":1220,"context_line":""},{"line_number":1221,"context_line":"    def bdm_destroy_at_top(self, message, instance_uuid, device_name,"},{"line_number":1222,"context_line":"                           volume_id):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_215b3130","line":1219,"updated":"2015-11-09 21:16:33.000000000","message":"I\u0027d rather see this on the same level as the create case. Meaning, don\u0027t do:\n\n if create:\n     ...\n     return\n update\n\nbut rather:\n\n if create:\n     ...\n else:\n     ...\n\nAlternately, if we are receiving the bdm object anyway, we could just pop out the id, touch all the fields, and call .save() or .create() on it without breaking things out and just if..else around the create or save. I thought alaski said we had the object here...","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4aa34e4bcf28fa793abf69491f73db7bcca62fa3","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"                  \u0027bdm id %s and values: %s\u0027, instance_bdm[\u0027id\u0027], bdm)"},{"line_number":1217,"context_line":"        self.db.block_device_mapping_update(message.ctxt,"},{"line_number":1218,"context_line":"                                            instance_bdm[\u0027id\u0027], bdm,"},{"line_number":1219,"context_line":"                                            legacy\u003dFalse)"},{"line_number":1220,"context_line":""},{"line_number":1221,"context_line":"    def bdm_destroy_at_top(self, message, instance_uuid, device_name,"},{"line_number":1222,"context_line":"                           volume_id):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_374b7389","line":1219,"in_reply_to":"da85f559_1c2454ad","updated":"2015-11-09 22:24:57.000000000","message":"Sure, I\u0027m happy to do cleanups once we\u0027re out of the toilet.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"836179209d30a1d202643046e9febdd792e0f7cf","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"                  \u0027bdm id %s and values: %s\u0027, instance_bdm[\u0027id\u0027], bdm)"},{"line_number":1217,"context_line":"        self.db.block_device_mapping_update(message.ctxt,"},{"line_number":1218,"context_line":"                                            instance_bdm[\u0027id\u0027], bdm,"},{"line_number":1219,"context_line":"                                            legacy\u003dFalse)"},{"line_number":1220,"context_line":""},{"line_number":1221,"context_line":"    def bdm_destroy_at_top(self, message, instance_uuid, device_name,"},{"line_number":1222,"context_line":"                           volume_id):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_a1e1619c","line":1219,"in_reply_to":"da85f559_215b3130","updated":"2015-11-09 21:33:17.000000000","message":"Cells RPC \u003c 1.28 would pass a dict:\n\nhttps://github.com/openstack/nova/blob/835ff1bf73d36a311168283f8a4ef5bec03d5a7e/nova/cells/rpcapi.py#L415","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"0d58084abf862faa4c4c61e46260b7fdf171e92e","unresolved":false,"context_lines":[{"line_number":1216,"context_line":"                  \u0027bdm id %s and values: %s\u0027, instance_bdm[\u0027id\u0027], bdm)"},{"line_number":1217,"context_line":"        self.db.block_device_mapping_update(message.ctxt,"},{"line_number":1218,"context_line":"                                            instance_bdm[\u0027id\u0027], bdm,"},{"line_number":1219,"context_line":"                                            legacy\u003dFalse)"},{"line_number":1220,"context_line":""},{"line_number":1221,"context_line":"    def bdm_destroy_at_top(self, message, instance_uuid, device_name,"},{"line_number":1222,"context_line":"                           volume_id):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_1c2454ad","line":1219,"in_reply_to":"da85f559_a1e1619c","updated":"2015-11-09 21:37:10.000000000","message":"That means we should convert to an object at the top of this. That\u0027s what we should have done to make 1.29 server-side compatible with the older clients.\n\nWe should get this passing and then we can worry about those sorts of details, I was just saying it could be a lot cleaner if we do the object thing I think.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"}],"nova/compute/api.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"6ffe6266a2944c594b408f80235284e2b1a42013","unresolved":false,"context_lines":[{"line_number":1278,"context_line":"                continue"},{"line_number":1279,"context_line":""},{"line_number":1280,"context_line":"            bdm.instance_uuid \u003d instance_uuid"},{"line_number":1281,"context_line":"            bdm.create()"},{"line_number":1282,"context_line":""},{"line_number":1283,"context_line":"    def _validate_bdm(self, context, instance, instance_type, all_mappings):"},{"line_number":1284,"context_line":"        def _subsequent_list(l):"}],"source_content_type":"text/x-python","patch_set":10,"id":"da85f559_8aa8bf8e","line":1281,"updated":"2015-11-10 19:04:07.000000000","message":"What about creating a uuid on the bdm at this point?","commit_id":"7cebb8feafbd1f1086e5214a2eb7df8f910a600c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"8a87fd7ac9c18db8f65158a28aed7ecb1582d541","unresolved":false,"context_lines":[{"line_number":1278,"context_line":"                continue"},{"line_number":1279,"context_line":""},{"line_number":1280,"context_line":"            bdm.instance_uuid \u003d instance_uuid"},{"line_number":1281,"context_line":"            bdm.create()"},{"line_number":1282,"context_line":""},{"line_number":1283,"context_line":"    def _validate_bdm(self, context, instance, instance_type, all_mappings):"},{"line_number":1284,"context_line":"        def _subsequent_list(l):"}],"source_content_type":"text/x-python","patch_set":10,"id":"da85f559_b5f08892","line":1281,"in_reply_to":"da85f559_8aa8bf8e","updated":"2015-11-10 19:32:20.000000000","message":"I think I\u0027ll try that just to be sure we\u0027re not hitting the auto-create in the BlockDeviceMapping._from_db_object() method.\n\nSame in the compute manager for the attach volume case.","commit_id":"7cebb8feafbd1f1086e5214a2eb7df8f910a600c"}],"nova/objects/block_device.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0ca7876151bf5d84cf22d2786e54657114c12098","unresolved":false,"context_lines":[{"line_number":131,"context_line":"                instance for the first time."},{"line_number":132,"context_line":"        \"\"\""},{"line_number":133,"context_line":"        cell_type \u003d cells_opts.get_cell_type()"},{"line_number":134,"context_line":"        if cell_type \u003d\u003d \u0027api\u0027:"},{"line_number":135,"context_line":"            raise exception.ObjectActionError("},{"line_number":136,"context_line":"                    action\u003d\u0027create\u0027,"},{"line_number":137,"context_line":"                    reason\u003d\u0027BlockDeviceMapping cannot be \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"da85f559_ec0c4b3d","side":"PARENT","line":134,"updated":"2015-11-09 17:00:53.000000000","message":"Actually, seems we should change this to \u0027compute\u0027 such that we can only create BDMs in the API cell, and then we could remove the logic blow to call bdm_update_or_create_at_top.","commit_id":"347cda824d3651e925c0e1776b97d5065a7b7b5d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b5fc78d347d4b068b3a8557ecdec56f6e151704a","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                continue"},{"line_number":105,"context_line":"            if key \u003d\u003d \u0027uuid\u0027 and not db_block_device.get(key):"},{"line_number":106,"context_line":"                # NOTE(danms): While the records could be nullable,"},{"line_number":107,"context_line":"                # generate a UUID on read since the object requires it"},{"line_number":108,"context_line":"                db_block_device[key] \u003d str(uuid.uuid4())"},{"line_number":109,"context_line":"            block_device_obj[key] \u003d db_block_device[key]"},{"line_number":110,"context_line":"        if \u0027instance\u0027 in expected_attrs:"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_c146b24e","line":107,"updated":"2015-11-10 17:44:10.000000000","message":"We should log when this happens because I don\u0027t think it really should, save() might be changing this value underneath us and screwing things up.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c378599286f8691a542bbd65d96f727ed063ce4d","unresolved":false,"context_lines":[{"line_number":152,"context_line":"        if cells_opts.get_cell_type() \u003d\u003d \u0027compute\u0027:"},{"line_number":153,"context_line":"            # NOTE(mriedem): There are currently two ways a BDM is created:"},{"line_number":154,"context_line":"            # 1. Boot from volume creates the BDM in the API (parent cell)."},{"line_number":155,"context_line":"            # 2. Volume attach creates the BDM in the compute (child cell)."},{"line_number":156,"context_line":"            # Since we\u0027re in the compute cell (child) we assume that this BDM"},{"line_number":157,"context_line":"            # does not exist in the parent cell and we should pass create\u003dTrue."},{"line_number":158,"context_line":"            LOG.debug(\u0027Calling cells_api.bdm_update_or_create_at_top with \u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_01cb8da6","line":155,"updated":"2015-11-09 21:16:33.000000000","message":"Hmm, why is this? We can just create the bdm in the parent cell at this point for both cases, right?","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"836179209d30a1d202643046e9febdd792e0f7cf","unresolved":false,"context_lines":[{"line_number":152,"context_line":"        if cells_opts.get_cell_type() \u003d\u003d \u0027compute\u0027:"},{"line_number":153,"context_line":"            # NOTE(mriedem): There are currently two ways a BDM is created:"},{"line_number":154,"context_line":"            # 1. Boot from volume creates the BDM in the API (parent cell)."},{"line_number":155,"context_line":"            # 2. Volume attach creates the BDM in the compute (child cell)."},{"line_number":156,"context_line":"            # Since we\u0027re in the compute cell (child) we assume that this BDM"},{"line_number":157,"context_line":"            # does not exist in the parent cell and we should pass create\u003dTrue."},{"line_number":158,"context_line":"            LOG.debug(\u0027Calling cells_api.bdm_update_or_create_at_top with \u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_c1b10591","line":155,"in_reply_to":"da85f559_01cb8da6","updated":"2015-11-09 21:33:17.000000000","message":"The compute API does a call to the compute manager to reserve a block device name:\n\nhttps://github.com/openstack/nova/blob/master/nova/compute/api.py#L3049\n\nAnd that is what creates the BDM in the attach case:\n\nhttps://github.com/openstack/nova/blob/master/nova/compute/manager.py#L4618\n\nIf there is another way to do this in the parent API cell, I\u0027m not sure what it is, I thought we\u0027d have to intercept that somehow.","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c04443abb27d71e35d867e5491fa3b724b78f72e","unresolved":false,"context_lines":[{"line_number":205,"context_line":"        self._from_db_object(self._context, self, updated)"},{"line_number":206,"context_line":"        cell_type \u003d cells_opts.get_cell_type()"},{"line_number":207,"context_line":"        if cell_type \u003d\u003d \u0027compute\u0027:"},{"line_number":208,"context_line":"            # The API cell creates the BDM so propagate updates from the child"},{"line_number":209,"context_line":"            # cell to the parent."},{"line_number":210,"context_line":"            cells_api \u003d cells_rpcapi.CellsAPI()"},{"line_number":211,"context_line":"            cells_api.bdm_update_or_create_at_top(self._context, self,"}],"source_content_type":"text/x-python","patch_set":9,"id":"da85f559_773d7aba","line":208,"updated":"2015-11-09 23:21:28.000000000","message":"This comment should be updated since we can create the BDM in the API cell (boot from volume) or the child cell (volume attach).","commit_id":"047f51a21e9206a576ee2499788cbd21b0411e4e"}]}
