)]}'
{"zun/api/controllers/v1/containers.py":[{"author":{"_account_id":8264,"name":"Shunli Zhou","username":"ShunliZhou"},"change_message_id":"2219b75b74fa71c2a3356b48bc3949c179dd1af1","unresolved":false,"context_lines":[{"line_number":268,"context_line":"        return view.format_container(pecan.request.host_url, new_container)"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def _build_requested_networks(self, context, nets):"},{"line_number":271,"context_line":"        neutron_api \u003d neutron.NeutronAPI(context)"},{"line_number":272,"context_line":"        requested_networks \u003d []"},{"line_number":273,"context_line":"        for net in nets:"},{"line_number":274,"context_line":"            if \u0027port\u0027 in net:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_be0cbd3b","line":271,"range":{"start_line":271,"start_character":8,"end_line":271,"end_character":49},"updated":"2017-07-10 01:23:59.000000000","message":"please move this to the __init__ method.","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"5860f17bacf4d8a93a702b175745f8b7375c5186","unresolved":false,"context_lines":[{"line_number":268,"context_line":"        return view.format_container(pecan.request.host_url, new_container)"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def _build_requested_networks(self, context, nets):"},{"line_number":271,"context_line":"        neutron_api \u003d neutron.NeutronAPI(context)"},{"line_number":272,"context_line":"        requested_networks \u003d []"},{"line_number":273,"context_line":"        for net in nets:"},{"line_number":274,"context_line":"            if \u0027port\u0027 in net:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_319e53b8","line":271,"range":{"start_line":271,"start_character":8,"end_line":271,"end_character":49},"in_reply_to":"3f1d235d_be0cbd3b","updated":"2017-07-11 23:22:44.000000000","message":"There is no __init__ method in this class (but I could create one). However, the problem is the \u0027context\u0027 parameter is not available on __init__.","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":25026,"name":"Bin Zhou","email":"lakerzhou@gmail.com","username":"lakerzhou"},"change_message_id":"06f177611c60333a60820ad41e0f7587bf09137f","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                neutron_api.ensure_neutron_port_usable(port)"},{"line_number":280,"context_line":"                requested_networks.append({\u0027network\u0027: port[\u0027network_id\u0027],"},{"line_number":281,"context_line":"                                           \u0027port\u0027: port[\u0027id\u0027],"},{"line_number":282,"context_line":"                                           \u0027v4-fixed-ip\u0027: \u0027\u0027,"},{"line_number":283,"context_line":"                                           \u0027v6-fixed-ip\u0027: \u0027\u0027})"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if not requested_networks:"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_bc94a78c","line":282,"range":{"start_line":282,"start_character":43,"end_line":282,"end_character":60},"updated":"2017-07-24 16:05:29.000000000","message":"if a user create a port with an IP address, should the IP be used here?","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":8264,"name":"Shunli Zhou","username":"ShunliZhou"},"change_message_id":"7e2af6f4d67f6eba5f34ea7498a5f74d1085cc08","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                neutron_api.ensure_neutron_port_usable(port)"},{"line_number":280,"context_line":"                requested_networks.append({\u0027network\u0027: port[\u0027network_id\u0027],"},{"line_number":281,"context_line":"                                           \u0027port\u0027: port[\u0027id\u0027],"},{"line_number":282,"context_line":"                                           \u0027v4-fixed-ip\u0027: \u0027\u0027,"},{"line_number":283,"context_line":"                                           \u0027v6-fixed-ip\u0027: \u0027\u0027})"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if not requested_networks:"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_fe719577","line":282,"range":{"start_line":282,"start_character":43,"end_line":282,"end_character":60},"in_reply_to":"ff346bd7_bc94a78c","updated":"2017-07-27 06:58:47.000000000","message":"I guess user create port with ip address, the ip address will get from neutron by port id. v4-fixed-ip here just for user create container specify a network and v4-fixed-ip.\n\nTwo ways to specify fixed ip for containers like nova:\n1, zun create --net net-id\u003dxxxx, v4-fixed-ip\u003dxxx\n2,neutron port-create --fixed-ip subnet_id\u003dSUBNET_ID,ip_address\u003dIP_ADDRESS NET_ID\nzun create --image IMAGE --net port-id\u003dPORT_ID VM_NAME","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":25026,"name":"Bin Zhou","email":"lakerzhou@gmail.com","username":"lakerzhou"},"change_message_id":"da151d0589bc60e3b8d41ec1cd11d31fefd43d51","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                neutron_api.ensure_neutron_port_usable(port)"},{"line_number":280,"context_line":"                requested_networks.append({\u0027network\u0027: port[\u0027network_id\u0027],"},{"line_number":281,"context_line":"                                           \u0027port\u0027: port[\u0027id\u0027],"},{"line_number":282,"context_line":"                                           \u0027v4-fixed-ip\u0027: \u0027\u0027,"},{"line_number":283,"context_line":"                                           \u0027v6-fixed-ip\u0027: \u0027\u0027})"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if not requested_networks:"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_d98ee077","line":282,"range":{"start_line":282,"start_character":43,"end_line":282,"end_character":60},"in_reply_to":"ff346bd7_fe719577","updated":"2017-07-27 12:58:52.000000000","message":"Thanks Shunli for the clarification.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"}],"zun/container/docker/driver.py":[{"author":{"_account_id":8264,"name":"Shunli Zhou","username":"ShunliZhou"},"change_message_id":"2219b75b74fa71c2a3356b48bc3949c179dd1af1","unresolved":false,"context_lines":[{"line_number":563,"context_line":"                       image\u003d\u0027kubernetes/pause\u0027):"},{"line_number":564,"context_line":"        with docker_utils.docker_client() as docker:"},{"line_number":565,"context_line":"            network_api \u003d zun_network.api(context\u003dcontext, docker_api\u003ddocker)"},{"line_number":566,"context_line":"            for request in requested_networks:"},{"line_number":567,"context_line":"                self._get_or_create_docker_network("},{"line_number":568,"context_line":"                    context, network_api, request[\u0027network\u0027])"},{"line_number":569,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_3e466d51","line":566,"range":{"start_line":566,"start_character":12,"end_line":566,"end_character":46},"updated":"2017-07-10 01:23:59.000000000","message":"I think here removed the \u0027auto\u0027 create network case. if use specify \u0027auto\u0027, requested_networks is [], nothing done here.","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"5860f17bacf4d8a93a702b175745f8b7375c5186","unresolved":false,"context_lines":[{"line_number":563,"context_line":"                       image\u003d\u0027kubernetes/pause\u0027):"},{"line_number":564,"context_line":"        with docker_utils.docker_client() as docker:"},{"line_number":565,"context_line":"            network_api \u003d zun_network.api(context\u003dcontext, docker_api\u003ddocker)"},{"line_number":566,"context_line":"            for request in requested_networks:"},{"line_number":567,"context_line":"                self._get_or_create_docker_network("},{"line_number":568,"context_line":"                    context, network_api, request[\u0027network\u0027])"},{"line_number":569,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_b192639e","line":566,"range":{"start_line":566,"start_character":12,"end_line":566,"end_character":46},"in_reply_to":"3f1d235d_3e466d51","updated":"2017-07-11 23:22:44.000000000","message":"The logic has moved to controller: https://review.openstack.org/#/c/481861/4/zun/api/controllers/v1/containers.py@282 , but I understand how it confused. I would split this patches into two to make it clear.","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"}],"zun/network/kuryr_network.py":[{"author":{"_account_id":25026,"name":"Bin Zhou","email":"lakerzhou@gmail.com","username":"lakerzhou"},"change_message_id":"06f177611c60333a60820ad41e0f7587bf09137f","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if requested_network.get(\u0027port\u0027):"},{"line_number":134,"context_line":"            neutron_port_id \u003d requested_network.get(\u0027port\u0027)"},{"line_number":135,"context_line":"            neutron_port \u003d self.neutron_api.get_neutron_port(neutron_port_id)"},{"line_number":136,"context_line":"            # NOTE(hongbin): If existing port is specified, security_group_ids"},{"line_number":137,"context_line":"            # is ignored because existing port already has security groups."},{"line_number":138,"context_line":"            # We might revisit this behaviour later. Alternatively, we could"},{"line_number":139,"context_line":"            # either throw an exception or overwrite the port\u0027s security"},{"line_number":140,"context_line":"            # groups."},{"line_number":141,"context_line":"        else:"},{"line_number":142,"context_line":"            network \u003d self.inspect_network(network_name)"},{"line_number":143,"context_line":"            neutron_net_id \u003d network[\u0027Options\u0027][\u0027neutron.net.uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_fa9472ea","line":140,"range":{"start_line":136,"start_character":13,"end_line":140,"end_character":21},"updated":"2017-07-24 16:05:29.000000000","message":"I think we can simply add the passed security group to the port using port-update with [--security-group SECURITY_GROUP] option.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"05b0c2dcbaa765143f6479d5431883721d2ead67","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if requested_network.get(\u0027port\u0027):"},{"line_number":134,"context_line":"            neutron_port_id \u003d requested_network.get(\u0027port\u0027)"},{"line_number":135,"context_line":"            neutron_port \u003d self.neutron_api.get_neutron_port(neutron_port_id)"},{"line_number":136,"context_line":"            # NOTE(hongbin): If existing port is specified, security_group_ids"},{"line_number":137,"context_line":"            # is ignored because existing port already has security groups."},{"line_number":138,"context_line":"            # We might revisit this behaviour later. Alternatively, we could"},{"line_number":139,"context_line":"            # either throw an exception or overwrite the port\u0027s security"},{"line_number":140,"context_line":"            # groups."},{"line_number":141,"context_line":"        else:"},{"line_number":142,"context_line":"            network \u003d self.inspect_network(network_name)"},{"line_number":143,"context_line":"            neutron_net_id \u003d network[\u0027Options\u0027][\u0027neutron.net.uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"df3967d1_a177dc3a","line":140,"range":{"start_line":136,"start_character":13,"end_line":140,"end_character":21},"in_reply_to":"df3967d1_ce50e9d7","updated":"2017-07-31 17:54:11.000000000","message":"Take a look at this proposal: https://review.openstack.org/#/c/489275/ . Nova documented the behavior that security groups should not apply to existing ports.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"f5178d451744d79e35fb2aa3a7b2744545dcf2c3","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if requested_network.get(\u0027port\u0027):"},{"line_number":134,"context_line":"            neutron_port_id \u003d requested_network.get(\u0027port\u0027)"},{"line_number":135,"context_line":"            neutron_port \u003d self.neutron_api.get_neutron_port(neutron_port_id)"},{"line_number":136,"context_line":"            # NOTE(hongbin): If existing port is specified, security_group_ids"},{"line_number":137,"context_line":"            # is ignored because existing port already has security groups."},{"line_number":138,"context_line":"            # We might revisit this behaviour later. Alternatively, we could"},{"line_number":139,"context_line":"            # either throw an exception or overwrite the port\u0027s security"},{"line_number":140,"context_line":"            # groups."},{"line_number":141,"context_line":"        else:"},{"line_number":142,"context_line":"            network \u003d self.inspect_network(network_name)"},{"line_number":143,"context_line":"            neutron_net_id \u003d network[\u0027Options\u0027][\u0027neutron.net.uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"df3967d1_ce50e9d7","line":140,"range":{"start_line":136,"start_character":13,"end_line":140,"end_character":21},"in_reply_to":"ff346bd7_fa9472ea","updated":"2017-07-30 01:37:25.000000000","message":"In Nova, if users create a vm with an existing port and a security group, the passed security group is ignored. Arguably, this could be a bug since the port\u0027s security group should be updated in this case as you mentioned. I created a bug in Nova side (https://bugs.launchpad.net/nova/+bug/1707319) and proposed a patch to fix it (https://review.openstack.org/#/c/488956/). Let\u0027s see how Nova team will response to it.\n\nFor now, I think it is better to make the behavior consistent with Nova. We could revisit it later depending on if the same fix will be accepted in Nova side.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"6dff176b9d99e77edcdf2b4a52d227d47e60449a","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if requested_network.get(\u0027port\u0027):"},{"line_number":134,"context_line":"            neutron_port_id \u003d requested_network.get(\u0027port\u0027)"},{"line_number":135,"context_line":"            neutron_port \u003d self.neutron_api.get_neutron_port(neutron_port_id)"},{"line_number":136,"context_line":"            # NOTE(hongbin): If existing port is specified, security_group_ids"},{"line_number":137,"context_line":"            # is ignored because existing port already has security groups."},{"line_number":138,"context_line":"            # We might revisit this behaviour later. Alternatively, we could"},{"line_number":139,"context_line":"            # either throw an exception or overwrite the port\u0027s security"},{"line_number":140,"context_line":"            # groups."},{"line_number":141,"context_line":"        else:"},{"line_number":142,"context_line":"            network \u003d self.inspect_network(network_name)"},{"line_number":143,"context_line":"            neutron_net_id \u003d network[\u0027Options\u0027][\u0027neutron.net.uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_2198f567","line":140,"range":{"start_line":136,"start_character":13,"end_line":140,"end_character":21},"in_reply_to":"ff346bd7_fa9472ea","updated":"2017-07-28 04:23:12.000000000","message":"Yes, this is a good idea. I will investigate on it. Personally, I would like the behavior to be inconsistent with Nova. Probably, I can ask the nova team about how to handle this case. Potentially, we could convince the nova team to adopt the scenario you suggested.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"}],"zun/network/neutron.py":[{"author":{"_account_id":8264,"name":"Shunli Zhou","username":"ShunliZhou"},"change_message_id":"2219b75b74fa71c2a3356b48bc3949c179dd1af1","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        # Make sure the port is usable"},{"line_number":65,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"},{"line_number":66,"context_line":"        if binding_vif_type \u003d\u003d \u0027binding_failed\u0027:"},{"line_number":67,"context_line":"            raise exception.PortBindingFailed(port\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_fb1da773","line":65,"range":{"start_line":65,"start_character":37,"end_line":65,"end_character":53},"updated":"2017-07-10 01:23:59.000000000","message":"whether need to check the port status here? how about binding a port that is down?","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"2d43e13deb75934dc0266d6349c1913e40923e62","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        # Make sure the port is usable"},{"line_number":65,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"},{"line_number":66,"context_line":"        if binding_vif_type \u003d\u003d \u0027binding_failed\u0027:"},{"line_number":67,"context_line":"            raise exception.PortBindingFailed(port\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_33d7c9c2","line":65,"range":{"start_line":65,"start_character":37,"end_line":65,"end_character":53},"in_reply_to":"3f1d235d_fb1da773","updated":"2017-07-12 23:35:09.000000000","message":"Done","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"5860f17bacf4d8a93a702b175745f8b7375c5186","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"        # Make sure the port is usable"},{"line_number":65,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"},{"line_number":66,"context_line":"        if binding_vif_type \u003d\u003d \u0027binding_failed\u0027:"},{"line_number":67,"context_line":"            raise exception.PortBindingFailed(port\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_9191a79c","line":65,"range":{"start_line":65,"start_character":37,"end_line":65,"end_character":53},"in_reply_to":"3f1d235d_fb1da773","updated":"2017-07-11 23:22:44.000000000","message":"I will look into this point.","commit_id":"e9d8dde865bc9c5b257468648ab4b8cddde33b1f"},{"author":{"_account_id":25026,"name":"Bin Zhou","email":"lakerzhou@gmail.com","username":"lakerzhou"},"change_message_id":"06f177611c60333a60820ad41e0f7587bf09137f","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if project_id is None:"},{"line_number":54,"context_line":"            project_id \u003d self.context.project_id"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        # Make sure the container has access to the port."},{"line_number":57,"context_line":"        if port[\u0027tenant_id\u0027] !\u003d project_id:"},{"line_number":58,"context_line":"            raise exception.PortNotUsable(port\u003dport[\u0027id\u0027])"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        # Make sure the port isn\u0027t already attached to another"},{"line_number":61,"context_line":"        # container or Nova instance."}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_fc4a2f7e","line":58,"range":{"start_line":56,"start_character":0,"end_line":58,"end_character":58},"updated":"2017-07-24 16:05:29.000000000","message":"Should the port inherit the \"project\" from network? I think if a tenant can access a network, he should be able to use any available ports of the network. I am not sure if the \"tenant_id\" here is the tenant who creates the port. For example, if network A (an external network) is shared for all the projects, A tenant user UA create a port on this network, the port should be able to be used by another tenant user UB. BTW, I never tested this before. Thoughts?","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"6dff176b9d99e77edcdf2b4a52d227d47e60449a","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if project_id is None:"},{"line_number":54,"context_line":"            project_id \u003d self.context.project_id"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        # Make sure the container has access to the port."},{"line_number":57,"context_line":"        if port[\u0027tenant_id\u0027] !\u003d project_id:"},{"line_number":58,"context_line":"            raise exception.PortNotUsable(port\u003dport[\u0027id\u0027])"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        # Make sure the port isn\u0027t already attached to another"},{"line_number":61,"context_line":"        # container or Nova instance."}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_818c41d7","line":58,"range":{"start_line":56,"start_character":0,"end_line":58,"end_character":58},"in_reply_to":"ff346bd7_fc4a2f7e","updated":"2017-07-28 04:23:12.000000000","message":"Replies to your questions:\n* I don\u0027t believe the port will inherit from the \"project\" of the network. Instead, the port will inherit from the \"project\" of the user who created the port.\n* The \u0027tenant_id\u0027 here is the same tenant as the user who created the port.\n* If network A is shared for all projects, a tenant user UA create a port on this network, the port is able to be used by another tenant user UB. I agree with this statement and this patch implements it.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":25026,"name":"Bin Zhou","email":"lakerzhou@gmail.com","username":"lakerzhou"},"change_message_id":"06f177611c60333a60820ad41e0f7587bf09137f","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        # Make sure the port isn\u0027t already attached to another"},{"line_number":61,"context_line":"        # container or Nova instance."},{"line_number":62,"context_line":"        if port.get(\u0027device_id\u0027) or port.get(\u0027status\u0027) \u003d\u003d \u0027ACTIVE\u0027:"},{"line_number":63,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        # Make sure the port is usable"},{"line_number":66,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_a2b8fc29","line":63,"range":{"start_line":62,"start_character":8,"end_line":63,"end_character":54},"updated":"2017-07-24 16:05:29.000000000","message":"Should we test other cases also? Without testing, I am not sure what is the expected state before the port is attached to a container/VM. I guess it is DOWN or N/A.\nPORT_STATUS_ACTIVE \u003d \u0027ACTIVE\u0027\nPORT_STATUS_BUILD \u003d \u0027BUILD\u0027\nPORT_STATUS_DOWN \u003d \u0027DOWN\u0027\nPORT_STATUS_ERROR \u003d \u0027ERROR\u0027\nPORT_STATUS_NOTAPPLICABLE \u003d \u0027N/A\u0027","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"f5178d451744d79e35fb2aa3a7b2744545dcf2c3","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        # Make sure the port isn\u0027t already attached to another"},{"line_number":61,"context_line":"        # container or Nova instance."},{"line_number":62,"context_line":"        if port.get(\u0027device_id\u0027) or port.get(\u0027status\u0027) \u003d\u003d \u0027ACTIVE\u0027:"},{"line_number":63,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        # Make sure the port is usable"},{"line_number":66,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"df3967d1_8e6421bb","line":63,"range":{"start_line":62,"start_character":8,"end_line":63,"end_character":54},"in_reply_to":"ff346bd7_a2b8fc29","updated":"2017-07-30 01:37:25.000000000","message":"Good catch. I improved the validation logic of the port states in the new patchset.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"6dff176b9d99e77edcdf2b4a52d227d47e60449a","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        # Make sure the port isn\u0027t already attached to another"},{"line_number":61,"context_line":"        # container or Nova instance."},{"line_number":62,"context_line":"        if port.get(\u0027device_id\u0027) or port.get(\u0027status\u0027) \u003d\u003d \u0027ACTIVE\u0027:"},{"line_number":63,"context_line":"            raise exception.PortInUse(port\u003dport[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        # Make sure the port is usable"},{"line_number":66,"context_line":"        binding_vif_type \u003d port.get(\u0027binding:vif_type\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff346bd7_4169b9f6","line":63,"range":{"start_line":62,"start_character":8,"end_line":63,"end_character":54},"in_reply_to":"ff346bd7_a2b8fc29","updated":"2017-07-28 04:23:12.000000000","message":"I see. I will investigate on the possible states.","commit_id":"3b32051778fadcf3d03c36871aa19d2189f44bde"},{"author":{"_account_id":22406,"name":"Kien Nguyen","email":"kiennt2609@gmail.com","username":"kiennt"},"change_message_id":"5af5d0881c63d7abf15e1c813e23ac77d9703a91","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        return nets[0]"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    def get_neutron_port(self, port):"},{"line_number":37,"context_line":"        neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":38,"context_line":"        if uuidutils.is_uuid_like(port):"},{"line_number":39,"context_line":"            ports \u003d neutron.list_ports(id\u003dport)[\u0027ports\u0027]"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":12,"id":"df3967d1_6d2c5a47","line":37,"range":{"start_line":37,"start_character":8,"end_line":37,"end_character":66},"updated":"2017-07-31 07:13:39.000000000","message":"I have a question about this. You init neutron client in each method. Why don\u0027t init one (self.neutron \u003d...) in __init__() and reuse in another method? Same thing happens in zun/image/utils/.\n\nI think you did it for a reason and I just want to know what it is. Thank you.","commit_id":"3719f921736681549d20463698a9b67dc1fd41d5"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"a9442a0c4465ed5d853e3d633ac03eb1f1afb9bf","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        return nets[0]"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    def get_neutron_port(self, port):"},{"line_number":37,"context_line":"        neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":38,"context_line":"        if uuidutils.is_uuid_like(port):"},{"line_number":39,"context_line":"            ports \u003d neutron.list_ports(id\u003dport)[\u0027ports\u0027]"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":12,"id":"df3967d1_04d6b6c6","line":37,"range":{"start_line":37,"start_character":8,"end_line":37,"end_character":66},"in_reply_to":"df3967d1_6d2c5a47","updated":"2017-07-31 18:47:11.000000000","message":"Done","commit_id":"3719f921736681549d20463698a9b67dc1fd41d5"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"ba7980e8f209021a3443c200994b4b9951ecad38","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        return nets[0]"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    def get_neutron_port(self, port):"},{"line_number":37,"context_line":"        neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":38,"context_line":"        if uuidutils.is_uuid_like(port):"},{"line_number":39,"context_line":"            ports \u003d neutron.list_ports(id\u003dport)[\u0027ports\u0027]"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":12,"id":"df3967d1_2afaaa41","line":37,"range":{"start_line":37,"start_character":8,"end_line":37,"end_character":66},"in_reply_to":"df3967d1_6d2c5a47","updated":"2017-07-31 14:40:41.000000000","message":"Yes, we should do that. I will fix it if there is another patchset.","commit_id":"3719f921736681549d20463698a9b67dc1fd41d5"},{"author":{"_account_id":22406,"name":"Kien Nguyen","email":"kiennt2609@gmail.com","username":"kiennt"},"change_message_id":"561dcc10e1ed199e02bdb8e4e95292ea84e5c2c0","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    def __init__(self, context):"},{"line_number":24,"context_line":"        self.context \u003d context"},{"line_number":25,"context_line":"        self.neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    def get_available_network(self):"},{"line_number":28,"context_line":"        search_opts \u003d {\u0027tenant_id\u0027: self.context.project_id, \u0027shared\u0027: False}"}],"source_content_type":"text/x-python","patch_set":13,"id":"df3967d1_be95a5e6","line":25,"range":{"start_line":25,"start_character":8,"end_line":25,"end_character":71},"updated":"2017-08-01 09:24:49.000000000","message":"I think we should change back to 1st strategy - Init neutronclient within each method. I have taken a look at nova code, they init client within each method and discard it for e.x [1]. After that, I investigate about it, why they do such a thing and found the answer from Nova core reviewer\u0027s blog [2]. Shortcut:\n\n\"As a very small application this isn’t obvious however because all the caching and authentication logic is being handled by the session and plugin there is no reason to keep a client around. Clients become very cheap to create and so in most situations you can use a client object within a function and then discard it.\"\n\nSorry about that confusion.\n\n[1] https://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L308\n[2] http://www.jamielennox.net/blog/2015/09/10/user-auth-in-openstack-services/","commit_id":"9f36bb76727dd676ff43e5c027c23dd6697fe6b1"},{"author":{"_account_id":11536,"name":"hongbin","email":"hongbin034@gmail.com","username":"hongbin"},"change_message_id":"5c79753f333b160ea3f1705a88836222807c6d58","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    def __init__(self, context):"},{"line_number":24,"context_line":"        self.context \u003d context"},{"line_number":25,"context_line":"        self.neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    def get_available_network(self):"},{"line_number":28,"context_line":"        search_opts \u003d {\u0027tenant_id\u0027: self.context.project_id, \u0027shared\u0027: False}"}],"source_content_type":"text/x-python","patch_set":13,"id":"df3967d1_c3719f0e","line":25,"range":{"start_line":25,"start_character":8,"end_line":25,"end_character":71},"in_reply_to":"df3967d1_be95a5e6","updated":"2017-08-01 18:35:48.000000000","message":"Hi Kien,\n\nThat is fine. We will create a NeutronAPI in the fly and this object will be discarded whenever the caller function ends. Therefore, I don\u0027t think the location of neutron client matters.","commit_id":"9f36bb76727dd676ff43e5c027c23dd6697fe6b1"},{"author":{"_account_id":22406,"name":"Kien Nguyen","email":"kiennt2609@gmail.com","username":"kiennt"},"change_message_id":"827f4ea5fd44abbd5c1bdb8c5e57b66b85424fe7","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    def __init__(self, context):"},{"line_number":24,"context_line":"        self.context \u003d context"},{"line_number":25,"context_line":"        self.neutron \u003d clients.OpenStackClients(self.context).neutron()"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    def get_available_network(self):"},{"line_number":28,"context_line":"        search_opts \u003d {\u0027tenant_id\u0027: self.context.project_id, \u0027shared\u0027: False}"}],"source_content_type":"text/x-python","patch_set":13,"id":"df3967d1_ce3c1bca","line":25,"range":{"start_line":25,"start_character":8,"end_line":25,"end_character":71},"in_reply_to":"df3967d1_c3719f0e","updated":"2017-08-02 00:48:46.000000000","message":"Cool! Because when I read Nova code, it makes me confuse a lot.","commit_id":"9f36bb76727dd676ff43e5c027c23dd6697fe6b1"}]}
