)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When attaching virtual interfaces to ironic ports and portgroups, we"},{"line_number":10,"context_line":"need to take account of the physical network assigned to those ports and"},{"line_number":11,"context_line":"portgroups. A neutron virtual interface has have a set of physical"},{"line_number":12,"context_line":"networks on which it can be attached which is governed by the segments"},{"line_number":13,"context_line":"of its network (of which there may be more than one)."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df140735_6a4e5fc2","line":11,"updated":"2017-06-07 15:54:06.000000000","message":"nit s/have a/a/","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When attaching virtual interfaces to ironic ports and portgroups, we"},{"line_number":10,"context_line":"need to take account of the physical network assigned to those ports and"},{"line_number":11,"context_line":"portgroups. A neutron virtual interface has have a set of physical"},{"line_number":12,"context_line":"networks on which it can be attached which is governed by the segments"},{"line_number":13,"context_line":"of its network (of which there may be more than one)."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"df140735_573c63be","line":11,"in_reply_to":"df140735_6a4e5fc2","updated":"2017-06-07 17:08:20.000000000","message":"Done","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"}],"ironic/common/neutron.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_id(client, network_id, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_9ea8d8db","line":420,"updated":"2017-06-07 15:54:06.000000000","message":"The other methods use s/network_id/network_uuid/ so we should do the same here for consistency.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8e948df84d5b89d630cadc3b95b2bf835c813d11","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_id(client, network_id, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."}],"source_content_type":"text/x-python","patch_set":3,"id":"7f231b9d_9d6d759a","line":420,"in_reply_to":"df140735_32a8dd75","updated":"2017-06-12 17:16:37.000000000","message":"Done","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"a72d9a09d86f45cc76219aa642e8cf570e1a5cff","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_id(client, network_id, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_32a8dd75","line":420,"in_reply_to":"df140735_77964797","updated":"2017-06-07 17:26:03.000000000","message":"I don\u0027t care which we use, but we ought to be consistent in *our* code. I\u0027d prefer that you changed it to network_uuid; if someone later feels like changing them all to network_id, they could (try).","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_id(client, network_id, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_77964797","line":420,"in_reply_to":"df140735_9ea8d8db","updated":"2017-06-07 17:08:20.000000000","message":"I did originally use network_uuid but decided to change to be consistent with neutron\u0027s terminology and the use of port_id here. I can change it back if you prefer?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_id: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_3e90ac95","line":426,"updated":"2017-06-07 15:54:06.000000000","message":"what kind of thing is this, a dictionary?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_id: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_f7e7f745","line":426,"in_reply_to":"df140735_3e90ac95","updated":"2017-06-07 17:08:20.000000000","message":"Yes. I\u0027ll improve the docstring.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_id(client, network_id):"},{"line_number":440,"context_line":"    \"\"\"Return the set of physical networks associated with a network."},{"line_number":441,"context_line":""},{"line_number":442,"context_line":"    Query the network and return the set of physical networks associated with"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_deec102b","line":439,"updated":"2017-06-07 15:54:06.000000000","message":"ditto about s/network_id/network_uuid/","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8e948df84d5b89d630cadc3b95b2bf835c813d11","unresolved":false,"context_lines":[{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_id(client, network_id):"},{"line_number":440,"context_line":"    \"\"\"Return the set of physical networks associated with a network."},{"line_number":441,"context_line":""},{"line_number":442,"context_line":"    Query the network and return the set of physical networks associated with"}],"source_content_type":"text/x-python","patch_set":3,"id":"7f231b9d_7d6a9980","line":439,"in_reply_to":"df140735_deec102b","updated":"2017-06-12 17:16:37.000000000","message":"Done","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":21909,"name":"Bob Fournier","email":"bfournie@redhat.com","username":"bfournie"},"change_message_id":"1c4cc4e19846aaf2ff2778c30b1cb7ea37d3916c","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    if SEGMENTS_PARAM_NAME in network:"},{"line_number":454,"context_line":"        # A network with multiple segments will have a \u0027segments\u0027 parameter"},{"line_number":455,"context_line":"        # which will contain a list of segments. Each segment should have a"},{"line_number":456,"context_line":"        # \u0027provider:physical_network\u0027 parameter which contains the physical"},{"line_number":457,"context_line":"        # network of the segment."},{"line_number":458,"context_line":"        segments \u003d network[SEGMENTS_PARAM_NAME]"},{"line_number":459,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_f7dd7670","line":456,"range":{"start_line":456,"start_character":10,"end_line":456,"end_character":37},"updated":"2017-06-13 20:45:53.000000000","message":"I think that the neutron segment parameter is actually \u0027physical_network\u0027, while the network parameter is \u0027provider:physical_network\u0027, e.g:\n[stack@host01 ~]$ openstack network segment show 4ee588ef-e326-4e35-83db-3436d011e9a3\n+------------------+--------------------------------------+\n| Field            | Value                                |\n+------------------+--------------------------------------+\n| description      | None                                 |\n| id               | 4ee588ef-e326-4e35-83db-3436d011e9a3 |\n| name             | ctlplane-segment1                    |\n| network_id       | 552fe717-6386-4c07-9683-e5e6c51f9af1 |\n| network_type     | flat                                 |\n| physical_network | ctlplane                             |\n| segmentation_id  | None                                 |\n+------------------+--------------------------------------+","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"b6161418b501cc4844a74badc66516dd5099735e","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    if SEGMENTS_PARAM_NAME in network:"},{"line_number":454,"context_line":"        # A network with multiple segments will have a \u0027segments\u0027 parameter"},{"line_number":455,"context_line":"        # which will contain a list of segments. Each segment should have a"},{"line_number":456,"context_line":"        # \u0027provider:physical_network\u0027 parameter which contains the physical"},{"line_number":457,"context_line":"        # network of the segment."},{"line_number":458,"context_line":"        segments \u003d network[SEGMENTS_PARAM_NAME]"},{"line_number":459,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_a6cfb9ae","line":456,"range":{"start_line":456,"start_character":10,"end_line":456,"end_character":37},"in_reply_to":"7f231b9d_963aba31","updated":"2017-06-14 17:56:58.000000000","message":"yup, provider:physical_network is appropriate field https://developer.openstack.org/api-ref/networking/v2/?expanded\u003dshow-network-details-detail,list-networks-detail#show-network-details","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":21909,"name":"Bob Fournier","email":"bfournie@redhat.com","username":"bfournie"},"change_message_id":"fdf5c484f80017aae0c6de0192d6fcd92e74bcff","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    if SEGMENTS_PARAM_NAME in network:"},{"line_number":454,"context_line":"        # A network with multiple segments will have a \u0027segments\u0027 parameter"},{"line_number":455,"context_line":"        # which will contain a list of segments. Each segment should have a"},{"line_number":456,"context_line":"        # \u0027provider:physical_network\u0027 parameter which contains the physical"},{"line_number":457,"context_line":"        # network of the segment."},{"line_number":458,"context_line":"        segments \u003d network[SEGMENTS_PARAM_NAME]"},{"line_number":459,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_963aba31","line":456,"range":{"start_line":456,"start_character":10,"end_line":456,"end_character":37},"in_reply_to":"7f231b9d_f7dd7670","updated":"2017-06-14 05:07:41.000000000","message":"Scratch that, I wasn\u0027t looking at the \u0027segments\u0027 fields in network, the provider:physical_network is fine.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":21909,"name":"Bob Fournier","email":"bfournie@redhat.com","username":"bfournie"},"change_message_id":"1c4cc4e19846aaf2ff2778c30b1cb7ea37d3916c","unresolved":false,"context_lines":[{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    return {segment[PHYSNET_PARAM_NAME]"},{"line_number":466,"context_line":"            for segment in segments"},{"line_number":467,"context_line":"            if segment[PHYSNET_PARAM_NAME]}"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"class NeutronNetworkInterfaceMixin(object):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_37cd2eb8","line":467,"range":{"start_line":467,"start_character":23,"end_line":467,"end_character":41},"updated":"2017-06-13 20:45:53.000000000","message":"This would need to change to use correct name if from network or segment.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":21909,"name":"Bob Fournier","email":"bfournie@redhat.com","username":"bfournie"},"change_message_id":"fdf5c484f80017aae0c6de0192d6fcd92e74bcff","unresolved":false,"context_lines":[{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    return {segment[PHYSNET_PARAM_NAME]"},{"line_number":466,"context_line":"            for segment in segments"},{"line_number":467,"context_line":"            if segment[PHYSNET_PARAM_NAME]}"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"class NeutronNetworkInterfaceMixin(object):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_564422b7","line":467,"range":{"start_line":467,"start_character":23,"end_line":467,"end_character":41},"in_reply_to":"7f231b9d_37cd2eb8","updated":"2017-06-14 05:07:41.000000000","message":"Ignore.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b49dab6180af02dd3d59fc39fe37f065d1222aad","unresolved":false,"context_lines":[{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.exception(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_c397fc47","line":434,"updated":"2017-06-16 11:46:27.000000000","message":"traceback here is not going to be particulatly useful; I suggest changing to LOG.error. If you do keep LOG.exception, you don\u0027t need to include \"exc\" into \"msg\".","commit_id":"10d2e4560c2f409f626e79344e91726e74294ac8"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"5d5ea29f29969a9f570b532b399fb968ba439ee7","unresolved":false,"context_lines":[{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.exception(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7f231b9d_0bec9cf1","line":434,"in_reply_to":"7f231b9d_c397fc47","updated":"2017-06-22 14:17:48.000000000","message":"Done","commit_id":"10d2e4560c2f409f626e79344e91726e74294ac8"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"19c8b99742bfcf379c57882a47b2a9c9059932c8","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_uuid(client, network_uuid, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_uuid: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A dict describing the neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"},{"line_number":430,"context_line":"        network \u003d client.show_network(network_uuid, **params)"},{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.error(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_uuid(client, network_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_0d0b858e","line":436,"range":{"start_line":420,"start_character":0,"end_line":436,"end_character":29},"updated":"2017-06-21 13:08:54.000000000","message":"It concerns me how close this function is in functionality to the validate_network function above, both functions can fetch a neutron network via uuid.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_uuid(client, network_uuid, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_uuid: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A dict describing the neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"},{"line_number":430,"context_line":"        network \u003d client.show_network(network_uuid, **params)"},{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.error(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_uuid(client, network_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_136848f3","line":436,"range":{"start_line":420,"start_character":0,"end_line":436,"end_character":29},"in_reply_to":"5f201791_0d0b858e","updated":"2017-06-21 15:04:24.000000000","message":"doesn\u0027t validate_network() return a network uuid (not the info about a particular network which this returns)?","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"93508bd7a7c4ec14dd62ec887dc39e3d47284c52","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_uuid(client, network_uuid, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_uuid: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A dict describing the neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"},{"line_number":430,"context_line":"        network \u003d client.show_network(network_uuid, **params)"},{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.error(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_uuid(client, network_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_120918dc","line":436,"range":{"start_line":420,"start_character":0,"end_line":436,"end_character":29},"in_reply_to":"5f201791_119b9bc9","updated":"2017-06-23 14:43:18.000000000","message":"I\u0027ve rolled this up into a common _get_network_by_uuid_or_name function.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":417,"context_line":"    return True"},{"line_number":418,"context_line":""},{"line_number":419,"context_line":""},{"line_number":420,"context_line":"def _get_network_by_uuid(client, network_uuid, **params):"},{"line_number":421,"context_line":"    \"\"\"Return a neutron network by UUID."},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"    :param client: A Neutron client object."},{"line_number":424,"context_line":"    :param network_uuid: UUID of a neutron network to query."},{"line_number":425,"context_line":"    :param params: Additional parameters to pass to the neutron client."},{"line_number":426,"context_line":"    :returns: A dict describing the neutron network."},{"line_number":427,"context_line":"    :raises: NetworkError if the network query fails."},{"line_number":428,"context_line":"    \"\"\""},{"line_number":429,"context_line":"    try:"},{"line_number":430,"context_line":"        network \u003d client.show_network(network_uuid, **params)"},{"line_number":431,"context_line":"    except neutron_exceptions.NeutronClientException as exc:"},{"line_number":432,"context_line":"        msg \u003d (_(\"Failed to get neutron network %(network)s: %(exc)s.\"),"},{"line_number":433,"context_line":"               {\u0027network\u0027: network_uuid, \u0027exc\u0027: exc})"},{"line_number":434,"context_line":"        LOG.error(msg)"},{"line_number":435,"context_line":"        raise exception.NetworkError(msg)"},{"line_number":436,"context_line":"    return network[\u0027network\u0027]"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":""},{"line_number":439,"context_line":"def get_physnets_by_network_uuid(client, network_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_119b9bc9","line":436,"range":{"start_line":420,"start_character":0,"end_line":436,"end_character":29},"in_reply_to":"5f201791_136848f3","updated":"2017-06-22 14:17:16.000000000","message":"Hmm, perhaps this could be consolidated a little. If _get_network_by_uuid was actually _get_network_by_uuid_or_name then it could be used by validate_network.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"19c8b99742bfcf379c57882a47b2a9c9059932c8","unresolved":false,"context_lines":[{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    return {segment[PHYSNET_PARAM_NAME]"},{"line_number":466,"context_line":"            for segment in segments"},{"line_number":467,"context_line":"            if segment[PHYSNET_PARAM_NAME]}"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"class NeutronNetworkInterfaceMixin(object):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_0d1945d6","line":467,"range":{"start_line":467,"start_character":42,"end_line":467,"end_character":43},"updated":"2017-06-21 13:08:54.000000000","message":"Nit: generally I prefer the set() style syntax because its easier to distinguish from a dictionary at a quick glance.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    return {segment[PHYSNET_PARAM_NAME]"},{"line_number":466,"context_line":"            for segment in segments"},{"line_number":467,"context_line":"            if segment[PHYSNET_PARAM_NAME]}"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"class NeutronNetworkInterfaceMixin(object):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_1184bb5d","line":467,"range":{"start_line":467,"start_character":42,"end_line":467,"end_character":43},"in_reply_to":"5f201791_0d1945d6","updated":"2017-06-22 14:17:16.000000000","message":"I guess so. A set comprehension is slightly more performant but I suppose that\u0027s not too much of an issue here.\n\n\u003e\u003e\u003e timeit.timeit(\u0027{x for x in range(100)}\u0027)\n3.700277090072632\n\u003e\u003e\u003e timeit.timeit(\u0027set(x for x in range(100))\u0027)\n5.446889162063599","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"93508bd7a7c4ec14dd62ec887dc39e3d47284c52","unresolved":false,"context_lines":[{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    return {segment[PHYSNET_PARAM_NAME]"},{"line_number":466,"context_line":"            for segment in segments"},{"line_number":467,"context_line":"            if segment[PHYSNET_PARAM_NAME]}"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"class NeutronNetworkInterfaceMixin(object):"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_f20fbcde","line":467,"range":{"start_line":467,"start_character":42,"end_line":467,"end_character":43},"in_reply_to":"5f201791_1184bb5d","updated":"2017-06-23 14:43:18.000000000","message":"Done","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":24828,"name":"Kaifeng Wang","email":"kaifeng.w@gmail.com","username":"wangkf"},"change_message_id":"ecf52e572c25a51791575d4e433697435972a2d3","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        # A network with a single segment will have a"},{"line_number":490,"context_line":"        # \u0027provider:physical_network\u0027 parameter which contains the network\u0027s"},{"line_number":491,"context_line":"        # physical network."},{"line_number":492,"context_line":"        segments \u003d [network]"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":"    return set(segment[PHYSNET_PARAM_NAME]"},{"line_number":495,"context_line":"               for segment in segments"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f1d235d_a12380be","line":492,"range":{"start_line":492,"start_character":8,"end_line":492,"end_character":28},"updated":"2017-07-10 05:19:53.000000000","message":"this is somewhat tricky, I would suggest to handle each case specifically, what do you think?","commit_id":"b9b820954da825f3c80c782fcffcaa5dd4643c22"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"3b1a4d780abdaf24d7d1d81c3795bda7445e25dc","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        # A network with a single segment will have a"},{"line_number":490,"context_line":"        # \u0027provider:physical_network\u0027 parameter which contains the network\u0027s"},{"line_number":491,"context_line":"        # physical network."},{"line_number":492,"context_line":"        segments \u003d [network]"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":"    return set(segment[PHYSNET_PARAM_NAME]"},{"line_number":495,"context_line":"               for segment in segments"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f1d235d_78ad12e9","line":492,"range":{"start_line":492,"start_character":8,"end_line":492,"end_character":28},"in_reply_to":"3f1d235d_a12380be","updated":"2017-07-10 09:25:58.000000000","message":"I personally think it\u0027s fine, but let\u0027s see what others think.","commit_id":"b9b820954da825f3c80c782fcffcaa5dd4643c22"}],"ironic/conductor/manager.py":[{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"6b80e24f386299a3bb9b02bd513f90a10bbc91c9","unresolved":false,"context_lines":[{"line_number":2604,"context_line":"            VIF attach is wrong/missing."},{"line_number":2605,"context_line":"        :raises: PortgroupPhysnetInconsistent if one of the node\u0027s portgroups"},{"line_number":2606,"context_line":"                 has ports which are not all assigned the same physical"},{"line_number":2607,"context_line":"                 network."},{"line_number":2608,"context_line":"        \"\"\""},{"line_number":2609,"context_line":"        LOG.debug(\"RPC vif_attach called for the node %(node_id)s with \""},{"line_number":2610,"context_line":"                  \"vif_info %(vif_info)s\", {\u0027node_id\u0027: node_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_1a468fc1","line":2607,"updated":"2017-07-05 16:42:35.000000000","message":"nit: do we need to add new Segments exception here?, its going to get a big crazy if we list every exception that every type of network driver can raise here... perhaps all those exceptions should be sub-exceptions of NetworkError then their covered by the raises call above?","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"1d77bd47d59d6eb8fd736eaff4633e86dbc28328","unresolved":false,"context_lines":[{"line_number":2604,"context_line":"            VIF attach is wrong/missing."},{"line_number":2605,"context_line":"        :raises: PortgroupPhysnetInconsistent if one of the node\u0027s portgroups"},{"line_number":2606,"context_line":"                 has ports which are not all assigned the same physical"},{"line_number":2607,"context_line":"                 network."},{"line_number":2608,"context_line":"        \"\"\""},{"line_number":2609,"context_line":"        LOG.debug(\"RPC vif_attach called for the node %(node_id)s with \""},{"line_number":2610,"context_line":"                  \"vif_info %(vif_info)s\", {\u0027node_id\u0027: node_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_be440f75","line":2607,"in_reply_to":"3f1d235d_14d89e1b","updated":"2017-07-06 10:39:47.000000000","message":"I like the idea of 409 for the segmentation error, hmm NetworkError is a weird one because its so generic it could be either a input (400) error or a server error (500) maybe we need to do some more sub-classing for different types of NetworkError","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"0003424ccf3bcf7fc930a032fe363bb82f2d7f29","unresolved":false,"context_lines":[{"line_number":2604,"context_line":"            VIF attach is wrong/missing."},{"line_number":2605,"context_line":"        :raises: PortgroupPhysnetInconsistent if one of the node\u0027s portgroups"},{"line_number":2606,"context_line":"                 has ports which are not all assigned the same physical"},{"line_number":2607,"context_line":"                 network."},{"line_number":2608,"context_line":"        \"\"\""},{"line_number":2609,"context_line":"        LOG.debug(\"RPC vif_attach called for the node %(node_id)s with \""},{"line_number":2610,"context_line":"                  \"vif_info %(vif_info)s\", {\u0027node_id\u0027: node_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_be9d2f0b","line":2607,"in_reply_to":"3f1d235d_14d89e1b","updated":"2017-07-06 10:40:55.000000000","message":"One other thing to keep in mind is returning 409 will make ironic client retry the request.","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"20b360a43c5fc35bda81a7983856384666fa2ad5","unresolved":false,"context_lines":[{"line_number":2604,"context_line":"            VIF attach is wrong/missing."},{"line_number":2605,"context_line":"        :raises: PortgroupPhysnetInconsistent if one of the node\u0027s portgroups"},{"line_number":2606,"context_line":"                 has ports which are not all assigned the same physical"},{"line_number":2607,"context_line":"                 network."},{"line_number":2608,"context_line":"        \"\"\""},{"line_number":2609,"context_line":"        LOG.debug(\"RPC vif_attach called for the node %(node_id)s with \""},{"line_number":2610,"context_line":"                  \"vif_info %(vif_info)s\", {\u0027node_id\u0027: node_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_14d89e1b","line":2607,"in_reply_to":"3f1d235d_1a468fc1","updated":"2017-07-05 20:08:54.000000000","message":"Good point. The PortgroupPhysnetInconsistent seems fairly generally applicable but perhaps you\u0027re right that MultipleSegmentMappings is leaking too much of the driver-specifics.\n\nI also just found that as it\u0027s missed from the expected exception list, we get a 500 internal server error instead of 400 invalid.\n\nNetwork error maps to a 500 internal server error so I\u0027m not sure that\u0027s quite right. I just checked the neutron exception for the IPAM check you linked previously and found that a neutron.services.segments.exceptions.HostConnectedToMultipleSegments error maps to a 409 conflict. That seems like a better fit than 400 invalid, perhaps we should follow suit. I\u0027ll look into how best to do that.","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"ba2eb9229a025daf23bae46b3dbdd2748367e278","unresolved":false,"context_lines":[{"line_number":2604,"context_line":"            VIF attach is wrong/missing."},{"line_number":2605,"context_line":"        :raises: PortgroupPhysnetInconsistent if one of the node\u0027s portgroups"},{"line_number":2606,"context_line":"                 has ports which are not all assigned the same physical"},{"line_number":2607,"context_line":"                 network."},{"line_number":2608,"context_line":"        \"\"\""},{"line_number":2609,"context_line":"        LOG.debug(\"RPC vif_attach called for the node %(node_id)s with \""},{"line_number":2610,"context_line":"                  \"vif_info %(vif_info)s\", {\u0027node_id\u0027: node_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_21dea2d9","line":2607,"in_reply_to":"3f1d235d_be9d2f0b","updated":"2017-07-06 10:58:47.000000000","message":"That\u0027s a good point Vlad. There is a spec to change that behaviour, right? Even so, if it\u0027s not implemented currently then that would be sub-optimal.\n\nThen again, this is quite an unusual corner case. As long as we do the right thing, the retries shouldn\u0027t be a problem should they?","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"}],"ironic/drivers/modules/network/common.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":64,"context_line":"    :param task: a TaskManager instance."},{"line_number":65,"context_line":"    :param vif_id: Name or UUID of a VIF."},{"line_number":66,"context_line":"    :param physnets: Set of allowed physical networks."},{"line_number":67,"context_line":"    :returns: tuple of: list of free portgroups, list of free ports."},{"line_number":68,"context_line":"    :raises: VifAlreadyAttached, if vif_id is attached to any of the"},{"line_number":69,"context_line":"        node\u0027s ports or portgroups."},{"line_number":70,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_fe77d407","line":67,"updated":"2017-06-07 15:54:06.000000000","message":"looks like you\u0027ve changed this return value.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":64,"context_line":"    :param task: a TaskManager instance."},{"line_number":65,"context_line":"    :param vif_id: Name or UUID of a VIF."},{"line_number":66,"context_line":"    :param physnets: Set of allowed physical networks."},{"line_number":67,"context_line":"    :returns: tuple of: list of free portgroups, list of free ports."},{"line_number":68,"context_line":"    :raises: VifAlreadyAttached, if vif_id is attached to any of the"},{"line_number":69,"context_line":"        node\u0027s ports or portgroups."},{"line_number":70,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_17bb8b0e","line":67,"in_reply_to":"df140735_fe77d407","updated":"2017-06-07 17:08:20.000000000","message":"Done","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            # added in this set is not a problem"},{"line_number":90,"context_line":"            non_usable_portgroups.add(p.portgroup_id)"},{"line_number":91,"context_line":"            continue"},{"line_number":92,"context_line":"        if physnets and p.physical_network not in allowed_physnets:"},{"line_number":93,"context_line":"            # Physical network must match or be unspecified on either the port"},{"line_number":94,"context_line":"            # or network."},{"line_number":95,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_3e754cfb","line":92,"updated":"2017-06-07 15:54:06.000000000","message":"this seems a bit odd to me. if physnets is true, allowed_physnets \u003d\u003d physnets. I guess I\u0027m not sure what the logic is here, why do you need both physnets and allowed_physnets?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"c60342b01726904e002e3e5623f5cc77ceb27cd0","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            # added in this set is not a problem"},{"line_number":90,"context_line":"            non_usable_portgroups.add(p.portgroup_id)"},{"line_number":91,"context_line":"            continue"},{"line_number":92,"context_line":"        if physnets and p.physical_network not in allowed_physnets:"},{"line_number":93,"context_line":"            # Physical network must match or be unspecified on either the port"},{"line_number":94,"context_line":"            # or network."},{"line_number":95,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_28b4ea34","line":92,"in_reply_to":"df140735_379d6f66","updated":"2017-06-07 17:54:31.000000000","message":"I\u0027ve refactored this logic into its own function which will hopefully clear things up a little.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"a72d9a09d86f45cc76219aa642e8cf570e1a5cff","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            # added in this set is not a problem"},{"line_number":90,"context_line":"            non_usable_portgroups.add(p.portgroup_id)"},{"line_number":91,"context_line":"            continue"},{"line_number":92,"context_line":"        if physnets and p.physical_network not in allowed_physnets:"},{"line_number":93,"context_line":"            # Physical network must match or be unspecified on either the port"},{"line_number":94,"context_line":"            # or network."},{"line_number":95,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_92cfa956","line":92,"in_reply_to":"df140735_379d6f66","updated":"2017-06-07 17:26:03.000000000","message":"No, still confusing.\n\nYou have code elsewhere that includes None in your list of physnets. Why then, doesn\u0027t the physnet parameter also include None? I don\u0027t think you should be able to have it two ways; sometimes in a list of physnets, sometimes not. Otherwise, how can I debug if I don\u0027t know if it is/should be there or not?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":89,"context_line":"            # added in this set is not a problem"},{"line_number":90,"context_line":"            non_usable_portgroups.add(p.portgroup_id)"},{"line_number":91,"context_line":"            continue"},{"line_number":92,"context_line":"        if physnets and p.physical_network not in allowed_physnets:"},{"line_number":93,"context_line":"            # Physical network must match or be unspecified on either the port"},{"line_number":94,"context_line":"            # or network."},{"line_number":95,"context_line":"            continue"}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_379d6f66","line":92,"in_reply_to":"df140735_3e754cfb","updated":"2017-06-07 17:08:20.000000000","message":"We need to always return ports with physical_network\u003dNone. Here, allowed_physnets is the set of physical networks available for the VIF plus the physical network None. This allows us to be backwards compatible by returning ports with physical_network\u003dNone.\n\nThis could be done without using allowed_physnets via something like:\n\nif (physnets and\n    p.physical_network not in allowed_physnets and\n    p.physical_network !\u003d None):\n\nIs that less confusing?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    :param task: a TaskManager instance."},{"line_number":120,"context_line":"    :param portgroup: a Portgroup object."},{"line_number":121,"context_line":"    :returns: The phyiscal network associated with the portgroup."},{"line_number":122,"context_line":"    :raises: PortgroupPhysnetInconsistent if the portgroup\u0027s ports are not"},{"line_number":123,"context_line":"             assigned the same physical network."},{"line_number":124,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_fe2fd4a4","line":121,"updated":"2017-06-07 15:54:06.000000000","message":"nit s/phyiscal/physical/","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    :param task: a TaskManager instance."},{"line_number":120,"context_line":"    :param portgroup: a Portgroup object."},{"line_number":121,"context_line":"    :returns: The phyiscal network associated with the portgroup."},{"line_number":122,"context_line":"    :raises: PortgroupPhysnetInconsistent if the portgroup\u0027s ports are not"},{"line_number":123,"context_line":"             assigned the same physical network."},{"line_number":124,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_5779032d","line":121,"in_reply_to":"df140735_fe2fd4a4","updated":"2017-06-07 17:08:20.000000000","message":"Done","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"7b0b292953cc99d1c19c0a071b84462174002c38","unresolved":false,"context_lines":[{"line_number":124,"context_line":"    \"\"\""},{"line_number":125,"context_line":"    pg_ports \u003d network.get_ports_by_portgroup_id(task, portgroup.id)"},{"line_number":126,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":127,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":128,"context_line":"    # all ports should have the same physical network."},{"line_number":129,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":130,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":131,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":132,"context_line":"    return pg_physnets.pop()"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"def get_free_port_like_object(task, vif_id, physnets):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf091321_25bf87fc","line":132,"range":{"start_line":127,"start_character":4,"end_line":132,"end_character":28},"updated":"2017-06-08 12:09:38.000000000","message":"This check is not needed, please see my comments to https://review.openstack.org/#/c/469932/4/ironic/conductor/utils.py@546","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8e948df84d5b89d630cadc3b95b2bf835c813d11","unresolved":false,"context_lines":[{"line_number":124,"context_line":"    \"\"\""},{"line_number":125,"context_line":"    pg_ports \u003d network.get_ports_by_portgroup_id(task, portgroup.id)"},{"line_number":126,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":127,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":128,"context_line":"    # all ports should have the same physical network."},{"line_number":129,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":130,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":131,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":132,"context_line":"    return pg_physnets.pop()"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"def get_free_port_like_object(task, vif_id, physnets):"}],"source_content_type":"text/x-python","patch_set":3,"id":"7f231b9d_eb73877f","line":132,"range":{"start_line":127,"start_character":4,"end_line":132,"end_character":28},"in_reply_to":"bf091321_25bf87fc","updated":"2017-06-12 17:16:37.000000000","message":"As before, I\u0027m trying to be defensive here. We shouldn\u0027t ever fail this check.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":140,"context_line":"    ordered criteria are applied:"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    * Require ports or portgroups to have a suitable physical network if"},{"line_number":143,"context_line":"      not null."},{"line_number":144,"context_line":"    * Prefer ports or portgroups with non-null allowed physical networks."},{"line_number":145,"context_line":"    * Prefer portgroups to ports."},{"line_number":146,"context_line":"    * Prefer ports with PXE enabled."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_7e0ce441","line":143,"updated":"2017-06-07 15:54:06.000000000","message":"we should probably s/null/None/ (that\u0027s what you mean I think?)\n\nWhat does this mean, either the port or portgroup\u0027s physical network \u003d\u003d None, or it is something that isn\u0027t None. Is the latter a \u0027suitable physical network\u0027?","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":140,"context_line":"    ordered criteria are applied:"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    * Require ports or portgroups to have a suitable physical network if"},{"line_number":143,"context_line":"      not null."},{"line_number":144,"context_line":"    * Prefer ports or portgroups with non-null allowed physical networks."},{"line_number":145,"context_line":"    * Prefer portgroups to ports."},{"line_number":146,"context_line":"    * Prefer ports with PXE enabled."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_97bb1b71","line":143,"in_reply_to":"df140735_7e0ce441","updated":"2017-06-07 17:08:20.000000000","message":"I\u0027m using None/null/unset fairly interchangably, perhaps I should stick with None.\n\nWhat I\u0027m trying to say here is that the port/portgroup needs to have either:\n\nphysical_network \u003d\u003d None\n\nOR\n\nA physical_network which matches the physical network of one of the segments of the VIF\u0027s network.\n\nWould the following wording be better:\n\n* Require ports or portgroups to have a physical network that is either None or one of the allowed physical networks.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":143,"context_line":"      not null."},{"line_number":144,"context_line":"    * Prefer ports or portgroups with non-null allowed physical networks."},{"line_number":145,"context_line":"    * Prefer portgroups to ports."},{"line_number":146,"context_line":"    * Prefer ports with PXE enabled."},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    :param task: a TaskManager instance."},{"line_number":149,"context_line":"    :param vif_id: Name or UUID of a VIF."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_61aa05d3","line":146,"updated":"2017-06-07 15:54:06.000000000","message":"I don\u0027t understand the first point, but for these three, if I understand them:\n\npreference is as follows:\n- portgroup with a physical network\n- port with a physical network\n- portgroup (with no physical network)\n- port with PXE enabled (and no physical network)\n- port (with no physical network)","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":143,"context_line":"      not null."},{"line_number":144,"context_line":"    * Prefer ports or portgroups with non-null allowed physical networks."},{"line_number":145,"context_line":"    * Prefer portgroups to ports."},{"line_number":146,"context_line":"    * Prefer ports with PXE enabled."},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    :param task: a TaskManager instance."},{"line_number":149,"context_line":"    :param vif_id: Name or UUID of a VIF."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_372d6fa8","line":146,"in_reply_to":"df140735_61aa05d3","updated":"2017-06-07 17:08:20.000000000","message":"Correct.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"292d55756a2dd35ff483685c49c8932c636472c3","unresolved":false,"context_lines":[{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    :param task: a TaskManager instance."},{"line_number":149,"context_line":"    :param vif_id: Name or UUID of a VIF."},{"line_number":150,"context_line":"    :param physnets: Set of allowed physical networks."},{"line_number":151,"context_line":"    :raises: VifAlreadyAttached, if VIF is already attached to the node."},{"line_number":152,"context_line":"    :raises: NoFreePhysicalPorts, if there is no port-like object VIF can be"},{"line_number":153,"context_line":"        attached to."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_21e2cd30","line":150,"updated":"2017-06-07 15:54:06.000000000","message":"I think I am confused with \u0027physical networks\u0027, \u0027allowed physical networks\u0027, and \u0027non-null allowed physical networks\u0027.\n\nDo we really need those distinctions, and maybe you can clarify.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"75a1be44d02e4c9e2bb153b7b16006b51e21d6d9","unresolved":false,"context_lines":[{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    :param task: a TaskManager instance."},{"line_number":149,"context_line":"    :param vif_id: Name or UUID of a VIF."},{"line_number":150,"context_line":"    :param physnets: Set of allowed physical networks."},{"line_number":151,"context_line":"    :raises: VifAlreadyAttached, if VIF is already attached to the node."},{"line_number":152,"context_line":"    :raises: NoFreePhysicalPorts, if there is no port-like object VIF can be"},{"line_number":153,"context_line":"        attached to."}],"source_content_type":"text/x-python","patch_set":3,"id":"df140735_923fa9b4","line":150,"in_reply_to":"df140735_21e2cd30","updated":"2017-06-07 17:08:20.000000000","message":"Perhaps not. This is really the set of physical networks of the segments of the VIF\u0027s network. I\u0027ll update the docstring.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"7b0b292953cc99d1c19c0a071b84462174002c38","unresolved":false,"context_lines":[{"line_number":423,"context_line":"        # Check if the requested vif_id is a neutron port, and if so determine"},{"line_number":424,"context_line":"        # its network ID."},{"line_number":425,"context_line":"        try:"},{"line_number":426,"context_line":"            port \u003d client.show_port(vif_id, fields\u003d[\u0027network_id\u0027])"},{"line_number":427,"context_line":"        except neutron_exceptions.NeutronClientException:"},{"line_number":428,"context_line":"            # NOTE(sambetts): If a client error occurs this is because"},{"line_number":429,"context_line":"            # either neutron doesn\u0027t exist because we\u0027re running in"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf091321_05e36335","line":426,"updated":"2017-06-08 12:09:38.000000000","message":"No need to execute this step and rest if ironic port doesn\u0027t contain physnet. Having None means we allow to plug port to network with any physnet.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8e948df84d5b89d630cadc3b95b2bf835c813d11","unresolved":false,"context_lines":[{"line_number":423,"context_line":"        # Check if the requested vif_id is a neutron port, and if so determine"},{"line_number":424,"context_line":"        # its network ID."},{"line_number":425,"context_line":"        try:"},{"line_number":426,"context_line":"            port \u003d client.show_port(vif_id, fields\u003d[\u0027network_id\u0027])"},{"line_number":427,"context_line":"        except neutron_exceptions.NeutronClientException:"},{"line_number":428,"context_line":"            # NOTE(sambetts): If a client error occurs this is because"},{"line_number":429,"context_line":"            # either neutron doesn\u0027t exist because we\u0027re running in"}],"source_content_type":"text/x-python","patch_set":3,"id":"7f231b9d_5cb803c7","line":426,"in_reply_to":"bf091321_05e36335","updated":"2017-06-12 17:16:37.000000000","message":"That\u0027s a nice idea, although it only helps us in one case - where we attach to a portgroup with no MAC address and all ports have no physical network. In other cases we need to do a show_port() at least once. I\u0027ll see what I can do.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"b6161418b501cc4844a74badc66516dd5099735e","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        attached. This is governed by the segments of the VIF\u0027s network."},{"line_number":77,"context_line":"    :returns: True if the port\u0027s physical network is allowed, False otherwise."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    return (not physnets or"},{"line_number":80,"context_line":"            port.physical_network is None or"},{"line_number":81,"context_line":"            port.physical_network in physnets)"},{"line_number":82,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_86103aaa","line":79,"updated":"2017-06-14 17:56:58.000000000","message":"shouldn\u0027t this be option of network interface something like: physnet_allowed? We do not prohibit setting port.physnet for node with custom network interfaces.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"714578a8697b9315c72275148e5104e8ec352032","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        attached. This is governed by the segments of the VIF\u0027s network."},{"line_number":77,"context_line":"    :returns: True if the port\u0027s physical network is allowed, False otherwise."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    return (not physnets or"},{"line_number":80,"context_line":"            port.physical_network is None or"},{"line_number":81,"context_line":"            port.physical_network in physnets)"},{"line_number":82,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_7981adc3","line":79,"in_reply_to":"7f231b9d_02ff3267","updated":"2017-06-20 10:11:25.000000000","message":"IMO if a network interface doesn\u0027t support physnets it can just ignore that field, the code in this file temporary and is mostly designed to support neutron specific network drivers, and much of this code should move into a common neutron network drivers location when we remove the deprecated support for drivers that don\u0027t implement the vif functions.\n\nIf they are a network interface interacting with neutron then they should always have physical network awareness, and eventually it should become a required field because otherwise we leave the potential security issue of a port being bound into a vlan network on the wrong physnet.\n\nThe network interface validate function can be used to ensure that the field is populated if required by that driver.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"605fb94b16ec23dd3861c485308c2ed18d2ae5fd","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        attached. This is governed by the segments of the VIF\u0027s network."},{"line_number":77,"context_line":"    :returns: True if the port\u0027s physical network is allowed, False otherwise."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    return (not physnets or"},{"line_number":80,"context_line":"            port.physical_network is None or"},{"line_number":81,"context_line":"            port.physical_network in physnets)"},{"line_number":82,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_02ff3267","line":79,"in_reply_to":"7f231b9d_3eb82de3","updated":"2017-06-16 09:52:08.000000000","message":"Ok, I think I see what you\u0027re saying. This should probably have been covered in the spec.\n\nAre there any cases where having physnet support is different than simply using neutron?\n\nWe do implicitly support drivers that do not support physnets (i.e. not neutron), since we allow the neutron port/network lookup to fail, and use physnets \u003d set() in that case. This will mean that L79 (not physnets) will succeed. Perhaps the comments could be improved around this?\n\nI agree it would be nicer to not attempt the neutron port/network lookup for non-neutron drivers but that behaviour existed before this change and fixing it seems like a separate change to me. Would you agree?","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8bdd74fd6860b34c5b3a7846aa624320ce5ee0c0","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        attached. This is governed by the segments of the VIF\u0027s network."},{"line_number":77,"context_line":"    :returns: True if the port\u0027s physical network is allowed, False otherwise."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    return (not physnets or"},{"line_number":80,"context_line":"            port.physical_network is None or"},{"line_number":81,"context_line":"            port.physical_network in physnets)"},{"line_number":82,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_906170ac","line":79,"in_reply_to":"7f231b9d_86103aaa","updated":"2017-06-15 11:56:46.000000000","message":"Sorry Vasyl, I don\u0027t quite follow this. Are you saying that this function should be a method of VIFPortIDMixin?","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"012b66ec55a75e9c054e7ff9198d42eb3e6cbd85","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        attached. This is governed by the segments of the VIF\u0027s network."},{"line_number":77,"context_line":"    :returns: True if the port\u0027s physical network is allowed, False otherwise."},{"line_number":78,"context_line":"    \"\"\""},{"line_number":79,"context_line":"    return (not physnets or"},{"line_number":80,"context_line":"            port.physical_network is None or"},{"line_number":81,"context_line":"            port.physical_network in physnets)"},{"line_number":82,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7f231b9d_3eb82de3","line":79,"in_reply_to":"7f231b9d_906170ac","updated":"2017-06-15 13:10:41.000000000","message":"I think that trigger to check if physnet is allowed or not should be done via additional network interface flag. Something like pxe_required (https://review.openstack.org/#/c/450104/) might be call it physnets_supported?\n\nAlso I\u0027m  not sure but in future we may want to prohibit (hide from API physnet field) setting physnet value for ports if node has configured network_interface that doesn\u0027t understand/work with physnets.","commit_id":"d5d3bac89760314728fea4272a4895209c5519ae"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_c55b2185","line":157,"updated":"2017-06-21 15:04:24.000000000","message":"This will be raised if there are 0 physnets (cuz no ports in the portgroup). Shouldn\u0027t no ports be a different exception -- this exception msg is incorrect in this case.\n\nIf you really need there to be at least one port in the portgroup, it would be good to test for that after L152.\n\nMaybe I missed or forgot, but I don\u0027t recall now where we enforce that a portgroup must have at least one port...","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_11603ba5","line":157,"in_reply_to":"5f201791_c55b2185","updated":"2017-06-22 14:17:16.000000000","message":"We shouldn\u0027t get here with a portgroup with zero ports since these will be filtered out in _get_free_portgroups_and_ports().","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"ea5f0be187047e9aebea5949c4d97b12bd85cf89","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_f484b1b3","line":158,"range":{"start_line":156,"start_character":4,"end_line":158,"end_character":79},"updated":"2017-06-20 18:03:44.000000000","message":"Not sure how this is possible, as you cant create such port, or update the existing one this way. Only by manually updating the DB? Id drop this not to increase amount of various checks.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"2924ce81600110a2f7905485e79a5a5aad9169e3","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_7973e3e8","line":158,"range":{"start_line":156,"start_character":4,"end_line":158,"end_character":79},"in_reply_to":"5f201791_3bd9e482","updated":"2017-06-21 10:57:15.000000000","message":"Right, but we usually only do this stuff during create/update. Otherwise, the amount of checks may become huge. Not a blocker though.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_118f1b24","line":158,"range":{"start_line":156,"start_character":4,"end_line":158,"end_character":79},"in_reply_to":"5f201791_454831cb","updated":"2017-06-22 14:17:16.000000000","message":"@rloo: Yes you\u0027re right, there is a lot of overlap between those functions. I\u0027ll consider how best to clean that up.\n\n@vdrok: There are plenty of checks in the driver validation methods that get performed during non create/update operations. Admittedly they might be more user input validation rather than sanity checks.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_454831cb","line":158,"range":{"start_line":156,"start_character":4,"end_line":158,"end_character":79},"in_reply_to":"5f201791_7973e3e8","updated":"2017-06-21 15:04:24.000000000","message":"I\u0027m fine with the sanity check as long as it is clear in the comments that it isn\u0027t expected to occur, but yeah, i think the ironic community doesn\u0027t tend to like having sanity checks.\n\nI would say that it might be useful (not in this patch) to try to combine this code with some code in conductor.utils.validate_port_physnet(), where the similar check is. Both are getting the physnets, with a few differences.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"7f4204f28b22281a46cf385270112fc8d7e15a1f","unresolved":false,"context_lines":[{"line_number":153,"context_line":"    pg_physnets \u003d {port.physical_network for port in pg_ports}"},{"line_number":154,"context_line":"    # Sanity check: there should be at least one port in the portgroup and"},{"line_number":155,"context_line":"    # all ports should have the same physical network."},{"line_number":156,"context_line":"    if len(pg_physnets) !\u003d 1:"},{"line_number":157,"context_line":"        raise exception.PortgroupPhysnetInconsistent("},{"line_number":158,"context_line":"            portgroup\u003dportgroup.uuid, physical_networks\u003d\", \".join(pg_physnets))"},{"line_number":159,"context_line":"    return pg_physnets.pop()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_3bd9e482","line":158,"range":{"start_line":156,"start_character":4,"end_line":158,"end_character":79},"in_reply_to":"5f201791_f484b1b3","updated":"2017-06-21 08:59:06.000000000","message":"Hmm, I had some resistance to a similar check in the port update code [1]. The idea that this \u0027can never happen\u0027 seems odd to me. It\u0027s just being defensive.\n\nI started out writing C where perhaps there is a different tradeoff between the cost of adding these checks and severity of mistakes. I don\u0027t mind removing this if people agree that is the best direction to take but we should probably also remove the equivalent check at [1] which has now been merged.\n\n[1] https://review.openstack.org/#/c/469932/7/ironic/conductor/utils.py","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":160,"context_line":""},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"def _get_vif_by_id_errors_ignored(client, vif_id, fields):"},{"line_number":163,"context_line":"    \"\"\"Get a VIF by ID from neutron API, ignoring neutron client errors."},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_65732de9","line":163,"updated":"2017-06-21 15:04:24.000000000","message":"maybe a nit, but the \u0027ignoring errors\u0027 part might be better as a parameter to this, instead of as part of the function name. That would make this more general/flexible...","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":160,"context_line":""},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"def _get_vif_by_id_errors_ignored(client, vif_id, fields):"},{"line_number":163,"context_line":"    \"\"\"Get a VIF by ID from neutron API, ignoring neutron client errors."},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_bf793294","line":163,"in_reply_to":"5f201791_65732de9","updated":"2017-06-22 14:17:16.000000000","message":"I was going for YAGNI, but I guess it wouldn\u0027t hurt to make it more general.\n\nThis function may go away again soon (or perhaps never get merged) based on what sambetts said in his comments below. If this doesn\u0027t need to support non-neutron drivers then we shouldn\u0027t ignore errors.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"93508bd7a7c4ec14dd62ec887dc39e3d47284c52","unresolved":false,"context_lines":[{"line_number":160,"context_line":""},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"def _get_vif_by_id_errors_ignored(client, vif_id, fields):"},{"line_number":163,"context_line":"    \"\"\"Get a VIF by ID from neutron API, ignoring neutron client errors."},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_54854159","line":163,"in_reply_to":"5f201791_bf793294","updated":"2017-06-23 14:43:18.000000000","message":"This function has been rolled up into get_physnets_by_port_uuid().","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":163,"context_line":"    \"\"\"Get a VIF by ID from neutron API, ignoring neutron client errors."},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_e535fdf8","line":166,"updated":"2017-06-21 15:04:24.000000000","message":"nit s/if/of/","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":163,"context_line":"    \"\"\"Get a VIF by ID from neutron API, ignoring neutron client errors."},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_9f579603","line":166,"in_reply_to":"5f201791_e535fdf8","updated":"2017-06-22 14:17:16.000000000","message":"Done","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""},{"line_number":170,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_e51e1d6f","line":167,"updated":"2017-06-21 15:04:24.000000000","message":"I wonder if it might make sense for this to have a default value eg None, to indicate get-all-the-fields?","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""},{"line_number":170,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_df4d0e73","line":167,"in_reply_to":"5f201791_e51e1d6f","updated":"2017-06-22 14:17:16.000000000","message":"Again, YAGNI :)","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""},{"line_number":170,"context_line":"    try:"},{"line_number":171,"context_line":"        return client.show_port(vif_id, fields\u003dfields)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_2556552b","line":168,"updated":"2017-06-21 15:04:24.000000000","message":"we use \u0027neutron port\u0027 and \u0027vif\u0027 to mean the same thing? Sigh.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":165,"context_line":"    :param client: A neutron client object."},{"line_number":166,"context_line":"    :param vif_id: UUID if the VIF to get."},{"line_number":167,"context_line":"    :param fields: A list of fields to get."},{"line_number":168,"context_line":"    :returns: A dict representing the neutron port or None on failure."},{"line_number":169,"context_line":"    \"\"\""},{"line_number":170,"context_line":"    try:"},{"line_number":171,"context_line":"        return client.show_port(vif_id, fields\u003dfields)"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_1f36e6e7","line":168,"in_reply_to":"5f201791_2556552b","updated":"2017-06-22 14:17:16.000000000","message":"I think they are interchangeable when neutron is in use, although a VIF could be a non-neutron port. I think sambetts suggested changing the name of this function to reflect that.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"0981f3e94be029eeb0f153a6a1a357be405de8eb","unresolved":false,"context_lines":[{"line_number":189,"context_line":"    * Prefer ports or portgroups with a physical network field which is not"},{"line_number":190,"context_line":"      None."},{"line_number":191,"context_line":"    * Prefer portgroups to ports."},{"line_number":192,"context_line":"    * Prefer ports with PXE enabled."},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"    :param task: a TaskManager instance."},{"line_number":195,"context_line":"    :param vif_id: Name or UUID of a VIF."}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_5847f81e","line":192,"updated":"2017-06-21 15:04:24.000000000","message":"I have to admit that the above doesn\u0027t describe a clear order for me (it could just be me).\n\nCan physnets have \u0027None\u0027 in the set?\n\nI\u0027m guessing (w/o looking at the code) that you mean:\nportgroup with physical network in physnets, that is not None\nport with physical network in physnets, that is not None; prefer with PXE enabled.\nportgroup with physnet\u003d\u003dNone\nport with physnet\u003d\u003dNone; prefer with PXE enabled.\n\nWill you use a port or portgroup that has a physical network that is not in physnets?","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":189,"context_line":"    * Prefer ports or portgroups with a physical network field which is not"},{"line_number":190,"context_line":"      None."},{"line_number":191,"context_line":"    * Prefer portgroups to ports."},{"line_number":192,"context_line":"    * Prefer ports with PXE enabled."},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"    :param task: a TaskManager instance."},{"line_number":195,"context_line":"    :param vif_id: Name or UUID of a VIF."}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_bfd5b245","line":192,"in_reply_to":"5f201791_5847f81e","updated":"2017-06-22 14:17:16.000000000","message":"Here, physnets cannot have None in the set as it comes from the neutron network.\n\nI think you\u0027ve got it. How could I reword my criteria to make that more obvious?","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"19c8b99742bfcf379c57882a47b2a9c9059932c8","unresolved":false,"context_lines":[{"line_number":472,"context_line":""},{"line_number":473,"context_line":"        # Determine whether any of the node\u0027s ports have a physical network. If"},{"line_number":474,"context_line":"        # not, we don\u0027t need to check the VIF\u0027s network\u0027s physical networks."},{"line_number":475,"context_line":"        any_port_physnets \u003d any(port.physical_network is not None"},{"line_number":476,"context_line":"                                for port in task.ports)"},{"line_number":477,"context_line":""},{"line_number":478,"context_line":"        vif \u003d None"},{"line_number":479,"context_line":"        if any_port_physnets:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_48bccb04","line":476,"range":{"start_line":475,"start_character":0,"end_line":476,"end_character":55},"updated":"2017-06-21 13:08:54.000000000","message":"I think this is probably OK for now, but eventually I think we want to enforce physical_network is a populated port field because without checking physical network awareness there are a number of horrible things that could happen. So when that happens this check will be redundant.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":472,"context_line":""},{"line_number":473,"context_line":"        # Determine whether any of the node\u0027s ports have a physical network. If"},{"line_number":474,"context_line":"        # not, we don\u0027t need to check the VIF\u0027s network\u0027s physical networks."},{"line_number":475,"context_line":"        any_port_physnets \u003d any(port.physical_network is not None"},{"line_number":476,"context_line":"                                for port in task.ports)"},{"line_number":477,"context_line":""},{"line_number":478,"context_line":"        vif \u003d None"},{"line_number":479,"context_line":"        if any_port_physnets:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_bf3a5295","line":476,"range":{"start_line":475,"start_character":0,"end_line":476,"end_character":55},"in_reply_to":"5f201791_48bccb04","updated":"2017-06-22 14:17:16.000000000","message":"We probably need at least one release where it is not mandatory to support smooth upgrades.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"ea5f0be187047e9aebea5949c4d97b12bd85cf89","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        if any_port_physnets:"},{"line_number":480,"context_line":"            # Check if the requested vif_id is a neutron port, and if so"},{"line_number":481,"context_line":"            # determine its network ID."},{"line_number":482,"context_line":"            vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027network_id\u0027])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        if vif is not None:"},{"line_number":485,"context_line":"            network_id \u003d vif[\u0027port\u0027][\u0027network_id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_d7909798","line":482,"updated":"2017-06-20 18:03:44.000000000","message":"I don\u0027t really like the fact that we do two requests to neutron to get two fields, but not sure if there is a better way, if we want to preserve the option of not doing the call at all if we don\u0027t have physnets or address.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"2924ce81600110a2f7905485e79a5a5aad9169e3","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        if any_port_physnets:"},{"line_number":480,"context_line":"            # Check if the requested vif_id is a neutron port, and if so"},{"line_number":481,"context_line":"            # determine its network ID."},{"line_number":482,"context_line":"            vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027network_id\u0027])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        if vif is not None:"},{"line_number":485,"context_line":"            network_id \u003d vif[\u0027port\u0027][\u0027network_id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_19318f0c","line":482,"in_reply_to":"5f201791_004595b3","updated":"2017-06-21 10:57:15.000000000","message":"right, makes sense.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"19c8b99742bfcf379c57882a47b2a9c9059932c8","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        if any_port_physnets:"},{"line_number":480,"context_line":"            # Check if the requested vif_id is a neutron port, and if so"},{"line_number":481,"context_line":"            # determine its network ID."},{"line_number":482,"context_line":"            vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027network_id\u0027])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        if vif is not None:"},{"line_number":485,"context_line":"            network_id \u003d vif[\u0027port\u0027][\u0027network_id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_8dab15d5","line":482,"in_reply_to":"5f201791_19318f0c","updated":"2017-06-21 13:08:54.000000000","message":"Small nit/opinion, I would have preferred this be called _get_neutron_port_by_id_errors_ignored just because we use \u0027vif\u0027 as a general term not tied to neutron or other service, but this function is neutron specific.\n\nAdditionally I\u0027m don\u0027t think if we need to maintain these checks any longer because the code to check if neutron existed was only in place to support the now deprecated and removed case for calling this code if a non-neutron out of tree network interface didn\u0027t override vif_attach. Perhaps we can put together a follow up patch to refactor this file.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        if any_port_physnets:"},{"line_number":480,"context_line":"            # Check if the requested vif_id is a neutron port, and if so"},{"line_number":481,"context_line":"            # determine its network ID."},{"line_number":482,"context_line":"            vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027network_id\u0027])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        if vif is not None:"},{"line_number":485,"context_line":"            network_id \u003d vif[\u0027port\u0027][\u0027network_id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_bfbff2ce","line":482,"in_reply_to":"5f201791_8dab15d5","updated":"2017-06-22 14:17:16.000000000","message":"A lot of the complexity of this method is due to the assumption that we need to support non-neutron network interfaces. If that\u0027s no longer the case, perhaps the best option is to remove that support in a separate patch, and rebase this change onto that patch?\n\nWe\u0027d be able to remove _get_vif_by_id_errors_ignored() completely, which would address a number of review comments about it. We could also go with my original plan (before I realised it would require an additional neutron API call in some cases) of adding a neutron.get_physnets_by_port_uuid() function and push the port -\u003e network_id lookup into there.\n\nLast but not least, I wouldn\u0027t have to commit a patch with a function named *_errors_ignored :)","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"7f4204f28b22281a46cf385270112fc8d7e15a1f","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        if any_port_physnets:"},{"line_number":480,"context_line":"            # Check if the requested vif_id is a neutron port, and if so"},{"line_number":481,"context_line":"            # determine its network ID."},{"line_number":482,"context_line":"            vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027network_id\u0027])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        if vif is not None:"},{"line_number":485,"context_line":"            network_id \u003d vif[\u0027port\u0027][\u0027network_id\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_004595b3","line":482,"in_reply_to":"5f201791_d7909798","updated":"2017-06-21 08:59:06.000000000","message":"We only ever call _get_vif_by_id_errors_ignored at most once. If any_port_physnets is True we call it here. If any_port_physnets is False and the selected port-like-object has an address we call it on L499.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"99084ad99e8823febd0a576df325e1b93da7849c","unresolved":false,"context_lines":[{"line_number":495,"context_line":"            # its MAC address. If no ports have a physical network then we will"},{"line_number":496,"context_line":"            # not have queried the neutron API yet to determine whether the"},{"line_number":497,"context_line":"            # port is a neutron port. In that case, do so now."},{"line_number":498,"context_line":"            if not any_port_physnets:"},{"line_number":499,"context_line":"                vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027id\u0027])"},{"line_number":500,"context_line":""},{"line_number":501,"context_line":"            if vif is not None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_39456bb4","line":498,"updated":"2017-06-21 10:44:36.000000000","message":"We shouldn\u0027t rely on port physnet value here.\nFor example this will break flat case when we didn\u0027t set  physnet for ports, but still need to update mac_address of neutron port.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"d32ebea05acbaee1032102eb6579b95638cb40eb","unresolved":false,"context_lines":[{"line_number":495,"context_line":"            # its MAC address. If no ports have a physical network then we will"},{"line_number":496,"context_line":"            # not have queried the neutron API yet to determine whether the"},{"line_number":497,"context_line":"            # port is a neutron port. In that case, do so now."},{"line_number":498,"context_line":"            if not any_port_physnets:"},{"line_number":499,"context_line":"                vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027id\u0027])"},{"line_number":500,"context_line":""},{"line_number":501,"context_line":"            if vif is not None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_d9b79786","line":498,"in_reply_to":"5f201791_39456bb4","updated":"2017-06-21 10:51:51.000000000","message":"Flat case should still care about physnet... the neutron provider network still has a physnet, and actually if we check physnet for flat case it\u0027ll prevent people making the mistake of passing the wrong network into nova boot because it would get bound.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4f5660c26ff455c7f748ed4c4757d590daef0ceb","unresolved":false,"context_lines":[{"line_number":495,"context_line":"            # its MAC address. If no ports have a physical network then we will"},{"line_number":496,"context_line":"            # not have queried the neutron API yet to determine whether the"},{"line_number":497,"context_line":"            # port is a neutron port. In that case, do so now."},{"line_number":498,"context_line":"            if not any_port_physnets:"},{"line_number":499,"context_line":"                vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027id\u0027])"},{"line_number":500,"context_line":""},{"line_number":501,"context_line":"            if vif is not None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_9988ffc6","line":498,"in_reply_to":"5f201791_39456bb4","updated":"2017-06-21 10:50:48.000000000","message":"We\u0027re only using this check because when any_port_physnets is True we can reuse the vif variable that was set on L482. We only need to check whether the VIF exists.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4cdb254a82191e0fe417f8b700e86263af50191b","unresolved":false,"context_lines":[{"line_number":495,"context_line":"            # its MAC address. If no ports have a physical network then we will"},{"line_number":496,"context_line":"            # not have queried the neutron API yet to determine whether the"},{"line_number":497,"context_line":"            # port is a neutron port. In that case, do so now."},{"line_number":498,"context_line":"            if not any_port_physnets:"},{"line_number":499,"context_line":"                vif \u003d _get_vif_by_id_errors_ignored(client, vif_id, [\u0027id\u0027])"},{"line_number":500,"context_line":""},{"line_number":501,"context_line":"            if vif is not None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f201791_dfa18eab","line":498,"in_reply_to":"5f201791_d9b79786","updated":"2017-06-22 14:17:16.000000000","message":"+1. That should be covered by the current patch.","commit_id":"fac452bae8887de761369abb2a56c5f9983f1f8f"},{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"edc1de3c13d9c27f1c417d072f5cd8a8f7bfc57a","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                # port which means a user might be requesting a non-neutron"},{"line_number":470,"context_line":"                # port. So skip trying to update the neutron port MAC address"},{"line_number":471,"context_line":"                # in these cases."},{"line_number":472,"context_line":"                pass"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"        port_like_obj \u003d get_free_port_like_object(task, vif_id, physnets)"},{"line_number":475,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3f1d235d_ef779ed3","line":472,"updated":"2017-07-05 13:20:32.000000000","message":"Digging into the routed networks logic for selecting a subnet/segment/physnet on the neutron side when the port is bound, I think we need to add one other additional check here which is:\n\n if len(physnets) \u003e 1:\n     # this is a routed network\n     node_physical_networks \u003d _get_physnets_for_node(task)\n     if len(physnets.intersection(node_physical_networks)) \u003e 1:\n         raise Exception(\"Node is connected to multiple physical networks in the same neutron routed network, this results in ambiguous port mapping. Node should only be connected to one of the physical networks in the routed network.\")\n\nThis marries up with Neutron\u0027s assumption for routed networks which is that each compute host is only connected to one of the segments in a routed network. https://github.com/openstack/neutron/blob/master/neutron/db/ipam_backend_mixin.py#L722\n\nThis doesn\u0027t prevent a node having NICs in multiple physnets, just as long as none of the physnets are used in the same routed network.","commit_id":"de6b6ba1de70df98ce1371934f4486b1ad265f7e"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"59a459607892a62bfc0d3986efb1dde26f1426d1","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                # port which means a user might be requesting a non-neutron"},{"line_number":470,"context_line":"                # port. So skip trying to update the neutron port MAC address"},{"line_number":471,"context_line":"                # in these cases."},{"line_number":472,"context_line":"                pass"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"        port_like_obj \u003d get_free_port_like_object(task, vif_id, physnets)"},{"line_number":475,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3f1d235d_5a23e756","line":472,"in_reply_to":"3f1d235d_65772da2","updated":"2017-07-05 15:56:40.000000000","message":"Done","commit_id":"de6b6ba1de70df98ce1371934f4486b1ad265f7e"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"b454c3d9b2e749fd373831127dd0589c861380bf","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                # port which means a user might be requesting a non-neutron"},{"line_number":470,"context_line":"                # port. So skip trying to update the neutron port MAC address"},{"line_number":471,"context_line":"                # in these cases."},{"line_number":472,"context_line":"                pass"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"        port_like_obj \u003d get_free_port_like_object(task, vif_id, physnets)"},{"line_number":475,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3f1d235d_65772da2","line":472,"in_reply_to":"3f1d235d_ef779ed3","updated":"2017-07-05 13:39:17.000000000","message":"That\u0027s a good spot. I\u0027ll add something to catch that case.","commit_id":"de6b6ba1de70df98ce1371934f4486b1ad265f7e"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"0bccc52cd91fe727b0ef7591617d255ec2e88b90","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                # either neutron doesn\u0027t exist because we\u0027re running in"},{"line_number":468,"context_line":"                # standalone environment or we can\u0027t find a matching neutron"},{"line_number":469,"context_line":"                # port which means a user might be requesting a non-neutron"},{"line_number":470,"context_line":"                # port. So skip trying to update the neutron port MAC address"},{"line_number":471,"context_line":"                # in these cases."},{"line_number":472,"context_line":"                pass"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"            if len(physnets) \u003e 1:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f1d235d_786872b9","line":471,"range":{"start_line":470,"start_character":24,"end_line":471,"end_character":33},"updated":"2017-07-10 09:39:34.000000000","message":"nit - copy-paste here","commit_id":"b9b820954da825f3c80c782fcffcaa5dd4643c22"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"4668b1b0bf00875c97b5dfc46094ef94b0d741b0","unresolved":false,"context_lines":[{"line_number":467,"context_line":"                # either neutron doesn\u0027t exist because we\u0027re running in"},{"line_number":468,"context_line":"                # standalone environment or we can\u0027t find a matching neutron"},{"line_number":469,"context_line":"                # port which means a user might be requesting a non-neutron"},{"line_number":470,"context_line":"                # port. So skip trying to update the neutron port MAC address"},{"line_number":471,"context_line":"                # in these cases."},{"line_number":472,"context_line":"                pass"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"            if len(physnets) \u003e 1:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f1d235d_38479abf","line":471,"range":{"start_line":470,"start_character":24,"end_line":471,"end_character":33},"in_reply_to":"3f1d235d_786872b9","updated":"2017-07-10 09:44:15.000000000","message":"Good point. I\u0027ll address this in a follow up patch if there are no more iterations on this one.","commit_id":"b9b820954da825f3c80c782fcffcaa5dd4643c22"}],"ironic/tests/unit/common/test_neutron.py":[{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"7b0b292953cc99d1c19c0a071b84462174002c38","unresolved":false,"context_lines":[{"line_number":679,"context_line":"            self.client, network_id, fields\u003dfields)"},{"line_number":680,"context_line":"        self.client.show_network.assert_called_once_with("},{"line_number":681,"context_line":"            network_id, fields\u003dfields)"},{"line_number":682,"context_line":"        self.assertEqual(result, network[\u0027network\u0027])"},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"    def test__get_network_by_id_failure(self):"},{"line_number":685,"context_line":"        network_id \u003d \u0027fake-network-id\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf091321_a50ef7e2","line":682,"updated":"2017-06-08 12:09:38.000000000","message":"please use assertEqual(expected, actual) here and below.","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"8e948df84d5b89d630cadc3b95b2bf835c813d11","unresolved":false,"context_lines":[{"line_number":679,"context_line":"            self.client, network_id, fields\u003dfields)"},{"line_number":680,"context_line":"        self.client.show_network.assert_called_once_with("},{"line_number":681,"context_line":"            network_id, fields\u003dfields)"},{"line_number":682,"context_line":"        self.assertEqual(result, network[\u0027network\u0027])"},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"    def test__get_network_by_id_failure(self):"},{"line_number":685,"context_line":"        network_id \u003d \u0027fake-network-id\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"7f231b9d_dc3e5328","line":682,"in_reply_to":"bf091321_a50ef7e2","updated":"2017-06-12 17:16:37.000000000","message":"Doh. For some reason I always forget this one. Perhaps because it\u0027s common to write\n\nif actual \u003d\u003d expected:\n\n(Except in some corners of the C world where people use if 3 \u003d\u003d actual to avoid accidental assignment bugs).","commit_id":"731a624aa3c8c48a15fe2690ba1451eca4d956fb"}],"ironic/tests/unit/drivers/modules/network/test_common.py":[{"author":{"_account_id":6637,"name":"Sam Betts","email":"sam@code-smash.net","username":"sambetts"},"change_message_id":"6b80e24f386299a3bb9b02bd513f90a10bbc91c9","unresolved":false,"context_lines":[{"line_number":650,"context_line":"        self.port.extra \u003d {}"},{"line_number":651,"context_line":"        self.port.physical_network \u003d \u0027physnet1\u0027"},{"line_number":652,"context_line":"        self.port.save()"},{"line_number":653,"context_line":"        self.port \u003d obj_utils.create_test_port("},{"line_number":654,"context_line":"            self.context, node_id\u003dself.node.id,"},{"line_number":655,"context_line":"            uuid\u003duuidutils.generate_uuid(),"},{"line_number":656,"context_line":"            address\u003d\u002752:54:00:cf:2d:33\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_e02fa43c","line":653,"updated":"2017-07-05 16:42:35.000000000","message":"NIT: it took me a little while to click that this was creating a new port in the DB so you ended up with two ports with different phyiscal_networks and not replacing the existing self.port, maybe just a comment or self.port2 to make it more obvious to someone reading this test code to know whats happening.","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"20b360a43c5fc35bda81a7983856384666fa2ad5","unresolved":false,"context_lines":[{"line_number":650,"context_line":"        self.port.extra \u003d {}"},{"line_number":651,"context_line":"        self.port.physical_network \u003d \u0027physnet1\u0027"},{"line_number":652,"context_line":"        self.port.save()"},{"line_number":653,"context_line":"        self.port \u003d obj_utils.create_test_port("},{"line_number":654,"context_line":"            self.context, node_id\u003dself.node.id,"},{"line_number":655,"context_line":"            uuid\u003duuidutils.generate_uuid(),"},{"line_number":656,"context_line":"            address\u003d\u002752:54:00:cf:2d:33\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_243fe9b4","line":653,"in_reply_to":"3f1d235d_e02fa43c","updated":"2017-07-05 20:08:54.000000000","message":"Actually there should be no assignment of self.port here, you\u0027re right. I\u0027ll fix that.","commit_id":"9b7ada9821cd8cc40258ca2683fa6063c546f8ec"}]}
