)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"f180254b0a17de6eb877ba0b9bfa4b080cdbff53","unresolved":false,"context_lines":[{"line_number":9,"context_line":"This patch enables basic CRUD operations on trunk ports and defines"},{"line_number":10,"context_line":"related API extensions. Trunk ports and sub-ports can be persisted"},{"line_number":11,"context_line":"in the Neutron model and are made visible through the API, but the"},{"line_number":12,"context_line":"data path for trunk ports and sub-ports is not rendered by the L2"},{"line_number":13,"context_line":"agent."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9abb7d3a_934aae24","line":12,"updated":"2016-06-01 00:34:13.000000000","message":"not sure I understand the last part \u0027but the\ndata path for trunk ports and sub-ports is not rendered by the L2 agent\u0027","commit_id":"a0014bc9fd3924e317a4ba28da2c5cb466191107"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"9b45c4f3fb28ad21fc044178b8e50a3a7fcecaad","unresolved":false,"context_lines":[{"line_number":9,"context_line":"This patch enables basic CRUD operations on trunk ports and defines"},{"line_number":10,"context_line":"related API extensions. Trunk ports and sub-ports can be persisted"},{"line_number":11,"context_line":"in the Neutron model and are made visible through the API, but the"},{"line_number":12,"context_line":"data path for trunk ports and sub-ports is not rendered by the L2"},{"line_number":13,"context_line":"agent."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9abb7d3a_52665b51","line":12,"in_reply_to":"9abb7d3a_934aae24","updated":"2016-06-01 15:09:48.000000000","message":"I\u0027ll re-phrase, just trying to drive home the point that this doesn\u0027t connect anything to the L2 agent, so trunk ports and subports can\u0027t actually be created and used. They will only exist as resources stored in the DB.","commit_id":"a0014bc9fd3924e317a4ba28da2c5cb466191107"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":10,"context_line":"related API extensions. Trunk ports and sub-ports can be persisted"},{"line_number":11,"context_line":"in the Neutron model and are made visible through the API, but the"},{"line_number":12,"context_line":"L2 agent is not notified and no trunk ports or subports are actually"},{"line_number":13,"context_line":"instantiated on compute hosts."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":23,"id":"3aaa91ec_985fe471","line":13,"updated":"2016-06-22 15:42:22.000000000","message":"I\u0027d add this is a patch in the series that defines the API and provide an initial implementation stub for the service plugin. More to follow.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"dab67761845156711c808568fb8ccbda9af647a4","unresolved":false,"context_lines":[{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"},{"line_number":17,"context_line":"Co-Authored-By: SongmingYan \u003cneutron@zte.com.cn\u003e"},{"line_number":18,"context_line":"Partially-implements: blueprint vlan-aware-vms"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":23,"id":"3aaa91ec_194f93be","line":18,"updated":"2016-06-22 06:23:54.000000000","message":"I think that we need a release note for this","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":14605,"name":"vikram.choudhary","email":"vikschw@gmail.com","username":"vikram.choudhary"},"change_message_id":"5ec11b16ef42fb93ed0afaa7bdd2777c230b7d2e","unresolved":false,"context_lines":[{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"},{"line_number":17,"context_line":"Co-Authored-By: SongmingYan \u003cneutron@zte.com.cn\u003e"},{"line_number":18,"context_line":"Partially-implements: blueprint vlan-aware-vms"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":23,"id":"3aaa91ec_648f0e24","line":18,"in_reply_to":"3aaa91ec_194f93be","updated":"2016-06-22 06:48:21.000000000","message":"I am not sure whether we need a release note with this change as the change only implements the feature partially..","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"ae434c1723e3595bdad94f79e49c4b837e55fa2d","unresolved":false,"context_lines":[{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"},{"line_number":17,"context_line":"Co-Authored-By: SongmingYan \u003cneutron@zte.com.cn\u003e"},{"line_number":18,"context_line":"Partially-implements: blueprint vlan-aware-vms"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":23,"id":"3aaa91ec_e45e5e44","line":18,"in_reply_to":"3aaa91ec_648f0e24","updated":"2016-06-22 06:56:07.000000000","message":"no point in one yet, we can add one to the patch that seals it all :)\n\nbut this one is a drop in the bucket","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":11,"context_line":"in the Neutron model and are made visible through the API, but the"},{"line_number":12,"context_line":"L2 agent is not notified and no trunk ports or subports are actually"},{"line_number":13,"context_line":"instantiated on compute hosts."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"},{"line_number":17,"context_line":"Partially-implements: blueprint vlan-aware-vms"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":41,"id":"1aa78d24_b7e143d3","line":14,"updated":"2016-07-02 09:29:18.000000000","message":"DocImpact? Release note?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":11,"context_line":"in the Neutron model and are made visible through the API, but the"},{"line_number":12,"context_line":"L2 agent is not notified and no trunk ports or subports are actually"},{"line_number":13,"context_line":"instantiated on compute hosts."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1"},{"line_number":16,"context_line":"Co-Authored-By: Armando Migliaccio \u003carmamig@gmail.com\u003e"},{"line_number":17,"context_line":"Partially-implements: blueprint vlan-aware-vms"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":41,"id":"1aa78d24_881a266d","line":14,"in_reply_to":"1aa78d24_b7e143d3","updated":"2016-07-02 15:12:46.000000000","message":"not yet, the work is not finished.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"}],"devstack/lib/trunk":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":2,"context_line":"    _neutron_service_plugin_class_add \"trunk\""},{"line_number":3,"context_line":"}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"function configure_trunk {"},{"line_number":6,"context_line":"    configure_trunk_service_plugin"},{"line_number":7,"context_line":"}"}],"source_content_type":"application/octet-stream","patch_set":23,"id":"3aaa91ec_98d6c4c3","line":5,"updated":"2016-06-22 15:42:22.000000000","message":"nit: I\u0027d rename configure_trunk_extension","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":2,"context_line":"    _neutron_service_plugin_class_add \"trunk\""},{"line_number":3,"context_line":"}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"function configure_trunk {"},{"line_number":6,"context_line":"    configure_trunk_service_plugin"},{"line_number":7,"context_line":"}"}],"source_content_type":"application/octet-stream","patch_set":23,"id":"3aaa91ec_4b847ed3","line":5,"in_reply_to":"3aaa91ec_98d6c4c3","updated":"2016-06-22 17:04:18.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":1,"context_line":"function configure_trunk_service_plugin {"},{"line_number":2,"context_line":"    _neutron_service_plugin_class_add \"trunk\""},{"line_number":3,"context_line":"}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"function configure_trunk_extension {"}],"source_content_type":"application/octet-stream","patch_set":27,"id":"3aaa91ec_89e6e7e5","line":2,"updated":"2016-06-24 21:59:09.000000000","message":"do we need \u0027trunk-details\u0027 as well?","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":1,"context_line":"function configure_trunk_service_plugin {"},{"line_number":2,"context_line":"    _neutron_service_plugin_class_add \"trunk\""},{"line_number":3,"context_line":"}"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"function configure_trunk_extension {"}],"source_content_type":"application/octet-stream","patch_set":27,"id":"3aaa91ec_cc759d64","line":2,"in_reply_to":"3aaa91ec_89e6e7e5","updated":"2016-06-24 22:13:34.000000000","message":"No, we only need to activate the plugin. The plugin implements both extensions.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"}],"devstack/plugin.sh":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":23,"context_line":"            if is_service_enabled q-qos; then"},{"line_number":24,"context_line":"                configure_qos"},{"line_number":25,"context_line":"            fi"},{"line_number":26,"context_line":"            if is_service_enabled q-trunk; then"},{"line_number":27,"context_line":"                configure_trunk"},{"line_number":28,"context_line":"            fi"},{"line_number":29,"context_line":"            if [[ \"$Q_AGENT\" \u003d\u003d \"openvswitch\" ]] \u0026\u0026 \\"}],"source_content_type":"text/x-sh","patch_set":23,"id":"3aaa91ec_f3a3a99c","line":26,"updated":"2016-06-22 15:42:22.000000000","message":"Thinking about this I am starting to believe we\u0027re overloading a utility function that\u0027s not quite meant to be used for controlling features like trunking but I can see that we\u0027ve been copying a bad pattern. I would have personally added a [1] to devstack/settings and did [2]. This way it\u0027s clear that trunk is not yet another service that runs alongside neutron\u0027s backbone.\n\n [1] TRUNK_ENABLED\u003d$(trueorfalse True TRUNK_ENABLED)\n [2] if [[ $TRUNK_ENABLED \u003d\u003d True ]] ; then # do what you have to do.\n\nWe may want to clean the rest up, but that\u0027s another story.\n\nAs for the gate configuration, the hook should simply set TRUNK_ENABLED\u003dTrue. \n\nThe outcome is the same and I am questioning the style here. I am not strongly opinionated at this point.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"}],"neutron/common/exceptions.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e08fc05c1b2b9380a4237fbc8cdf8ea82f8b75c0","unresolved":false,"context_lines":[{"line_number":317,"context_line":"    message \u003d _(\"Quota for tenant %(tenant_id)s could not be found.\")"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":""},{"line_number":320,"context_line":"class TrunkNotFound(e.NotFound):"},{"line_number":321,"context_line":"    message \u003d _(\"Trunk %(id)s could not be found.\")"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_e1ea560e","line":320,"updated":"2016-05-31 17:21:34.000000000","message":"this has a place under neutron/services/trunk","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"ae2c192bcd9b9050b0a17a0f3e55fcfb366ff4c7","unresolved":false,"context_lines":[{"line_number":317,"context_line":"    message \u003d _(\"Quota for tenant %(tenant_id)s could not be found.\")"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":""},{"line_number":320,"context_line":"class TrunkNotFound(e.NotFound):"},{"line_number":321,"context_line":"    message \u003d _(\"Trunk %(id)s could not be found.\")"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_509cbc5c","line":320,"in_reply_to":"9abb7d3a_e1ea560e","updated":"2016-05-31 23:53:33.000000000","message":"Done","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"}],"neutron/extensions/trunk.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"65e9a44120bd959d7496730de439a2930024a642","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":31,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":32,"context_line":"    if not isinstance(data, list):"},{"line_number":33,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"},{"line_number":34,"context_line":"        LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9abb7d3a_872428c5","line":31,"updated":"2016-06-01 04:31:59.000000000","message":"a nit, but once the bike shedding stops in [1], consider refreshing this validator.\n\n[1] https://review.openstack.org/#/c/319386/","commit_id":"a0014bc9fd3924e317a4ba28da2c5cb466191107"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"9b45c4f3fb28ad21fc044178b8e50a3a7fcecaad","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":31,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":32,"context_line":"    if not isinstance(data, list):"},{"line_number":33,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"},{"line_number":34,"context_line":"        LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9abb7d3a_92d3a3d4","line":31,"in_reply_to":"9abb7d3a_872428c5","updated":"2016-06-01 15:09:48.000000000","message":"Done. I\u0027m actually hoping the validator merges quickly so we can just dispense with this whole block :)","commit_id":"a0014bc9fd3924e317a4ba28da2c5cb466191107"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":81,"context_line":"    \u0027trunks\u0027: {"},{"line_number":82,"context_line":"        \u0027id\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":83,"context_line":"               \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":84,"context_line":"               \u0027is_visible\u0027: True, \u0027primary_key\u0027: True},"},{"line_number":85,"context_line":"        \u0027tenant_id\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":86,"context_line":"                      \u0027required_by_policy\u0027: True,"},{"line_number":87,"context_line":"                      \u0027validate\u0027:"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_f066f527","line":84,"range":{"start_line":84,"start_character":35,"end_line":84,"end_character":55},"updated":"2016-06-06 22:04:30.000000000","message":"What does primary_key mean in this context?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":81,"context_line":"    \u0027trunks\u0027: {"},{"line_number":82,"context_line":"        \u0027id\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":83,"context_line":"               \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":84,"context_line":"               \u0027is_visible\u0027: True, \u0027primary_key\u0027: True},"},{"line_number":85,"context_line":"        \u0027tenant_id\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":86,"context_line":"                      \u0027required_by_policy\u0027: True,"},{"line_number":87,"context_line":"                      \u0027validate\u0027:"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_b788dc23","line":84,"range":{"start_line":84,"start_character":35,"end_line":84,"end_character":55},"in_reply_to":"7aa08908_f066f527","updated":"2016-06-06 22:28:40.000000000","message":"No clue, I inherited it :)","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":74,"context_line":"            return msg"},{"line_number":75,"context_line":"        if segmentation_id:"},{"line_number":76,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":77,"context_line":"validators.validators[\u0027type:subports\u0027] \u003d validate_subports"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"RESOURCE_ATTRIBUTE_MAP \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_4caa1f72","line":77,"updated":"2016-06-21 16:59:45.000000000","message":"Please add a new line between end of validate_suports() and this call.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":74,"context_line":"            return msg"},{"line_number":75,"context_line":"        if segmentation_id:"},{"line_number":76,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":77,"context_line":"validators.validators[\u0027type:subports\u0027] \u003d validate_subports"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"RESOURCE_ATTRIBUTE_MAP \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_a7dbd11a","line":77,"in_reply_to":"3aaa91ec_13f30b0c","updated":"2016-06-21 19:33:45.000000000","message":"Two lines it is! :)","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"b88f16b93b3bff74926e242767d3eb9fa8713f8a","unresolved":false,"context_lines":[{"line_number":74,"context_line":"            return msg"},{"line_number":75,"context_line":"        if segmentation_id:"},{"line_number":76,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":77,"context_line":"validators.validators[\u0027type:subports\u0027] \u003d validate_subports"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"RESOURCE_ATTRIBUTE_MAP \u003d {"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_13f30b0c","line":77,"in_reply_to":"3aaa91ec_4caa1f72","updated":"2016-06-21 18:23:06.000000000","message":"Two new lines, please.  :)","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    @classmethod"},{"line_number":125,"context_line":"    def get_description(cls):"},{"line_number":126,"context_line":"        return \"Trunk Extension\""},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @classmethod"},{"line_number":129,"context_line":"    def get_updated(cls):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_2f77c5d5","line":126,"range":{"start_line":126,"start_character":15,"end_line":126,"end_character":32},"updated":"2016-06-21 16:59:45.000000000","message":"It\u0027s better to make it clear, for instance, why not \"Provides trunk port support\"?","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    @classmethod"},{"line_number":125,"context_line":"    def get_description(cls):"},{"line_number":126,"context_line":"        return \"Trunk Extension\""},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    @classmethod"},{"line_number":129,"context_line":"    def get_updated(cls):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_67f8c97d","line":126,"range":{"start_line":126,"start_character":15,"end_line":126,"end_character":32},"in_reply_to":"3aaa91ec_2f77c5d5","updated":"2016-06-21 19:33:45.000000000","message":"Yes, should be something along those lines.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":14605,"name":"vikram.choudhary","email":"vikschw@gmail.com","username":"vikram.choudhary"},"change_message_id":"5ec11b16ef42fb93ed0afaa7bdd2777c230b7d2e","unresolved":false,"context_lines":[{"line_number":27,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":31,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":32,"context_line":"    if not isinstance(data, list):"},{"line_number":33,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_64dd4e14","line":30,"updated":"2016-06-22 06:48:21.000000000","message":"I think we can use the validator from neutron-lib \n\nhttps://github.com/openstack/neutron-lib/blob/e419f24f1b1a07df514f990aeffec9ff8934f4df/neutron_lib/api/validators.py#L491-L536","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"57aec5ca330361cfdb5ee47e6e8d9d1692800bfc","unresolved":false,"context_lines":[{"line_number":27,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":31,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":32,"context_line":"    if not isinstance(data, list):"},{"line_number":33,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_247866f2","line":30,"in_reply_to":"3aaa91ec_64dd4e14","updated":"2016-06-22 06:50:44.000000000","message":"no we can\u0027t, until there\u0027s a new release, in which case we need to bump the requirements.txt file","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"dab67761845156711c808568fb8ccbda9af647a4","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                    \u0027required_by_policy\u0027: True,"},{"line_number":94,"context_line":"                    \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":95,"context_line":"                    \u0027is_visible\u0027: True},"},{"line_number":96,"context_line":"        \u0027sub_ports\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":97,"context_line":"                      \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":98,"context_line":"                      \u0027convert_list_to\u0027: converters.convert_kvp_list_to_dict,"},{"line_number":99,"context_line":"                      \u0027validate\u0027: {\u0027type:subports\u0027: None},"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_39940f36","line":96,"updated":"2016-06-22 06:23:54.000000000","message":"why is one unable to update a subport?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"1732b7e4eee8fa5cc92196588c2b879ea4268fa3","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                    \u0027required_by_policy\u0027: True,"},{"line_number":94,"context_line":"                    \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":95,"context_line":"                    \u0027is_visible\u0027: True},"},{"line_number":96,"context_line":"        \u0027sub_ports\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":97,"context_line":"                      \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":98,"context_line":"                      \u0027convert_list_to\u0027: converters.convert_kvp_list_to_dict,"},{"line_number":99,"context_line":"                      \u0027validate\u0027: {\u0027type:subports\u0027: None},"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_d977cbd2","line":96,"in_reply_to":"3aaa91ec_39940f36","updated":"2016-06-22 06:33:01.000000000","message":"subports are added/removed with PUT on a subresource. See L140.  There\u0027s some asymmetry when it comes to adding subports in that they can be created on POST when creating a trunk but can only be added to the trunk with PUT on trunks/add_subports. Not sure if we should worry too much about it, but that\u0027s where the API is at right now.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                    \u0027required_by_policy\u0027: True,"},{"line_number":94,"context_line":"                    \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":95,"context_line":"                    \u0027is_visible\u0027: True},"},{"line_number":96,"context_line":"        \u0027sub_ports\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":97,"context_line":"                      \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":98,"context_line":"                      \u0027convert_list_to\u0027: converters.convert_kvp_list_to_dict,"},{"line_number":99,"context_line":"                      \u0027validate\u0027: {\u0027type:subports\u0027: None},"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ee958240","line":96,"in_reply_to":"3aaa91ec_d977cbd2","updated":"2016-06-22 15:42:22.000000000","message":"Right, this is similar to the API design for routers, and making sub_ports editable for adding/removing ports would introduce the complication where if you want to simply add or remove a single port you gotta read the whole thing first. Instead we provide explicit API calls and give the user only one way of doing things, which is the right thing to do from the usability point of view. On the other end, we want to return the ports when we do trunk-show, instead of having to do two API calls.\n\nSo no, I don\u0027t think this is an oversight on my part ;)","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"dab67761845156711c808568fb8ccbda9af647a4","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":107,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":108,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":109,"context_line":"                                \u0027is_visible\u0027: True,"},{"line_number":110,"context_line":"                                \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_f9c1e72f","line":107,"updated":"2016-06-22 06:23:54.000000000","message":"is this just read only?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":107,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":108,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":109,"context_line":"                                \u0027is_visible\u0027: True,"},{"line_number":110,"context_line":"                                \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_cb822e94","line":107,"in_reply_to":"3aaa91ec_0ed9ee21","updated":"2016-06-22 17:04:18.000000000","message":"Ah, gotcha. I thought it was simply a cosmetic thing to have a separate extension. Good to know, I\u0027ll put this back in a separate extension.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":107,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":108,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":109,"context_line":"                                \u0027is_visible\u0027: True,"},{"line_number":110,"context_line":"                                \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_0ed9ee21","line":107,"in_reply_to":"3aaa91ec_1982f394","updated":"2016-06-22 15:42:22.000000000","message":"The reason why this was a separate extension has to do that with which plugin owns the resource being modified and in the case of ports it\u0027s the core plugin. Therefore I think you must put it back the way it was, unless you managed to figure out a way of disentangle the whole thing. Right now you don\u0027t see the problem because you have not added the trunk_details alias to the list, but as soon as you do you\u0027ll see.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"1732b7e4eee8fa5cc92196588c2b879ea4268fa3","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":107,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":108,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":109,"context_line":"                                \u0027is_visible\u0027: True,"},{"line_number":110,"context_line":"                                \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_1982f394","line":107,"in_reply_to":"3aaa91ec_f9c1e72f","updated":"2016-06-22 06:33:01.000000000","message":"Yes, this is read-only","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"3fec98e099acb8444352a23ea236992308c772c1","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        # ids"},{"line_number":61,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":62,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":63,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":64,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":65,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":66,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_36ca236f","line":63,"updated":"2016-06-23 00:40:49.000000000","message":"Using len(subport) to check that two particular things are specified is risky and not very explicit (this would break if we added another field). I think it would be better to be more explicit.\n\nif any((segmentation_id, segmentation_type)) and not all((segmentation_id, segmentation_type)):","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e0c9bc95c1861ab7628174901a63f1c7fd0b5b52","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        # ids"},{"line_number":61,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":62,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":63,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":64,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":65,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":66,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_090533bb","line":63,"in_reply_to":"3aaa91ec_36ca236f","updated":"2016-06-23 12:15:59.000000000","message":"first point: this validator is here only temporarily as this is made available through neutron-lib, second point: this must break if we add a new field as the validator must change to accommodate the API modification! So I\u0027d rather keep the existing behavior","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"3fec98e099acb8444352a23ea236992308c772c1","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"validators.validators[\u0027type:subports\u0027] \u003d validate_subports"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"RESOURCE_ATTRIBUTE_MAP \u003d {"}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_96c9577b","line":79,"updated":"2016-06-23 00:40:49.000000000","message":"All of this de-duping logic in the validator isn\u0027t really appropriately placed if I can call add_subports to add more sub-ports because none of this checks against the existing sub-ports. I think we should probabily simplify this validation to have it just make sure that its a list and has the correct keys.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e0c9bc95c1861ab7628174901a63f1c7fd0b5b52","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"validators.validators[\u0027type:subports\u0027] \u003d validate_subports"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"RESOURCE_ATTRIBUTE_MAP \u003d {"}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_a91cdf13","line":79,"in_reply_to":"3aaa91ec_96c9577b","updated":"2016-06-23 12:15:59.000000000","message":"I talked to Ryan about this and I was going to break down the logic of the validator so that bits are more reusable. Watch for it.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":142,"context_line":"            attributes, extension_attrs_map\u003dRESOURCE_ATTRIBUTE_MAP)"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def get_required_extensions(self):"},{"line_number":145,"context_line":"        return [\"binding\"]"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def get_extended_resources(self, version):"},{"line_number":148,"context_line":"        if version \u003d\u003d \"2.0\":"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_0976773d","line":145,"updated":"2016-06-24 21:59:09.000000000","message":"Question: will this cause the neutron server to exit if both \u0027trunk\u0027 and \u0027binding\u0027 aren\u0027t enabled as extensions?\n\nI.e. we will always have \u0027binding:*\u0027 attributes in the ports while this extension is enabled?\n\nDo we also need to require \"trunk-details\"?","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":142,"context_line":"            attributes, extension_attrs_map\u003dRESOURCE_ATTRIBUTE_MAP)"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    def get_required_extensions(self):"},{"line_number":145,"context_line":"        return [\"binding\"]"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def get_extended_resources(self, version):"},{"line_number":148,"context_line":"        if version \u003d\u003d \"2.0\":"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_ecfdf9b1","line":145,"in_reply_to":"3aaa91ec_0976773d","updated":"2016-06-24 22:13:34.000000000","message":"Yes, we want the neutron server to exit if the main plugin doesn\u0027t implement the port binding extension. This causes the trunk extension to have that dependency. I don\u0027t think we need to require trunk-details.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"14911823f234a3b1c4aa01eab1f1d3121c571354","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        # ids"},{"line_number":61,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":62,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":63,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":64,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":65,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":66,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_ec14d9e9","line":63,"range":{"start_line":63,"start_character":62,"end_line":63,"end_character":78},"updated":"2016-06-24 22:57:12.000000000","message":"This isn\u0027t clear to me.  What does len(subport) \u003e 1 checking here?","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"792e381747368c7343182d19c4c2e21d31be2b44","unresolved":false,"context_lines":[{"line_number":60,"context_line":"        # ids"},{"line_number":61,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":62,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":63,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":64,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":65,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":66,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_fa764704","line":63,"range":{"start_line":63,"start_character":62,"end_line":63,"end_character":78},"in_reply_to":"3aaa91ec_ec14d9e9","updated":"2016-06-24 23:59:19.000000000","message":"I think we\u0027re asserting that if we have 2 or more fields passed to us both segmentation_type and segmentation_id are passed together. This check then generates a message to that effect.  The idea is that port_id can be passed by itself, but if it\u0027s not we need to alert the user that all 3 fields are required. We already asserted that port_id was passed at L46, so at this point we know it\u0027s there and the number of fields passed is at least 1.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"c993a09f4806038542ab7f6c3692b2f1579c6ee7","unresolved":false,"context_lines":[{"line_number":94,"context_line":"                    \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":95,"context_line":"                    \u0027is_visible\u0027: True},"},{"line_number":96,"context_line":"        \u0027sub_ports\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":97,"context_line":"                      \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":98,"context_line":"                      \u0027convert_list_to\u0027: converters.convert_kvp_list_to_dict,"},{"line_number":99,"context_line":"                      \u0027validate\u0027: {\u0027type:subports\u0027: None},"},{"line_number":100,"context_line":"                      \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":29,"id":"3aaa91ec_a498d66b","line":97,"updated":"2016-06-27 22:47:38.000000000","message":"Any harm in defaulting to [] here? It may make the logic for handling subports cleaner. I don\u0027t see any reason we need to distinguish between [] and ATTR_NOT_SPECIFIED. The intent of the user would seem to be the same: \"don\u0027t create any subports at this time\"","commit_id":"f09066325636326922f9406e0134e8de3883ed39"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6904c3625357256de611957c3c038e3ba7c6d648","unresolved":false,"context_lines":[{"line_number":94,"context_line":"                    \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":95,"context_line":"                    \u0027is_visible\u0027: True},"},{"line_number":96,"context_line":"        \u0027sub_ports\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":97,"context_line":"                      \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":98,"context_line":"                      \u0027convert_list_to\u0027: converters.convert_kvp_list_to_dict,"},{"line_number":99,"context_line":"                      \u0027validate\u0027: {\u0027type:subports\u0027: None},"},{"line_number":100,"context_line":"                      \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":29,"id":"3aaa91ec_602505c1","line":97,"in_reply_to":"3aaa91ec_a498d66b","updated":"2016-06-28 18:21:20.000000000","message":"Probably not, the use of a sentinel value like object() is used when determining a default value needs to be in the code itself, eg. like in the case of a mac address, but in this case [] will fit the bill.","commit_id":"f09066325636326922f9406e0134e8de3883ed39"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":112,"context_line":"    @classmethod"},{"line_number":113,"context_line":"    def get_alias(cls):"},{"line_number":114,"context_line":"        return \"trunk\""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @classmethod"},{"line_number":117,"context_line":"    def get_description(cls):"},{"line_number":118,"context_line":"        return \"Provides support for trunk ports\""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_13573903","line":115,"updated":"2016-06-28 19:52:50.000000000","message":"not sure if we want to use string literals for this, but it does not bother me either way.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":112,"context_line":"    @classmethod"},{"line_number":113,"context_line":"    def get_alias(cls):"},{"line_number":114,"context_line":"        return \"trunk\""},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @classmethod"},{"line_number":117,"context_line":"    def get_description(cls):"},{"line_number":118,"context_line":"        return \"Provides support for trunk ports\""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_c27319b3","line":115,"in_reply_to":"3aaa91ec_13573903","updated":"2016-06-28 20:16:43.000000000","message":"Will leave as is","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_baced880","line":62,"range":{"start_line":62,"start_character":12,"end_line":62,"end_character":56},"updated":"2016-06-29 11:33:52.000000000","message":"this validator was already merged in neutron-lib so this patch is not the right place to modify the code, I am aware of that but I wanted to raise a concerns anyway.\none request from Ironic is to be able to create a subport without specifying the segmentation type and segmentation id. By default if those parameters are not specified we should use the ones of the network. Are we going to take care of this request from Ironic later? Isn\u0027t is better to do it straight away?","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_79b2b0e6","line":62,"range":{"start_line":62,"start_character":12,"end_line":62,"end_character":56},"in_reply_to":"3aaa91ec_baced880","updated":"2016-06-29 14:45:05.000000000","message":"Yes, we\u0027re going to take care of it. I wanted to avoid it in this patch because it\u0027s already large enough. We have put the framework in place to handle it quickly in a follow-on patch.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_8094fb36","line":62,"range":{"start_line":62,"start_character":58,"end_line":62,"end_character":79},"updated":"2016-06-30 17:05:53.000000000","message":"I thought we were going to require segmentation details.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6e80c211062581c8d50470214318d6956b9ba71c","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_e64238aa","line":62,"range":{"start_line":62,"start_character":58,"end_line":62,"end_character":79},"in_reply_to":"3aaa91ec_8094fb36","updated":"2016-06-30 17:22:01.000000000","message":"We\u0027re requiring them for the time being in the plugin implementation. The intent is to quickly relax that constraint to support Ironic. IMO the validator at this level should still allow the user to omit segmentation_id and segmentation_type and let the implementation of the extension do something more specific.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"31861d1afeecf92884bedecf303bc33b07320bee","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_23e6e743","line":62,"range":{"start_line":62,"start_character":58,"end_line":62,"end_character":79},"in_reply_to":"3aaa91ec_e64238aa","updated":"2016-06-30 20:40:00.000000000","message":"+1","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"},{"line_number":72,"context_line":"            LOG.debug(msg)"},{"line_number":73,"context_line":"            return msg"},{"line_number":74,"context_line":"        if segmentation_id:"},{"line_number":75,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_a02db7ff","line":74,"range":{"start_line":74,"start_character":11,"end_line":74,"end_character":26},"updated":"2016-06-30 17:05:53.000000000","message":"ditto","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6e80c211062581c8d50470214318d6956b9ba71c","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"},{"line_number":72,"context_line":"            LOG.debug(msg)"},{"line_number":73,"context_line":"            return msg"},{"line_number":74,"context_line":"        if segmentation_id:"},{"line_number":75,"context_line":"            segmentation_ids.add(segmentation_id)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_061f84b7","line":74,"range":{"start_line":74,"start_character":11,"end_line":74,"end_character":26},"in_reply_to":"3aaa91ec_a02db7ff","updated":"2016-06-30 17:22:01.000000000","message":"See comments at L62.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":26,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":30,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":31,"context_line":"    if not isinstance(data, list):"},{"line_number":32,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_97f1a7d0","line":29,"updated":"2016-07-02 09:29:18.000000000","message":"Just curious, why would we put it in a shared library? It does not seem to be a piece to share with other neutron-lib consumers. Or is it part of neutron-api consolidation in the library tree?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":26,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"#TODO(armax): remove this validator when released in neutron-lib"},{"line_number":30,"context_line":"def validate_subports(data, valid_values\u003dNone):"},{"line_number":31,"context_line":"    if not isinstance(data, list):"},{"line_number":32,"context_line":"        msg \u003d _(\"Invalid data format for subports: \u0027%s\u0027\") % data"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_e84c8a78","line":29,"in_reply_to":"1aa78d24_97f1a7d0","updated":"2016-07-02 15:12:46.000000000","message":"That, plus the possibility of being reused by other subprojects. See neutron-lib patch\u0027s comments for more details.\n\n[1] https://review.openstack.org/#/c/319386/","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":49,"context_line":"        elif validators.validate_uuid(subport[\"port_id\"]):"},{"line_number":50,"context_line":"            msg \u003d _(\"Invalid UUID for subport: \u0027%s\u0027\") % subport[\"port_id\"]"},{"line_number":51,"context_line":"            return msg"},{"line_number":52,"context_line":"        elif subport[\"port_id\"] in subport_ids:"},{"line_number":53,"context_line":"            msg \u003d _(\"Non unique UUID for subport: \u0027%s\u0027\") % subport[\"port_id\"]"},{"line_number":54,"context_line":"            return msg"},{"line_number":55,"context_line":"        subport_ids.add(subport[\"port_id\"])"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_57dd7f6f","line":52,"updated":"2016-07-02 09:29:18.000000000","message":"(No action required) maybe better to split the checks into independent pieces, so that you don\u0027t need to maintain state (subport_ids, segmentation_ids) for too long.\n\nSo for those dup checks, you would have:\n\ntry:\n    port_ids \u003d sp[\u0027port_id\u0027] for sp in data\nexcept KeyError:\n    msg \u003d ...\n    return msg\n\nif not all(validate_uuid(port_id) for port_id in port_ids):\n   msg \u003d ...\n   return msg\n\nif len(port_ids) \u003e len(set(port_ids)):\n    msg \u003d ...\n    return msg","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":49,"context_line":"        elif validators.validate_uuid(subport[\"port_id\"]):"},{"line_number":50,"context_line":"            msg \u003d _(\"Invalid UUID for subport: \u0027%s\u0027\") % subport[\"port_id\"]"},{"line_number":51,"context_line":"            return msg"},{"line_number":52,"context_line":"        elif subport[\"port_id\"] in subport_ids:"},{"line_number":53,"context_line":"            msg \u003d _(\"Non unique UUID for subport: \u0027%s\u0027\") % subport[\"port_id\"]"},{"line_number":54,"context_line":"            return msg"},{"line_number":55,"context_line":"        subport_ids.add(subport[\"port_id\"])"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_483e7eb9","line":52,"in_reply_to":"1aa78d24_57dd7f6f","updated":"2016-07-02 15:12:46.000000000","message":"Any action that I would like to take would need to go in neutron-lib at this point. This validator is here just until we have a neutron-lib release.\n\nAs for your suggestion of refactoring, there\u0027s many ways to skin a cat, but I personally don\u0027t believe that splitting the method is buying us much.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_b73b039c","line":62,"range":{"start_line":62,"start_character":57,"end_line":62,"end_character":78},"updated":"2016-07-02 09:29:18.000000000","message":"what\u0027s that check for? Does it suggest that you will allow to pass empty dicts? Why?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # ids"},{"line_number":60,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":61,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":62,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":63,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":64,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_286e92c9","line":62,"range":{"start_line":62,"start_character":57,"end_line":62,"end_character":78},"in_reply_to":"1aa78d24_b73b039c","updated":"2016-07-02 15:12:46.000000000","message":"Perhaps looking at the tests for the above mentioned patch would help. Anyway: this piece is validating that a port can either contain only port_id or all of the attributes port_id, segmentation_id, and segmentation_type. Any other attribute must be rejected, see msg below.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":66,"context_line":"            LOG.debug(msg)"},{"line_number":67,"context_line":"            return msg"},{"line_number":68,"context_line":"        if segmentation_id in segmentation_ids:"},{"line_number":69,"context_line":"            msg \u003d _(\"Segmentation ID \u0027%(seg_id)s\u0027 for \u0027%(subport)s\u0027 is not \""},{"line_number":70,"context_line":"                    \"unique\") % {\"seg_id\": segmentation_id,"},{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_57729f7d","line":68,"updated":"2016-07-02 09:29:18.000000000","message":"that would then be another independent check, as in:\n\nsegmentation_ids \u003d sp[\u0027segmentation_id\u0027] for sp in data\n\nif len(segmentation_ids) \u003e len(set(segmentation_ids)):\n    msg \u003d ...\n    return msg","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":66,"context_line":"            LOG.debug(msg)"},{"line_number":67,"context_line":"            return msg"},{"line_number":68,"context_line":"        if segmentation_id in segmentation_ids:"},{"line_number":69,"context_line":"            msg \u003d _(\"Segmentation ID \u0027%(seg_id)s\u0027 for \u0027%(subport)s\u0027 is not \""},{"line_number":70,"context_line":"                    \"unique\") % {\"seg_id\": segmentation_id,"},{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_0873d6b2","line":68,"in_reply_to":"1aa78d24_57729f7d","updated":"2016-07-02 15:12:46.000000000","message":"I am not sure I understand what you\u0027re asking or saying.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            LOG.debug(msg)"},{"line_number":67,"context_line":"            return msg"},{"line_number":68,"context_line":"        if segmentation_id in segmentation_ids:"},{"line_number":69,"context_line":"            msg \u003d _(\"Segmentation ID \u0027%(seg_id)s\u0027 for \u0027%(subport)s\u0027 is not \""},{"line_number":70,"context_line":"                    \"unique\") % {\"seg_id\": segmentation_id,"},{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"},{"line_number":72,"context_line":"            LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_5720df49","line":69,"updated":"2016-07-02 09:29:18.000000000","message":"For the sake of completeness, shouldn\u0027t we consider segmentation type when determining if it\u0027s a real duplicate (to avoid returning an error when duplication is only for ID but types are different)?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            LOG.debug(msg)"},{"line_number":67,"context_line":"            return msg"},{"line_number":68,"context_line":"        if segmentation_id in segmentation_ids:"},{"line_number":69,"context_line":"            msg \u003d _(\"Segmentation ID \u0027%(seg_id)s\u0027 for \u0027%(subport)s\u0027 is not \""},{"line_number":70,"context_line":"                    \"unique\") % {\"seg_id\": segmentation_id,"},{"line_number":71,"context_line":"                    \"subport\": subport[\"port_id\"]}"},{"line_number":72,"context_line":"            LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_48acbeed","line":69,"in_reply_to":"1aa78d24_5720df49","updated":"2016-07-02 15:12:46.000000000","message":"This might be worth looking into. Right now the trunk plugin will only be supporting a single type, so the logic as is would work. Let me think about it, any action I will take will target neutron-lib.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":83,"context_line":"        \u0027id\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":84,"context_line":"               \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":85,"context_line":"               \u0027is_visible\u0027: True, \u0027primary_key\u0027: True},"},{"line_number":86,"context_line":"        \u0027tenant_id\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":87,"context_line":"                      \u0027required_by_policy\u0027: True,"},{"line_number":88,"context_line":"                      \u0027validate\u0027:"},{"line_number":89,"context_line":"                          {\u0027type:string\u0027: attr.TENANT_ID_MAX_LEN},"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_d7d20f34","line":86,"updated":"2016-07-02 09:29:18.000000000","message":"This is a new resource. Shouldn\u0027t we start with project_id right away? What\u0027s the strategy in relation to keystonev3? Do we maintain tenant_id for all resources, not just those that existed already?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":83,"context_line":"        \u0027id\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":84,"context_line":"               \u0027validate\u0027: {\u0027type:uuid\u0027: None},"},{"line_number":85,"context_line":"               \u0027is_visible\u0027: True, \u0027primary_key\u0027: True},"},{"line_number":86,"context_line":"        \u0027tenant_id\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: False,"},{"line_number":87,"context_line":"                      \u0027required_by_policy\u0027: True,"},{"line_number":88,"context_line":"                      \u0027validate\u0027:"},{"line_number":89,"context_line":"                          {\u0027type:string\u0027: attr.TENANT_ID_MAX_LEN},"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_88b6a63b","line":86,"in_reply_to":"1aa78d24_d7d20f34","updated":"2016-07-02 15:12:46.000000000","message":"Spec [1] did not make mandatory to start with project-id right away and I believe for a good reason. I think the transition to project-id must be \u0027atomic\u0027, and until we know with confidence we can switch over I think it will be problematic to ship an API with mixed attributes, hence here it has tenant-id\n\n[1] http://specs.openstack.org/openstack/neutron-specs/specs/newton/moving-to-keystone-v3.html","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"}],"neutron/extensions/trunk_details.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_233f95d7","line":29,"range":{"start_line":29,"start_character":6,"end_line":29,"end_character":19},"updated":"2016-06-06 22:04:30.000000000","message":"I\u0027m not sure why this is a different extension than the Trunk extension.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_77ae7486","line":29,"range":{"start_line":29,"start_character":6,"end_line":29,"end_character":19},"in_reply_to":"7aa08908_233f95d7","updated":"2016-06-06 22:28:40.000000000","message":"I think this an artifact us trying to review to trunks API and the trunk_details separately. I\u0027m not opposed to combining into a single extension.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_49923f4d","line":29,"updated":"2016-06-24 21:59:09.000000000","message":"do we need the following in this class?\n\n \n    def get_required_extensions(self):\n        return [\"trunk\"]","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_6c28e933","line":29,"in_reply_to":"3aaa91ec_49923f4d","updated":"2016-06-24 22:13:34.000000000","message":"I don\u0027t think so. I don\u0027t feel strongly about it though. The service plugin implements both trunk and trunk-details, so you get both.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"14911823f234a3b1c4aa01eab1f1d3121c571354","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from neutron.api import extensions"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":21,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":22,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":23,"context_line":"                                \u0027is_visible\u0027: True,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_ec99797a","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":23},"updated":"2016-06-24 22:57:12.000000000","message":"So, if these have to be separate extensions, have I create a problem with this [1] one?  What is the problem I\u0027m going to hit here?\n\n [1] https://github.com/openstack/neutron/blob/a711a874a6/neutron/extensions/segment.py#L37-L75","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ccf39cb033f14ba5ea630ff19eeedb3bd597e641","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from neutron.api import extensions"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":21,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":22,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":23,"context_line":"                                \u0027is_visible\u0027: True,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_39ba4fc1","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":23},"in_reply_to":"3aaa91ec_3abf2f62","updated":"2016-06-27 22:30:14.000000000","message":"It is implemented by a service plugin.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"792e381747368c7343182d19c4c2e21d31be2b44","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from neutron.api import extensions"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":21,"context_line":"    \u0027ports\u0027: {\u0027trunk_details\u0027: {\u0027allow_post\u0027: False, \u0027allow_put\u0027: False,"},{"line_number":22,"context_line":"                                \u0027default\u0027: constants.ATTR_NOT_SPECIFIED,"},{"line_number":23,"context_line":"                                \u0027is_visible\u0027: True,"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_3abf2f62","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":23},"in_reply_to":"3aaa91ec_ec99797a","updated":"2016-06-24 23:59:19.000000000","message":"Armando can probably explain it better than me, I\u0027ll just explain what I saw.\n\nBasically the extended attributes aren\u0027t visible on the port unless you do it this way. I was able to see this firsthand. It\u0027s not a blocker for this patch, but it did make me do a double-take. If I understand correctly it has something to do with the fact that the service plugin doesn\u0027t own the port resource, so using EXTENDED_ATTRIBUTES_2_0 doesn\u0027t append the trunk_details on the port.\n\n@Carl is the segments extension implemented by a service plugin or by a core plugin?","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_97c88776","line":29,"updated":"2016-07-02 09:29:18.000000000","message":"What\u0027s the rationale to keep it as a separate extension? Can\u0027t we reuse the \u0027trunk\u0027 one? Is there a use case to have one of them enabled but not another?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":26,"context_line":"}"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class Trunk_details(extensions.ExtensionDescriptor):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    def get_name(cls):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_e8812a4f","line":29,"in_reply_to":"1aa78d24_97c88776","updated":"2016-07-02 15:12:46.000000000","message":"This was brought up and it\u0027s due to the way the service plugin is configured and what resources it owns. Ports are owned by the core plugin and as such adding this extension to the service plugin\u0027s one would break the API controller.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"}],"neutron/services/trunk/db.py":[{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"ad14a90f695fd888588cdeb5d55a39b6ffa767a3","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    \"\"\"Create a trunk (with description) given the parent port uuid.\"\"\""},{"line_number":26,"context_line":"    try:"},{"line_number":27,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":28,"context_line":"            trunk \u003d models.Trunk(id\u003duuidutils.generate_uuid(),"},{"line_number":29,"context_line":"                                 tenant_id\u003dcontext.tenant_id,"},{"line_number":30,"context_line":"                                 port_id\u003dport_id,"},{"line_number":31,"context_line":"                                 description\u003ddescription)"}],"source_content_type":"text/x-python","patch_set":2,"id":"bab6814e_1adcba45","line":28,"updated":"2016-05-23 22:56:16.000000000","message":"Revert the changes in this method. Not needed.","commit_id":"a3238095f83724b78e88ab63aee8acb2cd65a8c6"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d2def0dfa9324a3c9b7b1a9913ce97bdcfc7ad3d","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    \"\"\"Create a trunk (with description) given the parent port uuid.\"\"\""},{"line_number":26,"context_line":"    try:"},{"line_number":27,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":28,"context_line":"            trunk \u003d models.Trunk(id\u003duuidutils.generate_uuid(),"},{"line_number":29,"context_line":"                                 tenant_id\u003dcontext.tenant_id,"},{"line_number":30,"context_line":"                                 port_id\u003dport_id,"},{"line_number":31,"context_line":"                                 description\u003ddescription)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_a1532ee1","line":28,"updated":"2016-05-31 17:24:09.000000000","message":"Should we make use of [1] in this model instead now? I put this together before we had the marching order that new features should go straight and adopt OVO.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/objects/trunk.py","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"ae2c192bcd9b9050b0a17a0f3e55fcfb366ff4c7","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    \"\"\"Create a trunk (with description) given the parent port uuid.\"\"\""},{"line_number":26,"context_line":"    try:"},{"line_number":27,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":28,"context_line":"            trunk \u003d models.Trunk(id\u003duuidutils.generate_uuid(),"},{"line_number":29,"context_line":"                                 tenant_id\u003dcontext.tenant_id,"},{"line_number":30,"context_line":"                                 port_id\u003dport_id,"},{"line_number":31,"context_line":"                                 description\u003ddescription)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_70ae2082","line":28,"in_reply_to":"9abb7d3a_a1532ee1","updated":"2016-05-31 23:53:33.000000000","message":"We probably should. Will address this in a coming patch set.","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"7aa08908_9c5fca40","updated":"2016-06-06 21:15:04.000000000","message":"Please, see [1]. I think we\u0027r doing the same thing in different places :)\n\n[1] https://review.openstack.org/#/c/323518/3/neutron/objects/trunk.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"7aa08908_68c5f13a","in_reply_to":"7aa08908_173610e7","updated":"2016-06-06 23:54:52.000000000","message":"Would you care to review [3] then :) It was a heartbreaking experience moving from that 500-700 lines monstrosity [1] to 2 very small patches [2][3], but I believe that was for good (as it reuses lots of good stuff of NeutronDbObject) :)\n\n[1] https://review.openstack.org/#/c/310410/13\n[2] https://review.openstack.org/#/c/310410/15\n[3] https://review.openstack.org/#/c/323518/3","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"7aa08908_173610e7","in_reply_to":"7aa08908_9c5fca40","updated":"2016-06-06 22:28:40.000000000","message":"Hurry up and merge it already!! :)\n\nSeriously though, let\u0027s try and merge that patch ASAP. We can also abandon it and put the logic in this patch if it will speed things up. This patch is dependent on having this code in place, so I\u0027m not touching this until it\u0027s ironed out. We really want to have the basic CRUD working ASAP, so whatever gets us there fastest is what we should do IMO.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":57,"context_line":"       and segementation_id."},{"line_number":58,"context_line":"    \"\"\""},{"line_number":59,"context_line":"    try:"},{"line_number":60,"context_line":"        if not trunk_utils.is_eligible_parent_port(port_id):"},{"line_number":61,"context_line":"            raise exceptions.ParentPortInUse(port_id)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":64,"context_line":"            subport_obj \u003d trunk_objects.SubPort(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_37ceafb4","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":53},"updated":"2016-06-06 21:15:04.000000000","message":"Unfortunately it\u0027s not that simple. This check does not provide any guarantees as the concurrent session could happens to create a Trunk while we are between L61 and L69. I did not add these checks in [1] so it would be to up to the agent to provide actual guarantees (although I was planning to add such pre-checks in a later patch as an \u0027optimisation\u0027 to fail early in most cases).\n\n[1] https://review.openstack.org/#/c/323518/3/neutron/objects/trunk.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":57,"context_line":"       and segementation_id."},{"line_number":58,"context_line":"    \"\"\""},{"line_number":59,"context_line":"    try:"},{"line_number":60,"context_line":"        if not trunk_utils.is_eligible_parent_port(port_id):"},{"line_number":61,"context_line":"            raise exceptions.ParentPortInUse(port_id)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":64,"context_line":"            subport_obj \u003d trunk_objects.SubPort(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_578ff8cb","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":53},"in_reply_to":"7aa08908_14c60e49","updated":"2016-06-06 22:28:40.000000000","message":"Yes it is. As I stated above, it has nothing to do with the trunk and everything to do with whether the parent port has a port binding or not.  To simplify things, I am checking this on the server-side rather than delegating the check to the agent.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":57,"context_line":"       and segementation_id."},{"line_number":58,"context_line":"    \"\"\""},{"line_number":59,"context_line":"    try:"},{"line_number":60,"context_line":"        if not trunk_utils.is_eligible_parent_port(port_id):"},{"line_number":61,"context_line":"            raise exceptions.ParentPortInUse(port_id)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":64,"context_line":"            subport_obj \u003d trunk_objects.SubPort(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_14c60e49","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":53},"in_reply_to":"7aa08908_37ceafb4","updated":"2016-06-06 22:04:30.000000000","message":"Isn\u0027t this effectively a fail early optimization?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":57,"context_line":"       and segementation_id."},{"line_number":58,"context_line":"    \"\"\""},{"line_number":59,"context_line":"    try:"},{"line_number":60,"context_line":"        if not trunk_utils.is_eligible_parent_port(port_id):"},{"line_number":61,"context_line":"            raise exceptions.ParentPortInUse(port_id)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":64,"context_line":"            subport_obj \u003d trunk_objects.SubPort(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_7407921c","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":53},"in_reply_to":"7aa08908_37ceafb4","updated":"2016-06-06 22:28:40.000000000","message":"This check has nothing to do with the trunk. It\u0027s checking that the parent neutron port does not have a port binding.  The trunk should always exist before the subport is created, even if it\u0027s inside the same transaction because there are foreign key constraints to satisfy.  However, as stated above this check has nothing to do with the trunk.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":57,"context_line":"       and segementation_id."},{"line_number":58,"context_line":"    \"\"\""},{"line_number":59,"context_line":"    try:"},{"line_number":60,"context_line":"        if not trunk_utils.is_eligible_parent_port(port_id):"},{"line_number":61,"context_line":"            raise exceptions.ParentPortInUse(port_id)"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":64,"context_line":"            subport_obj \u003d trunk_objects.SubPort(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_a804f97d","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":53},"in_reply_to":"7aa08908_7407921c","updated":"2016-06-06 23:54:52.000000000","message":"I\u0027ve commented on \u0027is_eligible_parent_port\u0027. I\u0027d say lets keep things simple for now and optimise as needed.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                                          segmentation_id\u003dsegmentation_id)"},{"line_number":69,"context_line":"            subport_obj.create()"},{"line_number":70,"context_line":"            return subport_obj.to_dict()"},{"line_number":71,"context_line":"    except n_exc.PortNotFound:"},{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_97fa03bc","line":72,"range":{"start_line":71,"start_character":0,"end_line":72,"end_character":63},"updated":"2016-06-06 21:15:04.000000000","message":"Please see discussion in [1]. The general idea was to have as few different exception types as possible.\n\n[1] https://review.openstack.org/#/c/310410/12/neutron/services/trunk/exceptions.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                                          segmentation_id\u003dsegmentation_id)"},{"line_number":69,"context_line":"            subport_obj.create()"},{"line_number":70,"context_line":"            return subport_obj.to_dict()"},{"line_number":71,"context_line":"    except n_exc.PortNotFound:"},{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_32b87de5","line":72,"range":{"start_line":71,"start_character":0,"end_line":72,"end_character":63},"in_reply_to":"7aa08908_97fa03bc","updated":"2016-06-06 22:04:30.000000000","message":"Why is having as few exceptions as possible important?  I added my own comments in [1] and I\u0027ll follow up with Armando but I don\u0027t think we should go around saying \"have as few different exception types as possible.\"  If that were a core value, I could do everything with Exception and avoid having any new exception classes.  We need to find the right middle ground and add new exception classes where there is good reason.  For example, I think L75 is an example of a very good reason to add a new exception class.\n\nIf we combine exceptions for different kinds of error conditions we end up having exceptions and default messages that are unhelpful and/or confusing to the end user.  It isn\u0027t expensive to create exception classes.  We should be clearly identifying exceptional conditions and using exception classes, and their accompanying messages, to clearly communicate them to the end user.\n\n [1] https://review.openstack.org/#/c/310410/12/neutron/services/trunk/exceptions.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("},{"line_number":76,"context_line":"                               port_id\u003dport_id,"},{"line_number":77,"context_line":"                               segmentation_id\u003dsegmentation_id,"},{"line_number":78,"context_line":"                               segmentation_type\u003dsegmentation_type,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_d291399b","line":75,"range":{"start_line":75,"start_character":25,"end_line":75,"end_character":41},"updated":"2016-06-06 22:04:30.000000000","message":"Given my comment here [1] I we need to figure out how to detect which exceptional case happened and raise the appropriate exception.\n\n1 - unique constraint on (port_id) is violated\n2 - unique constrant on (trunk_id, segmentation_type, segmentation_id) is violated.  \n\nWithout doing this, the error message is too confusing because the two error conditions have totally different causes and require the end user fix it in two totally different ways.\n\n [1] https://review.openstack.org/#/c/320092/9/neutron/services/trunk/exceptions.py@39","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"539adf1568385f5fe60bf091013a732049a724cd","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("},{"line_number":76,"context_line":"                               port_id\u003dport_id,"},{"line_number":77,"context_line":"                               segmentation_id\u003dsegmentation_id,"},{"line_number":78,"context_line":"                               segmentation_type\u003dsegmentation_type,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3aaa91ec_41f3f60a","line":75,"range":{"start_line":75,"start_character":25,"end_line":75,"end_character":41},"in_reply_to":"7aa08908_28dc89e3","updated":"2016-06-28 21:10:17.000000000","message":"@Ilya:  This patch set is old and didn\u0027t use the OVO objects iiuc.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e42eb67a398b2863345eb648c0f6291e97c49f9d","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("},{"line_number":76,"context_line":"                               port_id\u003dport_id,"},{"line_number":77,"context_line":"                               segmentation_id\u003dsegmentation_id,"},{"line_number":78,"context_line":"                               segmentation_type\u003dsegmentation_type,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_fa26cb66","line":75,"range":{"start_line":75,"start_character":25,"end_line":75,"end_character":41},"in_reply_to":"7aa08908_d291399b","updated":"2016-06-06 22:33:23.000000000","message":"+1, this is too opaque. I felt icky writing it, but hey this patch is WIP :)","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        raise exceptions.NonExistentParentPort(port_id\u003dport_id)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":75,"context_line":"        raise exceptions.DuplicateSubport("},{"line_number":76,"context_line":"                               port_id\u003dport_id,"},{"line_number":77,"context_line":"                               segmentation_id\u003dsegmentation_id,"},{"line_number":78,"context_line":"                               segmentation_type\u003dsegmentation_type,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_28dc89e3","line":75,"range":{"start_line":75,"start_character":25,"end_line":75,"end_character":41},"in_reply_to":"7aa08908_fa26cb66","updated":"2016-06-06 23:54:52.000000000","message":"Did it actually raise DBDuplicateEntry? Because OVO should raise NeutronDbObjectDuplicateEntry (and I believe it only shows the attributes that violated the constraint, so it should be informative enough for the user).","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"}],"neutron/services/trunk/drivers/__init__.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"from neutron.services.trunk.drivers import openvswitch"},{"line_number":16,"context_line":"from neutron.services.trunk.drivers.validator import vlan"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# Register segmentation_type validation drivers"},{"line_number":19,"context_line":"vlan.register()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_16b447f0","line":16,"updated":"2016-06-28 19:52:50.000000000","message":"If we intend to keep this separation between drivers and validators then this should be renamed to \u0027validators\u0027","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"from neutron.services.trunk.drivers import openvswitch"},{"line_number":16,"context_line":"from neutron.services.trunk.drivers.validator import vlan"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"# Register segmentation_type validation drivers"},{"line_number":19,"context_line":"vlan.register()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_026ec1c8","line":16,"in_reply_to":"3aaa91ec_16b447f0","updated":"2016-06-28 20:16:43.000000000","message":"Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":19,"context_line":"vlan.register()"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"# Register backend \"mech\" drivers"},{"line_number":23,"context_line":"openvswitch.register()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_eca1ee47","line":22,"updated":"2016-06-28 19:52:50.000000000","message":"Consider removing this placeholder altogether. It can be added later","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":19,"context_line":"vlan.register()"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"# Register backend \"mech\" drivers"},{"line_number":23,"context_line":"openvswitch.register()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_e270d5a6","line":22,"in_reply_to":"3aaa91ec_eca1ee47","updated":"2016-06-28 20:16:43.000000000","message":"Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"}],"neutron/services/trunk/drivers/openvswitch.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"14911823f234a3b1c4aa01eab1f1d3121c571354","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def vlan_range(segmentation_id):"},{"line_number":36,"context_line":"    return 0 \u003c\u003d segmentation_id \u003c\u003d 4095"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_8c9ef504","line":36,"range":{"start_line":36,"start_character":35,"end_line":36,"end_character":39},"updated":"2016-06-24 22:57:12.000000000","message":"Constants!  [1]\n\nAlso, 0 and 4095 shouldn\u0027t be valid.  According to 802.1Q, they are reserved.  0 means \"priority tag\".  I\u0027m not sure why 4095 is reserved.\n\n[1] https://github.com/openstack/neutron/blob/a711a874a6b39d1253254a9668cca3e50dff8f1c/neutron/plugins/common/constants.py#L78-L79","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"b59d509f167631829424ce35ec6ce0bc2cbc6917","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def vlan_range(segmentation_id):"},{"line_number":36,"context_line":"    return 0 \u003c\u003d segmentation_id \u003c\u003d 4095"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_2cef011f","line":36,"updated":"2016-06-24 22:03:19.000000000","message":"are the edge id\u0027s valid to use? 0 and 4095? I don\u0027t see why they couldn\u0027t be, just want to make sure.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"06f563c306a5d9c45502e0a1314fb67dc43a2eb5","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def vlan_range(segmentation_id):"},{"line_number":36,"context_line":"    return 0 \u003c\u003d segmentation_id \u003c\u003d 4095"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_4c988d1c","line":36,"in_reply_to":"3aaa91ec_2cef011f","updated":"2016-06-24 22:25:37.000000000","message":"Technically 0 can be put on the wire and I know there are vendors that can read it. 4095 isn\u0027t usable. I guess we should really check 1 \u003c\u003d segmentation_id \u003c\u003d 4093","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"792e381747368c7343182d19c4c2e21d31be2b44","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def vlan_range(segmentation_id):"},{"line_number":36,"context_line":"    return 0 \u003c\u003d segmentation_id \u003c\u003d 4095"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_9aae232c","line":36,"range":{"start_line":36,"start_character":35,"end_line":36,"end_character":39},"in_reply_to":"3aaa91ec_8c9ef504","updated":"2016-06-24 23:59:19.000000000","message":"Right, constants are the answer here. This patch should be marked as WIP, I\u0027m being taken too seriously :)","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"435f27ffef36bf2925424849f0a9d38465c329a9","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def vlan_range(segmentation_id):"},{"line_number":36,"context_line":"    return 0 \u003c\u003d segmentation_id \u003c\u003d 4095"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_7376c0d9","line":36,"range":{"start_line":36,"start_character":35,"end_line":36,"end_character":39},"in_reply_to":"3aaa91ec_9aae232c","updated":"2016-06-27 18:14:26.000000000","message":"Done","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":17,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def register():"},{"line_number":21,"context_line":"    # TODO(tidwellr): register for trunk events"},{"line_number":22,"context_line":"    # TODO(armax): add here handlers for RPC notifications"},{"line_number":23,"context_line":"    LOG.debug(\u0027Registering for trunk notifications\u0027)"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_8cfcaa3f","line":20,"updated":"2016-06-28 19:52:50.000000000","message":"at this point, I think the drivers module can be dropped altogether and added later. This seems just placeholder code.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":17,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def register():"},{"line_number":21,"context_line":"    # TODO(tidwellr): register for trunk events"},{"line_number":22,"context_line":"    # TODO(armax): add here handlers for RPC notifications"},{"line_number":23,"context_line":"    LOG.debug(\u0027Registering for trunk notifications\u0027)"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_c7dccb1a","line":20,"in_reply_to":"3aaa91ec_8cfcaa3f","updated":"2016-06-28 20:16:43.000000000","message":"Yes it is placeholder code. I was leaving it in for now just to help illustrate the differences between what you sketched out and what I came to after diving in.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d9a22afff824d1a77ac625789badca5abdfc5728","unresolved":false,"context_lines":[{"line_number":17,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def register():"},{"line_number":21,"context_line":"    # TODO(tidwellr): register for trunk events"},{"line_number":22,"context_line":"    # TODO(armax): add here handlers for RPC notifications"},{"line_number":23,"context_line":"    LOG.debug(\u0027Registering for trunk notifications\u0027)"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_e87277e2","line":20,"in_reply_to":"3aaa91ec_c7dccb1a","updated":"2016-06-28 21:02:22.000000000","message":"understood. You can remove it now ;)","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"}],"neutron/services/trunk/drivers/validator/vlan.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"def register():"},{"line_number":26,"context_line":"    registry.subscribe(handler, trunk_consts.TRUNK_PLUGIN,"},{"line_number":27,"context_line":"                       events.AFTER_CREATE)"},{"line_number":28,"context_line":"    # TODO(armax): add here handlers for RPC notifications"},{"line_number":29,"context_line":"    LOG.debug(\u0027Registering for trunk support\u0027)"},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_76714b44","line":27,"updated":"2016-06-28 19:52:50.000000000","message":"this should now be AFTER_INIT (based on earlier comment)","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":25,"context_line":"def register():"},{"line_number":26,"context_line":"    registry.subscribe(handler, trunk_consts.TRUNK_PLUGIN,"},{"line_number":27,"context_line":"                       events.AFTER_CREATE)"},{"line_number":28,"context_line":"    # TODO(armax): add here handlers for RPC notifications"},{"line_number":29,"context_line":"    LOG.debug(\u0027Registering for trunk support\u0027)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_369ea354","line":28,"updated":"2016-06-28 19:52:50.000000000","message":"this comment should go","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":30,"context_line":""},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"def handler(resource, event, trigger, **kwargs):"},{"line_number":33,"context_line":"    trigger.add_segmentation_type(trunk_consts.VLAN, vlan_range)"},{"line_number":34,"context_line":"    LOG.debug(\u0027Registration complete\u0027)"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_6c7cdeb5","line":33,"updated":"2016-06-28 19:52:50.000000000","message":"I wonder if here we want to give the handler the ability to know what other segmentation types are available for support so that the insertion can be made conditional","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def vlan_range(segmentation_id):"},{"line_number":38,"context_line":"    min, max \u003d common_consts.MIN_VLAN_TAG, common_consts.MAX_VLAN_TAG"},{"line_number":39,"context_line":"    return min \u003c\u003d segmentation_id \u003c\u003d max"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_b6b8d3c8","line":38,"updated":"2016-06-28 19:52:50.000000000","message":"please do not shadow built-in functions.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def vlan_range(segmentation_id):"},{"line_number":38,"context_line":"    min, max \u003d common_consts.MIN_VLAN_TAG, common_consts.MAX_VLAN_TAG"},{"line_number":39,"context_line":"    return min \u003c\u003d segmentation_id \u003c\u003d max"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_67ed17b7","line":38,"in_reply_to":"3aaa91ec_b6b8d3c8","updated":"2016-06-28 20:16:43.000000000","message":"Oops!","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"}],"neutron/services/trunk/exceptions.py":[{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"7aa08908_b71c5fc2","updated":"2016-06-06 21:15:04.000000000","message":"Please see [1]. The general idea was to have as few exception types as possible.\n\n[1] https://review.openstack.org/#/c/310410/12/neutron/services/trunk/exceptions.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":30,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":31,"context_line":"                \"eligible for use a a parent port.\")"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_8642d73c","line":30,"range":{"start_line":30,"start_character":54,"end_line":30,"end_character":56},"updated":"2016-06-06 22:04:30.000000000","message":"*and?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":30,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":31,"context_line":"                \"eligible for use a a parent port.\")"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_265b2330","line":30,"range":{"start_line":30,"start_character":37,"end_line":30,"end_character":50},"updated":"2016-06-06 22:04:30.000000000","message":"swap order of these two words?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e42eb67a398b2863345eb648c0f6291e97c49f9d","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":30,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":31,"context_line":"                \"eligible for use a a parent port.\")"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_7a777b3a","line":30,"range":{"start_line":30,"start_character":54,"end_line":30,"end_character":56},"in_reply_to":"7aa08908_8642d73c","updated":"2016-06-06 22:33:23.000000000","message":"Done","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":30,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":31,"context_line":"                \"eligible for use a a parent port.\")"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class NonExistentParentPort(n_exc.NotFound):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_a647134a","line":31,"range":{"start_line":31,"start_character":34,"end_line":31,"end_character":38},"updated":"2016-06-06 22:04:30.000000000","message":"duplicate word","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e42eb67a398b2863345eb648c0f6291e97c49f9d","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":30,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":31,"context_line":"                \"eligible for use a a parent port.\")"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class NonExistentParentPort(n_exc.NotFound):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_5a727f4a","line":31,"range":{"start_line":31,"start_character":34,"end_line":31,"end_character":38},"in_reply_to":"7aa08908_a647134a","updated":"2016-06-06 22:33:23.000000000","message":"Done","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class DuplicateSubport(n_exc.InUse):"},{"line_number":39,"context_line":"    message \u003d _(\"Subports must not use duplicate parent ports. \""},{"line_number":40,"context_line":"                \"Port %(port_id)s should be not be used by other trunks or \""},{"line_number":41,"context_line":"                \"subports. segmentation_type %(segmentation_type)s and \""},{"line_number":42,"context_line":"                \"segmentation_id %(segmentation_id)s pair should be unique \""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_66640be5","line":39,"range":{"start_line":39,"start_character":17,"end_line":39,"end_character":61},"updated":"2016-06-06 22:04:30.000000000","message":"I\u0027m not sure what this means.  From what I can tell, the following tuples are enforced unique by the DB and could cause this exception and getting a duplicate entry might mean different things.  It is hard to explain in a single error message when one of a few different problems could\u0027ve caused it.\n\n  (port_id) # \n  (port_id, trunk_id) # Primary key\n  (trunk_id, segmentation_type, segmentation_id)\n\nThe first one means the port_id is unique in the table.  The second one means the port_id can\u0027t be added to the same trunk id twice (redundant but its a result of the primary key).  The third one means that the same segmentation type and id can\u0027t be added twice under a given trunk id.  The wording below just doesn\u0027t communicate this to me effectively.\n\nThe first and third, are two different things and shouldn\u0027t be reported in a single generic exception.\n\nI actually think I see some problems with the current model.  I might put up a patch to show what I mean but that is out of the scope of this patch set.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e42eb67a398b2863345eb648c0f6291e97c49f9d","unresolved":false,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class DuplicateSubport(n_exc.InUse):"},{"line_number":39,"context_line":"    message \u003d _(\"Subports must not use duplicate parent ports. \""},{"line_number":40,"context_line":"                \"Port %(port_id)s should be not be used by other trunks or \""},{"line_number":41,"context_line":"                \"subports. segmentation_type %(segmentation_type)s and \""},{"line_number":42,"context_line":"                \"segmentation_id %(segmentation_id)s pair should be unique \""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_7aa01ba0","line":39,"range":{"start_line":39,"start_character":17,"end_line":39,"end_character":61},"in_reply_to":"7aa08908_66640be5","updated":"2016-06-06 22:33:23.000000000","message":"This exception is icky, totally agree. I needed to take a shower after pushing this patch set :) I\u0027ll re-work this. I\u0027m curious what you\u0027re seeing in the model that isn\u0027t computing for you.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"539adf1568385f5fe60bf091013a732049a724cd","unresolved":false,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class DuplicateSubport(n_exc.InUse):"},{"line_number":39,"context_line":"    message \u003d _(\"Subports must not use duplicate parent ports. \""},{"line_number":40,"context_line":"                \"Port %(port_id)s should be not be used by other trunks or \""},{"line_number":41,"context_line":"                \"subports. segmentation_type %(segmentation_type)s and \""},{"line_number":42,"context_line":"                \"segmentation_id %(segmentation_id)s pair should be unique \""}],"source_content_type":"text/x-python","patch_set":9,"id":"3aaa91ec_a1c57a5c","line":39,"range":{"start_line":39,"start_character":17,"end_line":39,"end_character":61},"in_reply_to":"7aa08908_7aa01ba0","updated":"2016-06-28 21:10:17.000000000","message":"I ended up just changing the primary key.  I actually was going to add an index to trunk_id too but Ilya pointed out that that was redundant given the index on (trunk_id, segmentation_type, segmentation_id).  My changes have merged by now.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":37,"context_line":""},{"line_number":38,"context_line":"class DuplicateSubport(n_exc.InUse):"},{"line_number":39,"context_line":"    message \u003d _(\"Subports must not use duplicate parent ports. \""},{"line_number":40,"context_line":"                \"Port %(port_id)s should be not be used by other trunks or \""},{"line_number":41,"context_line":"                \"subports. segmentation_type %(segmentation_type)s and \""},{"line_number":42,"context_line":"                \"segmentation_id %(segmentation_id)s pair should be unique \""},{"line_number":43,"context_line":"                \"on trunk %(trunk_id)s.\")"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_86b01745","line":40,"range":{"start_line":40,"start_character":41,"end_line":40,"end_character":43},"updated":"2016-06-06 22:04:30.000000000","message":"drop \"be\" here","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"class TrunkNotFound(n_exc.NotFound):"},{"line_number":26,"context_line":"    message \u003d _(\"Trunk %(id)s could not be found.\")"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class ParentPortInUse(n_exc.InUse):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_9932230f","line":26,"range":{"start_line":26,"start_character":25,"end_line":26,"end_character":27},"updated":"2016-06-07 09:51:42.000000000","message":"We got a small naming conflict here with base patch :) I\u0027d sugggest we use \u0027trunk_id\u0027 for consistency with \u0027port_id\u0027 in other exceptions.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":14605,"name":"vikram.choudhary","email":"vikschw@gmail.com","username":"vikram.choudhary"},"change_message_id":"5ec11b16ef42fb93ed0afaa7bdd2777c230b7d2e","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":35,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":36,"context_line":"                \"eligible for use a a parent port.\")"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_c4cec259","line":35,"updated":"2016-06-22 06:48:21.000000000","message":"nit: %s/an/and/g","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":35,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":36,"context_line":"                \"eligible for use a a parent port.\")"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_eb4d6a9a","line":35,"in_reply_to":"3aaa91ec_c4cec259","updated":"2016-06-22 17:04:18.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":35,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":36,"context_line":"                \"eligible for use a a parent port.\")"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_2e4f8abe","line":36,"updated":"2016-06-22 15:42:22.000000000","message":"another typo.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":35,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use an is not \""},{"line_number":36,"context_line":"                \"eligible for use a a parent port.\")"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_8b5f8640","line":36,"in_reply_to":"3aaa91ec_2e4f8abe","updated":"2016-06-22 17:04:18.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class DuplicateSubPort(n_exc.Conflict):"},{"line_number":35,"context_line":"    def __init__(self, message\u003dNone):"},{"line_number":36,"context_line":"        self.message \u003d message"},{"line_number":37,"context_line":"        super(DuplicateSubPort, self).__init__()"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_96db171b","line":36,"updated":"2016-06-28 19:52:50.000000000","message":"why is this crafted like this? Shouldn\u0027t this use the usual pattern like the one above and below?","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":33,"context_line":""},{"line_number":34,"context_line":"class DuplicateSubPort(n_exc.Conflict):"},{"line_number":35,"context_line":"    def __init__(self, message\u003dNone):"},{"line_number":36,"context_line":"        self.message \u003d message"},{"line_number":37,"context_line":"        super(DuplicateSubPort, self).__init__()"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_e784670c","line":36,"in_reply_to":"3aaa91ec_96db171b","updated":"2016-06-28 20:16:43.000000000","message":"Re-working this. Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"2908b6e124fb8ab0220311f2b9251b5dd48dc63d","unresolved":false,"context_lines":[{"line_number":36,"context_line":"                \"%(segmentation_id)s already in use on trunk %(trunk_id)s.\")"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"class ParentPortInUse(n_exc.InUse):"},{"line_number":40,"context_line":"    message \u003d _(\"Port %(port_id)s is in currently use and is not \""},{"line_number":41,"context_line":"                \"eligible for use as a parent port.\")"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_0738e53c","line":39,"updated":"2016-07-01 17:03:15.000000000","message":"Looking at this with fresh eyes, I\u0027m thinking it may be good to distinguish between ParentPortInUse and TrunkPortInUse a little more clearly. I had been thinking ParentPortInUse would indicate that the port_id supplied to either a trunk or a subport is a) already referenced by a trunk, b) already reference by a subport, or c) the port has a port binding and a device_owner of \"compute:XXXXXXXX\" (meaning someone booted a VM on that port).\n\nIt may be that this error should only be applied to case c. Thoughts?","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"}],"neutron/services/trunk/plugin.py":[{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"97ebffbfcb0fa79b9d6047b1aa48ee3c709a38dc","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":27,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":28,"context_line":"    port_res[\u0027trunk_details\u0027] \u003d \u0027foobar\u0027"},{"line_number":29,"context_line":"    return port_res"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bab6814e_a871bae2","line":28,"range":{"start_line":28,"start_character":4,"end_line":28,"end_character":40},"updated":"2016-05-24 17:00:35.000000000","message":"I know this is WIP, but what will be putting into trunk_details?\n\nList of subports, each w/ the subport\u0027s parent port_id, segmentation_type, and segmentation_id?\nWill a port that is used as a subport have trunk_details?","commit_id":"a3238095f83724b78e88ab63aee8acb2cd65a8c6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"791397b32215a9c8cfc2b7c035008669f7951cf2","unresolved":false,"context_lines":[{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":27,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":28,"context_line":"    port_res[\u0027trunk_details\u0027] \u003d \u0027foobar\u0027"},{"line_number":29,"context_line":"    return port_res"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_da3a15cd","line":28,"range":{"start_line":28,"start_character":4,"end_line":28,"end_character":40},"in_reply_to":"bab6814e_a871bae2","updated":"2016-05-27 18:40:53.000000000","message":"See L37. It\u0027s commented out for now since there mocks that don\u0027t expect trunk details in the RPC. Just trying to minimize test failures for the moment.","commit_id":"a3238095f83724b78e88ab63aee8acb2cd65a8c6"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5a7b736efde649d67251913dbe944d9a4d004314","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":99,"context_line":"        subport_objs \u003d trunk_objects.SubPort.get_objects(context,"},{"line_number":100,"context_line":"                                                         trunk_id\u003dtrunk_id)"},{"line_number":101,"context_line":"        res_list \u003d []"},{"line_number":102,"context_line":"        for subport in subport_objs:"},{"line_number":103,"context_line":"            res_list.append(subport.to_dict())"},{"line_number":104,"context_line":"        #TODO(tidwellr) implement filters"},{"line_number":105,"context_line":"        return {\"ports\": res_list}"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_1f7ff415","line":103,"range":{"start_line":101,"start_character":8,"end_line":103,"end_character":46},"updated":"2016-05-31 16:36:32.000000000","message":"This could be a list comprehension:\n\nsubports \u003d [subport.to_dict() for subport in subport_objs]","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"ae2c192bcd9b9050b0a17a0f3e55fcfb366ff4c7","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":99,"context_line":"        subport_objs \u003d trunk_objects.SubPort.get_objects(context,"},{"line_number":100,"context_line":"                                                         trunk_id\u003dtrunk_id)"},{"line_number":101,"context_line":"        res_list \u003d []"},{"line_number":102,"context_line":"        for subport in subport_objs:"},{"line_number":103,"context_line":"            res_list.append(subport.to_dict())"},{"line_number":104,"context_line":"        #TODO(tidwellr) implement filters"},{"line_number":105,"context_line":"        return {\"ports\": res_list}"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_f074d036","line":103,"range":{"start_line":101,"start_character":8,"end_line":103,"end_character":46},"in_reply_to":"9abb7d3a_1f7ff415","updated":"2016-05-31 23:53:33.000000000","message":"Done","commit_id":"e8578ac9d99a6f4c6fed4e134433b8bda8e9235a"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        if subports !\u003d constants.ATTR_NOT_SPECIFIED:"},{"line_number":77,"context_line":"            try:"},{"line_number":78,"context_line":"                # NOTE(tidwellr) foreign keys checks aren\u0027t deferred, meaning"},{"line_number":79,"context_line":"                # we have to commit the trunk to the DB first then store"},{"line_number":80,"context_line":"                # subports in a separate transaction. Rollback involves"},{"line_number":81,"context_line":"                # removing the trunk we wrote into the DB."},{"line_number":82,"context_line":"                self.add_subports(context, trunk_res[\u0027id\u0027], subports)"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_74303202","line":79,"range":{"start_line":79,"start_character":18,"end_line":79,"end_character":35},"updated":"2016-06-06 22:04:30.000000000","message":"I\u0027m not convinced.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        if subports !\u003d constants.ATTR_NOT_SPECIFIED:"},{"line_number":77,"context_line":"            try:"},{"line_number":78,"context_line":"                # NOTE(tidwellr) foreign keys checks aren\u0027t deferred, meaning"},{"line_number":79,"context_line":"                # we have to commit the trunk to the DB first then store"},{"line_number":80,"context_line":"                # subports in a separate transaction. Rollback involves"},{"line_number":81,"context_line":"                # removing the trunk we wrote into the DB."},{"line_number":82,"context_line":"                self.add_subports(context, trunk_res[\u0027id\u0027], subports)"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_9a3a2797","line":79,"range":{"start_line":79,"start_character":18,"end_line":79,"end_character":35},"in_reply_to":"7aa08908_74303202","updated":"2016-06-06 22:28:40.000000000","message":"I can show you the test failures.\n\nSee http://dev.mysql.com/doc/refman/5.7/en/innodb-foreign-key-constraints.html\n\n\"InnoDB checks foreign key constraints immediately\".\n\nI can\u0027t get unit tests to pass at the moment unless I run it this way. This is icky, but is just temporary until I figure out the right way to run a single transaction.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"64cf9a300d1f66fba264e9129b2efdccf84f0769","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        if subports !\u003d constants.ATTR_NOT_SPECIFIED:"},{"line_number":77,"context_line":"            try:"},{"line_number":78,"context_line":"                # NOTE(tidwellr) foreign keys checks aren\u0027t deferred, meaning"},{"line_number":79,"context_line":"                # we have to commit the trunk to the DB first then store"},{"line_number":80,"context_line":"                # subports in a separate transaction. Rollback involves"},{"line_number":81,"context_line":"                # removing the trunk we wrote into the DB."},{"line_number":82,"context_line":"                self.add_subports(context, trunk_res[\u0027id\u0027], subports)"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_03508e5d","line":79,"range":{"start_line":79,"start_character":18,"end_line":79,"end_character":35},"in_reply_to":"7aa08908_88293d8c","updated":"2016-06-07 00:31:56.000000000","message":"The point is that I tried running it all in a single transaction, it surprisingly wasn\u0027t working, so it led me to this temporarily. I just haven\u0027t found the right oslo and/or sqlalchemy knobs to run the transaction correctly. I think the solution may be as simple as using db_api.autonested_transaction.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        if subports !\u003d constants.ATTR_NOT_SPECIFIED:"},{"line_number":77,"context_line":"            try:"},{"line_number":78,"context_line":"                # NOTE(tidwellr) foreign keys checks aren\u0027t deferred, meaning"},{"line_number":79,"context_line":"                # we have to commit the trunk to the DB first then store"},{"line_number":80,"context_line":"                # subports in a separate transaction. Rollback involves"},{"line_number":81,"context_line":"                # removing the trunk we wrote into the DB."},{"line_number":82,"context_line":"                self.add_subports(context, trunk_res[\u0027id\u0027], subports)"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_88293d8c","line":79,"range":{"start_line":79,"start_character":18,"end_line":79,"end_character":35},"in_reply_to":"7aa08908_9a3a2797","updated":"2016-06-06 23:54:52.000000000","message":"You just need to create trunk and it\u0027s sub-ports in a single transaction (as in Trunk.create [1] :) )\n\n[1] https://review.openstack.org/#/c/323518/","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":73,"context_line":"        subports \u003d trunk.get(\u0027sub_ports\u0027)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        trunk_res \u003d trunk_db.create_trunk(context, trunk[\u0027port_id\u0027])"},{"line_number":76,"context_line":"        if subports !\u003d constants.ATTR_NOT_SPECIFIED:"},{"line_number":77,"context_line":"            try:"},{"line_number":78,"context_line":"                # NOTE(tidwellr) foreign keys checks aren\u0027t deferred, meaning"},{"line_number":79,"context_line":"                # we have to commit the trunk to the DB first then store"},{"line_number":80,"context_line":"                # subports in a separate transaction. Rollback involves"},{"line_number":81,"context_line":"                # removing the trunk we wrote into the DB."},{"line_number":82,"context_line":"                self.add_subports(context, trunk_res[\u0027id\u0027], subports)"},{"line_number":83,"context_line":"                trunk_res[\u0027sub_ports\u0027] \u003d subports"},{"line_number":84,"context_line":"            except Exception as e:"},{"line_number":85,"context_line":"                self.delete_trunk(context, trunk_res[\u0027id\u0027])"},{"line_number":86,"context_line":"                raise e"},{"line_number":87,"context_line":"        else:"},{"line_number":88,"context_line":"            trunk_res[\u0027sub_ports\u0027] \u003d []"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        return trunk_res"},{"line_number":91,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_1c38fa9f","line":88,"range":{"start_line":75,"start_character":0,"end_line":88,"end_character":39},"updated":"2016-06-06 21:15:04.000000000","message":"Please see [1] for Trunk init/create with sub_ports (note that it could raise NeutronDbDuplicate exception, but it\u0027s message seems to be quite informative).\n\n[1] https://review.openstack.org/#/c/323518/3/neutron/objects/trunk.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":93,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":94,"context_line":"        trunk_db.delete_trunk(context, trunk_id)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_bc68c688","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":29},"updated":"2016-06-06 21:15:04.000000000","message":"trunk \u003d Trunk.get_object(context, id\u003dtrunk_id)\nif trunk is None:\n  raise TrunkNotFound(...)\ntrunk.delete()","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"64cf9a300d1f66fba264e9129b2efdccf84f0769","unresolved":false,"context_lines":[{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":93,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":94,"context_line":"        trunk_db.delete_trunk(context, trunk_id)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_23966a4c","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":29},"in_reply_to":"7aa08908_3d7ded1c","updated":"2016-06-07 00:31:56.000000000","message":"+1. I really am not a fan of it of the helpers in services/trunk/db.py. The logic embedded in NeutronDbObject is very useful.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":93,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":94,"context_line":"        trunk_db.delete_trunk(context, trunk_id)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_3d7ded1c","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":29},"in_reply_to":"7aa08908_b75e1ce7","updated":"2016-06-06 23:54:52.000000000","message":"I think we should get rid of services/trunk/db.py and related tests as most of those helpers are rather trivial. We got a lot of good stuff (and tests) built in NeutronDbObject itself. IMHO the only thing that is missing is the Trunk.create with sub_ports (and [1] addresses that).\n\nAlso note that get_object will return None if the object could not be found.\n\n[1] https://review.openstack.org/#/c/323518/","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":93,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":94,"context_line":"        trunk_db.delete_trunk(context, trunk_id)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_b75e1ce7","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":29},"in_reply_to":"7aa08908_bc68c688","updated":"2016-06-06 22:28:40.000000000","message":"Why? This same logic is (or can be) embedded in https://review.openstack.org/#/c/320092/10/neutron/services/trunk/db.py at L49","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":98,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":99,"context_line":"            res \u003d []"},{"line_number":100,"context_line":"            for subport in subports:"},{"line_number":101,"context_line":"                res.append(trunk_db.create_subport(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_9ce86ae4","line":98,"range":{"start_line":98,"start_character":13,"end_line":98,"end_character":34},"updated":"2016-06-06 21:15:04.000000000","message":"nit: I\u0027d suggest db_api.autonested_transaction here","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2e66a855d21087d4f6055fbd2d3399343684403a","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":98,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":99,"context_line":"            res \u003d []"},{"line_number":100,"context_line":"            for subport in subports:"},{"line_number":101,"context_line":"                res.append(trunk_db.create_subport(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_28976991","line":98,"range":{"start_line":98,"start_character":13,"end_line":98,"end_character":34},"in_reply_to":"7aa08908_973a0097","updated":"2016-06-06 23:29:14.000000000","message":"++  Feels icky to me too.  :)","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":98,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":99,"context_line":"            res \u003d []"},{"line_number":100,"context_line":"            for subport in subports:"},{"line_number":101,"context_line":"                res.append(trunk_db.create_subport(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_1d73d1e8","line":98,"range":{"start_line":98,"start_character":13,"end_line":98,"end_character":34},"in_reply_to":"7aa08908_973a0097","updated":"2016-06-06 23:54:52.000000000","message":"\u003e FK constraints are being applied immediately\n\nIIRC they are applied on commit in case of the galera cluster and will raise Deadlock (and we need to handle that anyway for other reasons too), but I\u0027m not 100% sure about that.\n\nMy point was that we should not start separate transaction (if we already have one) unless it is really necessary.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":98,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":99,"context_line":"            res \u003d []"},{"line_number":100,"context_line":"            for subport in subports:"},{"line_number":101,"context_line":"                res.append(trunk_db.create_subport(context,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_973a0097","line":98,"range":{"start_line":98,"start_character":13,"end_line":98,"end_character":34},"in_reply_to":"7aa08908_9ce86ae4","updated":"2016-06-06 22:28:40.000000000","message":"I think you\u0027re right. The FK constraints are being applied immediately rather than on commit when a trunk and subports are created in the same transaction. As you can see above I\u0027m creating them in separate transactions, then handling rollback with its own transaction. It\u0027s feels icky to me, I wonder if this will help.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":96,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":97,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":98,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":99,"context_line":"            res \u003d []"},{"line_number":100,"context_line":"            for subport in subports:"},{"line_number":101,"context_line":"                res.append(trunk_db.create_subport(context,"},{"line_number":102,"context_line":"                                                 trunk_id,"},{"line_number":103,"context_line":"                                                 subport[\u0027port_id\u0027],"},{"line_number":104,"context_line":"                                                 subport[\u0027segmentation_type\u0027],"},{"line_number":105,"context_line":"                                                 subport[\u0027segmentation_id\u0027]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        return res"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_bcc4465f","line":105,"range":{"start_line":99,"start_character":12,"end_line":105,"end_character":77},"updated":"2016-06-06 21:15:04.000000000","message":"See L94-L98 in [1]\n\n[1] https://review.openstack.org/#/c/323518/3/neutron/objects/trunk.py","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # Expect subports to be a list of uuids"},{"line_number":112,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":113,"context_line":"            for subport_id in subports:"},{"line_number":114,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":115,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":116,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":117,"context_line":"                subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_1cde3a11","line":114,"updated":"2016-06-06 21:15:04.000000000","message":"Please use SubPort.get_object() or get_objects() instead of SubPort()","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # Expect subports to be a list of uuids"},{"line_number":112,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":113,"context_line":"            for subport_id in subports:"},{"line_number":114,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":115,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":116,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":117,"context_line":"                subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_ba9ba3c8","line":114,"in_reply_to":"7aa08908_1cde3a11","updated":"2016-06-06 22:28:40.000000000","message":"For my benefit could you explain why this doesn\u0027t work? I\u0027m still new to OVO, but this is doing working as I expect. What subtleties am I missing?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"64cf9a300d1f66fba264e9129b2efdccf84f0769","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # Expect subports to be a list of uuids"},{"line_number":112,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":113,"context_line":"            for subport_id in subports:"},{"line_number":114,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":115,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":116,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":117,"context_line":"                subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_c301666c","line":114,"in_reply_to":"7aa08908_9d15019d","updated":"2016-06-07 00:31:56.000000000","message":"Makes sense that the non-nullable fields would cause an issue.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # Expect subports to be a list of uuids"},{"line_number":112,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":113,"context_line":"            for subport_id in subports:"},{"line_number":114,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":115,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":116,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":117,"context_line":"                subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_9d15019d","line":114,"in_reply_to":"7aa08908_ba9ba3c8","updated":"2016-06-06 23:54:52.000000000","message":"IIRC I had some issues with OVO non-nullable field constraints (segmentation_type/id in this case). But if this works the way you did then it should probably be fine (and it is more efficient as get_object requires an additional DB call).","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"544ebc632fb36525f0f5d90c2c91da044aa51f51","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # Expect subports to be a list of uuids"},{"line_number":112,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":113,"context_line":"            for subport_id in subports:"},{"line_number":114,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":115,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":116,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":117,"context_line":"                subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_0ed715c0","line":114,"in_reply_to":"7aa08908_c301666c","updated":"2016-06-07 01:05:52.000000000","message":"It seems that VersionedObject does allow one to skip attributes in the object\u0027s __init__ without checking constraints and so there\u0027s no need for get_object here (the same applies to delete_trunk as well).\n\nNote that you\u0027d have to handle ObjectNotFound (I think it\u0027s the right one) exception anyway.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        subport_objs \u003d trunk_objects.SubPort.get_objects(context,"},{"line_number":123,"context_line":"                                                         trunk_id\u003dtrunk_id,"},{"line_number":124,"context_line":"                                                         **filters)"},{"line_number":125,"context_line":"        res_list \u003d []"},{"line_number":126,"context_line":"        for subport in subport_objs:"},{"line_number":127,"context_line":"            res_list.append(subport.to_dict())"},{"line_number":128,"context_line":"        return {\"ports\": res_list}"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_5cd282d3","line":127,"range":{"start_line":125,"start_character":8,"end_line":127,"end_character":46},"updated":"2016-06-06 21:15:04.000000000","message":"nit: I\u0027d use list comprehension here","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        subport_objs \u003d trunk_objects.SubPort.get_objects(context,"},{"line_number":123,"context_line":"                                                         trunk_id\u003dtrunk_id,"},{"line_number":124,"context_line":"                                                         **filters)"},{"line_number":125,"context_line":"        res_list \u003d []"},{"line_number":126,"context_line":"        for subport in subport_objs:"},{"line_number":127,"context_line":"            res_list.append(subport.to_dict())"},{"line_number":128,"context_line":"        return {\"ports\": res_list}"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_775674d3","line":127,"range":{"start_line":125,"start_character":8,"end_line":127,"end_character":46},"in_reply_to":"7aa08908_5cd282d3","updated":"2016-06-06 22:28:40.000000000","message":"Done","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":60,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":61,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":62,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":63,"context_line":"        filters \u003d filters or {}"},{"line_number":64,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_84ed9627","line":61,"range":{"start_line":61,"start_character":19,"end_line":61,"end_character":74},"updated":"2016-06-07 09:51:42.000000000","message":"Please see [1] for _pager in get_objects.\n\n[1] https://review.openstack.org/#/c/300055/16/neutron/objects/db/api.py","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":60,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":61,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":62,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":63,"context_line":"        filters \u003d filters or {}"},{"line_number":64,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_81556cfb","line":61,"range":{"start_line":61,"start_character":19,"end_line":61,"end_character":74},"in_reply_to":"7aa08908_84ed9627","updated":"2016-06-07 15:13:06.000000000","message":"Done","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":69,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":70,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":71,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":72,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":73,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":74,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_c4b83ee8","line":71,"range":{"start_line":71,"start_character":40,"end_line":71,"end_character":69},"updated":"2016-06-07 09:51:42.000000000","message":"\u0027id\u0027 is auto-generated (see HasId model mixin).","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":70,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":71,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":72,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":73,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":74,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"},{"line_number":75,"context_line":"        trunk_obj.create()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_44744efc","line":72,"range":{"start_line":72,"start_character":40,"end_line":72,"end_character":68},"updated":"2016-06-07 09:51:42.000000000","message":"Is it really passed to the plugin in \u0027trunk\u0027? I think it should be inherited from the \u0027context\u0027 (if so, Trunk\u0027s init/create will take care of that and that line can be removed).","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"ca4ad5d2a778885975e11e43564699ed7f28eace","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":70,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":71,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":72,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":73,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":74,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"},{"line_number":75,"context_line":"        trunk_obj.create()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_ed49c1b8","line":72,"range":{"start_line":72,"start_character":40,"end_line":72,"end_character":68},"in_reply_to":"7aa08908_1e0b9d8f","updated":"2016-06-07 16:04:20.000000000","message":"Ok, you are right, and it\u0027s done that way in [1]. It\u0027s just that we had tenant_id\u003dcontext.tenant_id in [2]. But looking at [3], trunk[\u0027tenant_id\u0027] is indeed the way it should be.\n\n[1] https://github.com/openstack/neutron/blob/3d3f0595ebb3a20949d52b7226a2d4551f0eaf6d/neutron/plugins/ml2/plugin.py#L677-L678\n[2] https://github.com/openstack/neutron/blob/3d3f0595ebb3a20949d52b7226a2d4551f0eaf6d/neutron/services/trunk/db.py#L31\n[3] https://github.com/openstack/neutron/blob/3d3f0595ebb3a20949d52b7226a2d4551f0eaf6d/neutron/api/v2/attributes.py#L442","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":70,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":71,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":72,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":73,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":74,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"},{"line_number":75,"context_line":"        trunk_obj.create()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_1e0b9d8f","line":72,"range":{"start_line":72,"start_character":40,"end_line":72,"end_character":68},"in_reply_to":"7aa08908_44744efc","updated":"2016-06-07 15:13:06.000000000","message":"It really is passed on the resource. I was not seeing tenant_id being persisted without passing it this way.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":79,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":80,"context_line":"        trunk_objects.Trunk.get_object(context, id\u003dtrunk_id).delete()"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":83,"context_line":"    def add_subports(self, context, trunk_id, subports):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_dfd2cbd1","line":80,"range":{"start_line":80,"start_character":22,"end_line":80,"end_character":38},"updated":"2016-06-07 09:51:42.000000000","message":"I think you could follow your \u0027remove_subports\u0027 approach here and use Trunk() instead of Trunk.get_object.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":79,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":80,"context_line":"        trunk_objects.Trunk.get_object(context, id\u003dtrunk_id).delete()"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":83,"context_line":"    def add_subports(self, context, trunk_id, subports):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_9f2cc303","line":80,"range":{"start_line":80,"start_character":28,"end_line":80,"end_character":69},"updated":"2016-06-07 09:51:42.000000000","message":"nit: I\u0027d split it into 2 lines for readability\n\nand please be aware that Trunk.get_object would return None if object is not found","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":79,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":80,"context_line":"        trunk_objects.Trunk.get_object(context, id\u003dtrunk_id).delete()"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":83,"context_line":"    def add_subports(self, context, trunk_id, subports):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_610cc03b","line":80,"range":{"start_line":80,"start_character":28,"end_line":80,"end_character":69},"in_reply_to":"7aa08908_9f2cc303","updated":"2016-06-07 15:13:06.000000000","message":"yes, returning None would be bad here :)","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":82,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":83,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":84,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":85,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":86,"context_line":"            res \u003d []"},{"line_number":87,"context_line":"            for subport in subports:"},{"line_number":88,"context_line":"                obj \u003d trunk_objects.SubPort("}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_3f002faa","line":85,"range":{"start_line":85,"start_character":13,"end_line":85,"end_character":56},"updated":"2016-06-07 09:51:42.000000000","message":"nit: I\u0027d use \u0027db_api.autonested_transaction(context.session)\u0027 here (it does the same, but I think it\u0027s a nice \u0027default\u0027 transaction wrapper).","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":82,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":83,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":84,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":85,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":86,"context_line":"            res \u003d []"},{"line_number":87,"context_line":"            for subport in subports:"},{"line_number":88,"context_line":"                obj \u003d trunk_objects.SubPort("}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_de4475b8","line":85,"range":{"start_line":85,"start_character":13,"end_line":85,"end_character":56},"in_reply_to":"7aa08908_3f002faa","updated":"2016-06-07 15:13:06.000000000","message":"Oops, I forgot to change this section","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            res \u003d []"},{"line_number":87,"context_line":"            for subport in subports:"},{"line_number":88,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":89,"context_line":"                               context\u003dcontext,"},{"line_number":90,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":91,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":92,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_1fdf336a","line":89,"range":{"start_line":89,"start_character":31,"end_line":89,"end_character":39},"updated":"2016-06-07 09:51:42.000000000","message":"nit: we could avoid \u0027context\u003d\u0027 here for consistency with other uses of OVO constructors (e.g. L104).","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            res \u003d []"},{"line_number":87,"context_line":"            for subport in subports:"},{"line_number":88,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":89,"context_line":"                               context\u003dcontext,"},{"line_number":90,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":91,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":92,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_be6fe929","line":89,"range":{"start_line":89,"start_character":31,"end_line":89,"end_character":39},"in_reply_to":"7aa08908_1fdf336a","updated":"2016-06-07 15:13:06.000000000","message":"Done","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":105,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":106,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":107,"context_line":"                subport_obj.delete()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":110,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_d1911f54","line":107,"range":{"start_line":107,"start_character":0,"end_line":107,"end_character":36},"updated":"2016-06-07 09:51:42.000000000","message":"That could raise ObjectNotFound (with very uninformative message). But I think you can leave it as is for now. We\u0027d better fix OVO to raise more informative message instead.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                subport_obj \u003d trunk_objects.SubPort(context,"},{"line_number":105,"context_line":"                                                    trunk_id\u003dtrunk_id,"},{"line_number":106,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":107,"context_line":"                subport_obj.delete()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":110,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_1ef55d56","line":107,"range":{"start_line":107,"start_character":0,"end_line":107,"end_character":36},"in_reply_to":"7aa08908_d1911f54","updated":"2016-06-07 15:13:06.000000000","message":"Yes, I had been relying on OVO to raise the right exception.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":107,"context_line":"                subport_obj.delete()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":110,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":111,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":112,"context_line":"        filters \u003d filters or {}"},{"line_number":113,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_91eb17b0","line":110,"updated":"2016-06-07 09:51:42.000000000","message":"Don\u0027t we need \u0027sorts/limit\u0027 as in get_trunks?","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":107,"context_line":"                subport_obj.delete()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":110,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":111,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":112,"context_line":"        filters \u003d filters or {}"},{"line_number":113,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_de53d537","line":110,"in_reply_to":"7aa08908_91eb17b0","updated":"2016-06-07 15:13:06.000000000","message":"I\u0027ve never seen those passed on a subresource before. Makes me wonder if filters ever actually has anything passed to it.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"ca4ad5d2a778885975e11e43564699ed7f28eace","unresolved":false,"context_lines":[{"line_number":107,"context_line":"                subport_obj.delete()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":110,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":111,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":112,"context_line":"        filters \u003d filters or {}"},{"line_number":113,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_273808ef","line":110,"in_reply_to":"7aa08908_de53d537","updated":"2016-06-07 16:04:20.000000000","message":"IMHO we should consider that as it would be possible for get_subports to return thousands of entries (e.g. ~4k for vlan segmentation_type).","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"4b509b6033147de6da8a17321267730208979eba","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":61,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":62,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":63,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":64,"context_line":"        filters \u003d filters or {}"},{"line_number":65,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"}],"source_content_type":"text/x-python","patch_set":12,"id":"7aa08908_ebbf82cd","line":62,"range":{"start_line":62,"start_character":19,"end_line":62,"end_character":74},"updated":"2016-06-09 00:30:14.000000000","message":"I guess _pager got lost in transit (you said \u0027done\u0027, but its still missing).","commit_id":"0a0732081bd1a4f5d6cc400539248553d6b2bebd"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"4ffaaa27db7a1c90748627fdf765e7be793e2a89","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":61,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":62,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":63,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":64,"context_line":"        filters \u003d filters or {}"},{"line_number":65,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"}],"source_content_type":"text/x-python","patch_set":12,"id":"7aa08908_b2365ce5","line":62,"range":{"start_line":62,"start_character":19,"end_line":62,"end_character":74},"in_reply_to":"7aa08908_ebbf82cd","updated":"2016-06-09 18:28:40.000000000","message":"Started looking into it briefly and it made no sense. I decided to just make some progress without it for now. Sorry for the confusion.","commit_id":"0a0732081bd1a4f5d6cc400539248553d6b2bebd"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"bb5cbe083f34afae94826f2f2fe9de1882c8d585","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":104,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":105,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":106,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":107,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"            for subport_id in subports:"},{"line_number":110,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("}],"source_content_type":"text/x-python","patch_set":12,"id":"7aa08908_cb4a8654","line":107,"range":{"start_line":106,"start_character":0,"end_line":107,"end_character":45},"updated":"2016-06-09 00:25:29.000000000","message":"nit: thats not necessary as its not a 100% accurate check due to concurrency issues and an exception from \u0027subport_obj.delete()\u0027 should be good enough (if trunk does not exist then neither does subport).","commit_id":"0a0732081bd1a4f5d6cc400539248553d6b2bebd"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"4ffaaa27db7a1c90748627fdf765e7be793e2a89","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":104,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":105,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":106,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":107,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"            for subport_id in subports:"},{"line_number":110,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("}],"source_content_type":"text/x-python","patch_set":12,"id":"7aa08908_720d1437","line":107,"range":{"start_line":106,"start_character":0,"end_line":107,"end_character":45},"in_reply_to":"7aa08908_cb4a8654","updated":"2016-06-09 18:28:40.000000000","message":"What we want is a specific exception stating that the trunk does not exist. Just relying on delete to fail isn\u0027t sufficient as it doesn\u0027t distinguish between missing trunk and missing subport. I suppose if someone deletes the trunk between reading it and removing subports this could come back with an error stating that only the subport doesn\u0027t exist. When the user comes back the trunk will be gone AND the subports will be removed as well (they cascade on trunk delete). On the surface it doesn\u0027t seem like a major fail.\n\nI\u0027m not sure this suffers from concurrency issues anymore so than other resource removal we have in Neutron. Can you point out what I\u0027m missing in terms of concurrency and setting up the transaction? I still fumble around with the sqlalchemy knobs that need to be turned to run transactions the right way.\n\nThis doesn\u0027t read as nicely as I\u0027d like and I\u0027d like to make it read more cleanly. Something about it just isn\u0027t sitting right, but I guess I\u0027d like to understand your concerns from a functional perspective too.","commit_id":"0a0732081bd1a4f5d6cc400539248553d6b2bebd"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"594dedc2cdbbcd02ac026e509e13e3e322c704c8","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":73,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":74,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":75,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"},{"line_number":76,"context_line":"        trunk_obj.create()"},{"line_number":77,"context_line":"        return trunk_obj"},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"7aa08908_edc44542","line":75,"range":{"start_line":75,"start_character":40,"end_line":75,"end_character":72},"updated":"2016-06-16 17:54:05.000000000","message":"Sorry, Ryan, but after the latest update [1] the \u0027sub_ports\u0027 parameter of Trunk\u0027s constructor has to be a list of SubPort objects. So this part has to be updated accordingly (SubPort.trunk_id would be set by Trunk.create), e.g.:\n\nsub_ports \u003d [SubPort(context, port_id\u003dp.port_id,\n                     segmentation_id\u003dp.segmentation_id,\n                     segmentation_type\u003dp.segmentation_type)\n             for p in trunk.get(\u0027sub_ports\u0027)]\ntrunk_obj \u003d trunk_objects.Trunk(..., sub_ports\u003dsub_ports)\n\n[1] https://review.openstack.org/#/c/323518/5/neutron/objects/trunk.py@95","commit_id":"5f8e0d09f04481318a7e3a0cdc35f43a5923cb46"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"17a266522d4c2896902d4e1093ac2e3adea6a3d6","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":73,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":74,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":75,"context_line":"                                        sub_ports\u003dtrunk.get(\u0027sub_ports\u0027))"},{"line_number":76,"context_line":"        trunk_obj.create()"},{"line_number":77,"context_line":"        return trunk_obj"},{"line_number":78,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"7aa08908_5fc89b74","line":75,"range":{"start_line":75,"start_character":40,"end_line":75,"end_character":72},"in_reply_to":"7aa08908_edc44542","updated":"2016-06-16 19:56:10.000000000","message":"Done","commit_id":"5f8e0d09f04481318a7e3a0cdc35f43a5923cb46"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    def get_plugin_description(self):"},{"line_number":57,"context_line":"        return \"Trunk Port Service Plugin\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    def get_plugin_type(self):"},{"line_number":60,"context_line":"        return \"trunk\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_cf860113","line":59,"range":{"start_line":59,"start_character":0,"end_line":59,"end_character":30},"updated":"2016-06-21 16:59:45.000000000","message":"It seems that this is really called as instance method but other service plugin defines it as classmethod. I have no idea about the reason but it\u0027s better to make it consistent.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a0da15109ab83f8d99cd2b6b639563cd0bedf070","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    def get_plugin_description(self):"},{"line_number":57,"context_line":"        return \"Trunk Port Service Plugin\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    def get_plugin_type(self):"},{"line_number":60,"context_line":"        return \"trunk\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_6751e262","line":59,"range":{"start_line":59,"start_character":0,"end_line":59,"end_character":30},"in_reply_to":"3aaa91ec_07b585cc","updated":"2016-06-27 22:19:39.000000000","message":"Right.  The reason is for consistency.  It didn\u0027t make sense to have to instantiate the plugin to call this so we wanted to make it either static or class method.  I think one plugin had a reason to make it a classmethod, so blogan made them all classmethods.  This was recent [1].\n\n [1] https://review.openstack.org/#/c/326716/","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"ba2939989bf286518c3860349a1d8227113149a2","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    def get_plugin_description(self):"},{"line_number":57,"context_line":"        return \"Trunk Port Service Plugin\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    def get_plugin_type(self):"},{"line_number":60,"context_line":"        return \"trunk\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_c4f40289","line":59,"range":{"start_line":59,"start_character":0,"end_line":59,"end_character":30},"in_reply_to":"3aaa91ec_6751e262","updated":"2016-06-27 22:51:01.000000000","message":"I got it. I didn\u0027t notice the patch. Thanks for your telling.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    def get_plugin_description(self):"},{"line_number":57,"context_line":"        return \"Trunk Port Service Plugin\""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    def get_plugin_type(self):"},{"line_number":60,"context_line":"        return \"trunk\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_07b585cc","line":59,"range":{"start_line":59,"start_character":0,"end_line":59,"end_character":30},"in_reply_to":"3aaa91ec_cf860113","updated":"2016-06-21 19:33:45.000000000","message":"Done","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":14605,"name":"vikram.choudhary","email":"vikschw@gmail.com","username":"vikram.choudhary"},"change_message_id":"d91eef730c322e5b9670c8cc271c5b60c42b3ea8","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# All Rights Reserved."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_84115aaf","line":1,"updated":"2016-06-22 06:49:42.000000000","message":"copyright is missed..","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"882625fe51b0f6b6346c14f5411cece7ce381f86","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# All Rights Reserved."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_04fa8a42","line":1,"in_reply_to":"3aaa91ec_84115aaf","updated":"2016-06-22 06:53:01.000000000","message":"This is ok, so long as the license header is here:\n\nhttps://wiki.openstack.org/wiki/LegalIssuesFAQ#Copyright_Headers","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":33,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":34,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":35,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":36,"context_line":"        return port_res"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_a41efa60","line":35,"updated":"2016-06-22 15:42:22.000000000","message":"this would no longer work now that you\u0027re removed the alias. When you do port-show, there\u0027s no trunk_details being exposed.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":32,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":33,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":34,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":35,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":36,"context_line":"        return port_res"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ab024209","line":35,"in_reply_to":"3aaa91ec_a41efa60","updated":"2016-06-22 17:04:18.000000000","message":"I wondered why that was happening but just put it off since we\u0027re not populating it in this patch. Mystery solved.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":39,"context_line":"class TrunkPlugin(service_base.ServicePluginBase,"},{"line_number":40,"context_line":"                  common_db_mixin.CommonDbMixin):"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    supported_extension_aliases \u003d [\"trunk\"]"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_131bd573","line":42,"updated":"2016-06-22 15:42:22.000000000","message":"what happened to trunk_details? It disappeared in PS18 without comments. Did you find it no longer necessary or you\u0027re gonna bring it in later? As per your TODO on line 34? It looks like you undid what I so hard worked for...shame on you! :)","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":39,"context_line":"class TrunkPlugin(service_base.ServicePluginBase,"},{"line_number":40,"context_line":"                  common_db_mixin.CommonDbMixin):"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    supported_extension_aliases \u003d [\"trunk\"]"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def __init__(self):"},{"line_number":45,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ce351cdb","line":42,"in_reply_to":"3aaa91ec_131bd573","updated":"2016-06-22 17:04:18.000000000","message":"There was a review comment asking whether we could combine into a single extension. I think you\u0027ve explained why that doesn\u0027t work, so I\u0027ll be reverting back to 2 extensions.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":46,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def _validate_subport_data(self, subport):"},{"line_number":49,"context_line":"        if \u0027port_id\u0027 not in subport:"},{"line_number":50,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":51,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_0448ae86","line":48,"updated":"2016-06-22 15:42:22.000000000","message":"Should this perhaps be another validator for an individual subport? I\u0027d rather not duplicate the logic here and in the validator, as it can be easily reused. It seems that was a lack on my part, I can fix that. Thoughts?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":46,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def _validate_subport_data(self, subport):"},{"line_number":49,"context_line":"        if \u0027port_id\u0027 not in subport:"},{"line_number":50,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":51,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ae8c1080","line":48,"in_reply_to":"3aaa91ec_0448ae86","updated":"2016-06-22 17:04:18.000000000","message":"Is there a way to add validators to subresources (ie add_subports/remove_subports)? I struggled with this in the context of BGP and ended up validating at this level with BGP subresources. I\u0027m just following that pattern here. But just because I haven\u0027t seen a way to add validators on subresources doesn\u0027t mean it\u0027s impossible. It may be that I just don\u0027t know how to do it.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":46,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def _validate_subport_data(self, subport):"},{"line_number":49,"context_line":"        if \u0027port_id\u0027 not in subport:"},{"line_number":50,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":51,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_2a6e412f","line":48,"in_reply_to":"3aaa91ec_ae8c1080","updated":"2016-06-22 21:53:26.000000000","message":"ok, let me clean that up for ya.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":70,"context_line":"    def get_trunk(self, context, trunk_id, fields\u003dNone):"},{"line_number":71,"context_line":"        \"\"\"Return information for the specified trunk.\"\"\""},{"line_number":72,"context_line":"        obj \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":73,"context_line":"        if obj is None:"},{"line_number":74,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":75,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_0786f012","line":72,"updated":"2016-06-22 15:42:22.000000000","message":"fields are not passed on here, so if I want to select filters this is not working at least for API clients, the CLI client should be able to filter client side. Unless this is handled by the decorator, I am not sure, but from what I can tell from the response the filter server-side doesn\u0027t seem to work","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":70,"context_line":"    def get_trunk(self, context, trunk_id, fields\u003dNone):"},{"line_number":71,"context_line":"        \"\"\"Return information for the specified trunk.\"\"\""},{"line_number":72,"context_line":"        obj \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":73,"context_line":"        if obj is None:"},{"line_number":74,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":75,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_0e38c49f","line":72,"in_reply_to":"3aaa91ec_0786f012","updated":"2016-06-22 17:04:18.000000000","message":"You are correct, not sure how that works. I don\u0027t know if I can pass fields to OVO somehow, that is a hole I don\u0027t know how to plug.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":70,"context_line":"    def get_trunk(self, context, trunk_id, fields\u003dNone):"},{"line_number":71,"context_line":"        \"\"\"Return information for the specified trunk.\"\"\""},{"line_number":72,"context_line":"        obj \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":73,"context_line":"        if obj is None:"},{"line_number":74,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":75,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ca5dfd7a","line":72,"in_reply_to":"3aaa91ec_0e38c49f","updated":"2016-06-22 21:53:26.000000000","message":"add a todo, file a bug, do something so that we don\u0027t forget! :)","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"61b177d2af1bfe47c2957225d9be56c55e520f2c","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":70,"context_line":"    def get_trunk(self, context, trunk_id, fields\u003dNone):"},{"line_number":71,"context_line":"        \"\"\"Return information for the specified trunk.\"\"\""},{"line_number":72,"context_line":"        obj \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":73,"context_line":"        if obj is None:"},{"line_number":74,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":75,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_abd07354","line":72,"in_reply_to":"3aaa91ec_ca5dfd7a","updated":"2016-06-22 22:15:33.000000000","message":"This is done in PS24.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":80,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":81,"context_line":"        filters \u003d filters or {}"},{"line_number":82,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":85,"context_line":"    def create_trunk(self, context, trunk):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_c71b487f","line":82,"updated":"2016-06-22 15:42:22.000000000","message":"similar question as above, what about the other params for doing sorting and paging?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"cffbff25223575f3c57acbb7dbd730a8a86f2584","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":80,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":81,"context_line":"        filters \u003d filters or {}"},{"line_number":82,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":85,"context_line":"    def create_trunk(self, context, trunk):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_9c3a2397","line":82,"in_reply_to":"3aaa91ec_10bbb9e6","updated":"2016-06-22 20:31:50.000000000","message":"Thanks for the pointers. Still fumbling around with OVO, this helps. Simple adjustment to make.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"baa40a8faaee325faf775a95de4ac978677189ae","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":80,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":81,"context_line":"        filters \u003d filters or {}"},{"line_number":82,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":85,"context_line":"    def create_trunk(self, context, trunk):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_10bbb9e6","line":82,"in_reply_to":"3aaa91ec_ae689088","updated":"2016-06-22 19:25:41.000000000","message":"@Ryan, take a look at [1] and [2], create Pager object and pass it as \u0027_pager\u0027 argument to Trunk.get_objects.\n\n[1] https://review.openstack.org/#/c/300055/16/neutron/tests/unit/objects/db/test_api.py@43\n[2] https://review.openstack.org/#/c/300055/16/neutron/objects/base.py@72","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":79,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":80,"context_line":"        \"\"\"Return information for available trunks.\"\"\""},{"line_number":81,"context_line":"        filters \u003d filters or {}"},{"line_number":82,"context_line":"        return trunk_objects.Trunk.get_objects(context, **filters)"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":85,"context_line":"    def create_trunk(self, context, trunk):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ae689088","line":82,"in_reply_to":"3aaa91ec_c71b487f","updated":"2016-06-22 17:04:18.000000000","message":"No clue how to pass this all on through OVO. Yet another hole to plug.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"},{"line_number":91,"context_line":"                        segmentation_id\u003dp[\u0027segmentation_id\u0027],"},{"line_number":92,"context_line":"                        segmentation_type\u003dp[\u0027segmentation_type\u0027])"},{"line_number":93,"context_line":"                     for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":94,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":95,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":96,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_849bfe71","line":93,"updated":"2016-06-22 15:42:22.000000000","message":"if I create with a body like [1] this bombs out with [2]\n\n[1] {\"trunk\": {\"port_id\": \"5d19e0c8-da01-4c21-837a-0aa9fdb0968d\"}}\n[2] TypeError: \u0027_Sentinel\u0027 object is not iterable","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"cffbff25223575f3c57acbb7dbd730a8a86f2584","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"},{"line_number":91,"context_line":"                        segmentation_id\u003dp[\u0027segmentation_id\u0027],"},{"line_number":92,"context_line":"                        segmentation_type\u003dp[\u0027segmentation_type\u0027])"},{"line_number":93,"context_line":"                     for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":94,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":95,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":96,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_9998751d","line":93,"in_reply_to":"3aaa91ec_849bfe71","updated":"2016-06-22 20:31:50.000000000","message":"That\u0027s probably because the expectation here is that you will supply segmentation_type and segmentation_id as well. See discussion at L110.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_4a50ff5e","line":110,"updated":"2016-06-22 15:42:22.000000000","message":"if I try to add a subport with a body like [1], this bombs out with [2]\n\n[1] [{\"port_id\": \"fb389ddf-a92d-4c6e-83d4-6b70bedd1734\"}]\n[2] KeyError: \u0027segmentation_type\u0027\n\nAdding a subport without segmentation details should be allowed and therefore we mustn\u0027t fail at line 123. In fact we want to make the plugin able to infer the segmentation details if missing or fail in case the plugin is not capable. Remember the Ironic use case for vlan trunking.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_4e100c02","line":110,"in_reply_to":"3aaa91ec_4a50ff5e","updated":"2016-06-22 17:04:18.000000000","message":"Good point, so we should enforce port_id only and read segmentation_id off the network of the parent port in the case segmentation_id is not passed.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"1fc2cd2863c3ac5f0b84244da20b6719a03074fa","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_84cbf352","line":110,"in_reply_to":"3aaa91ec_4e100c02","updated":"2016-06-22 17:40:51.000000000","message":"Will reading the segmentation_id off the network of the parent port actually work? That will break if the network type is vxlan, right?\n\nI think the segmentation_id should be generated arbitrarily from whatever is still available on that particular trunk.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"605af5624020f97e909f93c06323bf6aeeda997d","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_95979b8f","line":110,"in_reply_to":"3aaa91ec_64ac0736","updated":"2016-06-22 18:40:56.000000000","message":"What if for whatever reason I want two different subports connected to the same vlan network? Then the command will fail because the segmentation_id isn\u0027t unique. Perhaps we should only require that the segmentation_type is passed (even though we only have \u0027vlan\u0027 right now)?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"50f5724fae40baa024481a972dafb7e961e9d562","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_64ac0736","line":110,"in_reply_to":"3aaa91ec_84cbf352","updated":"2016-06-22 18:01:38.000000000","message":"We can bomb out if the network type is not vlan. Otherwise I feel like we should require you to pass segmentation_type and segmentation_id. We can only infer segmentation_id from the parent port if it\u0027s on a VLAN network. That should support the ironic use case.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"baa40a8faaee325faf775a95de4ac978677189ae","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_d6cdaab8","line":110,"in_reply_to":"3aaa91ec_95979b8f","updated":"2016-06-22 19:25:41.000000000","message":"Should not we just pick any valid unused segmentation_id if it was not specified by the user (similar to how IPAM picks unused IPs for ports)? If my understanding is correct, we need to implement it as drivers for each segmentation_type and that probably worth a separate PS/review.\n\n@Rawlin, note that the spec [1] suggests that either both segmentation_type and segmentation_id are present or none of them. But I also think that passing just the segmentation_type and allowing Neutron to pick the segmentation_id is a valid use case.\n\n[1] http://specs.openstack.org/openstack/neutron-specs/specs/newton/vlan-aware-vms.html#proposed-change","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"61b177d2af1bfe47c2957225d9be56c55e520f2c","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_6b04cbbf","line":110,"in_reply_to":"3aaa91ec_aabcf16c","updated":"2016-06-22 22:15:33.000000000","message":"I\u0027m not sure I\u0027m grokking what you\u0027re envisioning. I\u0027ll reach out and get some clarification.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"e44b92cdc960f8e8a78922fd746b92cd5add41df","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_df5dbd7a","line":110,"in_reply_to":"3aaa91ec_b960d136","updated":"2016-06-22 20:39:57.000000000","message":"\u003e I\u0027d like to see it tackled with a follow-on patch\n\n+1","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"cffbff25223575f3c57acbb7dbd730a8a86f2584","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_b960d136","line":110,"in_reply_to":"3aaa91ec_d6cdaab8","updated":"2016-06-22 20:31:50.000000000","message":"Now that I think about it, there shouldn\u0027t be any harm in just selecting a segmentation_id for you if you don\u0027t supply it. I agree that this mechanism will just cause this patch to balloon, I\u0027d like to see it tackled with a follow-on patch. To develop this iteratively, I\u0027m in favor of simply enforcing all 3 fields be supplied for now, then we can come back with a follow-on patch. No tests written in this patch should need to change with a follow-on patch, and it allows this patch to proceed with just supporting the basic use case, we can enhance it later.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        else:"},{"line_number":108,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_aabcf16c","line":110,"in_reply_to":"3aaa91ec_df5dbd7a","updated":"2016-06-22 21:53:26.000000000","message":"Guys, you\u0027re thinking too far ahead. What I want to see in THIS patch is a mechanism that allows us to have such logic to be customized at will and so that we can support multiple validation variations. That why at one point I suggested building such a plugin according the service_type architecture. Either way, we don\u0027t need to worry about how to support Ironic right now. I am happy to barf at the user if they don\u0027t specify both segmentation details right now, but what I do want to see is the ability to make this polymorph and thus flexible.\n\nThis won\u0027t balloon and it won\u0027t make the patch explode if you things right.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":116,"context_line":"            res \u003d []"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ca66af28","line":113,"updated":"2016-06-22 15:42:22.000000000","message":"looks like you\u0027re not validating the segmentation ID and type, i.e. whether they are valid for the specific technology at hand. We\u0027d need to make this customizable somehow","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":116,"context_line":"            res \u003d []"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_b0b61eda","line":113,"in_reply_to":"3aaa91ec_39dce1e3","updated":"2016-06-22 21:53:26.000000000","message":"I don\u0027t know....it seems procrastination for procrastination\u0027 sake, and it\u0027s not like something that is very decoupled by what you\u0027re doing right now. Anything that follows up ends up undoing what is being done here.\n\nI think it\u0027s useful if we give it some thought in the context of this patch, otherwise I fear it goes forgotten.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"61b177d2af1bfe47c2957225d9be56c55e520f2c","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":116,"context_line":"            res \u003d []"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_2be803e2","line":113,"in_reply_to":"3aaa91ec_b0b61eda","updated":"2016-06-22 22:15:33.000000000","message":"I guess I\u0027m procrastinating because I\u0027m not catching your vision. I guess I need to go re-read the devref and ping you with questions.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"cffbff25223575f3c57acbb7dbd730a8a86f2584","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    def add_subports(self, context, trunk_id, subports):"},{"line_number":111,"context_line":"        \"\"\"Add one or more subports to trunk.\"\"\""},{"line_number":112,"context_line":"        for subport in subports:"},{"line_number":113,"context_line":"            self._validate_subport_data(subport)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":116,"context_line":"            res \u003d []"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_39dce1e3","line":113,"in_reply_to":"3aaa91ec_ca66af28","updated":"2016-06-22 20:31:50.000000000","message":"Can we handle this in a follow-on patch so we get that customizable behavior? See discussion above at L110.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                obj.create()"},{"line_number":125,"context_line":"                res.append(obj.to_dict())"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ed2bc5e9","line":127,"updated":"2016-06-22 15:42:22.000000000","message":"I wonder if you\u0027re supposed to return the entire trunk","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"61b177d2af1bfe47c2957225d9be56c55e520f2c","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                obj.create()"},{"line_number":125,"context_line":"                res.append(obj.to_dict())"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_eb41db0c","line":127,"in_reply_to":"3aaa91ec_d0b3eae7","updated":"2016-06-22 22:15:33.000000000","message":"Done in PS24","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                obj.create()"},{"line_number":125,"context_line":"                res.append(obj.to_dict())"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_eed61826","line":127,"in_reply_to":"3aaa91ec_ed2bc5e9","updated":"2016-06-22 17:04:18.000000000","message":"Probably....","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                obj.create()"},{"line_number":125,"context_line":"                res.append(obj.to_dict())"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_d0b3eae7","line":127,"in_reply_to":"3aaa91ec_eed61826","updated":"2016-06-22 21:53:26.000000000","message":"No, definitely ;)","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_0d0d7137","line":132,"updated":"2016-06-22 15:42:22.000000000","message":"not sure I grasp why, can you elaborate?","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_8ed2f4fe","line":132,"in_reply_to":"3aaa91ec_0d0d7137","updated":"2016-06-22 17:04:18.000000000","message":"If the trunk_id doesn\u0027t exist, the OVO call at L136 will simply return None. It doesn\u0027t tell the user that the trunk they are trying to remove a subport from doesn\u0027t exist. We should probably raise TrunkNotFound exception if the trunk_id doesn\u0027t exist, and reading the trunk is how we get the exception to raise.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5116b4041f7cb6f5892f04bb93269bcb08b4fc47","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_aef4e586","line":132,"in_reply_to":"3aaa91ec_1d210aa0","updated":"2016-06-23 12:01:29.000000000","message":"That\u0027s fine. The fact that we return the trunk at the end in PS24 solves the issue, I think.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_d00f6a86","line":132,"in_reply_to":"3aaa91ec_76ae7686","updated":"2016-06-22 21:53:26.000000000","message":"I think that if delete() returns the # of rows affected as SQL does, this is a non issue.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"baa40a8faaee325faf775a95de4ac978677189ae","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_76ae7686","line":132,"in_reply_to":"3aaa91ec_8ed2f4fe","updated":"2016-06-22 19:25:41.000000000","message":"(subjective) nit: honestly, using getter (i.e. get_trunk) to raise an exception does not sit well with me.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0fcdb7540ad5885cd460eafcc01d17793f88532a","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_d0012a6c","line":132,"in_reply_to":"3aaa91ec_8ed2f4fe","updated":"2016-06-22 21:53:26.000000000","message":"hang on: you\u0027re telling me that the delete() method does not return a scalar that tells me how many rows are affected? Don\u0027t let me dig please, find it for me and if they do, then you can just see whether there are rows affected and if so, there you go.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"81530f23b64a6bfa0bf57580eb0bb8c3029c9263","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_1d210aa0","line":132,"in_reply_to":"3aaa91ec_d00f6a86","updated":"2016-06-22 22:30:41.000000000","message":"@Armando, if by \u0027delete\u0027 you mean the NeutronDbObject.delete, then it does not return anything (it is based on SQLAlchemy\u0027s Session.delete [1] that does not return anything either). To get that scalar we\u0027d have to use SQLAlchemy\u0027s Query API [2] in OVO and will sacrifice SQLA cascades and event handlers (see caveats in [2]).\n\n[1] https://github.com/zzzeek/sqlalchemy/blob/528509e/lib/sqlalchemy/orm/session.py#L1632-L1646\n[2] http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.delete","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"61b177d2af1bfe47c2957225d9be56c55e520f2c","unresolved":false,"context_lines":[{"line_number":129,"context_line":"    def remove_subports(self, context, trunk_id, subports):"},{"line_number":130,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":131,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ab5eb3e6","line":132,"in_reply_to":"3aaa91ec_d00f6a86","updated":"2016-06-22 22:15:33.000000000","message":"I cleaned this up in PS24","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"},{"line_number":136,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":137,"context_line":"                                                           context,"},{"line_number":138,"context_line":"                                                           trunk_id\u003dtrunk_id,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_4dc0197d","line":135,"updated":"2016-06-22 15:42:22.000000000","message":"subports is a list of dicts, you gotta make sure you pick only the subport_id otherwise you\u0027re sending junk to the DBMS. See stacktrace below:\n\nDBError: (pymysql.err.ProgrammingError) (1064, u\u0027You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \\\u0027: \\\u00272\\\u0027, u\\\u0027port_id\\\u0027: u\"\\\u002700e65672-ac77-42fe-8c30-cbd952ef9050\\\u0027\", u\\\u0027segmentation_typ\\\u0027 at line 3\u0027) [SQL: u\u0027SELECT subports.port_id AS subports_port_id, subports.trunk_id AS subports_trunk_id, subports.segmentation_type AS subports_segmentation_type, subports.segmentation_id AS subports_segmentation_id \\nFROM subports \\nWHERE subports.trunk_id \u003d %(trunk_id_1)s AND subports.port_id \u003d %(port_id_1)s \\n LIMIT %(param_1)s\u0027] [parameters: {u\u0027trunk_id_1\u0027: u\u00271992869b-b676-41a7-b7c8-1a5bc3138963\u0027, u\u0027port_id_1\u0027: {u\u0027segmentation_id\u0027: 2, u\u0027port_id\u0027: u\u002700e65672-ac77-42fe-8c30-cbd952ef9050\u0027, u\u0027segmentation_type\u0027: u\u0027vlan\u0027}, u\u0027param_1\u0027: 1}]","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":132,"context_line":"            #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":133,"context_line":"            self.get_trunk(context, trunk_id)"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"            for subport_id in subports:"},{"line_number":136,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":137,"context_line":"                                                           context,"},{"line_number":138,"context_line":"                                                           trunk_id\u003dtrunk_id,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ae4530b4","line":135,"in_reply_to":"3aaa91ec_4dc0197d","updated":"2016-06-22 17:04:18.000000000","message":"I was expecting a list of port_id\u0027s. That\u0027s where the disconnect is. Will make it look for a list of dicts","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    subport_obj.delete()"},{"line_number":142,"context_line":"                else:"},{"line_number":143,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":144,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_2d84add2","line":144,"updated":"2016-06-22 15:42:22.000000000","message":"you\u0027re returning None here, that\u0027s rude.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    subport_obj.delete()"},{"line_number":142,"context_line":"                else:"},{"line_number":143,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":144,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_ce4fdcbb","line":144,"in_reply_to":"3aaa91ec_2d84add2","updated":"2016-06-22 17:04:18.000000000","message":"Right, this is a PUT not a DELETE. I think I had it in my head that this is a DELETE. My bad, that is rude.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"dab67761845156711c808568fb8ccbda9af647a4","unresolved":false,"context_lines":[{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":148,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":149,"context_line":"        filters \u003d filters or {}"},{"line_number":150,"context_line":"        #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_798857e8","line":149,"updated":"2016-06-22 06:23:54.000000000","message":"nit\nfilters \u003d {} if filters is None else filters","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"baa40a8faaee325faf775a95de4ac978677189ae","unresolved":false,"context_lines":[{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":148,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":149,"context_line":"        filters \u003d filters or {}"},{"line_number":150,"context_line":"        #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_96e042ce","line":149,"in_reply_to":"3aaa91ec_24ab461f","updated":"2016-06-22 19:25:41.000000000","message":"+1 @Armando","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"ae434c1723e3595bdad94f79e49c4b837e55fa2d","unresolved":false,"context_lines":[{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":148,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":149,"context_line":"        filters \u003d filters or {}"},{"line_number":150,"context_line":"        #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_24ab461f","line":149,"in_reply_to":"3aaa91ec_394fef93","updated":"2016-06-22 06:56:07.000000000","message":"what difference does it make? I find Gary\u0027s suggestion needlessly verbose.","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"1732b7e4eee8fa5cc92196588c2b879ea4268fa3","unresolved":false,"context_lines":[{"line_number":146,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":147,"context_line":"    def get_subports(self, context, trunk_id, filters\u003dNone):"},{"line_number":148,"context_line":"        \"\"\"Return subports for the specified trunk and filters.\"\"\""},{"line_number":149,"context_line":"        filters \u003d filters or {}"},{"line_number":150,"context_line":"        #read the trunk to ensure it exists and raise the right exceptions"},{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_394fef93","line":149,"in_reply_to":"3aaa91ec_798857e8","updated":"2016-06-22 06:33:01.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"},{"line_number":153,"context_line":"                                                 trunk_id\u003dtrunk_id,"},{"line_number":154,"context_line":"                                                 **filters)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_edbc656e","line":154,"updated":"2016-06-22 15:42:22.000000000","message":"you\u0027d want to sanitize filters to make sure you\u0027re not sending goo to the DB","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        self.get_trunk(context, trunk_id)"},{"line_number":152,"context_line":"        return trunk_objects.SubPort.get_objects(context,"},{"line_number":153,"context_line":"                                                 trunk_id\u003dtrunk_id,"},{"line_number":154,"context_line":"                                                 **filters)"}],"source_content_type":"text/x-python","patch_set":23,"id":"3aaa91ec_8edcb4e5","line":154,"in_reply_to":"3aaa91ec_edbc656e","updated":"2016-06-22 17:04:18.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"c647a41cd8da1c5ab6920deda5a550c2ea0486d3","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_9ca211ad","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"updated":"2016-06-23 06:37:28.000000000","message":"This doesn\u0027t consider duplicated call. Now it just returns \"{\"NeutronError\": {\"message\": \"Failed to create a duplicate SubPort: for attribute(s) [\u0027PRIMARY\u0027] with value(s) XXXX\", \"type\": \"NeutronDbObjectDuplicateEntry\", \"detail\": \"\"}}\". We can select two solutions against the issue. First server returns OK when it receives duplicated subport call. This is correct for PUT method. Second server returns Error with message like \"The subport already have been on a port\". This is friendly for users. I prefer the former.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"9376a2e8f3c369a39fea83f6ab6bf066bb945cdb","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_30346bdc","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_0ab21006","updated":"2016-06-25 05:40:24.000000000","message":"Fair enough.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e20c149df43aaaac4192da16e92d621aea98f90b","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_4d89ee74","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_15789d8e","updated":"2016-06-23 17:57:31.000000000","message":"Ok, I think I understand now. Hirofumi is saying that we may be not following the PUT semantic stricly when adding a single/same subport more than once, ie the call should be idempotent when it currently isn\u0027t.\n\nIf I understood you correctly, I feel that attempting to preserve idempotency on identical requests may lead to needless complexity of the implementation of this method. In reality, this is using PUT, but it\u0027s not quite exactly matching the PUT semantic.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"82971b0614fd3d178b5c19867d0a7e42e82c4463","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_2be0c028","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_15e7e111","updated":"2016-06-23 22:22:58.000000000","message":"This is clearly more convoluted than how it is at the moment. I am personally not seeing the value, especially for something that should not gonna happen for the majority of times someone adds a subport.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"c7e2712b5370dcffb741a79af98bec9604b7a711","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_4039a2d6","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_2be0c028","updated":"2016-06-24 01:50:44.000000000","message":"Well, my point was duplicate port only.\n\nAnyway, I think that we can freely select two behaviors because we don\u0027t have a obligation following PUT semantic. Actually router interface add/remove doesn\u0027t follow the rule but it\u0027s clear for users because we can imagine it\u0027s management about physical router. However, the method was created in 2012. Now RESTful API is closer to users and they may expect it behaves idempotent. Resource tagging API follows the behavior :) I\u0027m OK about both solutions although I prefer idempotence.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"ee72fd3094143a20f8112ebabdfe9c643e942963","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_0ab21006","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_4039a2d6","updated":"2016-06-24 07:20:14.000000000","message":"As you pointed out routers do not follow the idempotency semantic and since trunks follow a similar structure I\u0027d rather keep things similar","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"845864b3a90d71ba0cffb93d93f16af9bcf89572","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_15e7e111","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_4d89ee74","updated":"2016-06-23 21:27:30.000000000","message":"@Armando, if we follow the same pattern as in remove_subports (which we probably should to make the return value of remove_subports/add_subports consistent), that would not add too much complexity (lines [1] - [2]):\n\ntrunk \u003d Trunk.get_object\nsub_ports \u003d {p.port_id: p for p in trunk.sub_ports} # nit: I dont like the name as it collides with \u0027subports\u0027 in \u0027for\u0027\nfor subport in subports:\n  # [1]\n  dup_sub_port \u003d sub_ports.get(subport[\u0027port_id\u0027])\n  dup_segmentation_id \u003d getattr(dup_sub_port, \u0027segmentation_id\u0027, None)\n  dup_segmentation_type \u003d getattr(dup_sub_port, \u0027segmentation_type\u0027, None)\n  segmentation_id \u003d subport.setdefault(\u0027segmentation_id\u0027, dup_segmentation_id)\n  segmentation_type \u003d subport.setdefault(\u0027segmentation_type\u0027, dup_segmentation_type)\n  if (segmentation_id, segmentation_type) \u003d\u003d (None, None):\n    # generate segmentation details if id/type is None\n  elif (segmentation_id, segmentation_type) !\u003d (dup_segmentation_id, dup_segmentation_type):\n    # raise\n  else:\n    continue\n  # [2]\n  obj \u003d SubPort()\n  obj.create()\n  trunk.sub_ports.append(obj)\nreturn trunk","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"40a70cf5d95ca5a1091053bf6b4ffab1aee7b96f","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_b9839403","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_9ca211ad","updated":"2016-06-23 10:12:20.000000000","message":"I like the idea to have server report OK on duplicates. But then we need to account for segmentation_type/segmentation_id:\n\n1. two requests specify the same segmentation details - OK\n\n2. two requests specify different segmentation details - FAIL\n\n3. of two requests only one specify segmentation details - OK/FAIL depending on the order of arrival (the one that is missing the segmentation details should get them from the other if it comes last)\n\n4. two requests do not specify segmentation details (so Neutron will pick them for us) - OK (same as (3))","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"edd9c634cba4b8f18627f34e67cfb8dbe1ba67a9","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_15789d8e","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_a9f4df86","updated":"2016-06-23 13:48:30.000000000","message":"@Armando, I think the point was about duplicate calls, i.e. same subport uuid, considering the NeutronError message with NeutronDbObjectDuplicateEntry. That\u0027s something that was covered by SubPortInUse exception in my initial OVO patch (but that did not make it into master).\n\nI like the idea about returning OK instead of error on duplicates if possible. That reminds me of Ansible\u0027s declarative approach.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e0c9bc95c1861ab7628174901a63f1c7fd0b5b52","unresolved":false,"context_lines":[{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":126,"context_line":"            res \u003d []"},{"line_number":127,"context_line":"            for subport in subports:"},{"line_number":128,"context_line":"                obj \u003d trunk_objects.SubPort("},{"line_number":129,"context_line":"                               context\u003dcontext,"},{"line_number":130,"context_line":"                               trunk_id\u003dtrunk_id,"},{"line_number":131,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":132,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":133,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_a9f4df86","line":135,"range":{"start_line":127,"start_character":12,"end_line":135,"end_character":41},"in_reply_to":"3aaa91ec_b9839403","updated":"2016-06-23 12:15:59.000000000","message":"I am not sure I fully understand the comment here. Two different subports (ie. different uuid\u0027s) but same segmentation details (i.e. same type and id) must lead to failure.\n\nCan you elaborate?","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"f5d2a06925080ca6777d57d2923c2c6764655f60","unresolved":false,"context_lines":[{"line_number":140,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":141,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"            for subport_id in subports:"},{"line_number":144,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":145,"context_line":"                                                           context,"},{"line_number":146,"context_line":"                                                           trunk_id\u003dtrunk_id,"},{"line_number":147,"context_line":"                                                           port_id\u003dsubport_id)"},{"line_number":148,"context_line":"                if subport_obj:"},{"line_number":149,"context_line":"                    subport_obj.delete()"},{"line_number":150,"context_line":"                else:"},{"line_number":151,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":152,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"            return self.get_trunk(context, trunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_subports(self, context, trunk_id, fields\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_fdb35ee7","line":154,"range":{"start_line":143,"start_character":0,"end_line":154,"end_character":52},"updated":"2016-06-22 22:58:04.000000000","message":"@Ryan, consider another option:\n\ntrunk \u003d Trunk.get_object(...) # you do that anyway in return\n# check for trunk \u003d\u003d None and raise TrunkNotFound\nsub_ports \u003d {p.port_id: p for p in trunk.sub_ports} # [1]\nfor subport_id in subports:\n  sub_ports.pop(subport_id).delete() # skipped error handling for clarity\ntrunk.sub_ports \u003d sub_ports.values()\n#return trunk as dict\n\nThat will get us the TrunkNotFound behaviour you wanted at the cost of building a dict in [1] (performance regress). But on the other hand it would save us SubPort.get_object (performance improvement on DB call, and that may be quite noticeable if we are deleting multiple subports) so it would probably compensate for the regression introduced by building a dict.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e0c9bc95c1861ab7628174901a63f1c7fd0b5b52","unresolved":false,"context_lines":[{"line_number":140,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":141,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"            for subport_id in subports:"},{"line_number":144,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":145,"context_line":"                                                           context,"},{"line_number":146,"context_line":"                                                           trunk_id\u003dtrunk_id,"},{"line_number":147,"context_line":"                                                           port_id\u003dsubport_id)"},{"line_number":148,"context_line":"                if subport_obj:"},{"line_number":149,"context_line":"                    subport_obj.delete()"},{"line_number":150,"context_line":"                else:"},{"line_number":151,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":152,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"            return self.get_trunk(context, trunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_subports(self, context, trunk_id, fields\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_c9696bc0","line":154,"range":{"start_line":143,"start_character":0,"end_line":154,"end_character":52},"in_reply_to":"3aaa91ec_bc80ad47","updated":"2016-06-23 12:15:59.000000000","message":"+1, response format must be equal","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"3ebf8a229446575e98259b535b8005f76e2185fe","unresolved":false,"context_lines":[{"line_number":140,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":141,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"            for subport_id in subports:"},{"line_number":144,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":145,"context_line":"                                                           context,"},{"line_number":146,"context_line":"                                                           trunk_id\u003dtrunk_id,"},{"line_number":147,"context_line":"                                                           port_id\u003dsubport_id)"},{"line_number":148,"context_line":"                if subport_obj:"},{"line_number":149,"context_line":"                    subport_obj.delete()"},{"line_number":150,"context_line":"                else:"},{"line_number":151,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":152,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"            return self.get_trunk(context, trunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_subports(self, context, trunk_id, fields\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_08ffd4aa","line":154,"range":{"start_line":143,"start_character":0,"end_line":154,"end_character":52},"in_reply_to":"3aaa91ec_bc80ad47","updated":"2016-06-23 18:26:22.000000000","message":"Done","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"c647a41cd8da1c5ab6920deda5a550c2ea0486d3","unresolved":false,"context_lines":[{"line_number":140,"context_line":"        \"\"\"Remove one or more subports from trunk.\"\"\""},{"line_number":141,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"            for subport_id in subports:"},{"line_number":144,"context_line":"                subport_obj \u003d trunk_objects.SubPort.get_object("},{"line_number":145,"context_line":"                                                           context,"},{"line_number":146,"context_line":"                                                           trunk_id\u003dtrunk_id,"},{"line_number":147,"context_line":"                                                           port_id\u003dsubport_id)"},{"line_number":148,"context_line":"                if subport_obj:"},{"line_number":149,"context_line":"                    subport_obj.delete()"},{"line_number":150,"context_line":"                else:"},{"line_number":151,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":152,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"            return self.get_trunk(context, trunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def get_subports(self, context, trunk_id, fields\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""}],"source_content_type":"text/x-python","patch_set":24,"id":"3aaa91ec_bc80ad47","line":154,"range":{"start_line":143,"start_character":0,"end_line":154,"end_character":52},"in_reply_to":"3aaa91ec_fdb35ee7","updated":"2016-06-23 06:37:28.000000000","message":"The result of remove_subports is different form from add_subports. It may confuse users so it\u0027s better to make it consistent.","commit_id":"c619f95bff185df36ca9a0808b25f7da916be7ac"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"52868496d04d325e90aca0064262d6c3e013de25","unresolved":false,"context_lines":[{"line_number":154,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":155,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"            trunk.sub_ports \u003d sub_ports.values()"},{"line_number":158,"context_line":"            return trunk"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def get_subports(self, context, trunk_id, fields\u003dNone):"}],"source_content_type":"text/x-python","patch_set":25,"id":"3aaa91ec_d70a8478","line":157,"updated":"2016-06-23 19:51:29.000000000","message":"Oops, I think the python34 test failure is because values() returns a list of view objects under python 3, not a list of SubPorts. Will work through that.","commit_id":"0e79f0ead5eec7995ab9d6647d0923043df8e099"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"a5cc40ef0a086773c92eeccccbeea8b6a787233d","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":140,"context_line":"    def remove_subports(self, context, trunk_id, subports):"}],"source_content_type":"text/x-python","patch_set":26,"id":"3aaa91ec_83eb9e12","line":137,"range":{"start_line":137,"start_character":15,"end_line":137,"end_character":33},"updated":"2016-06-23 20:59:20.000000000","message":"That is still inconsistent with remove_subports that returns the whole trunk, while this one only returns the added sub-ports.","commit_id":"8d721b57ab75360aa680a578aaacef2905cdc75d"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a647509fc8def6a14ea422e7737ddb88e316fbc","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                obj.create()"},{"line_number":135,"context_line":"                res.append(obj.to_dict())"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"        return {\u0027sub_ports\u0027: res}"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":140,"context_line":"    def remove_subports(self, context, trunk_id, subports):"}],"source_content_type":"text/x-python","patch_set":26,"id":"3aaa91ec_431ff6b6","line":137,"range":{"start_line":137,"start_character":15,"end_line":137,"end_character":33},"in_reply_to":"3aaa91ec_83eb9e12","updated":"2016-06-23 21:08:12.000000000","message":"Doh, I missed that. I got sidetracked on a python 3 incompatibility I introduced. I meant to address this.","commit_id":"8d721b57ab75360aa680a578aaacef2905cdc75d"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":31,"context_line":"#TODO(armax): finish this off"},{"line_number":32,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":33,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":34,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":35,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":36,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":37,"context_line":"        return port_res"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_c970ef0d","line":34,"range":{"start_line":34,"start_character":57,"end_line":34,"end_character":62},"updated":"2016-06-24 21:59:09.000000000","message":"Should this be \u0027trunk-details\u0027?","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":31,"context_line":"#TODO(armax): finish this off"},{"line_number":32,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":33,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":34,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":35,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":36,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":37,"context_line":"        return port_res"}],"source_content_type":"text/x-python","patch_set":27,"id":"3aaa91ec_cceabdda","line":34,"range":{"start_line":34,"start_character":57,"end_line":34,"end_character":62},"in_reply_to":"3aaa91ec_c970ef0d","updated":"2016-06-24 22:13:34.000000000","message":"No, this is checking for the service plugin not the extension. The difference between service plugin and extension is an important one. In this case we care that the plugin is loaded.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"14911823f234a3b1c4aa01eab1f1d3121c571354","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        \"\"\"Determine segmentation_id and segmentation type when omitted.\"\"\""},{"line_number":64,"context_line":"        return {"},{"line_number":65,"context_line":"            \u0027port_id\u0027: port_id,"},{"line_number":66,"context_line":"            \u0027segmentation_type\u0027: \u0027foo\u0027,"},{"line_number":67,"context_line":"            \u0027segmentation_id\u0027: 3333"},{"line_number":68,"context_line":"        }"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def validate_subport(self, subport):"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_2f053310","line":67,"range":{"start_line":66,"start_character":13,"end_line":67,"end_character":35},"updated":"2016-06-24 22:57:12.000000000","message":"What!?  These really shouldn\u0027t have a default.  I can\u0027t think of a single reason why any one segmentation_id should be defaulted over any other.  And what is foo?","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"792e381747368c7343182d19c4c2e21d31be2b44","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        \"\"\"Determine segmentation_id and segmentation type when omitted.\"\"\""},{"line_number":64,"context_line":"        return {"},{"line_number":65,"context_line":"            \u0027port_id\u0027: port_id,"},{"line_number":66,"context_line":"            \u0027segmentation_type\u0027: \u0027foo\u0027,"},{"line_number":67,"context_line":"            \u0027segmentation_id\u0027: 3333"},{"line_number":68,"context_line":"        }"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def validate_subport(self, subport):"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_3a072f83","line":67,"range":{"start_line":66,"start_character":13,"end_line":67,"end_character":35},"in_reply_to":"3aaa91ec_2f053310","updated":"2016-06-24 23:59:19.000000000","message":"This should have been marked as a TODO and the patch marked as WIP again. This is NOT what we want. I\u0027m still muddling through what to do with a request that doesn\u0027t specify a segmentation_type and segmentation_id (as Ironic apparently would). @Armando help? :) I may have misunderstood, but it was my understanding that Ironic would only be sending us a port_id per discussion in Austin.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a71708f88630be69cb16b0479d5827e0da89b504","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        \"\"\"Determine segmentation_id and segmentation type when omitted.\"\"\""},{"line_number":64,"context_line":"        return {"},{"line_number":65,"context_line":"            \u0027port_id\u0027: port_id,"},{"line_number":66,"context_line":"            \u0027segmentation_type\u0027: \u0027foo\u0027,"},{"line_number":67,"context_line":"            \u0027segmentation_id\u0027: 3333"},{"line_number":68,"context_line":"        }"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def validate_subport(self, subport):"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_7b936f5b","line":67,"range":{"start_line":66,"start_character":13,"end_line":67,"end_character":35},"in_reply_to":"3aaa91ec_3a072f83","updated":"2016-06-25 19:28:56.000000000","message":"I put together a patch quickly [1], under severe sleep deprivation to provide Ryan with more detailed reviewer feedback. I didn\u0027t think he would quote me literally! Anyway I think this can raise an exception at the moment. We\u0027ll cross this bridge when we get to Ironic support, but it\u0027s good to carve out the method to be used when Ironic support comes along.\n\n[1] https://review.openstack.org/#/c/333605/","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"435f27ffef36bf2925424849f0a9d38465c329a9","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        \"\"\"Determine segmentation_id and segmentation type when omitted.\"\"\""},{"line_number":64,"context_line":"        return {"},{"line_number":65,"context_line":"            \u0027port_id\u0027: port_id,"},{"line_number":66,"context_line":"            \u0027segmentation_type\u0027: \u0027foo\u0027,"},{"line_number":67,"context_line":"            \u0027segmentation_id\u0027: 3333"},{"line_number":68,"context_line":"        }"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def validate_subport(self, subport):"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_850fa32d","line":67,"range":{"start_line":66,"start_character":13,"end_line":67,"end_character":35},"in_reply_to":"3aaa91ec_7b936f5b","updated":"2016-06-27 18:14:26.000000000","message":"Don\u0027t worry Armando, I wasn\u0027t taking you that seriously :) I just put this up for review so I wouldn\u0027t lose what I had and so we could see how this might work. As you suggested I\u0027d prefer to simply raise InvalidInput and come back to this when we do tackle Ironic support. I think we have things decoupled enough that we can move forward and not rip everything apart when we do need to handle Ironic requests.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ccf39cb033f14ba5ea630ff19eeedb3bd597e641","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        \"\"\"Determine segmentation_id and segmentation type when omitted.\"\"\""},{"line_number":64,"context_line":"        return {"},{"line_number":65,"context_line":"            \u0027port_id\u0027: port_id,"},{"line_number":66,"context_line":"            \u0027segmentation_type\u0027: \u0027foo\u0027,"},{"line_number":67,"context_line":"            \u0027segmentation_id\u0027: 3333"},{"line_number":68,"context_line":"        }"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def validate_subport(self, subport):"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_39cb6f20","line":67,"range":{"start_line":66,"start_character":13,"end_line":67,"end_character":35},"in_reply_to":"3aaa91ec_850fa32d","updated":"2016-06-27 22:30:14.000000000","message":"I did forget about the Ironic discussion at summit.  But, it is all flooding back to my memory.  I agree with Armando that we should raise an exception here and cross the ironic bridge in another patch set.  Hopefully breaking that discussion out will help get this patch ready quicker.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"14911823f234a3b1c4aa01eab1f1d3121c571354","unresolved":false,"context_lines":[{"line_number":73,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        # the segmentation details are missing, hence we need to figure"},{"line_number":76,"context_line":"        # them out somehow, e.g. pull them from the subport\u0027s network"},{"line_number":77,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":78,"context_line":"            return self.default_segmentation_details(subport[\u0027port_id\u0027])"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_af3803d4","line":76,"range":{"start_line":76,"start_character":28,"end_line":76,"end_character":69},"updated":"2016-06-24 22:57:12.000000000","message":"How would we do this?  I don\u0027t get this.  The segmentation details for a sub-port don\u0027t really have anything to do with the subport\u0027s network.  This would just be confusing.  Why wouldn\u0027t the segmentation details just be required all the time?","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1821eb93a414eb3e599bfaff5171cf20ff06b530","unresolved":false,"context_lines":[{"line_number":73,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        # the segmentation details are missing, hence we need to figure"},{"line_number":76,"context_line":"        # them out somehow, e.g. pull them from the subport\u0027s network"},{"line_number":77,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":78,"context_line":"            return self.default_segmentation_details(subport[\u0027port_id\u0027])"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_7b7a4f25","line":76,"range":{"start_line":76,"start_character":28,"end_line":76,"end_character":69},"in_reply_to":"3aaa91ec_5a379b4c","updated":"2016-06-25 19:31:53.000000000","message":"VLAN trunking for Ironic is slightly different. We had a bunch of sessions at the summit to go over this use case. I\u0027ll fill you in, but for now I think we can safely say that the defeault_segmentation_details can raise an InvalidInput with missing segmentation details.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ccf39cb033f14ba5ea630ff19eeedb3bd597e641","unresolved":false,"context_lines":[{"line_number":73,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        # the segmentation details are missing, hence we need to figure"},{"line_number":76,"context_line":"        # them out somehow, e.g. pull them from the subport\u0027s network"},{"line_number":77,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":78,"context_line":"            return self.default_segmentation_details(subport[\u0027port_id\u0027])"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_b9fe3f36","line":76,"range":{"start_line":76,"start_character":28,"end_line":76,"end_character":69},"in_reply_to":"3aaa91ec_7b7a4f25","updated":"2016-06-27 22:30:14.000000000","message":"+1","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"792e381747368c7343182d19c4c2e21d31be2b44","unresolved":false,"context_lines":[{"line_number":73,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"        # the segmentation details are missing, hence we need to figure"},{"line_number":76,"context_line":"        # them out somehow, e.g. pull them from the subport\u0027s network"},{"line_number":77,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":78,"context_line":"            return self.default_segmentation_details(subport[\u0027port_id\u0027])"},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_5a379b4c","line":76,"range":{"start_line":76,"start_character":28,"end_line":76,"end_character":69},"in_reply_to":"3aaa91ec_af3803d4","updated":"2016-06-24 23:59:19.000000000","message":"See the comment above at L67. I\u0027m still scratching my head over this as well.","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"1cb06fca2c27d01370166545eed00ee6129d888e","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":169,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":170,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":171,"context_line":"                obj.create()"},{"line_number":172,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_53e64fe8","line":171,"range":{"start_line":171,"start_character":16,"end_line":171,"end_character":28},"updated":"2016-06-27 02:30:13.000000000","message":"As I suggested in PS24 this may happens duplicated object exception so we should catch it and tell users \"Duplicated SubPort\".","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"435f27ffef36bf2925424849f0a9d38465c329a9","unresolved":false,"context_lines":[{"line_number":168,"context_line":"                               port_id\u003dsubport[\u0027port_id\u0027],"},{"line_number":169,"context_line":"                               segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":170,"context_line":"                               segmentation_id\u003dsubport[\u0027segmentation_id\u0027])"},{"line_number":171,"context_line":"                obj.create()"},{"line_number":172,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":28,"id":"3aaa91ec_b3a94827","line":171,"range":{"start_line":171,"start_character":16,"end_line":171,"end_character":28},"in_reply_to":"3aaa91ec_53e64fe8","updated":"2016-06-27 18:14:26.000000000","message":"Done","commit_id":"57da3a8e2066a8637891fe222ea801c344f3a9ed"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"3b1ef2dfb740c41175f2c2132f9c77f7cf08980a","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":29,"id":"3aaa91ec_24586656","line":126,"range":{"start_line":126,"start_character":20,"end_line":126,"end_character":78},"updated":"2016-06-27 22:59:01.000000000","message":"See comments at https://review.openstack.org/#/c/320092/29/neutron/extensions/trunk.py L97. I believe when not specified sub_ports should be defaulting to [] instead of ATTR_NOT_SPECIFIED. As written not sending sub_ports causes a problem. Will also write a test to assert proper behavior.","commit_id":"f09066325636326922f9406e0134e8de3883ed39"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"3b1b8ff54a1c0b2e21f0b0ce67480606b51f5926","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":29,"id":"3aaa91ec_bfabbfd5","line":126,"range":{"start_line":126,"start_character":20,"end_line":126,"end_character":78},"in_reply_to":"3aaa91ec_24586656","updated":"2016-06-27 23:03:39.000000000","message":"+1\n\nIMO I think defaulting to [] makes more sense than object().","commit_id":"f09066325636326922f9406e0134e8de3883ed39"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"218277cdbe3c50da950328d21253d300148338c3","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":41,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":42,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":43,"context_line":"        return port_res"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"class TrunkPlugin(service_base.ServicePluginBase,"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_ee0eff30","line":43,"range":{"start_line":43,"start_character":8,"end_line":43,"end_character":23},"updated":"2016-06-28 21:28:42.000000000","message":"Shouldn\u0027t this return port_res regardless?","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"4f198973bea72fa919eac4f952a01826fd1940e0","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":41,"context_line":"        #TODO(tidwellr) fill in the trunk_details"},{"line_number":42,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":43,"context_line":"        return port_res"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"class TrunkPlugin(service_base.ServicePluginBase,"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_6ef16f6a","line":43,"range":{"start_line":43,"start_character":8,"end_line":43,"end_character":23},"in_reply_to":"3aaa91ec_ee0eff30","updated":"2016-06-28 21:53:41.000000000","message":"Yes, it should. Look for a fix in PS31.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":53,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":54,"context_line":"        self._segmentation_types \u003d {}"},{"line_number":55,"context_line":"        registry.notify(constants.TRUNK_PLUGIN, events.AFTER_CREATE, self)"},{"line_number":56,"context_line":"        LOG.debug(\u0027Trunk plugin loaded\u0027)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def add_segmentation_type(self, segmentation_type, id_validator):"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_d65d9fed","line":55,"updated":"2016-06-28 19:52:50.000000000","message":"Using AFTER_CREATE bothered me a little when I thought of this code, so I worked out [1]. Can you change, please?\n\n[1] https://review.openstack.org/#/c/335162/","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":53,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":54,"context_line":"        self._segmentation_types \u003d {}"},{"line_number":55,"context_line":"        registry.notify(constants.TRUNK_PLUGIN, events.AFTER_CREATE, self)"},{"line_number":56,"context_line":"        LOG.debug(\u0027Trunk plugin loaded\u0027)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def add_segmentation_type(self, segmentation_type, id_validator):"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_22aaddd2","line":55,"in_reply_to":"3aaa91ec_d65d9fed","updated":"2016-06-28 20:16:43.000000000","message":"AFTER_INIT it is. Done.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":64,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":65,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":68,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":69,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":70,"context_line":"        # cases."}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_cc17d252","line":67,"updated":"2016-06-28 19:52:50.000000000","message":"personally I would have kept the default_segmentation_details() method to avoid the inline change in the future, but that\u0027s just me.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        # cases."},{"line_number":71,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":72,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":73,"context_line":"                    \"provided to create a subport.\")"},{"line_number":74,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_2c3c96be","line":73,"updated":"2016-06-28 19:52:50.000000000","message":"drop the period at the end. InvalidInput already adds its own. I wonder if we should add the port_id","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        # cases."},{"line_number":71,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":72,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":73,"context_line":"                    \"provided to create a subport.\")"},{"line_number":74,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_62b4e534","line":73,"in_reply_to":"3aaa91ec_2c3c96be","updated":"2016-06-28 20:16:43.000000000","message":"Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":83,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"        if segmentation_type not in self._segmentation_types:"},{"line_number":86,"context_line":"            msg \u003d _(\"Invalid segmentation_type \u0027%s\u0027\") % segmentation_type"},{"line_number":87,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_76edcbb6","line":85,"updated":"2016-06-28 19:52:50.000000000","message":"not sure if here we want to provide a property to access this variable, but meh.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":83,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"        if segmentation_type not in self._segmentation_types:"},{"line_number":86,"context_line":"            msg \u003d _(\"Invalid segmentation_type \u0027%s\u0027\") % segmentation_type"},{"line_number":87,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_02f3610b","line":85,"in_reply_to":"3aaa91ec_76edcbb6","updated":"2016-06-28 20:16:43.000000000","message":"meh, I don\u0027t really care either way.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_8ce5caa9","line":126,"updated":"2016-06-28 19:52:50.000000000","message":"At this point in time we don\u0027t really know how to handle subports with different segmentation technology, but right now this implementation allows to add a subport on X and a subport on Y. Have you given this any thought?","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7b13bd0a9c6b04d675bdfe9c198a075567c5abd0","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_f19ede52","line":126,"in_reply_to":"3aaa91ec_4b77453a","updated":"2016-06-28 22:41:37.000000000","message":"well, right now there\u0027s only one segmentation type, so it\u0027s good. A note to remember us of the potential hybrid case might come handy in the future.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_a22ecd3f","line":126,"in_reply_to":"3aaa91ec_8ce5caa9","updated":"2016-06-28 20:16:43.000000000","message":"I have been noodling on that. As you can see I don\u0027t have an answer yet. I\u0027ve been wondering if the Trunk should carry a segmentation_type on it, that way we could match up subport segmentation_type with the Trunk.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d9a22afff824d1a77ac625789badca5abdfc5728","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_cb20559e","line":126,"in_reply_to":"3aaa91ec_a22ecd3f","updated":"2016-06-28 21:02:22.000000000","message":"not sure if a trunk-wide segmentation type is the answer. I can see that in the future a hybrid beast will be asked for and I don\u0027t want the model to get in the way.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"4f198973bea72fa919eac4f952a01826fd1940e0","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":124,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":125,"context_line":"        # sanitize subports"},{"line_number":126,"context_line":"        sub_ports \u003d [self.validate_subport(p) for p in trunk.get(\u0027sub_ports\u0027)]"},{"line_number":127,"context_line":"        sub_ports \u003d [trunk_objects.SubPort("},{"line_number":128,"context_line":"                        context\u003dcontext,"},{"line_number":129,"context_line":"                        port_id\u003dp[\u0027port_id\u0027],"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_4b77453a","line":126,"in_reply_to":"3aaa91ec_cb20559e","updated":"2016-06-28 21:53:41.000000000","message":"In that case, is there anything we need to do differently right now? As written this will allow subports of different segmentation types to co-exist on the same trunk, which is what you seem to be hinting at when you mention a \"hybrid beast\".","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"        # sanitize subports"},{"line_number":157,"context_line":"        subports \u003d [self.validate_subport(subport) for subport in subports]"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":160,"context_line":"            for subport in subports:"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_cc2512af","line":157,"updated":"2016-06-28 19:52:50.000000000","message":"I am wondering if here we should ensure we expect that subports be a list","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d9a22afff824d1a77ac625789badca5abdfc5728","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"        # sanitize subports"},{"line_number":157,"context_line":"        subports \u003d [self.validate_subport(subport) for subport in subports]"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":160,"context_line":"            for subport in subports:"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_0b425d3e","line":157,"in_reply_to":"3aaa91ec_a28a4d18","updated":"2016-06-28 21:02:22.000000000","message":"I don\u0027t believe so.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"        # sanitize subports"},{"line_number":157,"context_line":"        subports \u003d [self.validate_subport(subport) for subport in subports]"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":160,"context_line":"            for subport in subports:"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_a28a4d18","line":157,"in_reply_to":"3aaa91ec_cc2512af","updated":"2016-06-28 20:16:43.000000000","message":"Can it be anything other than a list? Good catch, we should assert we were given a list before proceeding.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"7c1971e3a131f3de97e65071fd2525c01bbf1382","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                try:"},{"line_number":168,"context_line":"                    obj.create()"},{"line_number":169,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry as e:"},{"line_number":170,"context_line":"                    raise trunk_exc.DuplicateSubPort(e.msg)"},{"line_number":171,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_c50fdc2c","line":170,"range":{"start_line":170,"start_character":20,"end_line":170,"end_character":59},"updated":"2016-06-28 04:47:07.000000000","message":"This just passes through ;) It\u0027s not user friendly.\n\nFor example, when we try to put duplicated port id to subport, server returns \u0027{\"NeutronError\": {\"message\": \"Failed to create a duplicate SubPort: for attribute(s) [\u0027PRIMARY\u0027] with value(s) 96c4a9f8-3130-4d16-bb6a-01abd8bcf05d\", \"type\": \"DuplicateSubPort\", \"detail\": \"\"}}\u0027. And also, when we try to put duplicated segmentation id to subport, server returns \u0027{\"NeutronError\": {\"message\": \"Failed to create a duplicate SubPort: for attribute(s) [\u0027trunk_id\u0027, \u0027segmentation_type\u0027, \u0027segmentation_id\u0027] with value(s) 02acdbda-67fc-4821-935e-c97926519af1-vlan-2\", \"type\": \"DuplicateSubPort\", \"detail\": \"\"}}\u0027.\n\nCan you prepare an appropriate message for DuplicateSubPort?","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                try:"},{"line_number":168,"context_line":"                    obj.create()"},{"line_number":169,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry as e:"},{"line_number":170,"context_line":"                    raise trunk_exc.DuplicateSubPort(e.msg)"},{"line_number":171,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_c2b959ee","line":170,"range":{"start_line":170,"start_character":20,"end_line":170,"end_character":59},"in_reply_to":"3aaa91ec_31bfcdfd","updated":"2016-06-28 20:16:43.000000000","message":"Yes, I realized this was a silly comment on my part when I started looking into addressing the comment from @Hirofumi. I promise this will be cleaner in the next patch set.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                try:"},{"line_number":168,"context_line":"                    obj.create()"},{"line_number":169,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry as e:"},{"line_number":170,"context_line":"                    raise trunk_exc.DuplicateSubPort(e.msg)"},{"line_number":171,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_31bfcdfd","line":170,"range":{"start_line":170,"start_character":20,"end_line":170,"end_character":59},"in_reply_to":"3aaa91ec_9a77cad3","updated":"2016-06-28 19:52:50.000000000","message":"it looks to me the offending segmentation details are right in front of us, I don\u0027t see the reason for going to back to the DB.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"88db62bd695204b591894d67369bcb3d1d6f80f3","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                try:"},{"line_number":168,"context_line":"                    obj.create()"},{"line_number":169,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry as e:"},{"line_number":170,"context_line":"                    raise trunk_exc.DuplicateSubPort(e.msg)"},{"line_number":171,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"        return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_9a77cad3","line":170,"range":{"start_line":170,"start_character":20,"end_line":170,"end_character":59},"in_reply_to":"3aaa91ec_c50fdc2c","updated":"2016-06-28 15:07:01.000000000","message":"It looked to me like NeutronDbObjectDuplicateEntry would actually tell us which attributes were the problematic ones. I\u0027m trying to avoid going back to the DB to figure out where the conflict is, I guess there\u0027s no avoiding it :(","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":182,"context_line":""},{"line_number":183,"context_line":"            sub_ports \u003d {p.port_id: p for p in trunk.sub_ports}"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"            for subport_id in subports:"},{"line_number":186,"context_line":"                try:"},{"line_number":187,"context_line":"                    subport_obj \u003d sub_ports.pop(subport_id)"},{"line_number":188,"context_line":"                    subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_cc4cf278","line":185,"updated":"2016-06-28 19:52:50.000000000","message":"ditto, do we want to ensure subports is what we expect? A buggy client may cause the server to spit a 500.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":182,"context_line":""},{"line_number":183,"context_line":"            sub_ports \u003d {p.port_id: p for p in trunk.sub_ports}"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"            for subport_id in subports:"},{"line_number":186,"context_line":"                try:"},{"line_number":187,"context_line":"                    subport_obj \u003d sub_ports.pop(subport_id)"},{"line_number":188,"context_line":"                    subport_obj.delete()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_02824100","line":185,"in_reply_to":"3aaa91ec_cc4cf278","updated":"2016-06-28 20:16:43.000000000","message":"Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"7c1971e3a131f3de97e65071fd2525c01bbf1382","unresolved":false,"context_lines":[{"line_number":182,"context_line":""},{"line_number":183,"context_line":"            sub_ports \u003d {p.port_id: p for p in trunk.sub_ports}"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"            for subport_id in subports:"},{"line_number":186,"context_line":"                try:"},{"line_number":187,"context_line":"                    subport_obj \u003d sub_ports.pop(subport_id)"},{"line_number":188,"context_line":"                    subport_obj.delete()"},{"line_number":189,"context_line":"                except KeyError:"},{"line_number":190,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":191,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"            trunk.sub_ports \u003d list(sub_ports.values())"},{"line_number":194,"context_line":"            return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_901ced14","line":191,"range":{"start_line":185,"start_character":12,"end_line":191,"end_character":71},"updated":"2016-06-28 04:47:07.000000000","message":"I prefer checking key over catching KeyError.\n\n for subport_id in subports:\n     subport_obj \u003d sub_ports.pop(subport_id, None)\n     if subport_obj is None:\n         raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id, port_id\u003dsubport_id)\n     subport_obj.delete()","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"88db62bd695204b591894d67369bcb3d1d6f80f3","unresolved":false,"context_lines":[{"line_number":182,"context_line":""},{"line_number":183,"context_line":"            sub_ports \u003d {p.port_id: p for p in trunk.sub_ports}"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"            for subport_id in subports:"},{"line_number":186,"context_line":"                try:"},{"line_number":187,"context_line":"                    subport_obj \u003d sub_ports.pop(subport_id)"},{"line_number":188,"context_line":"                    subport_obj.delete()"},{"line_number":189,"context_line":"                except KeyError:"},{"line_number":190,"context_line":"                    raise trunk_exc.SubPortNotFound(trunk_id\u003dtrunk_id,"},{"line_number":191,"context_line":"                                                    port_id\u003dsubport_id)"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"            trunk.sub_ports \u003d list(sub_ports.values())"},{"line_number":194,"context_line":"            return trunk"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_9a26aa14","line":191,"range":{"start_line":185,"start_character":12,"end_line":191,"end_character":71},"in_reply_to":"3aaa91ec_901ced14","updated":"2016-06-28 15:07:01.000000000","message":"Yeah, you\u0027re right. That is better.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"fe3fe4fcbfefa836d87948bfc3955a79489c5935","unresolved":false,"context_lines":[{"line_number":34,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":38,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":39,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":40,"context_line":"        #TODO(tidwellr) fill in trunk_details appropriately"}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_421c42c1","line":37,"updated":"2016-06-29 00:29:19.000000000","message":"since [1] is in the works, you can pull this entirely\n\n[1] https://review.openstack.org/#/c/334700/","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"9a1def3db8e46200362c9240a895dfe2ec48eba3","unresolved":false,"context_lines":[{"line_number":34,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":38,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":39,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":40,"context_line":"        #TODO(tidwellr) fill in trunk_details appropriately"}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_638b3d1f","line":37,"in_reply_to":"3aaa91ec_421c42c1","updated":"2016-06-29 06:24:24.000000000","message":"Done","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"fe3fe4fcbfefa836d87948bfc3955a79489c5935","unresolved":false,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":38,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":39,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":40,"context_line":"        #TODO(tidwellr) fill in trunk_details appropriately"},{"line_number":41,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":42,"context_line":""}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_226e562f","line":39,"updated":"2016-06-29 00:29:19.000000000","message":"I am thinking that if this method is called, the statement must be True.","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"9a1def3db8e46200362c9240a895dfe2ec48eba3","unresolved":false,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":"def _extend_port_trunk_details(core_plugin, port_res, port_db):"},{"line_number":38,"context_line":"    \"\"\"Add trunk details to a port.\"\"\""},{"line_number":39,"context_line":"    if manager.NeutronManager.get_service_plugins().get(\u0027trunk\u0027):"},{"line_number":40,"context_line":"        #TODO(tidwellr) fill in trunk_details appropriately"},{"line_number":41,"context_line":"        port_res[\u0027trunk_details\u0027] \u003d {}"},{"line_number":42,"context_line":""}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_a3852508","line":39,"in_reply_to":"3aaa91ec_226e562f","updated":"2016-06-29 06:24:24.000000000","message":"Good point.","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"fe3fe4fcbfefa836d87948bfc3955a79489c5935","unresolved":false,"context_lines":[{"line_number":49,"context_line":"    supported_extension_aliases \u003d [\"trunk\", \"trunk-details\"]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    def __init__(self):"},{"line_number":52,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":53,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":54,"context_line":"        self._segmentation_types \u003d {}"},{"line_number":55,"context_line":"        #TODO(tidwellr) notify using events.AFTER_INIT once available"}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_02699a25","line":52,"updated":"2016-06-29 00:29:19.000000000","message":"at this point you can pull this out and add it in the context of https://review.openstack.org/#/c/334700/","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"9a1def3db8e46200362c9240a895dfe2ec48eba3","unresolved":false,"context_lines":[{"line_number":49,"context_line":"    supported_extension_aliases \u003d [\"trunk\", \"trunk-details\"]"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    def __init__(self):"},{"line_number":52,"context_line":"        db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs("},{"line_number":53,"context_line":"            attributes.PORTS, [_extend_port_trunk_details])"},{"line_number":54,"context_line":"        self._segmentation_types \u003d {}"},{"line_number":55,"context_line":"        #TODO(tidwellr) notify using events.AFTER_INIT once available"}],"source_content_type":"text/x-python","patch_set":32,"id":"3aaa91ec_037d191c","line":52,"in_reply_to":"3aaa91ec_02699a25","updated":"2016-06-29 06:24:24.000000000","message":"agreed","commit_id":"aa2c980cf62b53cabb7806dd4624c1cc79b45b90"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_103a6b98","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"updated":"2016-06-29 11:33:52.000000000","message":"This validation is only partial...the port could be used by some other trunk or by another subport and we wouldn\u0027t validate that here. Do we really need it? The db would complain if the port is in use, since the port_id is a primary key","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_a657d758","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_103a6b98","updated":"2016-06-29 14:45:05.000000000","message":"The DB will enforce that port_id is unique across trunks or unique across subports. However, it doesn\u0027t protect us from a port_id in use for a trunk being used by a subport. In the case of a trying use a port_id used by a trunk on a subport, the DB actually would not complain.\n\nYou may be right that this is partial in that it doesn\u0027t check the inverse, that being a trunk attempting to use the port_id of an existing subport.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"1fc8966a054ea5506f93010efedd02cb877e86cf","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_37e2e82f","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_11437c43","updated":"2016-06-29 16:56:53.000000000","message":"Another reason I don\u0027t think we can\u0027t rely on the agent is from the agent\u0027s perspective port_id is probably irrelevant. I think port_id only matters from a model perspective, so there ends up being a breakdown in the model.\n\nA crazy thought I had is to adjust the model somehow so that we flip the FK constraints around to point from port_id to either trunk_id or a subport row. This way the model inherently enforces a port_id is never used by both a trunk and subport. The idea is half-baked and I\u0027m just thinking out loud.\n\nAs I mentioned in an earlier comment, I\u0027m uncomfortable having the agent enforce things that should be enforced in the model.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"8198bb845e4869d12c34e0378c0cd294337f1b9d","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_4900ad34","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_1a0ee83a","updated":"2016-06-29 23:41:14.000000000","message":"I\u0027m going to go ahead and leave this here. The checks we\u0027re talking about won\u0027t catch the case where the user passes subports at the same time as the trunk and the trunk uses the same port_id as a subport. This superficial check is still needed, but as pointed out by itself it\u0027s insufficient. Look for more complete checks in the next (and hopefully last :) ) patch set.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"d517fbc76ef0965e0cb28b2ab38a6a8676f3be4c","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_55184975","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_37e2e82f","updated":"2016-06-29 18:41:57.000000000","message":"@Ryan, I did not mean that we should _rely_ on the agent only, but that we could perform the the DB-level check in the plugin without accounting for possible race conditions at this level. We just need to be aware of them and leave a NOTE for that. That should work for maybe 99.(9)% of the cases. But for those exceptionally rare (unless the user is deliberately trying to force that) cases  where we have 2 concurrent requests trying to use the same port as both trunk and sub-port we\u0027ll get an error from the agent. And of course the agent has to make sure it is not trying to use the same port as both Trunk and SubPort (as the Port itself is unique anyway, we probably don\u0027t need to enforce it but that would happen naturally - we can\u0027t have 2 ports with the same name, right?).\n\nThere\u0027s one way we could achieve this by updating a model though - introduce another table that would have both trunk port and sub-port ids (and e.g. \u0027type\u0027 column). But I\u0027m not sure if I like that idea at all.\n\nI\u0027m not sure I understand what do you mean by \u0027flip the FK\u0027.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"49578c054f8da9b86c14bd5efd0d96bbeeaf6866","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_986948fc","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_382814e2","updated":"2016-06-29 19:26:38.000000000","message":"@Armando what you see here is a haphazard attempt at trying to enforce b) that is incomplete. I think what we\u0027re talking about here is how much to fret over the small probability that a race could theoretically result in the nested port scenario you mention by checking conditions a \u0026 b.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"d75c06f80acb7df13179f34eadca9a456bd0ba0d","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_6b748835","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_382814e2","updated":"2016-06-29 19:42:12.000000000","message":"@Armando, (a) and (b) is what I\u0027m suggesting for now. The problem is that it does not provide 100% guarantee as there\u0027s potential race condition (concurrent session used the same port_id _after_ we checked but _before_ we actually created a row in DB).\n\n\u003euse of another table ... won\u0027t actually help I don\u0027t think.\n\nIt will help, but it is ugly. If we have a table with unique port_id and we insert a row there for each Trunk/SubPort before actually creating that Trunk/SubPort, we\u0027ll have it enforce Trunk/SubPort uniqueness for us.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f319c8c7af4891527c08efc68197d6690e9bcd0d","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_582fe087","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_55184975","updated":"2016-06-29 19:06:23.000000000","message":"@Ilya Thanks for the clarification. What I\u0027m trying to avoid is the same Neutron port being used by a trunk when it is used on a subport and vice-versa. The current model doesn\u0027t allow trunks to share a port_id, and it doesn\u0027t allow subports to share a port_id. But it does allow a trunk and subport to share a port_id. We need a solution for enforcing that.\n\nIt is a wacky idea, but what I meant by \"flipping\" the FK constraint around is that the current constraints point from trunks/subports back to ports. I was batting around an intermediate table that could somehow enforce uniqueness of port_id across both trunks and subports. I still don\u0027t know how that would work and we can just drop the idea.\n\nI\u0027m still not convinced that the agent should even care about port_id enough to even be aware that a trunk and subport share a port_id. How would it even know? Why should it care? port_id is really irrelevant when you drill down below the API layer, at that level we\u0027re talking only in terms of segmentation_type and segmentation_id. port_id is essentially a nicety we provide the user for interacting with the API that doesn\u0027t mean much once we get down to the business of instantiating a trunk or subport. The agent isn\u0027t much of a backstop IMO. In fact, I don\u0027t see why it would even have to raise an error in this case.\n\nI want to leave the agent out of this discussion because we\u0027re really talking about keeping the model sane, and the agent should play absolutely no role in that.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"97ec14453f579ffdffa618db6287154422034f9d","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_eb799883","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_582fe087","updated":"2016-06-29 19:34:04.000000000","message":"\u003e But it does allow a trunk and subport to share a port_id. We need a solution for enforcing that.\n\nYes, that requirement is even listed in the Armando\u0027s comment at the end of the Trunk model declaration :)\n\n\u003e I was batting around an intermediate table that could somehow enforce uniqueness of port_id across both trunks and subports.\n\nThats totally possible, we just need to introduce another parent table that would have port_id as a primary key and be referenced by Trunk and SubPort FKs instead of Port and then that table would have a FK to Port. And when we add a Trunk or SubPort we also add a port_id to that table. That\u0027s what I was talking about in my previous comment, but as I said, I don\u0027t really like that idea as it makes the model counter intuitive and rather synthetic.\n\nIn fact there\u0027s another option. When creating a trunk we could create a synthetic SubPort with, say, segmentation_type\u003d\u0027TRUNK\u0027. That would solve the problem (as port_id uniqueness would be enforced by SubPort model) but then we\u0027d have to filter that SubPort to hide it from user and other layers. It is probably less intrusive than introducing intermediate table. But IMO that\u0027s still a workaround that requires another workaround.\n\n\u003e port_id is really irrelevant when you drill down below the API layer\n\nAFAIK agent uses port_id to fetch port details from Neutron server, so it is totally aware of it.\n\nMy suggestion is that for now we should implement this check by using \u0027Trunk.get_objects(port_id\u003dsub_port_id) is empty\u0027 and \u0027SubPort.get_objects(port_id\u003dtrunk_port_id) is empty\u0027. And leave a REVISIT note to come back to it later. That should cover like 99.(9)% of cases. And then we\u0027ll come back here later once the agent extension is implemented so we can improve it and cover 100%.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"bc5b37360a77f816b35a185cec1c8955a4b4c48b","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_382814e2","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_582fe087","updated":"2016-06-29 19:18:42.000000000","message":"Having the agent play any role here is out of the question. Whilst we go over this patch we need to bear in mind constraints [1]. I think you guys are talking about the case of nested ports, ie. ports that are attempted to be parent and sub-port of a trunk at the same time. This should be forbidden. At least at the moment. There\u0027s multiple ways in which can be solved:\n\na) when creating a trunk, we ensure that the port does not show up in the subport table.\nb) when adding a subport, we ensure that the port does not show up in the trunk table.\n\nThe use of another table or changing the integrity constraints won\u0027t actually help I don\u0027t think.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/services/trunk/models.py#L64","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"d41465da96bf67ce8300dfb657362f666891f217","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_da1d8063","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_5f18621e","updated":"2016-06-29 21:20:46.000000000","message":"Done","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9b55236bda7805c5e006c177211c2addf503b6ea","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_bf7ea667","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_6b748835","updated":"2016-06-29 20:58:21.000000000","message":"Talking about this reminded me that one thing we may wanna do is to update device_owner/device_id for subports in case that can come handy later. As for the race condition where two requests attempt to use the same port to create a trunk and to be added as a subport, there\u0027s way around it. For instance, the record can be created first and then rolled back if present in the other table. Potentially both requests may fail with conflict, and a retry should be able to solve it.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"34cda70f579777b5cfebf0799cf27d01e5391cb8","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_b7809fc0","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_a657d758","updated":"2016-06-29 15:26:06.000000000","message":"+1 @Rossella. Checking for \u0027trunk_port_id\u0027 is not enough, you also need to check for \u0027trunk_port_id\u0027 of other trunks, not just the one you are adding sub-ports to. So you\u0027ll need a DB call for that outside this validator (as well as checking trunk[\u0027port_id\u0027] when creating the trunk). Validating port_id uniqueness here may serve as a \u0027fail-fast\u0027 optimisation, but we still need to properly validate it in create/add.\n\nAlso note that simply checking for Trunk.get_objects(port_id\u003dsub_port_id) would not be enough as well as it is not atomic with Trunk/SubPort creation and prone to races (both in multi-server and single-server configuration). But while technically it\u0027s just another \u0027fail fast\u0027 optimisation, it should work for majority of use cases except for just the race conditions. It probably belongs to this patch or the followup one (then we need a TODO comment in this one).\n\nThe real \u0027source of truth\u0027 would be the agent extension that should fail to attach the port if it is already used.\n\nPS: sorry for raising this just now, I totally forgot about it despite that we already discussed that several times before in other patches :/","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"bd8d2f1228a0591fb470b04af7b6768937cc2a0a","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_11437c43","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_b7809fc0","updated":"2016-06-29 16:16:38.000000000","message":"Yeah, this is not the right place for this kind of check. Any sort of validation here will be racy. However, I\u0027m uncomfortable with the suggestion that the \"source of truth\" is the agent. We shouldn\u0027t have to wait until subport plugging is happening on the agent to notice a problem.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"f98b774d7666e7caed9a193ebd49ee5f0777cbfc","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_1a0ee83a","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_bf7ea667","updated":"2016-06-29 21:46:17.000000000","message":"\u003e there\u0027s way around it. For instance, the record can be created first and then rolled back if present in the other table.\n\nI was thinking about it as well, but just a regular rollback would not suffice here. We\u0027ll have to commit the transaction first, then check and then manually \u0027rollback\u0027 by deleting what we created if we see the conflict. Otherwise there would still be a chance for a race.\n\nThere are plenty solutions, but none that I feel comfortable with yet. Probably we\u0027ll have to figure out which one is the \u0027least evil\u0027. But let\u0027s leave that for a follow-up patch.\n\nJust to be clear, I\u0027m ok if we either have a simple TODO for constraints in this patch (but we\u0027ll need a follow up one ASAP) or a simple Trunk/SubPort.get_objects() check in create/add AND a REVISIT note for the race condition.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e9d2433fbdbbbba5412650a8fed0b48ff8043fd8","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_5f18621e","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_bf7ea667","updated":"2016-06-29 21:05:33.000000000","message":"Either way, let\u0027s make sure we nail down the constraints. We may want to work out a solution to deal with the race later on, especially if we consider the use of same port in two conflicting requests a corner case.\n\nIn this method we should ensure that the subport is not a parent port. We still need to detect the conflict for method create_trunk() where the port id is used as subports.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"d41465da96bf67ce8300dfb657362f666891f217","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_7aef2c1e","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_bf7ea667","updated":"2016-06-29 21:20:46.000000000","message":"Yes, updating device_owner and device_id something we want to do. Would it make sense to include it in https://review.openstack.org/#/c/334700/? That patch is focused on extending the port resource.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"80c504e38b01a2c5208047d5f697d7eaa6034cb1","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_492f1488","line":54,"range":{"start_line":54,"start_character":8,"end_line":54,"end_character":47},"in_reply_to":"3aaa91ec_eb799883","updated":"2016-06-29 20:30:06.000000000","message":"As long as we do come back to revisit it I\u0027m fine just proceeding with a \u0026 b. I\u0027d really like to get this merged, so anything that can handled with a follow-up works for me.\n\n@Ilya not to dwell on it (ok, I\u0027m dwelling on it), when I said port_id is really irrelevant from agent perspective that was probably too much of a sweeping statement. Yes we need a port ID to pull some data back from the server. What I meant is that once you get down to the mechanics of actually wiring the trunk/subport it becomes just a bit of metadata.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":58,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":59,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":60,"context_line":"        # cases."},{"line_number":61,"context_line":"        if len(subport) \u003d\u003d 1:"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_b0955741","line":58,"range":{"start_line":58,"start_character":21,"end_line":58,"end_character":67},"updated":"2016-06-29 11:33:52.000000000","message":"during the past summit we had a discussion with the Ironic people and we agreed that if segmentation id and type are not present we should use the ones of the network segment the port is on. Can we take care of this in this patch, why shall we delay it?","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":55,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":58,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":59,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":60,"context_line":"        # cases."},{"line_number":61,"context_line":"        if len(subport) \u003d\u003d 1:"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_f914e0e9","line":58,"range":{"start_line":58,"start_character":21,"end_line":58,"end_character":67},"in_reply_to":"3aaa91ec_b0955741","updated":"2016-06-29 14:45:05.000000000","message":"The reason to delay it was that implementing the default segmentation is not as straight-forward as it sounds. We have to consider the segmentation_type, as well as potentially the backend technology (ie Ironic, OVS, OVN). I\u0027m trying to keep this very basic. I thin we have the framework to handle in place though. I\u0027ve been planning a follow-up patch to this one to deal with this issue specifically.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":59,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":60,"context_line":"        # cases."},{"line_number":61,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":62,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":63,"context_line":"                    \"provided to create a subport\")"},{"line_number":64,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_90465b1f","line":61,"range":{"start_line":61,"start_character":8,"end_line":61,"end_character":29},"updated":"2016-06-29 11:33:52.000000000","message":"as already noted by Kevin this is tricky and confusing, please be more explicit.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":59,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":60,"context_line":"        # cases."},{"line_number":61,"context_line":"        if len(subport) \u003d\u003d 1:"},{"line_number":62,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":63,"context_line":"                    \"provided to create a subport\")"},{"line_number":64,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_59837456","line":61,"range":{"start_line":61,"start_character":8,"end_line":61,"end_character":29},"in_reply_to":"3aaa91ec_90465b1f","updated":"2016-06-29 14:45:05.000000000","message":"Done","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e9d2433fbdbbbba5412650a8fed0b48ff8043fd8","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":124,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":125,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":126,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":127,"context_line":"                                        sub_ports\u003dsub_ports)"},{"line_number":128,"context_line":"        trunk_obj.create()"},{"line_number":129,"context_line":"        return trunk_obj"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_bf84e60a","line":126,"updated":"2016-06-29 21:05:33.000000000","message":"we should ensure that the port id here is not in use as subport.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"d41465da96bf67ce8300dfb657362f666891f217","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        trunk_obj \u003d trunk_objects.Trunk(context\u003dcontext,"},{"line_number":124,"context_line":"                                        id\u003duuidutils.generate_uuid(),"},{"line_number":125,"context_line":"                                        tenant_id\u003dtrunk[\u0027tenant_id\u0027],"},{"line_number":126,"context_line":"                                        port_id\u003dtrunk[\u0027port_id\u0027],"},{"line_number":127,"context_line":"                                        sub_ports\u003dsub_ports)"},{"line_number":128,"context_line":"        trunk_obj.create()"},{"line_number":129,"context_line":"        return trunk_obj"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_7a2c4c99","line":126,"in_reply_to":"3aaa91ec_bf84e60a","updated":"2016-06-29 21:20:46.000000000","message":"Done","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        # sanitize subports"},{"line_number":147,"context_line":"        if not isinstance(subports, list):"},{"line_number":148,"context_line":"            msg \u003d _(\"A list of subports must be supplied.\")"},{"line_number":149,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":150,"context_line":""}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_d0a58347","line":147,"updated":"2016-06-29 11:33:52.000000000","message":"isn\u0027t the type already validated by the api?","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        # sanitize subports"},{"line_number":147,"context_line":"        if not isinstance(subports, list):"},{"line_number":148,"context_line":"            msg \u003d _(\"A list of subports must be supplied.\")"},{"line_number":149,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":150,"context_line":""}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_86ea9b72","line":147,"in_reply_to":"3aaa91ec_d0a58347","updated":"2016-06-29 14:45:05.000000000","message":"No, input is not validated on subresources. I\u0027ve never seen a way to attach validators to subresources in the extension descriptor. Am I missing something?","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a311da3ee8a57e9e7d9ad4c06d4dc06909c1fb60","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":166,"context_line":"                    # Lookup by port_id to see if port_id is in conflict"},{"line_number":167,"context_line":"                    obj \u003d None"},{"line_number":168,"context_line":"                    for sp in trunk[\u0027sub_ports\u0027]:"},{"line_number":169,"context_line":"                        if subport[\u0027port_id\u0027] \u003d\u003d sp[\u0027port_id\u0027]:"},{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_2d753831","line":168,"updated":"2016-06-30 19:54:30.000000000","message":"This is an incomplete check. It only catches the case where an overlap occurs within this request, it doesn\u0027t catch duplicates that are in the DB. This except block will be re-worked.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9cde24422e12c9d5ee3e900100fa13290ba1baed","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_30604735","line":173,"updated":"2016-06-29 11:33:52.000000000","message":"do we really need to write into the DB to discover there\u0027s a duplicate? Why don\u0027t we have a validate_subports method that checks if there are duplicates?","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"e86f57e869b94e526137d1c63d5075b7b6906e5c","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_59009401","line":173,"in_reply_to":"3aaa91ec_30604735","updated":"2016-06-29 14:45:05.000000000","message":"I guess not, we already read the trunk and its subports above so we could loop through that.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"d6240f53bcce511d7706487a6326eebe84dd1d4e","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_fbe4980d","line":173,"in_reply_to":"3aaa91ec_32e5dd37","updated":"2016-06-30 15:09:44.000000000","message":"Yes it\u0027s still possible but I think it\u0027s worth validating the data before inserting them in the db. Here we write few lines of code just to be able to discriminate between ParentPortInUse and DuplicateSubPort. I would use those line to check the data before inserting them and then throw a more general exception. The DB trace will clarify which are the duplicated data.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"7c2e79e786d30de5479a00d0aecbed112a301c19","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_dc21124f","line":173,"in_reply_to":"3aaa91ec_59009401","updated":"2016-06-29 14:58:34.000000000","message":"Although.... This does give us better protection against concurrent modifications in that we could bump into duplicate subports when we write into othe DB anyway. We\u0027d effectively be doing duplicate checks. I guess I\u0027m not seeing what\u0027s so bad about this.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"34cda70f579777b5cfebf0799cf27d01e5391cb8","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_32e5dd37","line":173,"in_reply_to":"3aaa91ec_59009401","updated":"2016-06-29 15:26:06.000000000","message":"Please note that even if \u0027validate_subports\u0027 passes the check it would still be possible (though unlikely) for the obj.create() to raise DbDuplicate if a concurrent \u0027add_subport\u0027 happened between L142 and L164.","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6d4b0b438ea6383bb84656c4b0d24bbc9f934054","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":171,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":174,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":175,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":176,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":33,"id":"3aaa91ec_af5be352","line":173,"in_reply_to":"3aaa91ec_fbe4980d","updated":"2016-06-30 18:26:02.000000000","message":"In PS34 I introduced _validate_port_id_not_in_use_by_subport(). We could use that check in validate(subport) and remove L168-171. Then we are still explicit about the duplicated port_id and duplicated segmentation details. The drawback is that it would have us going to the DB during validation more than this does because each subport is validated individually. I\u0027m not sure the pros of doing so outweigh the cons unless we go through another round of re-writing validate_subport() :(","commit_id":"a90095e3709dd04d57c75eaac3e289f51b4f6cf4"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"95191d4bf9d8e03512104d6c199649facc69999b","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        # NOTE(tidwellr) Check that the subport doesn\u0027t reference the same"},{"line_number":55,"context_line":"        # port_id as a trunk we may be in the middle of trying to create. In"},{"line_number":56,"context_line":"        # such cases a superficial check such as this is required as the trunk"},{"line_number":57,"context_line":"        # may not have been persisted yet."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_1b0fe437","line":54,"updated":"2016-06-30 15:10:06.000000000","message":"I don\u0027t think this check is needed, since we create the trunk before the subport and since we are using the same transaction. I might be wrong but it\u0027s easy to check. I see you have a unit test for this validation, can you run it removing these lines and see if it raises? If it raises than we can spare 6 lines, future Neutron devs will be grateful.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a689624ed33c23834189810441204a4f03474919","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            msg \u003d _(\"A valid port UUID must be specified\")"},{"line_number":52,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        # NOTE(tidwellr) Check that the subport doesn\u0027t reference the same"},{"line_number":55,"context_line":"        # port_id as a trunk we may be in the middle of trying to create. In"},{"line_number":56,"context_line":"        # such cases a superficial check such as this is required as the trunk"},{"line_number":57,"context_line":"        # may not have been persisted yet."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_f1acb7ee","line":54,"in_reply_to":"3aaa91ec_1b0fe437","updated":"2016-06-30 15:31:25.000000000","message":"This actually is needed. If you remove this check the validation isn\u0027t correct and the test fails. The reason for that is that in the case where you are creating a trunk AND passing subports in the same call, the trunk hasn\u0027t been persisted to the DB yet. In those cases, the deep validation that goes to the DB won\u0027t alert you to the overlap.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0240c853e40bdb8cb8eb54e1d5e3f3fb303f9b1a","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_14b87874","line":61,"updated":"2016-06-30 00:28:19.000000000","message":"I am thinking that a trigger might actually come handy here to avoid the race. We should check with zzeek to see how best to ensure unique values across tables is with sqlalchemy.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"5a2c39933001a15b958f13a85e6f1b436ecbc1f7","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_4f49cd30","line":61,"in_reply_to":"3aaa91ec_14b87874","updated":"2016-06-30 00:43:37.000000000","message":"\u003e a trigger might actually come handy here to avoid the race\n\nBy \u0027trigger\u0027 do you mean the DB triggers? If so I\u0027d rather avoid that as we\u0027ll need a custom one for each DB engine.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b9ee8ae6f6e300970491a0141ca6007f739749bc","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_8fe1f52c","line":61,"in_reply_to":"3aaa91ec_14b87874","updated":"2016-06-30 00:41:11.000000000","message":"I\u0027ve thought about a trigger as well, although I wasn\u0027t sure it was an option for us so I was just willing to settle for the time being.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_e5a99191","line":61,"in_reply_to":"3aaa91ec_275c654a","updated":"2016-06-30 17:05:53.000000000","message":"I\u0027m okay either way.  But, I don\u0027t know what you guys don\u0027t like about Ilya\u0027s idea.  I think it is pretty elegant.  To me, the untagged part of the trunk is just like any other subport, just with no tag.\n\nBut, I don\u0027t think it is that important.  No need to hold this up longer for this.  I don\u0027t think the race condition is likely at all.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"d253caf2c19aada774bc03a163238dbcc98b4b38","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_275c654a","line":61,"in_reply_to":"3aaa91ec_2f57215b","updated":"2016-06-30 03:24:36.000000000","message":"@Armando I think I\u0027m at the same place you are. We\u0027ve done our due diligence with validation and I feel we\u0027re in a pretty good place with this patch set. Let\u0027s not let perfection become the enemy of progress. Unless there\u0027s something glaring that I\u0027ve missed, I\u0027m not inclined to make many validation changes beyond what is in this patch set.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"572645c05782310a1525814bcf1e51f600686b0b","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_cf093d97","line":61,"in_reply_to":"3aaa91ec_4f49cd30","updated":"2016-06-30 00:59:24.000000000","message":"Actually, I\u0027m leaning toward adding a SubPort with segmentation_type\u003d\u0027untagged\u0027 for each Trunk. It probably even makes sense just by itself. Say, if you want to see what networks are aggregated on the trunk, you can just \u0027select from SubPort, Port, Network\u0027. I.e. we don\u0027t need to filter that. And considering that we\u0027ll have a driver based on segmentation_type, we can implement a no-op driver for \u0027untagged\u0027. What do you think about that?","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"6433232f44992fefa9203668b08d38ee20989ffc","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_af8643b6","line":61,"in_reply_to":"3aaa91ec_8c339561","updated":"2016-06-30 18:23:12.000000000","message":"@Armando, it does kill the race as port_id is unique in SubPort model and it is enforced on DB level.\n\nI don\u0027t see it as a misuse of logical model, but a change of the logic. Consider that Trunk.port_id is a medium and SubPort.port_id is a payload (either tagged or untagged). And as I said it may come in handy when we want to know what networks are aggregated on the trunk (and with the current model it is the Trunk.port_id that would require special casing).\n\n\u003e Then we could join on port id and build a query that inserts when the resultset of the join is empty. Do it in a transaction and the race should be gone.\n\nWould not that require going for SQLA instead of OVO? AFAIK the point of going for OVO (at the current stage) was to get rid of SQLA in plugins.\n\nAnd it would still be prone to the same race condition despite the transaction.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"31a03b5c8c213f6f809542fe098dbba302ca456f","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_8c339561","line":61,"in_reply_to":"3aaa91ec_a96f6390","updated":"2016-06-30 17:56:46.000000000","message":"Special casing on the segmentation type is not elegant IMO: it\u0027s a misuse of the logical model. The server or agent side business logic will have to be polluted with ignoring untagged ports and I am not 100% convinced it kills the race entirely.\n\nHaving said that, since we\u0027re talking, another thing worth considering is tweaking the subport model to add the parent_port_id. Then we could join on port id and build a query that inserts when the resultset of the join is empty. Do it in a transaction and the race should be gone.\n\nIt\u0027s now coming back why trunk_id might have made sense on the subport model, but I think that parent_port_id is more appropriate.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"840326b4812f22ee4b9ed15935161c73a4216489","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_2f57215b","line":61,"in_reply_to":"3aaa91ec_cf093d97","updated":"2016-06-30 01:14:52.000000000","message":"I think that we should cross the bridge when we get to it. Right now there\u0027s no evidence that this is a race that we\u0027re most definitely going to experience, either at scale or not. I can\u0027t imagine how a healthy script or a user can stumble upon it. You need two or more trunks and erroneously use the same port in two separate requests involving two separate trunks. It might as well be seen as a bug in the user script. The error can easily be recovered from. The trick of the dummy segmentation type might as well kill the race but I would feel dirt on my skin that I would never be able to wash off :)","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"407257c124d241575e4b098008316186860ab7ed","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d trunk_port_id:"},{"line_number":59,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"        # This is the deep check to assert the subport port_id doesn\u0027t overlap"},{"line_number":62,"context_line":"        # with any port_id\u0027s in use by trunks that have been persisted."},{"line_number":63,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":64,"context_line":"        # still allow a trunk and subport to reference the same port_id."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_a96f6390","line":61,"in_reply_to":"3aaa91ec_e5a99191","updated":"2016-06-30 17:31:30.000000000","message":"I guess I\u0027m not opposed to Ilya\u0027s idea in principle. I was just suggesting that we move on and not dwell on the issue of race conditions anymore. There\u0027s no reason we can\u0027t come up with a follow-on patch. I just didn\u0027t want to do it for the purpose of saving us from a race condition.\n\nI hadn\u0027t really thought of it in terms of the \"untagged subport\", I guess somehow that concept just went over my head since my mind was elsewhere. I could be sold on the idea, it does make sense that conceptually there is an untagged subport.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"95191d4bf9d8e03512104d6c199649facc69999b","unresolved":false,"context_lines":[{"line_number":67,"context_line":""},{"line_number":68,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":69,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":70,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":71,"context_line":"        # cases."},{"line_number":72,"context_line":"        port_id_only \u003d \u0027port_id\u0027 in subport and len(subport) \u003d\u003d 1"},{"line_number":73,"context_line":"        if port_id_only:"},{"line_number":74,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":75,"context_line":"                    \"provided to create a subport\")"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_09284199","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":65},"updated":"2016-06-30 15:10:06.000000000","message":"again, I\u0027d appreciate if you\u0027d be more explicit. len(subport)\u003d\u003d1 doesn\u0027t mean much and you had to add 2 lines of comments to make it somehow understandable.\nDo we care if only the port id is specified? I don\u0027t think so:\n\nWouldn\u0027t something like that be shorter and more clear:\n\nsegmentation_id \u003d subport.get(\"segmentation_id\")\nsegmentation_type \u003d subport.get(\"segmentation_type\")\n\nif not segmentation_id or not segmentation_type:\n   msg \u003d _(\"A valid segmentation_id and segmentation_type    must be provided to create a subport\")\n    raise n_exc.InvalidInput(error_message\u003dmsg)","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a689624ed33c23834189810441204a4f03474919","unresolved":false,"context_lines":[{"line_number":67,"context_line":""},{"line_number":68,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":69,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":70,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":71,"context_line":"        # cases."},{"line_number":72,"context_line":"        port_id_only \u003d \u0027port_id\u0027 in subport and len(subport) \u003d\u003d 1"},{"line_number":73,"context_line":"        if port_id_only:"},{"line_number":74,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":75,"context_line":"                    \"provided to create a subport\")"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_516b0b85","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":65},"in_reply_to":"3aaa91ec_09284199","updated":"2016-06-30 15:31:25.000000000","message":"Come on, it has made perfect sense to me this whole time!! ;) \n\nSeriously though, I\u0027ll make the change.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":67,"context_line":""},{"line_number":68,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":69,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":70,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":71,"context_line":"        # cases."},{"line_number":72,"context_line":"        port_id_only \u003d \u0027port_id\u0027 in subport and len(subport) \u003d\u003d 1"},{"line_number":73,"context_line":"        if port_id_only:"},{"line_number":74,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":75,"context_line":"                    \"provided to create a subport\")"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_a5066983","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":65},"in_reply_to":"3aaa91ec_516b0b85","updated":"2016-06-30 17:05:53.000000000","message":"I agree with Rossella.  If you recall, I asked about this very thing too.  It isn\u0027t obvious enough.  The more obvious the better, IMO.\n\nActually, I thought we had talked about requiring segmentation details for now.  So, why not just remove this and rely on a simplified L81 to catch this?","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6e80c211062581c8d50470214318d6956b9ba71c","unresolved":false,"context_lines":[{"line_number":67,"context_line":""},{"line_number":68,"context_line":"        # NOTE(tidwellr) the segmentation details are missing, we will need to"},{"line_number":69,"context_line":"        # figure out defaults when the time comes to support Ironic. We can"},{"line_number":70,"context_line":"        # reasonably expect segmentation details to be provided in all other"},{"line_number":71,"context_line":"        # cases."},{"line_number":72,"context_line":"        port_id_only \u003d \u0027port_id\u0027 in subport and len(subport) \u003d\u003d 1"},{"line_number":73,"context_line":"        if port_id_only:"},{"line_number":74,"context_line":"            msg \u003d _(\"A valid segmentation_id and segmentation_type must be \""},{"line_number":75,"context_line":"                    \"provided to create a subport\")"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_e66518af","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":65},"in_reply_to":"3aaa91ec_a5066983","updated":"2016-06-30 17:22:01.000000000","message":"I am planning on a simplified L81 to catch this. Look for that in the next PS.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":79,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":82,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":83,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":84,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_651f61b7","line":81,"range":{"start_line":81,"start_character":62,"end_line":81,"end_character":78},"updated":"2016-06-30 17:05:53.000000000","message":"Couldn\u0027t this just be removed too?","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6e80c211062581c8d50470214318d6956b9ba71c","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        segmentation_id \u003d subport.get(\"segmentation_id\")"},{"line_number":79,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":82,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":83,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":84,"context_line":"                    \"segmentation_type\") % subport"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_66de483f","line":81,"range":{"start_line":81,"start_character":62,"end_line":81,"end_character":78},"in_reply_to":"3aaa91ec_651f61b7","updated":"2016-06-30 17:22:01.000000000","message":"Probably could be removed","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"95191d4bf9d8e03512104d6c199649facc69999b","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":82,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":83,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":84,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":85,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_3b2e208c","line":82,"updated":"2016-06-30 15:10:06.000000000","message":"why would this case be different from the one at line 74. If you follow my suggestion in the previous comment I think this check can be deleted.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a689624ed33c23834189810441204a4f03474919","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        segmentation_type \u003d subport.get(\"segmentation_type\")"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        if (not segmentation_id or not segmentation_type) and len(subport) \u003e 1:"},{"line_number":82,"context_line":"            msg \u003d _(\"Invalid subport details \u0027%s\u0027: missing segmentation \""},{"line_number":83,"context_line":"                    \"information. Must specify both segmentation_id and \""},{"line_number":84,"context_line":"                    \"segmentation_type\") % subport"},{"line_number":85,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_7ee256d6","line":82,"in_reply_to":"3aaa91ec_3b2e208c","updated":"2016-06-30 15:31:25.000000000","message":"Done","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d64f739f3d15f878df161aa9f17969717864d8f7","unresolved":false,"context_lines":[{"line_number":135,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":136,"context_line":"    def create_trunk(self, context, trunk):"},{"line_number":137,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":138,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":139,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":140,"context_line":"        # still allow a trunk and subport to reference the same port_id."},{"line_number":141,"context_line":"        # Risk is low given typical usage, but theoretically still possible."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_90cb9fa3","line":138,"updated":"2016-06-30 20:13:52.000000000","message":"btw we should validate that a port is not in use (bound) to a VM already. Because of lack of upgrade we need to prevent that.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"00d10e847bf4ef48fde58122fece1b663f4ef3fa","unresolved":false,"context_lines":[{"line_number":135,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":136,"context_line":"    def create_trunk(self, context, trunk):"},{"line_number":137,"context_line":"        \"\"\"Create a trunk.\"\"\""},{"line_number":138,"context_line":"        trunk \u003d trunk[\u0027trunk\u0027]"},{"line_number":139,"context_line":"        # REVISIT(tidwellr) this check is racy and could theoretically"},{"line_number":140,"context_line":"        # still allow a trunk and subport to reference the same port_id."},{"line_number":141,"context_line":"        # Risk is low given typical usage, but theoretically still possible."}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_9036ff4e","line":138,"in_reply_to":"3aaa91ec_90cb9fa3","updated":"2016-06-30 20:23:50.000000000","message":"Doh, missed that too. Add it to the list for PS35 :)","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"464fa7e1a4a9d6eb02650597cd5b52aa9ac85bfc","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                    obj.create()"},{"line_number":195,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":196,"context_line":"                    # Lookup by port_id to see if port_id is in conflict"},{"line_number":197,"context_line":"                    obj \u003d None"},{"line_number":198,"context_line":"                    for sp in trunk[\u0027sub_ports\u0027]:"},{"line_number":199,"context_line":"                        if subport[\u0027port_id\u0027] \u003d\u003d sp[\u0027port_id\u0027]:"},{"line_number":200,"context_line":"                            raise trunk_exc.ParentPortInUse("}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_c06f23c2","line":197,"range":{"start_line":197,"start_character":20,"end_line":197,"end_character":30},"updated":"2016-06-30 17:05:53.000000000","message":"nit:  Why do you need this?  We\u0027re done.  We\u0027re going to raise an exception regardless so obj doesn\u0027t matter any more.","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6e80c211062581c8d50470214318d6956b9ba71c","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                    obj.create()"},{"line_number":195,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":196,"context_line":"                    # Lookup by port_id to see if port_id is in conflict"},{"line_number":197,"context_line":"                    obj \u003d None"},{"line_number":198,"context_line":"                    for sp in trunk[\u0027sub_ports\u0027]:"},{"line_number":199,"context_line":"                        if subport[\u0027port_id\u0027] \u003d\u003d sp[\u0027port_id\u0027]:"},{"line_number":200,"context_line":"                            raise trunk_exc.ParentPortInUse("}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_86f1b403","line":197,"range":{"start_line":197,"start_character":20,"end_line":197,"end_character":30},"in_reply_to":"3aaa91ec_c06f23c2","updated":"2016-06-30 17:22:01.000000000","message":"Huh, that line must have slipped through the cracks during a refactor. Done","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"95191d4bf9d8e03512104d6c199649facc69999b","unresolved":false,"context_lines":[{"line_number":200,"context_line":"                            raise trunk_exc.ParentPortInUse("},{"line_number":201,"context_line":"                                      port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":204,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":205,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":206,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":34,"id":"3aaa91ec_9bbc74dd","line":203,"updated":"2016-06-30 15:10:06.000000000","message":"see my comment on PS 33","commit_id":"009c73e4f78faf906788e20061994c91911882c8"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"a656667a2162562a99de72becf914024f53c2406","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"        subports_validator \u003d rules.SubPortsValidator("},{"line_number":120,"context_line":"            self._segmentation_types, subports)"},{"line_number":121,"context_line":"        subports \u003d subports_validator.validate(context, basic_validation\u003dTrue)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # persist subports"},{"line_number":124,"context_line":"        with db_api.autonested_transaction(context.session):"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_8d137300","line":121,"range":{"start_line":121,"start_character":55,"end_line":121,"end_character":72},"updated":"2016-07-01 09:12:29.000000000","message":"this seems to be always true, do we really need this extra param?","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5440786e8750fbaab78d8b599cd313ce1822a3f0","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"        subports_validator \u003d rules.SubPortsValidator("},{"line_number":120,"context_line":"            self._segmentation_types, subports)"},{"line_number":121,"context_line":"        subports \u003d subports_validator.validate(context, basic_validation\u003dTrue)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # persist subports"},{"line_number":124,"context_line":"        with db_api.autonested_transaction(context.session):"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_a1f0e467","line":121,"range":{"start_line":121,"start_character":55,"end_line":121,"end_character":72},"in_reply_to":"3aaa91ec_8d137300","updated":"2016-07-01 15:23:11.000000000","message":"it isn\u0027t when we  create the trunk.","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5e04a4b235e9ad643aa995dfa7decd2d83583a0d","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        trunk_obj.create()"},{"line_number":102,"context_line":"        return trunk_obj"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"}],"source_content_type":"text/x-python","patch_set":39,"id":"3aaa91ec_de4ce39f","line":104,"updated":"2016-07-01 18:52:09.000000000","message":"Per [1] we should also be validating that the trunk\u0027s parent port is unbound before deleting it.\n\n[1] https://github.com/openstack/neutron/blob/master/doc/source/devref/openvswitch_agent.rst#trunk-deletion-1","commit_id":"064b983c1e082648947877af2d55f077df5aa052"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"fc7bd38173b1e0393620b50f01abdcb78134662c","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        trunk_obj.create()"},{"line_number":102,"context_line":"        return trunk_obj"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"}],"source_content_type":"text/x-python","patch_set":39,"id":"1aa78d24_8bd7cd22","line":104,"in_reply_to":"3aaa91ec_de4ce39f","updated":"2016-07-01 21:59:34.000000000","message":"Done","commit_id":"064b983c1e082648947877af2d55f077df5aa052"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        if obj is None:"},{"line_number":71,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        res \u003d self._fields(obj.to_dict(), fields)"},{"line_number":74,"context_line":"        return res"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_979fe75e","line":73,"updated":"2016-07-02 09:29:18.000000000","message":"In qos plugin, we achieve that with:\n\n    @db_base_plugin_common.filter_fields\n    @db_base_plugin_common.convert_result_to_dict\n\nI would be glad if we stick to the pattern for all object based plugins.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        if obj is None:"},{"line_number":71,"context_line":"            raise trunk_exc.TrunkNotFound(trunk_id\u003dtrunk_id)"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"        res \u003d self._fields(obj.to_dict(), fields)"},{"line_number":74,"context_line":"        return res"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    @db_base_plugin_common.convert_result_to_dict"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_0881164b","line":73,"in_reply_to":"1aa78d24_979fe75e","updated":"2016-07-02 15:12:46.000000000","message":"ok, let me see what I can do","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        res \u003d self._fields(obj.to_dict(), fields)"},{"line_number":74,"context_line":"        return res"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":77,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":78,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":79,"context_line":"        \"\"\"Return information for available trunks.\"\"\""}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_d787af10","line":76,"updated":"2016-07-02 09:29:18.000000000","message":"You should also apply fields with:\n\n@db_base_plugin_common.filter_fields","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        res \u003d self._fields(obj.to_dict(), fields)"},{"line_number":74,"context_line":"        return res"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":77,"context_line":"    def get_trunks(self, context, filters\u003dNone, fields\u003dNone,"},{"line_number":78,"context_line":"                   sorts\u003dNone, limit\u003dNone, marker\u003dNone, page_reverse\u003dFalse):"},{"line_number":79,"context_line":"        \"\"\"Return information for available trunks.\"\"\""}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_6896da95","line":76,"in_reply_to":"1aa78d24_d787af10","updated":"2016-07-02 15:12:46.000000000","message":"ack","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_577c5f20","line":106,"updated":"2016-07-02 09:29:18.000000000","message":"I prefer if we move validation logic into the object, and keep the plugin clean.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_a890c296","line":106,"in_reply_to":"1aa78d24_577c5f20","updated":"2016-07-02 15:12:46.000000000","message":"IMO, the object is in charge of handling persistence. It knows nothing about the monkey business of trunks. That\u0027s the job of the plugin and that\u0027s why it\u0027s this way.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"867cec32d288bba60004053fa6ecdb1d05066df3","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_c3d7f121","line":106,"in_reply_to":"1aa78d24_a86c429d","updated":"2016-07-02 18:00:32.000000000","message":"Encapsulating business logic and data persistence is just as valid, but it is only one of the possible patterns. I have given this some thought and I have a sense that keeping the two separate will allow to maintain/extend this code more easily in the future.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ce8ec8d6308221e10227057fe64ba67e52ebf905","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_a86c429d","line":106,"in_reply_to":"1aa78d24_a890c296","updated":"2016-07-02 15:28:11.000000000","message":"I think we don\u0027t share a common view of the goal of objects. Indeed, consolidating persistence inside objects is one of goals we currently strive towards, but it doesn\u0027t end there. Objects are supposed to be a single point of consistency validation. It will become especially visible when we start to roll db upgrades, and maintain more rolling constraints inside objects instead of db.\n\nNow, if some validation indeed depends on a usage scenario, then it indeed may belong to outside an object. Maybe it\u0027s indeed the case here, I don\u0027t know.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"a5663f9e4d98eed3d6af0a19d9475145e59b1dba","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_de2a24e7","line":106,"in_reply_to":"1aa78d24_c3d7f121","updated":"2016-07-02 18:44:36.000000000","message":"It depends whether there are indeed different use cases for the same object. If there are, it\u0027s better to maintain the code out of objects; otherwise, it\u0027s cleaner to keep all the validation code in a single place. Since OVO already does some validation by the virtue of field typing system as well as additional checks we have in neutron object base classes, I would try to keep it near objects unless there is clear merit in not doing it.\n\nOf course, I wouldn\u0027t block the patch for that. I am just sorry we potentially don\u0027t encapsulate enough or do it inconsistently throughout object system.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"41e2cae2c1a1af69e43b6fa943f43733096b55b3","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def delete_trunk(self, context, trunk_id):"},{"line_number":105,"context_line":"        \"\"\"Delete the specified trunk.\"\"\""},{"line_number":106,"context_line":"        trunk \u003d trunk_objects.Trunk.get_object(context, id\u003dtrunk_id)"},{"line_number":107,"context_line":"        if trunk:"},{"line_number":108,"context_line":"            trunk_validator \u003d rules.TrunkPortValidator(trunk.port_id)"},{"line_number":109,"context_line":"            if not trunk_validator.is_bound(context):"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_9e4edcbf","line":106,"in_reply_to":"1aa78d24_de2a24e7","updated":"2016-07-02 18:56:09.000000000","message":"Consistency for consistency\u0027s sake seems counterproductive and may hinder maintainability for no good reason. If we can make the same data model fit different business needs why would we bloat the data model with business rules that clearly need flexibility? Now, we could move the validation logic in the object layer itself and still try to make it flexible enough, but here in the plugin layer everything seems to fit pretty nicely.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                try:"},{"line_number":138,"context_line":"                    obj.create()"},{"line_number":139,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":140,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":141,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":142,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":143,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_37a0b390","line":140,"updated":"2016-07-02 09:29:18.000000000","message":"We started raising object specific exception in Trunk object (e.g. we raise n_exc.PortNotFound on create()). I think we should then stick to the pattern here too, raising it from obj.create().","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ce8ec8d6308221e10227057fe64ba67e52ebf905","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                try:"},{"line_number":138,"context_line":"                    obj.create()"},{"line_number":139,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":140,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":141,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":142,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":143,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_c809cedf","line":140,"in_reply_to":"1aa78d24_28f3320c","updated":"2016-07-02 15:28:11.000000000","message":"I mean that in trunk and subport objects, we already transform object/db exceptions into trunk-specific:\n\nhttps://github.com/openstack/neutron/blob/master/neutron/objects/trunk.py#L97\nhttps://github.com/openstack/neutron/blob/master/neutron/objects/trunk.py#L50\n\nIt seems out of order that we are not consistent here.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                try:"},{"line_number":138,"context_line":"                    obj.create()"},{"line_number":139,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":140,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":141,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":142,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":143,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_28f3320c","line":140,"in_reply_to":"1aa78d24_37a0b390","updated":"2016-07-02 15:12:46.000000000","message":"not sure I fully understand what you mean? We\u0027re are raising trunk level exceptions, what\u0027s wrong with this?","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"867cec32d288bba60004053fa6ecdb1d05066df3","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                try:"},{"line_number":138,"context_line":"                    obj.create()"},{"line_number":139,"context_line":"                except objects_base.NeutronDbObjectDuplicateEntry:"},{"line_number":140,"context_line":"                    raise trunk_exc.DuplicateSubPort("},{"line_number":141,"context_line":"                              segmentation_type\u003dsubport[\u0027segmentation_type\u0027],"},{"line_number":142,"context_line":"                              segmentation_id\u003dsubport[\u0027segmentation_id\u0027],"},{"line_number":143,"context_line":"                              trunk_id\u003dtrunk_id)"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_03e29903","line":140,"in_reply_to":"1aa78d24_c809cedf","updated":"2016-07-02 18:00:32.000000000","message":"ok, now I am with you. Let me see if I can clean it up.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""},{"line_number":181,"context_line":"        trunk \u003d self.get_trunk(context, trunk_id)"},{"line_number":182,"context_line":"        subports \u003d trunk[\u0027sub_ports\u0027]"},{"line_number":183,"context_line":"        return [self._fields(subport, fields) for subport in subports]"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_17b017dd","line":183,"updated":"2016-07-02 09:29:18.000000000","message":"Please use @db_base_plugin_common.filter_fields","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":180,"context_line":"        \"\"\"Return subports for the specified trunk.\"\"\""},{"line_number":181,"context_line":"        trunk \u003d self.get_trunk(context, trunk_id)"},{"line_number":182,"context_line":"        subports \u003d trunk[\u0027sub_ports\u0027]"},{"line_number":183,"context_line":"        return [self._fields(subport, fields) for subport in subports]"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_68dd3a70","line":183,"in_reply_to":"1aa78d24_17b017dd","updated":"2016-07-02 15:12:46.000000000","message":"it seems cosmetic, but ok.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"}],"neutron/services/trunk/rules.py":[{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"2908b6e124fb8ab0220311f2b9251b5dd48dc63d","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        subports \u003d trunk_objects.SubPort.get_objects("},{"line_number":38,"context_line":"            context, port_id\u003dself.port_id)"},{"line_number":39,"context_line":"        if subports:"},{"line_number":40,"context_line":"            raise trunk_exc.TrunkPortInUse(port_id\u003dself.port_id)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"        # Validate that the given port_id is not used by a trunk."},{"line_number":43,"context_line":"        trunks \u003d trunk_objects.Trunk.get_objects(context, port_id\u003dself.port_id)"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_07446519","line":40,"range":{"start_line":40,"start_character":28,"end_line":40,"end_character":42},"updated":"2016-07-01 17:03:15.000000000","message":"Should we raise something different here? See comments at L39 https://review.openstack.org/#/c/320092/37/neutron/services/trunk/exceptions.py","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"9a3a8d2fd7fac0cf60e3145a269e9bf2f0c2a714","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":49,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":50,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":51,"context_line":"        if port.get(\u0027binding:host_id\u0027):"},{"line_number":52,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"},{"line_number":53,"context_line":"        if device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX):"},{"line_number":54,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_53cf5357","line":51,"range":{"start_line":51,"start_character":20,"end_line":51,"end_character":37},"updated":"2016-07-01 15:55:14.000000000","message":"nit: this is a constant that can be used from neutron.extensions.portbindings.HOST_ID","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"de6cabca4df195c7a4e9355620f7c9c729d0a4ba","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":49,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":50,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":51,"context_line":"        if port.get(\u0027binding:host_id\u0027):"},{"line_number":52,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"},{"line_number":53,"context_line":"        if device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX):"},{"line_number":54,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_a76ab17f","line":51,"range":{"start_line":51,"start_character":20,"end_line":51,"end_character":37},"in_reply_to":"3aaa91ec_53cf5357","updated":"2016-07-01 16:50:16.000000000","message":"Done","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"2908b6e124fb8ab0220311f2b9251b5dd48dc63d","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":49,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":50,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":51,"context_line":"        if port.get(\u0027binding:host_id\u0027):"},{"line_number":52,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"},{"line_number":53,"context_line":"        if device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX):"},{"line_number":54,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_0c33ec63","line":51,"range":{"start_line":51,"start_character":20,"end_line":51,"end_character":37},"in_reply_to":"3aaa91ec_53cf5357","updated":"2016-07-01 17:03:15.000000000","message":"I figured there was a constant for that but couldn\u0027t find it, thanks for the pointer. I\u0027ll grep a little harder next time ;)","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"a656667a2162562a99de72becf914024f53c2406","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX):"},{"line_number":54,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        return self.port_id"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class SubPortsValidator(object):"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_2d335f63","line":56,"updated":"2016-07-01 09:12:29.000000000","message":"validators should just validate, why do we need to return a known value?","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5440786e8750fbaab78d8b599cd313ce1822a3f0","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        if device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX):"},{"line_number":54,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dself.port_id)"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"        return self.port_id"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class SubPortsValidator(object):"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_61a55c46","line":56,"in_reply_to":"3aaa91ec_2d335f63","updated":"2016-07-01 15:23:11.000000000","message":"That\u0027s for future proofing the validator when parameters may end up being \u0027calculated\u0027 based on business rules.","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"f151aba2e364f3185ddb711c74693447ac25ba3f","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        self.trunk_port_id \u003d trunk_port_id"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    def validate(self, context,"},{"line_number":67,"context_line":"                 basic_validation\u003dFalse, parent_validation\u003dTrue):"},{"line_number":68,"context_line":"        \"\"\"Validate that subports can be used in a trunk.\"\"\""},{"line_number":69,"context_line":"        # Perform basic validation on subports"},{"line_number":70,"context_line":"        if basic_validation:"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_36c9d57a","line":67,"range":{"start_line":67,"start_character":17,"end_line":67,"end_character":39},"updated":"2016-07-01 15:50:52.000000000","message":"Using boolean flags to change the behavior of a method is almost always a sign that you should have two methods.  They end up being a lot more straight-forward when you do.","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"3312719ab16dba69d8be48f0329acfab2e5fcd62","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        self.trunk_port_id \u003d trunk_port_id"},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    def validate(self, context,"},{"line_number":67,"context_line":"                 basic_validation\u003dFalse, parent_validation\u003dTrue):"},{"line_number":68,"context_line":"        \"\"\"Validate that subports can be used in a trunk.\"\"\""},{"line_number":69,"context_line":"        # Perform basic validation on subports"},{"line_number":70,"context_line":"        if basic_validation:"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_967529fc","line":67,"range":{"start_line":67,"start_character":17,"end_line":67,"end_character":39},"in_reply_to":"3aaa91ec_36c9d57a","updated":"2016-07-01 15:55:45.000000000","message":"As a general rule of thumb, I would agree. In this case, I am not sure if breaking down the method is giving us much, I can give it a try though the method is already pretty thin as it is.","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"2908b6e124fb8ab0220311f2b9251b5dd48dc63d","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def _validate(self, context, subport, parent_validation):"},{"line_number":80,"context_line":"        # Check that the subport doesn\u0027t reference the same port_id as a"},{"line_number":81,"context_line":"        # trunk we may be in the middle of trying to create, in other words"},{"line_number":82,"context_line":"        # make the validation idiot proof."},{"line_number":83,"context_line":"        if subport[\u0027port_id\u0027] \u003d\u003d self.trunk_port_id:"},{"line_number":84,"context_line":"            raise trunk_exc.ParentPortInUse(port_id\u003dsubport[\u0027port_id\u0027])"},{"line_number":85,"context_line":""}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_4c75f4ca","line":82,"updated":"2016-07-01 17:03:15.000000000","message":"Always a good rule of thumb :)","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"a656667a2162562a99de72becf914024f53c2406","unresolved":false,"context_lines":[{"line_number":103,"context_line":"            msg \u003d _(\"Invalid segmentation id \u0027%s\u0027\") % segmentation_id"},{"line_number":104,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        if parent_validation:"},{"line_number":107,"context_line":"            trunk_validator \u003d TrunkValidator(subport[\u0027port_id\u0027])"},{"line_number":108,"context_line":"            trunk_validator.validate(context)"},{"line_number":109,"context_line":"        return subport"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_0ad2c9d0","line":108,"range":{"start_line":106,"start_character":1,"end_line":108,"end_character":45},"updated":"2016-07-01 09:12:29.000000000","message":"this should be moved in validate, what\u0027s the point of revalidating the trunk for every subport?","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5440786e8750fbaab78d8b599cd313ce1822a3f0","unresolved":false,"context_lines":[{"line_number":103,"context_line":"            msg \u003d _(\"Invalid segmentation id \u0027%s\u0027\") % segmentation_id"},{"line_number":104,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        if parent_validation:"},{"line_number":107,"context_line":"            trunk_validator \u003d TrunkValidator(subport[\u0027port_id\u0027])"},{"line_number":108,"context_line":"            trunk_validator.validate(context)"},{"line_number":109,"context_line":"        return subport"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_617c3cb6","line":108,"range":{"start_line":106,"start_character":1,"end_line":108,"end_character":45},"in_reply_to":"3aaa91ec_0ad2c9d0","updated":"2016-07-01 15:23:11.000000000","message":"Because every port may be reused in another trunk","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ee5adf244a99a99854f9e5d9fe65a9d1c0d7843c","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.services.trunk import exceptions as trunk_exc"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPortValidator(object):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def __init__(self, port_id):"},{"line_number":29,"context_line":"        self.port_id \u003d port_id"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_f75bcb2c","line":26,"updated":"2016-07-02 09:29:18.000000000","message":"I am not sure why we put this validation here and not in the object implementation itself. I think it\u0027s better to keep validation closer to objects, so that it\u0027s consistently applied to all attempts to write objects into the database.","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"1db5d0aea555eb7ca5db13fd996b206480da80f8","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.services.trunk import exceptions as trunk_exc"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPortValidator(object):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def __init__(self, port_id):"},{"line_number":29,"context_line":"        self.port_id \u003d port_id"}],"source_content_type":"text/x-python","patch_set":41,"id":"1aa78d24_a8e7223f","line":26,"in_reply_to":"1aa78d24_f75bcb2c","updated":"2016-07-02 15:12:46.000000000","message":"Doing as you suggest it pollutes and bloats the persistence layer and furthermore it makes it not inflexible when dealing with different business rules for different business cases (e.g. Ironic support).","commit_id":"eccb76a9a21fc7699dfeb6094ce59683821a6218"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"bd87589cf24424c4321bf6195963d68161f82582","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.services.trunk import exceptions as trunk_exc"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# This layer is introduced for keeping busines logic and"},{"line_number":27,"context_line":"# data persistence decoupled."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkPortValidator(object):"}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_ba838403","line":26,"range":{"start_line":26,"start_character":39,"end_line":26,"end_character":46},"updated":"2016-07-05 17:09:51.000000000","message":"nit: business","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"ea1cf1916aa4dbcd85c0c416a59ebbd0dce0a12b","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.services.trunk import exceptions as trunk_exc"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"# This layer is introduced for keeping busines logic and"},{"line_number":27,"context_line":"# data persistence decoupled."},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkPortValidator(object):"}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_7fb469d0","line":26,"range":{"start_line":26,"start_character":39,"end_line":26,"end_character":46},"in_reply_to":"1aa78d24_ba838403","updated":"2016-07-05 17:14:44.000000000","message":"breadcrumbs for the trivial fixers.","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"9191a60ffc2f0237f46a2dd5720c8ebeb4db5b41","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":60,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":61,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":62,"context_line":"        return port.get(portbindings.HOST_ID) or \\"},{"line_number":63,"context_line":"            device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_461c5377","line":62,"range":{"start_line":62,"start_character":48,"end_line":62,"end_character":50},"updated":"2016-07-05 15:23:22.000000000","message":"nit shouldn\u0027t we use parenthesis instead?","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9d7253c6254a718f78ae92f0523426d8939b51e4","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":60,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":61,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":62,"context_line":"        return port.get(portbindings.HOST_ID) or \\"},{"line_number":63,"context_line":"            device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_bfd9b185","line":62,"range":{"start_line":62,"start_character":48,"end_line":62,"end_character":50},"in_reply_to":"1aa78d24_1cac5333","updated":"2016-07-05 17:08:55.000000000","message":"let me see if I can figure out a clean way to do this.","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"780d238d302acc0a77b1dbb839d33885b4683f59","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":60,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":61,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":62,"context_line":"        return port.get(portbindings.HOST_ID) or \\"},{"line_number":63,"context_line":"            device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_1cac5333","line":62,"range":{"start_line":62,"start_character":48,"end_line":62,"end_character":50},"in_reply_to":"1aa78d24_461c5377","updated":"2016-07-05 17:05:09.000000000","message":"I agree.  I think our hacking checks only allow backslash because it is the *only* way to have more than one context manager in a single \"with\" statement.  So, unfortunately our hacking checks allow them.\n\nBUT!  I don\u0027t think reviewers should be burdened with catching style issues like this.  I think we need to either have a hacking check smart enough to enforce this or just let it go.\n\nI think it is more important to get this in than to fix this now.  So, I\u0027m not going to vote negatively for this.","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d0ffae3b6dffa06b1bcd7ba42ad2a2165d25e5ce","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        core_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":60,"context_line":"        port \u003d core_plugin.get_port(context, self.port_id)"},{"line_number":61,"context_line":"        device_owner \u003d port.get(\u0027device_owner\u0027, \u0027\u0027)"},{"line_number":62,"context_line":"        return port.get(portbindings.HOST_ID) or \\"},{"line_number":63,"context_line":"            device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":43,"id":"1aa78d24_3f03010f","line":62,"range":{"start_line":62,"start_character":48,"end_line":62,"end_character":50},"in_reply_to":"1aa78d24_461c5377","updated":"2016-07-05 17:04:11.000000000","message":"I\u0027ll follow up, unless something else comes up? Pinky swear?","commit_id":"9cda319687731bc839700c4085dc73e194b07e95"}],"neutron/services/trunk/utils.py":[{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"aa2ee249fcfa45e6038662c3159375b4cd9b212a","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_f72ee7f8","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"updated":"2016-06-06 21:15:04.000000000","message":"Do we really need to enforce it on plugin side? It is possible that we could convert a regular port into trunk for some cases.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"76df01a4fad4e984a7b384e17f84ed7ce7ffeedc","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_4868f587","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"in_reply_to":"7aa08908_37218c4e","updated":"2016-06-06 23:54:52.000000000","message":"This \u0027is_eligible_parent_port\u0027 is just a fail-fast optimisation, as the port could have been bound concurrently after we run \u0027get_port\u0027? So I\u0027d rather not optimise it that early (i.e. in this patch) to keep things simple for now (\"premature optimization is the root of all evil\", right? :) ). But we can implement that optimisation later (as well as ensuring trunk-port/sub-port port uniqueness in plugin) after we got the whole solution working.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"64cf9a300d1f66fba264e9129b2efdccf84f0769","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_6e4cd970","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"in_reply_to":"7aa08908_4868f587","updated":"2016-06-07 00:31:56.000000000","message":"It\u0027s really more than an optimization. At some point, we need to block the user from using a port with a binding as a parent port. That is our cue that a port is in use. Seeing as we can\u0027t support turning a bound port into a trunk port yet (scope creep), my first attempt (seen here) is to stop the action at the API layer rather than delegate to the agent. It\u0027s not about failing-fast per se, my intent is to simplify the enforcement mechanism. Bringing RPC calls into the mix is more complex, so I want to avoid that. It\u0027s also a better user experience if we can block the user at the API/DB layer like this rather than wait for the agent to attempt processing the trunk or subport.\n\nFor these reasons, I\u0027m convinced we need an enforcement mechanism that disallows use of bound ports as parent ports that lives in the API/DB layer. The user should be blocked from creating the trunk/subport and get immediate feedback. Any other solution involves asynchronous feedback to the user which is not nice to the user. We should tackle any race conditions at this level. This is more than just a handy optimization.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"544ebc632fb36525f0f5d90c2c91da044aa51f51","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_ae79a1fe","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"in_reply_to":"7aa08908_6e4cd970","updated":"2016-06-07 01:05:52.000000000","message":"I\u0027m 100% agree with you that we need to address that in the plugin for better UX. What I\u0027m saying is that it does not have to be done in this patch. Let\u0027s start with simple/minimalistic plugin, get a somewhat working solution as a whole (including the agent) and then polish it with smaller focused patches.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_173d70bb","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"in_reply_to":"7aa08908_f72ee7f8","updated":"2016-06-06 22:04:30.000000000","message":"The binding_host \u003d\u003d \u0027\u0027 is redundant here.\n\n  return not binding_host","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":23,"context_line":"    port \u003d core_plugin.get_port(context.get_admin_context(), port_id)"},{"line_number":24,"context_line":"    #TODO(tidwellr) use a constant here"},{"line_number":25,"context_line":"    binding_host \u003d port.get(\u0027binding:host_id\u0027)"},{"line_number":26,"context_line":"    if not binding_host or binding_host \u003d\u003d \u0027\u0027:"},{"line_number":27,"context_line":"        return True"},{"line_number":28,"context_line":"    return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"7aa08908_37218c4e","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":45},"in_reply_to":"7aa08908_f72ee7f8","updated":"2016-06-06 22:28:40.000000000","message":"Yes we do. It is NOT possible to convert a regular port into a trunk on this pass at the functionality. It\u0027s too messy to handle on the agent side, let\u0027s not go there yet. This can be easily relaxed in the future.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"}],"neutron/tests/contrib/hooks/api_extensions":[{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    subnet_allocation, \\"},{"line_number":35,"context_line":"    tag, \\"},{"line_number":36,"context_line":"    timestamp_core, \\"},{"line_number":37,"context_line":"    trunk\""},{"line_number":38,"context_line":"NETWORK_API_EXTENSIONS\u003d\"$(echo $NETWORK_API_EXTENSIONS | tr -d \u0027 \u0027)\""}],"source_content_type":"application/octet-stream","patch_set":27,"id":"3aaa91ec_492ebffb","line":37,"updated":"2016-06-24 21:59:09.000000000","message":"do we need trunk-details?","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    subnet_allocation, \\"},{"line_number":35,"context_line":"    tag, \\"},{"line_number":36,"context_line":"    timestamp_core, \\"},{"line_number":37,"context_line":"    trunk\""},{"line_number":38,"context_line":"NETWORK_API_EXTENSIONS\u003d\"$(echo $NETWORK_API_EXTENSIONS | tr -d \u0027 \u0027)\""}],"source_content_type":"application/octet-stream","patch_set":27,"id":"3aaa91ec_ace5b109","line":37,"in_reply_to":"3aaa91ec_492ebffb","updated":"2016-06-24 22:13:34.000000000","message":"Yes, we should add that here.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"}],"neutron/tests/contrib/hooks/trunk":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a611aeff6df6b9a9f6bb3339661bfdf572addfa5","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":9,"id":"7aa08908_06bb87e6","line":2,"updated":"2016-06-06 19:55:56.000000000","message":"this line can be dropped, there\u0027s no extra service to be executed.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ae8e4597735f9dba4a06346a2694e91f8dd39c60","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":9,"id":"7aa08908_17abb0d7","line":2,"in_reply_to":"7aa08908_06bb87e6","updated":"2016-06-06 22:04:30.000000000","message":"There is according to this [1] from this same patch set.\n\n [1] https://review.openstack.org/#/c/320092/9/devstack/plugin.sh@22","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"b41eae23a54fd39ddbdfa0de226b95e23e12ff5d","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":9,"id":"7aa08908_b7a1fcab","line":2,"in_reply_to":"7aa08908_17abb0d7","updated":"2016-06-06 22:28:40.000000000","message":"I think this is necessary. We do have a service to execute, I don\u0027t think the plugin will load without it.","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"b83f5c4b439808536d7a3fe2a2eb4d0256fd6006","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":9,"id":"7aa08908_e29a4761","line":2,"in_reply_to":"7aa08908_b7a1fcab","updated":"2016-06-13 18:40:23.000000000","message":"What service are you talking about? The service plugin runs in the neutron-server process space. Have you tried without?","commit_id":"19db9b3101b4fa53f634ac4b82e06ecf5ef4b3a6"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"c8033ee314870b048a38ea67091f192d8aa9d93c","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":16,"id":"5a9d85d2_6ce42e3b","line":2,"updated":"2016-06-19 20:15:16.000000000","message":"this ain\u0027t needed. This is the third time I said it...third time the charm?","commit_id":"2e7fc63126ca3439fb8d1d6c8e2bc6ce84f7741e"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"032ddebb7455764ede7dbb42483cba353bded16b","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_plugin neutron git://git.openstack.org/openstack/neutron"},{"line_number":2,"context_line":"enable_service q-trunk"}],"source_content_type":"application/octet-stream","patch_set":16,"id":"5a9d85d2_1d52da13","line":2,"in_reply_to":"5a9d85d2_6ce42e3b","updated":"2016-06-20 15:56:25.000000000","message":"Done","commit_id":"2e7fc63126ca3439fb8d1d6c8e2bc6ce84f7741e"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"9ecc26b3000ac8905cd8ba4b5aac87857922a843","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_service q-trunk"},{"line_number":2,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":23,"id":"3aaa91ec_8da68151","line":2,"updated":"2016-06-22 15:42:22.000000000","message":"space","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"6fa697d0dfac1d90e30b23000f8a992af3094104","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_service q-trunk"},{"line_number":2,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":23,"id":"3aaa91ec_eef1f86b","line":2,"in_reply_to":"3aaa91ec_8da68151","updated":"2016-06-22 17:04:18.000000000","message":"Done","commit_id":"1b2e080ffd0da7892a2d3124abbfd594b7ce27fb"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_service q-trunk"},{"line_number":2,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":30,"id":"3aaa91ec_56540f53","line":2,"updated":"2016-06-28 19:52:50.000000000","message":"extra space","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":1,"context_line":"enable_service q-trunk"},{"line_number":2,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":30,"id":"3aaa91ec_a77b7ff3","line":2,"in_reply_to":"3aaa91ec_56540f53","updated":"2016-06-28 20:16:43.000000000","message":"Done","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"}],"neutron/tests/tempest/api/test_trunk.py":[{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":11,"id":"7aa08908_d4d74dbd","updated":"2016-06-07 09:51:42.000000000","message":"Can we get a test with sub_ports as well?","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":11,"id":"7aa08908_4191c446","in_reply_to":"7aa08908_d4d74dbd","updated":"2016-06-07 15:13:06.000000000","message":"I must not have pushed the right revision :( I have those tests, will include with the next patch set.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    def resource_setup(cls):"},{"line_number":26,"context_line":"        super(TrunkTestJSON, cls).resource_setup()"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def _create_trunk(self, parent_port_id, subports):"},{"line_number":29,"context_line":"        return self.client.create_trunk(parent_port_id, subports,"},{"line_number":30,"context_line":"                                        tenant_id\u003dself.client.tenant_id)"},{"line_number":31,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_f421a94e","line":28,"range":{"start_line":28,"start_character":8,"end_line":28,"end_character":21},"updated":"2016-06-07 09:51:42.000000000","message":"nit: we could move that into _create_trunk_with_network_and_parent as it\u0027s the only use of that method","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"0664d068d0035ed41bd32c9ffa6067da39e162ba","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def _create_trunk(self, parent_port_id, subports):"},{"line_number":29,"context_line":"        return self.client.create_trunk(parent_port_id, subports,"},{"line_number":30,"context_line":"                                        tenant_id\u003dself.client.tenant_id)"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    def _create_trunk_with_network_and_parent(self, subports):"},{"line_number":33,"context_line":"        network \u003d self.create_network()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_71194b88","line":30,"range":{"start_line":30,"start_character":40,"end_line":30,"end_character":71},"updated":"2016-06-07 09:51:42.000000000","message":"My understanding is that it is already taken care of by self.client and plugin\u0027s context.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f52156a11ca49be672ce9d424843551b363ec989","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def _create_trunk(self, parent_port_id, subports):"},{"line_number":29,"context_line":"        return self.client.create_trunk(parent_port_id, subports,"},{"line_number":30,"context_line":"                                        tenant_id\u003dself.client.tenant_id)"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    def _create_trunk_with_network_and_parent(self, subports):"},{"line_number":33,"context_line":"        network \u003d self.create_network()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7aa08908_e11550e5","line":30,"range":{"start_line":30,"start_character":40,"end_line":30,"end_character":71},"in_reply_to":"7aa08908_71194b88","updated":"2016-06-07 15:13:06.000000000","message":"You\u0027re right. This is an artifact of debugging why tenant_id wasn\u0027t being persisted correctly. Will remove.","commit_id":"589fa871f5eb6804b70737d9278630d34dd2dd83"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkTestJSON(TrunkTestJSONBase):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    @test.requires_ext(extension\u003d\"trunk\", service\u003d\"network\")"},{"line_number":33,"context_line":"    def resource_setup(cls):"}],"source_content_type":"text/x-python","patch_set":19,"id":"5a9d85d2_12e44939","line":30,"updated":"2016-06-21 16:59:45.000000000","message":"It seems this lacks tests for remove_subports and get_subports.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkTestJSON(TrunkTestJSONBase):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"},{"line_number":32,"context_line":"    @test.requires_ext(extension\u003d\"trunk\", service\u003d\"network\")"},{"line_number":33,"context_line":"    def resource_setup(cls):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_67ce0985","line":30,"in_reply_to":"5a9d85d2_12e44939","updated":"2016-06-21 19:33:45.000000000","message":"Yes, it does.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"d9ae935d0b95e85aaba670ff8a7970311be166e1","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        parent_port \u003d self.create_port(network)"},{"line_number":26,"context_line":"        return self.client.create_trunk(parent_port[\u0027id\u0027], subports)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkTestJSON(TrunkTestJSONBase):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_b6902f44","line":28,"updated":"2016-07-01 12:50:56.000000000","message":"please also add sorting/pagination tests for the new resources. Search for PortsSearchCriteriaTest for an example, it should be easy.","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"abb3e0526dee84802d3db183211838709f32eea6","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        parent_port \u003d self.create_port(network)"},{"line_number":26,"context_line":"        return self.client.create_trunk(parent_port[\u0027id\u0027], subports)"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TrunkTestJSON(TrunkTestJSONBase):"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":37,"id":"3aaa91ec_5394738b","line":28,"in_reply_to":"3aaa91ec_b6902f44","updated":"2016-07-01 15:27:30.000000000","message":"ack","commit_id":"1ef153c9029574276f25b61809a620ad39b9c7e5"}],"neutron/tests/tempest/api/test_trunk_negative.py":[{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    @test.requires_ext(extension\u003d\"trunk\", service\u003d\"network\")"},{"line_number":26,"context_line":"    def resource_setup(cls):"},{"line_number":27,"context_line":"        super(test_trunk.TrunkTestJSONBase, cls).resource_setup()"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    @test.idempotent_id(\u00271b5cf87a-1d3a-4a94-ba64-647153d54f32\u0027)"},{"line_number":30,"context_line":"    def test_create_trunk_nonexistent_port_id(self):"},{"line_number":31,"context_line":"        self.assertRaises(lib_exc.NotFound, self.client.create_trunk,"}],"source_content_type":"text/x-python","patch_set":19,"id":"5a9d85d2_3eaaf170","line":28,"updated":"2016-06-21 16:59:45.000000000","message":"Can you add @test.attr(type\u003d\u0027negative\u0027) to all megative method?","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    @test.requires_ext(extension\u003d\"trunk\", service\u003d\"network\")"},{"line_number":26,"context_line":"    def resource_setup(cls):"},{"line_number":27,"context_line":"        super(test_trunk.TrunkTestJSONBase, cls).resource_setup()"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"    @test.idempotent_id(\u00271b5cf87a-1d3a-4a94-ba64-647153d54f32\u0027)"},{"line_number":30,"context_line":"    def test_create_trunk_nonexistent_port_id(self):"},{"line_number":31,"context_line":"        self.assertRaises(lib_exc.NotFound, self.client.create_trunk,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_87c5f55c","line":28,"in_reply_to":"5a9d85d2_3eaaf170","updated":"2016-06-21 19:33:45.000000000","message":"Done","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"}],"neutron/tests/unit/services/trunk/test_plugin.py":[{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"a784a5a30d2b16ab971324c02d4da8e6edf305b9","unresolved":false,"context_lines":[{"line_number":28,"context_line":"        self.trunk_plugin \u003d trunk_plugin.TrunkPlugin()"},{"line_number":29,"context_line":"        self.ml2_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _test_create_trunk(self, parent, subports\u003dNone, tenant_id\u003dNone):"},{"line_number":32,"context_line":"        subports \u003d subports or []"},{"line_number":33,"context_line":"        tenant_id \u003d tenant_id or \u0027test_tenant\u0027"},{"line_number":34,"context_line":"        trunk_data \u003d {\u0027port_id\u0027: parent[\u0027port\u0027][\u0027id\u0027], \u0027sub_ports\u0027: subports,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_6ce71b41","line":31,"range":{"start_line":31,"start_character":56,"end_line":31,"end_character":70},"updated":"2016-06-21 16:59:45.000000000","message":"I guess that it\u0027s better to pass tenant_id \u003d \u0027test_tenant\u0027 as default.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"0a3483c56e70b7d388ffa442a33851976545232f","unresolved":false,"context_lines":[{"line_number":28,"context_line":"        self.trunk_plugin \u003d trunk_plugin.TrunkPlugin()"},{"line_number":29,"context_line":"        self.ml2_plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def _test_create_trunk(self, parent, subports\u003dNone, tenant_id\u003dNone):"},{"line_number":32,"context_line":"        subports \u003d subports or []"},{"line_number":33,"context_line":"        tenant_id \u003d tenant_id or \u0027test_tenant\u0027"},{"line_number":34,"context_line":"        trunk_data \u003d {\u0027port_id\u0027: parent[\u0027port\u0027][\u0027id\u0027], \u0027sub_ports\u0027: subports,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3aaa91ec_27ab618b","line":31,"range":{"start_line":31,"start_character":56,"end_line":31,"end_character":70},"in_reply_to":"3aaa91ec_6ce71b41","updated":"2016-06-21 19:33:45.000000000","message":"I\u0027m pretty sure I saw warnings come back when passing \u0027test_tenant\u0027. The warning said support for that will be deprecated and I assume you will have to pass a valid UUID going forward.","commit_id":"8dca197f11b709d5eaee4fec00f884aa572d4a0c"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7c1fcf3bb4a8c7de8a2510767922bfe210bb3610","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import test_plugin"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPluginTests(test_plugin.Ml2PluginV2TestCase):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(TrunkPluginTests, self).setUp()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_367223e4","line":26,"updated":"2016-06-28 19:52:50.000000000","message":"These tests somewhat overlap with the tempest API ones, are you sure we can\u0027t live without them? I am not sure I appreciate the value in the coverage they provide. If you added them you must have a good reason, but I can\u0027t seem to find it on my own.\n\nAll I see is duplication of effort, and I\u0027d vote to kill it. It\u0027ll make the patch leaner too.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"a81d1f0dc86a787939b466d0c9baef2289e9df71","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import test_plugin"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPluginTests(test_plugin.Ml2PluginV2TestCase):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(TrunkPluginTests, self).setUp()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_4213a95c","line":26,"in_reply_to":"3aaa91ec_367223e4","updated":"2016-06-28 20:16:43.000000000","message":"I was using these unit tests to build up the basic functionality of the plugin, which is the way I tend to work. That\u0027s why these exist. Once the plugin reached a point of functional maturity, I then cut over to emphasizing the API tests. I guess this patch is bare-bones enough that the API tests are giving us sufficient coverage.\n\nI agree that any testing we do with the service plugin in its current state is easily duplicated. Are we really willing to just pitch out unit tests though? I don\u0027t care either way, unit tests for me tend to be a byproduct of writing code. I\u0027m not terribly invested in these particular tests. It would lean out the patch as you suggest.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"188634b8cea7914c45496ae4d8d818e3d539b657","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import test_plugin"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPluginTests(test_plugin.Ml2PluginV2TestCase):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(TrunkPluginTests, self).setUp()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_a8b98f7b","line":26,"in_reply_to":"3aaa91ec_4213a95c","updated":"2016-06-28 20:55:57.000000000","message":"Now that I\u0027ve thought about it a little more, I think there is value in these if for no other reason than to ensure we have both python 2.7 and python 3 compatibility. These tests actually helped me catch a python 3 incompatibility in an earlier patch set that may have otherwise slipped by. Food for thought...","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d9a22afff824d1a77ac625789badca5abdfc5728","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import test_plugin"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"class TrunkPluginTests(test_plugin.Ml2PluginV2TestCase):"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"    def setUp(self):"},{"line_number":29,"context_line":"        super(TrunkPluginTests, self).setUp()"}],"source_content_type":"text/x-python","patch_set":30,"id":"3aaa91ec_8be92d1d","line":26,"in_reply_to":"3aaa91ec_a8b98f7b","updated":"2016-06-28 21:02:22.000000000","message":"If the reason was just Python 3 compat, it sounds like this is an expensive way to ensure that, with lots of plumbing code.\n\nI\u0027d rather test the smaller units (the code is pretty well chunked up as it is), then parroting the tempest tests.","commit_id":"f3a4339797b68562bbd0054d82c9c4aabdc5d69b"}],"setup.cfg":[{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"39e9b921b24c1befc73fbac65854859850e51d56","unresolved":false,"context_lines":[{"line_number":82,"context_line":"    segments \u003d neutron.services.segments.plugin:Plugin"},{"line_number":83,"context_line":"    network_ip_availability \u003d neutron.services.network_ip_availability.plugin:NetworkIPAvailabilityPlugin"},{"line_number":84,"context_line":"    timestamp_core \u003d neutron.services.timestamp.timestamp_plugin:TimeStampPlugin"},{"line_number":85,"context_line":"    trunk \u003d neutron.services.trunk.plugin:TrunkPlugin"},{"line_number":86,"context_line":"neutron.qos.notification_drivers \u003d"},{"line_number":87,"context_line":"    message_queue \u003d neutron.services.qos.notification_drivers.message_queue:RpcQosServiceNotificationDriver"},{"line_number":88,"context_line":"neutron.ml2.type_drivers \u003d"}],"source_content_type":"text/x-ttcn-cfg","patch_set":27,"id":"3aaa91ec_c942afad","line":85,"updated":"2016-06-24 21:59:09.000000000","message":"I think we need \u0027trunk-details\u0027 here as well?","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"},{"author":{"_account_id":4187,"name":"Ryan Tidwell","email":"rtidwell@suse.com","username":"ryan-tidwell"},"change_message_id":"f7ff9a30bd5caf9469361888b97e970653d3f8f3","unresolved":false,"context_lines":[{"line_number":82,"context_line":"    segments \u003d neutron.services.segments.plugin:Plugin"},{"line_number":83,"context_line":"    network_ip_availability \u003d neutron.services.network_ip_availability.plugin:NetworkIPAvailabilityPlugin"},{"line_number":84,"context_line":"    timestamp_core \u003d neutron.services.timestamp.timestamp_plugin:TimeStampPlugin"},{"line_number":85,"context_line":"    trunk \u003d neutron.services.trunk.plugin:TrunkPlugin"},{"line_number":86,"context_line":"neutron.qos.notification_drivers \u003d"},{"line_number":87,"context_line":"    message_queue \u003d neutron.services.qos.notification_drivers.message_queue:RpcQosServiceNotificationDriver"},{"line_number":88,"context_line":"neutron.ml2.type_drivers \u003d"}],"source_content_type":"text/x-ttcn-cfg","patch_set":27,"id":"3aaa91ec_eceb39da","line":85,"in_reply_to":"3aaa91ec_c942afad","updated":"2016-06-24 22:13:34.000000000","message":"No. We only care about the plugin class, not the extensions it implements.","commit_id":"7e07a0bc250488e012590dfa97efb5aacdf1220a"}]}
