)]}'
{"nova/api/openstack/compute/contrib/networks_associate.py":[{"author":{"_account_id":14358,"name":"Marian Horban","email":"m.horban@gmail.com","username":"mhorban"},"change_message_id":"22c387539802da7f2711da458395b4efd4df0488","unresolved":false,"context_lines":[{"line_number":54,"context_line":"        authorize(context)"},{"line_number":55,"context_line":"        # NOTE(shaohe-feng): back-compatible with db layer hard-code"},{"line_number":56,"context_line":"        # admin permission checks.  call db API objects.Network.associate"},{"line_number":57,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            self.network_api.associate(context, id, project\u003dNone)"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a6ced46_30c4ca91","line":57,"updated":"2015-03-23 14:33:36.000000000","message":"Methods _disassociate_host_only and _disassociate_project_only - are the same. The only difference is  decorator. Method _associate_host contains almost the same content as _disassociate_host_only and _disassociate_project_only methods. I believe it is better to create single protected method with parameters without decorator and use it in body of  _disassociate_host_only, _disassociate_project_only, _associate_host methods.","commit_id":"49b6adee3010589b5b0c7e0797a5dc58b2ec7ff3"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"6d3eb0b9fede434079db06b34f56e64b948cdedf","unresolved":false,"context_lines":[{"line_number":54,"context_line":"        authorize(context)"},{"line_number":55,"context_line":"        # NOTE(shaohe-feng): back-compatible with db layer hard-code"},{"line_number":56,"context_line":"        # admin permission checks.  call db API objects.Network.associate"},{"line_number":57,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            self.network_api.associate(context, id, project\u003dNone)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3acd31a7_dac045e3","line":57,"in_reply_to":"1a6ced46_30c4ca91","updated":"2015-04-29 14:46:49.000000000","message":"sounds reasonable.\nThanks.","commit_id":"49b6adee3010589b5b0c7e0797a5dc58b2ec7ff3"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"020ba8f66e765d14c24047cae2a527d9425f418d","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        try:"},{"line_number":41,"context_line":"            self.network_api.associate(context, id, host\u003dNone)"},{"line_number":42,"context_line":"        except exception.NetworkNotFound:"},{"line_number":43,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":44,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"bab921fb_d6b86377","line":41,"updated":"2015-04-27 01:44:26.000000000","message":"This will call the db call \u0027network_disassociate\u0027, This back-compatible check shouldn\u0027t be in this patch.","commit_id":"7a595d9d50ecdda9dff00a0a615230ff68414859"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"68e22e56bd6ca633f9534cda7545e07ea57d1350","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        try:"},{"line_number":41,"context_line":"            self.network_api.associate(context, id, host\u003dNone)"},{"line_number":42,"context_line":"        except exception.NetworkNotFound:"},{"line_number":43,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":44,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7a016987_cf47ee49","line":41,"in_reply_to":"bab921fb_d6b86377","updated":"2015-05-18 03:19:50.000000000","message":"　from the code,  network_api.associate  not always call network_disassociate,\n  it will call Network.associate  in some case, the underlying is network_associate which requred admin\n  https://github.com/openstack/nova/blob/master/nova/network/api.py#L366\n and  \n https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L2715\n  \n\n   @wrap_check_policy\n    def associate(self, context, network_uuid, host\u003dbase_api.SENTINEL,\n                  project\u003dbase_api.SENTINEL):\n        \"\"\"Associate or disassociate host or project to network.\"\"\"\n        network \u003d self.get(context, network_uuid)\n        if host is not base_api.SENTINEL:\n            if host is None:\n                objects.Network.disassociate(context, network.id,\n                                             host\u003dTrue, project\u003dFalse)\n            else:\n                network.host \u003d host\n                network.save()\n        if project is not base_api.SENTINEL:\n            if project is None:\n                objects.Network.disassociate(context, network.id,\n                                             host\u003dFalse, project\u003dTrue)\n            else:\n                objects.Network.associate(context, project,\n                                          network_id\u003dnetwork.id, force\u003dTrue)","commit_id":"7a595d9d50ecdda9dff00a0a615230ff68414859"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"020ba8f66e765d14c24047cae2a527d9425f418d","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            self.network_api.associate(context, id, project\u003dNone)"},{"line_number":61,"context_line":"        except exception.NetworkNotFound:"},{"line_number":62,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":63,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"bab921fb_b6b28f92","line":60,"updated":"2015-04-27 01:44:26.000000000","message":"ditto","commit_id":"7a595d9d50ecdda9dff00a0a615230ff68414859"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"81539762b93a3f436c3ad6d3e6633620a2d7b56b","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":35,"context_line":"        authorize(context)"},{"line_number":36,"context_line":"        # NOTE(shaohe-feng): back-compatible with db layer hard-code"},{"line_number":37,"context_line":"        # admin permission checks.  call db API objects.Network.associate"},{"line_number":38,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_0d08e0d8","line":37,"updated":"2015-06-11 12:24:26.000000000","message":"nit, an extra blank space","commit_id":"f90b8a0ae1489bf00a08864e8f3736d54e92fad2"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"81539762b93a3f436c3ad6d3e6633620a2d7b56b","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        try:"},{"line_number":41,"context_line":"            self.network_api.associate(context, id, host\u003dNone)"},{"line_number":42,"context_line":"        except exception.NetworkNotFound:"},{"line_number":43,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":44,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_8d75f064","line":41,"updated":"2015-06-11 12:24:26.000000000","message":"Emm...in this function, it always call db.network_disassociate....so actually to say you should add the back-compatible check when you cleanup network_disassociate.\n\nAnyway you add now, it won\u0027t hurt anything.","commit_id":"f90b8a0ae1489bf00a08864e8f3736d54e92fad2"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"81539762b93a3f436c3ad6d3e6633620a2d7b56b","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            self.network_api.associate(context, id, project\u003dNone)"},{"line_number":61,"context_line":"        except exception.NetworkNotFound:"},{"line_number":62,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":63,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_4df018c9","line":60,"updated":"2015-06-11 12:24:26.000000000","message":"same as above.","commit_id":"f90b8a0ae1489bf00a08864e8f3736d54e92fad2"}],"nova/api/openstack/compute/contrib/os_networks.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"7e7ccace92e10f3465fe1d6bf31dd3e8df5a873a","unresolved":false,"context_lines":[{"line_number":193,"context_line":"        project_id \u003d context.project_id"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        try:"},{"line_number":196,"context_line":"            self.network_api.add_network_to_project("},{"line_number":197,"context_line":"                context, project_id, network_id)"},{"line_number":198,"context_line":"        except NotImplementedError:"},{"line_number":199,"context_line":"            msg \u003d (_(\"VLAN support must be enabled\"))"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a80dd14_512a9190","line":196,"updated":"2015-03-09 02:36:16.000000000","message":"This invoke the network associate also. We should add hard-permission checks at here.","commit_id":"b95e5c0b03dcf3351c2f21f0fef7f9a5074b6cd1"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"7f1946ee73847cd1c1c6987d9588189b73da4402","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            self.network_api.associate(context, id, host\u003dNone, project\u003dNone)"},{"line_number":109,"context_line":"        except exception.NetworkNotFound:"},{"line_number":110,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":111,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a6ced46_af1147ae","line":108,"updated":"2015-03-23 10:01:21.000000000","message":"even though here the name is associate, but actually\n\nnetwork_disassociate in db layer should be called\n\nI think it would be better to postpone the change to next patch to make logic more clear though it\u0027s no harm","commit_id":"49b6adee3010589b5b0c7e0797a5dc58b2ec7ff3"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"020ba8f66e765d14c24047cae2a527d9425f418d","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        nova_context.require_admin_context(context)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            self.network_api.associate(context, id, host\u003dNone, project\u003dNone)"},{"line_number":109,"context_line":"        except exception.NetworkNotFound:"},{"line_number":110,"context_line":"            msg \u003d _(\"Network not found\")"},{"line_number":111,"context_line":"            raise exc.HTTPNotFound(explanation\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"bab921fb_36655f1d","line":108,"updated":"2015-04-27 01:44:26.000000000","message":"This will call the db call network_disassociate, so the back-compabile checsk shouldn\u0027t be in this patch.","commit_id":"7a595d9d50ecdda9dff00a0a615230ff68414859"}],"nova/tests/unit/api/openstack/compute/contrib/test_networks.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"7e7ccace92e10f3465fe1d6bf31dd3e8df5a873a","unresolved":false,"context_lines":[{"line_number":548,"context_line":"    def test_network_disassociate_host_only(self):"},{"line_number":549,"context_line":"        uuid \u003d FAKE_NETWORKS[0][\u0027uuid\u0027]"},{"line_number":550,"context_line":"        res \u003d self.associate_controller._disassociate_host_only("},{"line_number":551,"context_line":"            self.admin_req, uuid, {\u0027disassociate_host\u0027: None})"},{"line_number":552,"context_line":"        self._check_status(res,"},{"line_number":553,"context_line":"                           self.associate_controller._disassociate_host_only,"},{"line_number":554,"context_line":"                           202)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a80dd14_e4b02545","line":551,"updated":"2015-03-09 02:36:16.000000000","message":"after remove the db hard-code permission checks, I think we use normal user for v2.1 api?","commit_id":"b95e5c0b03dcf3351c2f21f0fef7f9a5074b6cd1"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9cd6f4fbb45274202e67a5e09eaff058b8f42fc8","unresolved":false,"context_lines":[{"line_number":329,"context_line":"    def setUp(self):"},{"line_number":330,"context_line":"        super(NetworksTestV21, self).setUp()"},{"line_number":331,"context_line":"        self.fake_network_api \u003d FakeNetworkAPI()"},{"line_number":332,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":333,"context_line":"        self.admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027, use_admin_context\u003dTrue)"},{"line_number":334,"context_line":"        self.non_admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":335,"context_line":"        self._setup()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_b432ceef","line":332,"updated":"2015-03-13 23:51:08.000000000","message":"this is the non_admin request, why you need another non_admin request at line 334?","commit_id":"d6323bd30a2814488465e4fb9bf7693ae0acc840"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9cd6f4fbb45274202e67a5e09eaff058b8f42fc8","unresolved":false,"context_lines":[{"line_number":331,"context_line":"        self.fake_network_api \u003d FakeNetworkAPI()"},{"line_number":332,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":333,"context_line":"        self.admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027, use_admin_context\u003dTrue)"},{"line_number":334,"context_line":"        self.non_admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":335,"context_line":"        self._setup()"},{"line_number":336,"context_line":"        fakes.stub_out_networking(self.stubs)"},{"line_number":337,"context_line":"        fakes.stub_out_rate_limiting(self.stubs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_943eaab6","line":334,"updated":"2015-03-13 23:51:08.000000000","message":"move this into NetworkTestV21\u0027s setUp","commit_id":"d6323bd30a2814488465e4fb9bf7693ae0acc840"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9cd6f4fbb45274202e67a5e09eaff058b8f42fc8","unresolved":false,"context_lines":[{"line_number":351,"context_line":""},{"line_number":352,"context_line":"    def test_network_list_all_as_user(self):"},{"line_number":353,"context_line":"        self.maxDiff \u003d None"},{"line_number":354,"context_line":"        res_dict \u003d self.controller.index(self.non_admin_req)"},{"line_number":355,"context_line":"        self.assertEqual(res_dict, {\u0027networks\u0027: []})"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"        project_id \u003d self.req.environ[\"nova.context\"].project_id"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_d42d8290","line":354,"updated":"2015-03-13 23:51:08.000000000","message":"use self.req at here directly","commit_id":"d6323bd30a2814488465e4fb9bf7693ae0acc840"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9cd6f4fbb45274202e67a5e09eaff058b8f42fc8","unresolved":false,"context_lines":[{"line_number":360,"context_line":"        self.fake_network_api.associate(context\u003dcxt,"},{"line_number":361,"context_line":"                                        network_uuid\u003duuid,"},{"line_number":362,"context_line":"                                        project\u003dproject_id)"},{"line_number":363,"context_line":"        res_dict \u003d self.controller.index(self.non_admin_req)"},{"line_number":364,"context_line":"        expected \u003d [copy.deepcopy(FAKE_USER_NETWORKS[0])]"},{"line_number":365,"context_line":"        for network in expected:"},{"line_number":366,"context_line":"            self.network_uuid_to_id(network)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_f44fe668","line":363,"updated":"2015-03-13 23:51:08.000000000","message":"ditto","commit_id":"d6323bd30a2814488465e4fb9bf7693ae0acc840"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9cd6f4fbb45274202e67a5e09eaff058b8f42fc8","unresolved":false,"context_lines":[{"line_number":539,"context_line":"        self.fake_network_api \u003d FakeNetworkAPI()"},{"line_number":540,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":541,"context_line":"        self.admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027, use_admin_context\u003dTrue)"},{"line_number":542,"context_line":"        self.non_admin_req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":543,"context_line":"        self._setup()"},{"line_number":544,"context_line":"        fakes.stub_out_networking(self.stubs)"},{"line_number":545,"context_line":"        fakes.stub_out_rate_limiting(self.stubs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_147aba87","line":542,"updated":"2015-03-13 23:51:08.000000000","message":"same problem as above","commit_id":"d6323bd30a2814488465e4fb9bf7693ae0acc840"}]}
