)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"823de2f4e73c0fb131b4ec217ba5471a902714cf","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"So the CellMapping should be joined during the db query and loaded on"},{"line_number":16,"context_line":"the InstanceMapping object by default."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Change-Id: Ia8691b76bba310327bfe0995964525409794d1af"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"1af94dfe_e92e97a3","line":17,"updated":"2016-03-18 17:31:06.000000000","message":"Link to blueprint add-buildrequest-obj","commit_id":"1f3aca814693072c37f0122fc1e5c55a11b9d690"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"596fe908fa3e2977a391ac3bde76546cb9cfc50f","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"So the CellMapping should be joined during the db query and loaded on"},{"line_number":16,"context_line":"the InstanceMapping object by default."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Change-Id: Ia8691b76bba310327bfe0995964525409794d1af"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"1af94dfe_c3b28f4b","line":17,"in_reply_to":"1af94dfe_e92e97a3","updated":"2016-03-18 20:50:03.000000000","message":"I didn\u0027t do that because this isn\u0027t directly related to that. It\u0027s more a cleanup that makes the patches for that blueprint nicer. I can include the bp link though if you\u0027d still rather have it.","commit_id":"1f3aca814693072c37f0122fc1e5c55a11b9d690"}],"nova/objects/instance_mapping.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"72c145f8db46edad5c90e12bf21283ea75f8a02f","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        \u0027project_id\u0027: fields.StringField(),"},{"line_number":36,"context_line":"        }"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def _update_with_cell_id(self, updates):"},{"line_number":39,"context_line":"        cell_mapping_obj \u003d updates.pop(\"cell_mapping\", None)"},{"line_number":40,"context_line":"        if cell_mapping_obj:"},{"line_number":41,"context_line":"            updates[\"cell_id\"] \u003d cell_mapping_obj.id"}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_35aafb70","line":38,"updated":"2016-03-02 16:55:21.000000000","message":"@staticmethod? I guess it doesn\u0027t matter really.","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"a93ff606af072a2580230d6b8c39cb3b3cebf465","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        \u0027project_id\u0027: fields.StringField(),"},{"line_number":36,"context_line":"        }"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def _update_with_cell_id(self, updates):"},{"line_number":39,"context_line":"        cell_mapping_obj \u003d updates.pop(\"cell_mapping\", None)"},{"line_number":40,"context_line":"        if cell_mapping_obj:"},{"line_number":41,"context_line":"            updates[\"cell_id\"] \u003d cell_mapping_obj.id"}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_d4ff47a8","line":38,"in_reply_to":"7af24918_35aafb70","updated":"2016-03-02 21:21:02.000000000","message":"Doesn\u0027t matter, but I could update it.","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"72c145f8db46edad5c90e12bf21283ea75f8a02f","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_9a021e6e","line":59,"updated":"2016-03-02 16:55:21.000000000","message":"I think we might need to also call obj_reset_changes?\nhttps://github.com/openstack/nova/blob/master/nova/objects/instance.py#L903","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"a93ff606af072a2580230d6b8c39cb3b3cebf465","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_f41b6319","line":59,"in_reply_to":"7af24918_9a021e6e","updated":"2016-03-02 21:21:02.000000000","message":"Yeah, that would be a good optimization.","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"72c145f8db46edad5c90e12bf21283ea75f8a02f","unresolved":false,"context_lines":[{"line_number":83,"context_line":"                                       api_models.CellMapping)"},{"line_number":84,"context_line":"                        .filter("},{"line_number":85,"context_line":"                            api_models.InstanceMapping.instance_uuid"},{"line_number":86,"context_line":"                            \u003d\u003d instance_uuid)).first()"},{"line_number":87,"context_line":"        if not db_mapping:"},{"line_number":88,"context_line":"            raise exception.InstanceMappingNotFound(uuid\u003dinstance_uuid)"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_da2146b6","line":86,"updated":"2016-03-02 16:55:21.000000000","message":"I guess this is of instead of encoding this in the DB model? I kind prefer encoding this in the DB model, it seems easier to read, but I could do either way.","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"a93ff606af072a2580230d6b8c39cb3b3cebf465","unresolved":false,"context_lines":[{"line_number":83,"context_line":"                                       api_models.CellMapping)"},{"line_number":84,"context_line":"                        .filter("},{"line_number":85,"context_line":"                            api_models.InstanceMapping.instance_uuid"},{"line_number":86,"context_line":"                            \u003d\u003d instance_uuid)).first()"},{"line_number":87,"context_line":"        if not db_mapping:"},{"line_number":88,"context_line":"            raise exception.InstanceMappingNotFound(uuid\u003dinstance_uuid)"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"7af24918_54b857e5","line":86,"in_reply_to":"7af24918_da2146b6","updated":"2016-03-02 21:21:02.000000000","message":"I could go that route as well.","commit_id":"2dc125ce802437b251c50bbe874d5097fdb33c31"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e0a0c1d0562a1f17d9855b2c3c760e3daae16799","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                    self._context, cell_mapping.CellMapping(), cell_map)"},{"line_number":55,"context_line":"            return None"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_7af60efa","line":57,"updated":"2016-03-03 03:14:29.000000000","message":"I\u0027d suggest logging a debug message that we\u0027re lazy-loading an attribute like we do in the Instance object. A couple of us have been going through the logs trying to shore those up because it turns out we do a lot of round tripping from the compute node to the database to lazy-load instance attributes in predictable situations. Without the debug logging it\u0027s hard to realize how much we do that.\n\nAlso, do we need to check if self._context is set to make sure the object isn\u0027t orphaned like in the instance object?\n\nhttps://github.com/openstack/nova/blob/master/nova/objects/instance.py#L877-L885","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"52db584379b81b1ee62a4336496100f20467e255","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                    self._context, cell_mapping.CellMapping(), cell_map)"},{"line_number":55,"context_line":"            return None"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_a85b1ef5","line":57,"in_reply_to":"7af24918_7af60efa","updated":"2016-03-03 10:24:51.000000000","message":"Yeah, I think the extra consistency with instance would be useful here.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"7fa5eb12585e4fa6d92a11cb0253765574bf7e13","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                    self._context, cell_mapping.CellMapping(), cell_map)"},{"line_number":55,"context_line":"            return None"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_28af002b","line":57,"in_reply_to":"7af24918_a85b1ef5","updated":"2016-03-03 14:06:37.000000000","message":"Sure, I can add the logging. I don\u0027t think we need the orphan check because we never intentionally orphan the object, which does happen in the instance object.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e0a0c1d0562a1f17d9855b2c3c760e3daae16799","unresolved":false,"context_lines":[{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"},{"line_number":63,"context_line":"        for key in instance_mapping.fields:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_3a3e468c","line":60,"updated":"2016-03-03 03:14:29.000000000","message":"Do we need to reset changes after this?\n\nhttps://github.com/openstack/nova/blob/master/nova/objects/instance.py#L908","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"52db584379b81b1ee62a4336496100f20467e255","unresolved":false,"context_lines":[{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"},{"line_number":63,"context_line":"        for key in instance_mapping.fields:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_f5221ea2","line":60,"in_reply_to":"7af24918_3a3e468c","updated":"2016-03-03 10:24:51.000000000","message":"yeah, I think so, I asked for that in previous patchset.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"7fa5eb12585e4fa6d92a11cb0253765574bf7e13","unresolved":false,"context_lines":[{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"},{"line_number":63,"context_line":"        for key in instance_mapping.fields:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_e86fd8f9","line":60,"in_reply_to":"7af24918_f5221ea2","updated":"2016-03-03 14:06:37.000000000","message":"Yeah, I haven\u0027t updated for that yet, just rebased.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e0a0c1d0562a1f17d9855b2c3c760e3daae16799","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    def _get_by_project_id_from_db(context, project_id):"},{"line_number":162,"context_line":"        return (context.session.query(api_models.InstanceMapping)"},{"line_number":163,"context_line":"                .join(api_models.CellMapping)"},{"line_number":164,"context_line":"                .with_entities(api_models.InstanceMapping,"},{"line_number":165,"context_line":"                               api_models.CellMapping)"},{"line_number":166,"context_line":"                .filter("},{"line_number":167,"context_line":"                    api_models.InstanceMapping.project_id \u003d\u003d project_id)).all()"},{"line_number":168,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_baf896c4","line":165,"range":{"start_line":164,"start_character":16,"end_line":165,"end_character":53},"updated":"2016-03-03 03:14:29.000000000","message":"I thought this caused the query to return a tuple of (InstanceMapping, CellMapping) so wouldn\u0027t you need to return the [0] index of the tuple if this method is going to return an InstanceMapping?","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"52db584379b81b1ee62a4336496100f20467e255","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    def _get_by_project_id_from_db(context, project_id):"},{"line_number":162,"context_line":"        return (context.session.query(api_models.InstanceMapping)"},{"line_number":163,"context_line":"                .join(api_models.CellMapping)"},{"line_number":164,"context_line":"                .with_entities(api_models.InstanceMapping,"},{"line_number":165,"context_line":"                               api_models.CellMapping)"},{"line_number":166,"context_line":"                .filter("},{"line_number":167,"context_line":"                    api_models.InstanceMapping.project_id \u003d\u003d project_id)).all()"},{"line_number":168,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_f5a7be08","line":165,"range":{"start_line":164,"start_character":16,"end_line":165,"end_character":53},"in_reply_to":"7af24918_baf896c4","updated":"2016-03-03 10:24:51.000000000","message":"is that join vs outerjoin?\n\nI wish we used a back ref, these are doing my head in.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"45fd14ec823ecbde0e8fb0867ab10f2a244920ab","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    def _get_by_project_id_from_db(context, project_id):"},{"line_number":162,"context_line":"        return (context.session.query(api_models.InstanceMapping)"},{"line_number":163,"context_line":"                .join(api_models.CellMapping)"},{"line_number":164,"context_line":"                .with_entities(api_models.InstanceMapping,"},{"line_number":165,"context_line":"                               api_models.CellMapping)"},{"line_number":166,"context_line":"                .filter("},{"line_number":167,"context_line":"                    api_models.InstanceMapping.project_id \u003d\u003d project_id)).all()"},{"line_number":168,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7af24918_5d67a2e8","line":165,"range":{"start_line":164,"start_character":16,"end_line":165,"end_character":53},"in_reply_to":"7af24918_f5a7be08","updated":"2016-03-03 16:01:41.000000000","message":"I think you\u0027re right Matt. Though it\u0027s not failing the functional test which should have caught an issue. Honestly this List object should be removed for now and added back in when it\u0027s needed.","commit_id":"1c4eae5f06ba5e415838492d6e334089ffea0cd2"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"1108858ad788efdb29ee7c88f4355c89b5789f66","unresolved":false,"context_lines":[{"line_number":26,"context_line":"class InstanceMapping(base.NovaTimestampObject, base.NovaObject,"},{"line_number":27,"context_line":"                      ovo.VersionedObjectDictCompat):"},{"line_number":28,"context_line":"    # Version 1.0: Initial version"},{"line_number":29,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    fields \u003d {"},{"line_number":32,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_6af6eb8f","line":29,"updated":"2016-03-18 22:12:22.000000000","message":"Did you mean to bump this, or is this a \"has never been over RPC\" case?","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"baf5a8c052d966be30aa020b65a0e4053bcd308c","unresolved":false,"context_lines":[{"line_number":26,"context_line":"class InstanceMapping(base.NovaTimestampObject, base.NovaObject,"},{"line_number":27,"context_line":"                      ovo.VersionedObjectDictCompat):"},{"line_number":28,"context_line":"    # Version 1.0: Initial version"},{"line_number":29,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    fields \u003d {"},{"line_number":32,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_4ab5ef7b","line":29,"in_reply_to":"1af94dfe_6af6eb8f","updated":"2016-03-18 22:24:30.000000000","message":"Still hasn\u0027t been over RPC. The followup patch to this one is the first actual usage. Changing objects is fun when you don\u0027t have to worry about compatibility yet :)","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"1108858ad788efdb29ee7c88f4355c89b5789f66","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_ead83b55","line":59,"updated":"2016-03-18 22:12:22.000000000","message":"Generally we make this pretty painful if we attempt to load an attribute we\u0027re not expecting, since it will generate semi-infinite loops if you don\u0027t set or raise here. You can super() or do something else, but I think doing nothing is probably not a good call.","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"baf5a8c052d966be30aa020b65a0e4053bcd308c","unresolved":false,"context_lines":[{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":58,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":59,"context_line":"            self.cell_mapping \u003d self._get_cell_mapping()"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_caa9ff25","line":59,"in_reply_to":"1af94dfe_ead83b55","updated":"2016-03-18 22:24:30.000000000","message":"Good to know, will fix.","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"1108858ad788efdb29ee7c88f4355c89b5789f66","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"},{"line_number":63,"context_line":"        for key in instance_mapping.fields:"},{"line_number":64,"context_line":"            db_value \u003d db_instance_mapping.get(key)"},{"line_number":65,"context_line":"            if key \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":66,"context_line":"                if not db_value:"},{"line_number":67,"context_line":"                    # cell_mapping can be lazy loaded later."}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_2aad039b","line":64,"updated":"2016-03-18 22:12:22.000000000","message":"Won\u0027t this cause things like cell_mapping to be loaded if they\u0027re not already? I.e. are you sure it will return none and not just load the thing? I think I was told you should do \"if foo in bar\" to tell if something is loaded.","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"baf5a8c052d966be30aa020b65a0e4053bcd308c","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    @staticmethod"},{"line_number":62,"context_line":"    def _from_db_object(context, instance_mapping, db_instance_mapping):"},{"line_number":63,"context_line":"        for key in instance_mapping.fields:"},{"line_number":64,"context_line":"            db_value \u003d db_instance_mapping.get(key)"},{"line_number":65,"context_line":"            if key \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":66,"context_line":"                if not db_value:"},{"line_number":67,"context_line":"                    # cell_mapping can be lazy loaded later."}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_aa52b332","line":64,"in_reply_to":"1af94dfe_2aad039b","updated":"2016-03-18 22:24:30.000000000","message":"Right now it\u0027s guaranteed that everything is loaded. Cell_mapping being the only relationship and it\u0027s explicitly loaded. But I\u0027m happy to change this to be more robust.","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"b90c789ebbc11b191e9c0e55f0bfbf6f8c856ed7","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def _get_by_instance_uuid_from_db(context, instance_uuid):"},{"line_number":80,"context_line":"        db_mapping \u003d (context.session.query(api_models.InstanceMapping)"},{"line_number":81,"context_line":"                        .outerjoin(api_models.CellMapping)"},{"line_number":82,"context_line":"                        .with_entities(api_models.InstanceMapping,"},{"line_number":83,"context_line":"                                       api_models.CellMapping)"},{"line_number":84,"context_line":"                        .filter("},{"line_number":85,"context_line":"                            api_models.InstanceMapping.instance_uuid"}],"source_content_type":"text/x-python","patch_set":7,"id":"1af94dfe_ca8f3f73","line":82,"updated":"2016-03-18 21:55:19.000000000","message":"I know this is scary and confusing. I\u0027ll update it out.","commit_id":"f454cc70ce679099129e137ce1376a009c59c32c"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"14b6ee9939a7f289bb44bad907f2d2a0e5bf346c","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    fields \u003d {"},{"line_number":33,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"},{"line_number":34,"context_line":"        \u0027instance_uuid\u0027: fields.UUIDField(),"},{"line_number":35,"context_line":"        \u0027cell_mapping\u0027: fields.ObjectField(\u0027CellMapping\u0027, nullable\u003dTrue),"},{"line_number":36,"context_line":"        \u0027project_id\u0027: fields.StringField(),"},{"line_number":37,"context_line":"        }"},{"line_number":38,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_61f4cc85","line":35,"range":{"start_line":35,"start_character":57,"end_line":35,"end_character":71},"updated":"2016-03-22 15:30:45.000000000","message":"So, do you really want this to be nullable? I thought we\u0027d have no cellmapping until we\u0027re either scheduled in cell0 or a real cell. We can use None to signal \"not done yet\" but it would be out of sync with some of our other goals. And it means we can\u0027t lazy-load it later, which you\u0027re doing here.","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"3334e0f1abb120eca9d0531af23a593bc040055b","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    fields \u003d {"},{"line_number":33,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"},{"line_number":34,"context_line":"        \u0027instance_uuid\u0027: fields.UUIDField(),"},{"line_number":35,"context_line":"        \u0027cell_mapping\u0027: fields.ObjectField(\u0027CellMapping\u0027, nullable\u003dTrue),"},{"line_number":36,"context_line":"        \u0027project_id\u0027: fields.StringField(),"},{"line_number":37,"context_line":"        }"},{"line_number":38,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_9f9786eb","line":35,"range":{"start_line":35,"start_character":57,"end_line":35,"end_character":71},"in_reply_to":"fa0719c6_61f4cc85","updated":"2016-03-23 13:26:13.000000000","message":"This is nullable because None is the signal that we\u0027ve received the boot request and created a BuildRequest/RequestSpec but have not yet scheduled to a cell. So None indicates that the list/show needs to grab a BuildRequest rather than an instance. Unless we take the route of putting pre-scheduled instances into cell0 I couldn\u0027t think of a better way to signal this. I suppose we could create a special cell_mapping to indicate that as well, but either way we\u0027re special casing it.","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"f34435c4a1f23d172e3b3aa050c63e867daaa7e3","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    fields \u003d {"},{"line_number":33,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"},{"line_number":34,"context_line":"        \u0027instance_uuid\u0027: fields.UUIDField(),"},{"line_number":35,"context_line":"        \u0027cell_mapping\u0027: fields.ObjectField(\u0027CellMapping\u0027, nullable\u003dTrue),"},{"line_number":36,"context_line":"        \u0027project_id\u0027: fields.StringField(),"},{"line_number":37,"context_line":"        }"},{"line_number":38,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_0957bc58","line":35,"range":{"start_line":35,"start_character":57,"end_line":35,"end_character":71},"in_reply_to":"fa0719c6_9f9786eb","updated":"2016-03-23 14:48:11.000000000","message":"Yeah, makes sense. I think we should be consistent with the lazy load bit below, but that\u0027s cool. I think I was expecting it to mean one thing based on the load behavior, and was confused about the None-ness on lazy-load.","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"14b6ee9939a7f289bb44bad907f2d2a0e5bf346c","unresolved":false,"context_lines":[{"line_number":53,"context_line":"            if cell_map is not None:"},{"line_number":54,"context_line":"                return cell_mapping.CellMapping._from_db_object("},{"line_number":55,"context_line":"                    self._context, cell_mapping.CellMapping(), cell_map)"},{"line_number":56,"context_line":"            return None"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def obj_load_attr(self, attrname):"},{"line_number":59,"context_line":"        if attrname \u003d\u003d \u0027cell_mapping\u0027:"}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_218bf4c4","line":56,"updated":"2016-03-22 15:30:45.000000000","message":"I guess you\u0027re expecting to not set it until we need it, but load None in there if it\u0027s not scheduled yet?","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"14b6ee9939a7f289bb44bad907f2d2a0e5bf346c","unresolved":false,"context_lines":[{"line_number":70,"context_line":"            if key \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":71,"context_line":"                if key in db_instance_mapping:"},{"line_number":72,"context_line":"                    db_value \u003d db_instance_mapping.get(key)"},{"line_number":73,"context_line":"                if not db_value:"},{"line_number":74,"context_line":"                    # cell_mapping can be lazy loaded later."},{"line_number":75,"context_line":"                    continue"},{"line_number":76,"context_line":"                db_value \u003d cell_mapping.CellMapping._from_db_object("}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_61084c2d","line":73,"updated":"2016-03-22 15:30:45.000000000","message":"So here, if we will fail because db_value is not set, if cell_mapping is not in the db_instance_mapping right (if we hit this first, else we\u0027ll do something even weirder).\n\nThis is also weird because I think what you\u0027re going for here is to not set it if it\u0027s not set on the db object during the first round, but later if we lazy-load it and it\u0027s still not set, we set it to None.\n\nI think we should be consistent here. Perhaps we use expected_attrs to signal whether we want a None-or-not ruling on this during query?","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"3334e0f1abb120eca9d0531af23a593bc040055b","unresolved":false,"context_lines":[{"line_number":70,"context_line":"            if key \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":71,"context_line":"                if key in db_instance_mapping:"},{"line_number":72,"context_line":"                    db_value \u003d db_instance_mapping.get(key)"},{"line_number":73,"context_line":"                if not db_value:"},{"line_number":74,"context_line":"                    # cell_mapping can be lazy loaded later."},{"line_number":75,"context_line":"                    continue"},{"line_number":76,"context_line":"                db_value \u003d cell_mapping.CellMapping._from_db_object("}],"source_content_type":"text/x-python","patch_set":8,"id":"fa0719c6_226bbdb8","line":73,"in_reply_to":"fa0719c6_61084c2d","updated":"2016-03-23 13:26:13.000000000","message":"So far I have no expected usage of InstanceMapping which doesn\u0027t also need the CellMapping. I hedged against not having it here but the reality is I want to guarantee we get it from the db object, whether it\u0027s None or not. I\u0027ll rework this to make that clear, and to be consistent with the lazy load behavior above.","commit_id":"098027772f3bdbe5ed1ebf1a870cf786c857099f"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"7d232031a9745e2d8b177f236eb76b4f5b9303f1","unresolved":false,"context_lines":[{"line_number":49,"context_line":"            if key \u003d\u003d \u0027cell_mapping\u0027:"},{"line_number":50,"context_line":"                # cell_mapping can be None indicating that the instance has"},{"line_number":51,"context_line":"                # not been scheduled yet."},{"line_number":52,"context_line":"                if db_value:"},{"line_number":53,"context_line":"                    db_value \u003d cell_mapping.CellMapping._from_db_object("},{"line_number":54,"context_line":"                        instance_mapping._context, cell_mapping.CellMapping(),"},{"line_number":55,"context_line":"                        db_value)"}],"source_content_type":"text/x-python","patch_set":11,"id":"da0c15f0_e802db6e","line":52,"updated":"2016-03-24 18:45:01.000000000","message":"Where does this path get tested?","commit_id":"2f799151768f4dddf6de1c617a3176fdc3ae5720"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"e02e975a03be3d7ef2c48c263f1fa38c755b2926","unresolved":false,"context_lines":[{"line_number":51,"context_line":"                # not been scheduled yet."},{"line_number":52,"context_line":"                if db_value:"},{"line_number":53,"context_line":"                    db_value \u003d cell_mapping.CellMapping._from_db_object("},{"line_number":54,"context_line":"                        instance_mapping._context, cell_mapping.CellMapping(),"},{"line_number":55,"context_line":"                        db_value)"},{"line_number":56,"context_line":"            setattr(instance_mapping, key, db_value)"},{"line_number":57,"context_line":"        instance_mapping.obj_reset_changes()"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_db787efb","line":54,"range":{"start_line":54,"start_character":24,"end_line":54,"end_character":49},"updated":"2016-03-24 21:01:21.000000000","message":"Shouldn\u0027t this be \"context\" the argument passed in? I see instance_mapping._context \u003d context below","commit_id":"4e4a7bf1cc28e313f5f034f9edf8ab34cae14db0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"55aded76d9f49024051a99dabffbac000294e9d8","unresolved":false,"context_lines":[{"line_number":51,"context_line":"                # not been scheduled yet."},{"line_number":52,"context_line":"                if db_value:"},{"line_number":53,"context_line":"                    db_value \u003d cell_mapping.CellMapping._from_db_object("},{"line_number":54,"context_line":"                        instance_mapping._context, cell_mapping.CellMapping(),"},{"line_number":55,"context_line":"                        db_value)"},{"line_number":56,"context_line":"            setattr(instance_mapping, key, db_value)"},{"line_number":57,"context_line":"        instance_mapping.obj_reset_changes()"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_2cf33e0c","line":54,"range":{"start_line":54,"start_character":24,"end_line":54,"end_character":49},"in_reply_to":"da0c15f0_11b017f4","updated":"2016-03-24 21:56:13.000000000","message":"To summarize from IRC, the reason I ask this is because I\u0027m not \"in the know\" about _from_db_object and I was thinking of this making sense as a standalone function, resilient to changes to for example CellMapping._from_db_object that are receiving this context. Example like, if you call this _from_db_object(context, InstanceMapping(), ...) and CellMapping._from_db_object gets None for context if it did any queries.\n\nI realize now that there is no literal problem happening with this code but I thought the intention was to use the context passed in.","commit_id":"4e4a7bf1cc28e313f5f034f9edf8ab34cae14db0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"33c2506b68df18efdb3f50f2b9070b6ccc78f943","unresolved":false,"context_lines":[{"line_number":51,"context_line":"                # not been scheduled yet."},{"line_number":52,"context_line":"                if db_value:"},{"line_number":53,"context_line":"                    db_value \u003d cell_mapping.CellMapping._from_db_object("},{"line_number":54,"context_line":"                        instance_mapping._context, cell_mapping.CellMapping(),"},{"line_number":55,"context_line":"                        db_value)"},{"line_number":56,"context_line":"            setattr(instance_mapping, key, db_value)"},{"line_number":57,"context_line":"        instance_mapping.obj_reset_changes()"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_11b017f4","line":54,"range":{"start_line":54,"start_character":24,"end_line":54,"end_character":49},"in_reply_to":"da0c15f0_db787efb","updated":"2016-03-24 21:34:03.000000000","message":"I think this is fine as it is. See below.","commit_id":"4e4a7bf1cc28e313f5f034f9edf8ab34cae14db0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"33c2506b68df18efdb3f50f2b9070b6ccc78f943","unresolved":false,"context_lines":[{"line_number":55,"context_line":"                        db_value)"},{"line_number":56,"context_line":"            setattr(instance_mapping, key, db_value)"},{"line_number":57,"context_line":"        instance_mapping.obj_reset_changes()"},{"line_number":58,"context_line":"        instance_mapping._context \u003d context"},{"line_number":59,"context_line":"        return instance_mapping"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_f1876310","line":58,"updated":"2016-03-24 21:34:03.000000000","message":"This is holdover from older days where you could pass an alternate context into the object when you did create and you\u0027d absorb that context at that time. This line shouldn\u0027t be necessary anymore.","commit_id":"4e4a7bf1cc28e313f5f034f9edf8ab34cae14db0"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"33c2506b68df18efdb3f50f2b9070b6ccc78f943","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        changes \u003d self.obj_get_changes()"},{"line_number":95,"context_line":"        changes \u003d self._update_with_cell_id(changes)"},{"line_number":96,"context_line":"        db_mapping \u003d self._create_in_db(self._context, changes)"},{"line_number":97,"context_line":"        self._from_db_object(self._context, self, db_mapping)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    @staticmethod"},{"line_number":100,"context_line":"    @db_api.api_context_manager.writer"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_11877710","line":97,"updated":"2016-03-24 21:34:03.000000000","message":"Context comes from self._context, so if self._context isn\u0027t right, neither is the context arg above :)","commit_id":"4e4a7bf1cc28e313f5f034f9edf8ab34cae14db0"}],"nova/tests/functional/db/test_instance_mapping.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"57dce3ecc11c81c23e550c28c3efe4768285c75c","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        self.assertNotEqual(db_mapping[\u0027cell_id\u0027], mapping[\u0027cell_id\u0027])"},{"line_number":81,"context_line":"        for key in [key for key in self.mapping_obj.fields.keys()"},{"line_number":82,"context_line":"                    if key not in [\u0027cell_id\u0027, \u0027cell_mapping\u0027, \u0027updated_at\u0027]]:"},{"line_number":83,"context_line":"            self.assertEqual(db_mapping[key], mapping[key])"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def test_destroy_in_db(self):"},{"line_number":86,"context_line":"        mapping \u003d create_mapping()"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa0719c6_54111603","line":83,"updated":"2016-03-24 11:47:10.000000000","message":"we should assert db_mapping[\u0027cell_id\u0027] equal to cell_mapping[\u0027id\u0027], then we can ensure we save cell mapping correct.","commit_id":"9850f36683af14997205bac947244e47bb1dbc32"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"5ec97745bb7aff9e45f7ac5a1f872cd82301827d","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        self.assertNotEqual(db_mapping[\u0027cell_id\u0027], mapping[\u0027cell_id\u0027])"},{"line_number":81,"context_line":"        for key in [key for key in self.mapping_obj.fields.keys()"},{"line_number":82,"context_line":"                    if key not in [\u0027cell_id\u0027, \u0027cell_mapping\u0027, \u0027updated_at\u0027]]:"},{"line_number":83,"context_line":"            self.assertEqual(db_mapping[key], mapping[key])"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def test_destroy_in_db(self):"},{"line_number":86,"context_line":"        mapping \u003d create_mapping()"}],"source_content_type":"text/x-python","patch_set":10,"id":"fa0719c6_d616c34a","line":83,"in_reply_to":"fa0719c6_54111603","updated":"2016-03-24 13:47:59.000000000","message":"Yeah, I will add this.","commit_id":"9850f36683af14997205bac947244e47bb1dbc32"}],"nova/tests/unit/objects/test_instance_mapping.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"4c9152e333ca6125b3d2c9d17920aa05905fe687","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                 \u0027project_id\u0027: db_mapping[\u0027project_id\u0027]})"},{"line_number":105,"context_line":"        self.compare_obj(mapping_obj, db_mapping,"},{"line_number":106,"context_line":"                         subs\u003d{\u0027cell_mapping\u0027: \u0027cell_id\u0027})"},{"line_number":107,"context_line":"        self.assertEqual(None, mapping_obj.cell_mapping)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @mock.patch.object(instance_mapping.InstanceMapping, \u0027_save_in_db\u0027)"},{"line_number":110,"context_line":"    def test_save(self, save_in_db):"}],"source_content_type":"text/x-python","patch_set":12,"id":"da0c15f0_9b49e6d3","line":107,"updated":"2016-03-24 20:46:35.000000000","message":"pep8 :(","commit_id":"a2e7dd360f0e4f0e95a257f212639a64d416f139"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"6f235dd1c89ba8f18c0bbfe25a74108023ed44c5","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                 \u0027project_id\u0027: db_mapping[\u0027project_id\u0027]})"},{"line_number":105,"context_line":"        self.compare_obj(mapping_obj, db_mapping,"},{"line_number":106,"context_line":"                         subs\u003d{\u0027cell_mapping\u0027: \u0027cell_id\u0027})"},{"line_number":107,"context_line":"        self.assertIsNone(mapping_obj.cell_mapping)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @mock.patch.object(instance_mapping.InstanceMapping, \u0027_save_in_db\u0027)"},{"line_number":110,"context_line":"    def test_save(self, save_in_db):"}],"source_content_type":"text/x-python","patch_set":14,"id":"da0c15f0_6720b14a","line":107,"updated":"2016-03-24 22:30:41.000000000","message":"dangit","commit_id":"cabe2df80494841dab529ac9ff09453035ec650a"}]}
