)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":1030,"name":"Chris Behrens","email":"cbehrens@codestud.com","username":"cbehrens"},"change_message_id":"ba4cfd547237aa30c2f93c7efd2868673c64bce2","unresolved":false,"context_lines":[{"line_number":4205,"context_line":"            access_ref \u003d models.InstanceTypeProjects()"},{"line_number":4206,"context_line":"            access_ref.update({\"instance_type_id\": instance_type_ref.id,"},{"line_number":4207,"context_line":"                               \"project_id\": project})"},{"line_number":4208,"context_line":"            access_ref.save()"},{"line_number":4209,"context_line":""},{"line_number":4210,"context_line":"    return _dict_with_extra_specs(instance_type_ref)"},{"line_number":4211,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2BpnU%3D","line":4208,"updated":"2013-11-22 00:45:02.000000000","message":"I *think* you can do this in 1 save by creating the list of InstanceTypeProjects and assigning them to instance_type_ref.projects... and then just save instance_type_ref.\n\nWe do this for instance_create for metadata and sec groups... though there\u0027s a slight difference in that the associations with instance_create are with instance_uuid and not an autoincrement field.  But, if sql-a does things correctly, it should still work.","commit_id":"89ba1a41f10cd83e7f5ae3dd92e2e8ed68151a26"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"13b29af76f670aa198d7de15c6510ff12b6c373d","unresolved":false,"context_lines":[{"line_number":4204,"context_line":"            raise exception.FlavorExists(name\u003dvalues[\u0027name\u0027])"},{"line_number":4205,"context_line":"        except Exception as e:"},{"line_number":4206,"context_line":"            raise db_exc.DBError(e)"},{"line_number":4207,"context_line":"        for project in set(projects):"},{"line_number":4208,"context_line":"            access_ref \u003d models.InstanceTypeProjects()"},{"line_number":4209,"context_line":"            access_ref.update({\"instance_type_id\": instance_type_ref.id,"},{"line_number":4210,"context_line":"                               \"project_id\": project})"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2BeuY%3D","line":4207,"updated":"2013-11-25 16:37:41.000000000","message":"There was a path that dealt with concurrent writes (for some reason I am unable to access github at the moment)\nPlease look at flavor_access_add\n\nMaybe you should consider using that function here incase there is an exception with one of the project additions.","commit_id":"755ba297e8090299486e21336c403f2d88ea7b25"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"2af9f67257f216ed1fd77ef729d7dbfa8c4a515b","unresolved":false,"context_lines":[{"line_number":4208,"context_line":"            access_ref \u003d models.InstanceTypeProjects()"},{"line_number":4209,"context_line":"            access_ref.update({\"instance_type_id\": instance_type_ref.id,"},{"line_number":4210,"context_line":"                               \"project_id\": project})"},{"line_number":4211,"context_line":"            access_ref.save()"},{"line_number":4212,"context_line":""},{"line_number":4213,"context_line":"    return _dict_with_extra_specs(instance_type_ref)"},{"line_number":4214,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F96B0%3D","line":4211,"updated":"2013-12-04 16:36:39.000000000","message":"Any throw from this save call will roll back the whole session and discard the instance_type_ref.save() call on 4200 if this is the desired behavior, this is good code.","commit_id":"755ba297e8090299486e21336c403f2d88ea7b25"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b9b5a0aab8e9d32e459d1964c9b406293d6363fe","unresolved":false,"context_lines":[{"line_number":4207,"context_line":"        except Exception as e:"},{"line_number":4208,"context_line":"            raise db_exc.DBError(e)"},{"line_number":4209,"context_line":"        for project in set(projects):"},{"line_number":4210,"context_line":"            access_ref \u003d models.InstanceTypeProjects()"},{"line_number":4211,"context_line":"            access_ref.update({\"instance_type_id\": instance_type_ref.id,"},{"line_number":4212,"context_line":"                               \"project_id\": project})"},{"line_number":4213,"context_line":"            access_ref.save()"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F95Z4%3D","line":4210,"updated":"2013-12-04 18:46:13.000000000","message":"I think garyk pointed this out before, but why not just call self.flavor_access_add(context, instance_type_ref.id, project)?","commit_id":"05b2d0d4748b701e989ba244428bff8e30b0ec3f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6e3f77ab888f294a23c6054a6b33e2a03495eabc","unresolved":false,"context_lines":[{"line_number":4207,"context_line":"        except Exception as e:"},{"line_number":4208,"context_line":"            raise db_exc.DBError(e)"},{"line_number":4209,"context_line":"        for project in set(projects):"},{"line_number":4210,"context_line":"            access_ref \u003d models.InstanceTypeProjects()"},{"line_number":4211,"context_line":"            access_ref.update({\"instance_type_id\": instance_type_ref.id,"},{"line_number":4212,"context_line":"                               \"project_id\": project})"},{"line_number":4213,"context_line":"            access_ref.save()"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F95YY%3D","line":4210,"in_reply_to":"AAAATn%2F95Z4%3D","updated":"2013-12-04 18:53:00.000000000","message":"OK, two things:\n\n1. We shouldn\u0027t get a duplicate entry because we\u0027re creating the flavor here and using a set() to limit the projects.\n\n2. Going through flavor_access_add would make us do another db query to get the flavor ID, which we already know.","commit_id":"05b2d0d4748b701e989ba244428bff8e30b0ec3f"}],"nova/tests/db/test_db_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ed92af29aa218a750481370311dabe63e591b41f","unresolved":false,"context_lines":[{"line_number":2519,"context_line":"    def test_flavor_create_with_projects(self):"},{"line_number":2520,"context_line":"        projects \u003d [\u0027fake-project1\u0027, \u0027fake-project2\u0027]"},{"line_number":2521,"context_line":"        flavor \u003d self._create_flavor({}, projects)"},{"line_number":2522,"context_line":"        print flavor"},{"line_number":2523,"context_line":"        access \u003d db.flavor_access_get_by_flavor_id(self.ctxt,"},{"line_number":2524,"context_line":"                                                   flavor[\u0027flavorid\u0027])"},{"line_number":2525,"context_line":"        self.assertEqual(projects, [x.project_id for x in access])"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F95cI%3D","line":2522,"updated":"2013-12-04 18:39:51.000000000","message":"Hmm...","commit_id":"3019d340a9a22eca1c119ebd3ce11d0ff288a15d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6e3f77ab888f294a23c6054a6b33e2a03495eabc","unresolved":false,"context_lines":[{"line_number":2517,"context_line":"                                 ignored_keys)"},{"line_number":2518,"context_line":""},{"line_number":2519,"context_line":"    def test_flavor_create_with_projects(self):"},{"line_number":2520,"context_line":"        projects \u003d [\u0027fake-project1\u0027, \u0027fake-project2\u0027]"},{"line_number":2521,"context_line":"        flavor \u003d self._create_flavor({}, projects)"},{"line_number":2522,"context_line":"        access \u003d db.flavor_access_get_by_flavor_id(self.ctxt,"},{"line_number":2523,"context_line":"                                                   flavor[\u0027flavorid\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F95Yg%3D","line":2520,"updated":"2013-12-04 18:53:00.000000000","message":"Let\u0027s throw a duplicate entry in the list so it reinforces the set() is used when looping over the projects.","commit_id":"05b2d0d4748b701e989ba244428bff8e30b0ec3f"}]}
