)]}'
{"ironic/objects/port.py":[{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"880133ff88b15889ab6496c602e967586ab5f4b0","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            existing object fields in the target version as appropriate)."},{"line_number":72,"context_line":"        \"\"\""},{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_96ef131d","line":74,"updated":"2017-06-27 08:57:03.000000000","message":"What needs to happen when version 1.9 is added? Should it get added to this set? Would an API utils-style helper be a sensible pattern to start here?\n\ndef target_version_supports_physical_network(target_version):\n    return target_version \u003e\u003d (1, 7)","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e785d91ee3b02158724147d467a573cc6369c5cb","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            existing object fields in the target version as appropriate)."},{"line_number":72,"context_line":"        \"\"\""},{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_becf6f27","line":74,"in_reply_to":"5f201791_96ef131d","updated":"2017-06-27 18:57:44.000000000","message":"This is a good question. Honestly, I live one release at a time. Ie, I haven\u0027t yet thought beyond one release from when an object version changes. I don\u0027t have a \u0027best practises\u0027 yet. It seems like we can \n\n1. delete this code in a subsequent release, cuz all objects must have a minimum version before an upgrade can be done.\n\n2. leave the code and then have to deal with various versions...\n\n3. Maybe something else\n\n#1 seems easiest but what if we forget to delete the code.","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"1728c1caac13e7fea7eaf9a82855f15ae6658521","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            existing object fields in the target version as appropriate)."},{"line_number":72,"context_line":"        \"\"\""},{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_663ed8c1","line":74,"in_reply_to":"5f201791_becf6f27","updated":"2017-06-28 08:46:37.000000000","message":"It\u0027s not necessarily restricted to a single release - what if someone bumps the Port object version again and you aren\u0027t a reviewer of the change? Ideally any changes they need to make here could be self contained, dealing only with their new fields, and they wouldn\u0027t need to change the physnet code.\n\nIt does seem to me that for each field we need to convert, there are four cases:\n\n1a. The target version supports the field, the field is unset on the object\n  -\u003e set to default\n1b. The target version supports the field, the field is set on the object\n  -\u003e do nothing\n2a. The target version does not support the field, the field is unset on the object\n  -\u003e do nothing\n2b. The target version does not support the field, the field is set on the object\n  -\u003e delete/unset field based on change_fields\n\n1 vs 2 is a simple target_version \u003e\u003d min_version check - no set of versions required. If a version 1.9 gets built, it will likely still support physical_network.","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"880133ff88b15889ab6496c602e967586ab5f4b0","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"},{"line_number":78,"context_line":"            if self.obj_attr_is_set(\u0027physical_network\u0027):"},{"line_number":79,"context_line":"                if change_fields:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_23023f3e","line":76,"updated":"2017-06-27 08:57:03.000000000","message":"Don\u0027t we need to check the object\u0027s version here? Surely if self.VERSION \u003e\u003d 1.7 we can just keep its physical_network?","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e785d91ee3b02158724147d467a573cc6369c5cb","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"},{"line_number":78,"context_line":"            if self.obj_attr_is_set(\u0027physical_network\u0027):"},{"line_number":79,"context_line":"                if change_fields:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_fedf270a","line":76,"in_reply_to":"5f201791_23023f3e","updated":"2017-06-27 18:57:44.000000000","message":"This is only called if the object is in a version that is not 1.7 or 1.8. Assuming it only goes up to 1.8 for now, we\u0027ve got an older object. In that case, I *think* this value will already be None so no need for this line but I am not totally sure yet.","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"1728c1caac13e7fea7eaf9a82855f15ae6658521","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        target_version \u003d versionutils.convert_version_to_tuple(target_version)"},{"line_number":74,"context_line":"        if target_version in set([(1, 7), (1, 8)]):"},{"line_number":75,"context_line":"            # rloo: do we need to do this since it is the default value anyway?"},{"line_number":76,"context_line":"            self.physical_network \u003d None"},{"line_number":77,"context_line":"        elif target_version \u003c (1, 7):"},{"line_number":78,"context_line":"            if self.obj_attr_is_set(\u0027physical_network\u0027):"},{"line_number":79,"context_line":"                if change_fields:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_66dff868","line":76,"in_reply_to":"5f201791_fedf270a","updated":"2017-06-28 08:46:37.000000000","message":"So IMHO this is correct for case 1a in my previous comment, but incorrect if the object has a physical_network field. I guess I see your point that in the current upgrade scenario this should work, but it would be nice to build something that wouldn\u0027t immediately break when someone tries to upgrade pike to master or pike to queens after a Port version bump. It also sets a pattern that doesn\u0027t prevent skipping versions one day.\n\nHow about this:\n\nif not self.obj_attr_is_set(\u0027physical_network\u0027):\n    self.physical_network \u003d None","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"b11fd1d441e093b5b43a9556d6642effbc41eb59","unresolved":false,"context_lines":[{"line_number":38,"context_line":"    #              local_link_connection, portgroup_id and pxe_enabled"},{"line_number":39,"context_line":"    # Version 1.6: Add internal_info field"},{"line_number":40,"context_line":"    # Version 1.7: Add physical_network field"},{"line_number":41,"context_line":"    VERSION \u003d \u00271.7\u0027"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":44,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_88caf99e","line":41,"updated":"2017-07-20 13:40:35.000000000","message":"You still need to up the version, because a new method is being added that is NOT available in version 1.7.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e2546bd6d3f4c3bc3c68e3ed9c22475180547c46","unresolved":false,"context_lines":[{"line_number":38,"context_line":"    #              local_link_connection, portgroup_id and pxe_enabled"},{"line_number":39,"context_line":"    # Version 1.6: Add internal_info field"},{"line_number":40,"context_line":"    # Version 1.7: Add physical_network field"},{"line_number":41,"context_line":"    VERSION \u003d \u00271.7\u0027"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":44,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_eec4d561","line":41,"in_reply_to":"1f1a1f67_0b9dc365","updated":"2017-07-20 14:48:58.000000000","message":"Yes, that\u0027s true. I took a look and I think I understand why the version is being bumped when a new method is introduced. The VersionedObjects support remotable calls, although ironic didn\u0027t (and I doubt will ever) turn this on. For that, the public methods need to be versioned as well.\n\nSo this is fine. Wondering if we should add \u0027(and _convert_to_version()) to L40.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"ee4309197cf2e47297846c559ef918a235d23f00","unresolved":false,"context_lines":[{"line_number":38,"context_line":"    #              local_link_connection, portgroup_id and pxe_enabled"},{"line_number":39,"context_line":"    # Version 1.6: Add internal_info field"},{"line_number":40,"context_line":"    # Version 1.7: Add physical_network field"},{"line_number":41,"context_line":"    VERSION \u003d \u00271.7\u0027"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":44,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_0b9dc365","line":41,"in_reply_to":"1f1a1f67_88caf99e","updated":"2017-07-20 14:01:54.000000000","message":"Aren\u0027t the versions supposed to track changes to the object model, and remotable methods? This new method is only local - it won\u0027t affect anything in the DB or via RPC.\n\nCompare this to a change in the base object such as convert_to_version(). All subclass objects didn\u0027t bump their versions when that method was added, did they?\n\nPlus the object hash hasn\u0027t changed, otherwise the unit tests would fail.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"eb7b1ec883b6450c385e768d164a383ed1fef26f","unresolved":false,"context_lines":[{"line_number":38,"context_line":"    #              local_link_connection, portgroup_id and pxe_enabled"},{"line_number":39,"context_line":"    # Version 1.6: Add internal_info field"},{"line_number":40,"context_line":"    # Version 1.7: Add physical_network field"},{"line_number":41,"context_line":"    VERSION \u003d \u00271.7\u0027"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":44,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_ffb6bd3e","line":41,"in_reply_to":"1f1a1f67_eec4d561","updated":"2017-07-20 15:22:11.000000000","message":"I might be wrong here, but I think the versions really only need to track changes to things that could change the DB or the contents of a serialised object? _convert_to_version() falls into neither of these categories.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"b11fd1d441e093b5b43a9556d6642effbc41eb59","unresolved":false,"context_lines":[{"line_number":78,"context_line":"           appropriate values so that these fields are saved in the DB. (If"},{"line_number":79,"context_line":"           they are not set, the VersionedObject magic will not know to"},{"line_number":80,"context_line":"           save/update them to the DB.) remove_unavailable_fields is set to"},{"line_number":81,"context_line":"           False in this case."},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        Version 1.7 (\u0026 1.8): physical_network field was added. Its"},{"line_number":84,"context_line":"            default value is None. For versions prior to this, it should"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_4820614a","line":81,"updated":"2017-07-20 13:40:35.000000000","message":"My personal opinion (esp since it is so long) is not to copy/paste this. If you want it, I wouldn\u0027t put L63-65.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"ee4309197cf2e47297846c559ef918a235d23f00","unresolved":false,"context_lines":[{"line_number":78,"context_line":"           appropriate values so that these fields are saved in the DB. (If"},{"line_number":79,"context_line":"           they are not set, the VersionedObject magic will not know to"},{"line_number":80,"context_line":"           save/update them to the DB.) remove_unavailable_fields is set to"},{"line_number":81,"context_line":"           False in this case."},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        Version 1.7 (\u0026 1.8): physical_network field was added. Its"},{"line_number":84,"context_line":"            default value is None. For versions prior to this, it should"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_0bab8375","line":81,"in_reply_to":"1f1a1f67_4820614a","updated":"2017-07-20 14:01:54.000000000","message":"I was half and half about this. I guess once all objects redefine it things get a bit silly. Perhaps I should reference the comment in the base class?\n\nGood point about L63-65 also.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e2546bd6d3f4c3bc3c68e3ed9c22475180547c46","unresolved":false,"context_lines":[{"line_number":80,"context_line":"           save/update them to the DB.) remove_unavailable_fields is set to"},{"line_number":81,"context_line":"           False in this case."},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        Version 1.7 (\u0026 1.8): physical_network field was added. Its"},{"line_number":84,"context_line":"            default value is None. For versions prior to this, it should"},{"line_number":85,"context_line":"            be set to None (or removed)."},{"line_number":86,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_d9a7a1a7","line":83,"updated":"2017-07-20 14:48:58.000000000","message":"this needs to be updated then.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"eb7b1ec883b6450c385e768d164a383ed1fef26f","unresolved":false,"context_lines":[{"line_number":80,"context_line":"           save/update them to the DB.) remove_unavailable_fields is set to"},{"line_number":81,"context_line":"           False in this case."},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"        Version 1.7 (\u0026 1.8): physical_network field was added. Its"},{"line_number":84,"context_line":"            default value is None. For versions prior to this, it should"},{"line_number":85,"context_line":"            be set to None (or removed)."},{"line_number":86,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_9f87c962","line":83,"in_reply_to":"1f1a1f67_d9a7a1a7","updated":"2017-07-20 15:22:11.000000000","message":"Done","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e2546bd6d3f4c3bc3c68e3ed9c22475180547c46","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        fields \u003d ["},{"line_number":96,"context_line":"            (\u0027physical_network\u0027, None, (1, 7)),"},{"line_number":97,"context_line":"        ]"},{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_39021540","line":98,"updated":"2017-07-20 14:48:58.000000000","message":"if you wanted to generalize, why not pass in the entire fields, and do the for loop in .convert_field_to_version().","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"eb7b1ec883b6450c385e768d164a383ed1fef26f","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        fields \u003d ["},{"line_number":96,"context_line":"            (\u0027physical_network\u0027, None, (1, 7)),"},{"line_number":97,"context_line":"        ]"},{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_5fea51ac","line":98,"in_reply_to":"1f1a1f67_39021540","updated":"2017-07-20 15:22:11.000000000","message":"I had initially thought that some sort of data-driven process might be nice that could be entirely handled in the base. E.g.\n\nclass Port:\n\n    FIELD_METADATA \u003d {\n        \u0027physical_network\u0027: FieldMetadata(None, (1, 7)),\n    }\n\nI decided I\u0027d focus on getting the low level field conversion right, then we can build up from there. Plus it might introduce a long review process.\n\nWe could push all the fields down to convert_field(s)_to_version(), although that starts to seem even more generalised, and makes me ask difficult questions about the format of the field metadata to pass via a method call.\n\nIn all, I think there\u0027s definite scope for abstracting and generalising this whole area but it needs further thought, and perhaps (like you say) more data.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"b11fd1d441e093b5b43a9556d6642effbc41eb59","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_ab024f08","line":101,"updated":"2017-07-20 13:40:35.000000000","message":"I\u0027m not sure what I think about this. I\u0027m not sure we know enough to try to generalize it. For example, is this general enough to handle my test case [1]?\n\n[1] https://review.openstack.org/#/c/455811/12/ironic/objects/node.py","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"eb7b1ec883b6450c385e768d164a383ed1fef26f","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_9f17c9a4","line":101,"in_reply_to":"1f1a1f67_591151ac","updated":"2017-07-20 15:22:11.000000000","message":"There\u0027s quite a lot of data contained in the alembic migrations from previous releases of ironic. Of course the past is not a guaranteed prediction of the future but its better than nothing. That said, I haven\u0027t been through them all.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e2546bd6d3f4c3bc3c68e3ed9c22475180547c46","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_591151ac","line":101,"in_reply_to":"1f1a1f67_6bd437be","updated":"2017-07-20 14:48:58.000000000","message":"I don\u0027t know that we have enough data to know what is common. I\u0027m afraid to generalize too soon.\n\nWhat if V1.8 causes physical_network to be changed in a different way? Would the above mechanism support that easily?\n\nMy gut feeling is that this is premature. I\u0027d prefer that we had some experience with the rolling upgrades, before generalizing. We can see what others think.\n\nHaving a ._convert_to_version() call a .convert_field_to_version() also bothers me a bit; it may be fine but just seems like we\u0027re dealing at diff levels.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"6328ce4a1ae1a69d6d697183b83853e6e676300a","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_da454f45","line":101,"in_reply_to":"1f1a1f67_9f17c9a4","updated":"2017-07-20 15:34:23.000000000","message":"It\u0027s probably worth pointing out also that there\u0027s no inter-process, plugin or other complicated interfacing going on here - it\u0027s all in-tree, and localised to the object code. If we find that convert_field_to_version is way off of where it needs to be, it can be safely scrapped. OTOH, it\u0027s all quite fiddly logic and if we replicate it all over the place when we don\u0027t need to we\u0027re asking for trouble.\n\nOn the ._convert_to_version() calling a convert_field_to_version() point, would you prefer that convert_field_to_version() was \u0027private\u0027? Perhaps it makes more sense, although I had a review from Wang KaiFeng suggesting that subclasses shouldn\u0027t call the private methods of their superclasses.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"ee4309197cf2e47297846c559ef918a235d23f00","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_6bd437be","line":101,"in_reply_to":"1f1a1f67_ab024f08","updated":"2017-07-20 14:01:54.000000000","message":"I think it handles the very common case of adding a new field with no migration of old data.\n\nYour test case is quite hard given that it involves shuffling state from one field to another, so I think that\u0027s always going to be hard to generalise. I imagine it could be done e.g. by passing in up/down functions or something clever with objects, but IMO let\u0027s cross that bridge when we come to it.\n\nUltimately you don\u0027t have to use convert_field_to_version and can always write a custom converter.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"01144962e169c4b6ac1d194f0a56903ef618fc66","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        for field, default, min_version in fields:"},{"line_number":99,"context_line":"            self.convert_field_to_version(field, default, min_version,"},{"line_number":100,"context_line":"                                          target_version,"},{"line_number":101,"context_line":"                                          remove_unavailable_fields)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    # NOTE(xek): We don\u0027t want to enable RPC on this call just yet. Remotable"},{"line_number":104,"context_line":"    # methods can be used in the future to replace current explicit RPC calls."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f1a1f67_1a79872e","line":101,"in_reply_to":"1f1a1f67_da454f45","updated":"2017-07-20 15:42:42.000000000","message":"To be clear, my preference is NOT to have this new convert_field_..(). I\u0027m not going to block the patch cuz of this, but unless others think it is a good idea, I am not going to bless it either. I\u0027ve got enough reviewing and stuff to do, that I don\u0027t want to spend much time reviewing something that doesn\u0027t seem worthwhile at the moment. if others want to do so, then that is fine.","commit_id":"6f2a83a3f26821284d709209849a376d92cd72e9"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"63407f3d6c5404680e60766e44216397db794e2f","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            # Target version does not support physical_network, and it is set."},{"line_number":87,"context_line":"            if remove_unavailable_fields:"},{"line_number":88,"context_line":"                # (De)serialising: remove unavailable fields."},{"line_number":89,"context_line":"                delattr(self, \u0027physical_network\u0027)"},{"line_number":90,"context_line":"            elif self.physical_network is not None:"},{"line_number":91,"context_line":"                # DB: set unavailable fields to their default."},{"line_number":92,"context_line":"                self.physical_network \u003d None"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff346bd7_d7cc4036","line":89,"range":{"start_line":89,"start_character":16,"end_line":89,"end_character":49},"updated":"2017-07-28 13:34:54.000000000","message":"I\u0027m not sure this is needed, because the \u0027easy\u0027 ovo types accept None as a value during deserialization. I thought it\u0027s only object fields that do not. otoh this does not seem to make any harm.","commit_id":"7e4030600fe28f5f641e9743462700a28156c40e"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"8c11a1092c164033a79c640ed8dce789a07857f4","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            # Target version does not support physical_network, and it is set."},{"line_number":87,"context_line":"            if remove_unavailable_fields:"},{"line_number":88,"context_line":"                # (De)serialising: remove unavailable fields."},{"line_number":89,"context_line":"                delattr(self, \u0027physical_network\u0027)"},{"line_number":90,"context_line":"            elif self.physical_network is not None:"},{"line_number":91,"context_line":"                # DB: set unavailable fields to their default."},{"line_number":92,"context_line":"                self.physical_network \u003d None"}],"source_content_type":"text/x-python","patch_set":5,"id":"df3967d1_efd15459","line":89,"range":{"start_line":89,"start_character":16,"end_line":89,"end_character":49},"in_reply_to":"ff346bd7_d7cc4036","updated":"2017-07-31 13:48:39.000000000","message":"I believe that it is not necessary. However, if you don\u0027t do this, the serialization will serialize the object with this field. Since the idea is that the object should be in its desired version, it would be \u0027incorrect\u0027 (or at least confusing) to allow this to \u0027leak\u0027 through. At the deserialization end, things work out because of the way things are coded; the older object version doesn\u0027t know about this so it is ignored. I could imagine a scenario though, where someone decides to \u0027fix\u0027 the code to check for unknown fields...","commit_id":"7e4030600fe28f5f641e9743462700a28156c40e"}],"ironic/tests/unit/objects/test_port.py":[{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"880133ff88b15889ab6496c602e967586ab5f4b0","unresolved":false,"context_lines":[{"line_number":149,"context_line":"class TestConvertToVersion(db_base.DbTestCase, obj_utils.SchemasTestMixIn):"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _test__convert_to_version_new(self, version, change_fields):"},{"line_number":152,"context_line":"        port \u003d obj_utils.create_test_port(self.context)"},{"line_number":153,"context_line":"        delattr(port, \u0027physical_network\u0027)"},{"line_number":154,"context_line":"        self.assertFalse(port.obj_attr_is_set(\u0027physical_network\u0027))"},{"line_number":155,"context_line":"        self.assertEqual(set(), port.obj_what_changed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_03a98322","line":152,"updated":"2017-06-27 08:57:03.000000000","message":"How about a test that converts a port with a physical_network to \u003e\u003d 1.7?","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e785d91ee3b02158724147d467a573cc6369c5cb","unresolved":false,"context_lines":[{"line_number":149,"context_line":"class TestConvertToVersion(db_base.DbTestCase, obj_utils.SchemasTestMixIn):"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _test__convert_to_version_new(self, version, change_fields):"},{"line_number":152,"context_line":"        port \u003d obj_utils.create_test_port(self.context)"},{"line_number":153,"context_line":"        delattr(port, \u0027physical_network\u0027)"},{"line_number":154,"context_line":"        self.assertFalse(port.obj_attr_is_set(\u0027physical_network\u0027))"},{"line_number":155,"context_line":"        self.assertEqual(set(), port.obj_what_changed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_be9d2f0b","line":152,"in_reply_to":"5f201791_03a98322","updated":"2017-06-27 18:57:44.000000000","message":"I\u0027m not sure I understand your question. That\u0027s what this test does. It mimics a 1.6 port by removing port.physical_network, and then converts to 1.7 (via L161) or 1.8 (via L164).\n\nShould I add a comment?","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"},{"author":{"_account_id":14826,"name":"Mark Goddard","email":"markgoddard86@gmail.com","username":"mgoddard"},"change_message_id":"1728c1caac13e7fea7eaf9a82855f15ae6658521","unresolved":false,"context_lines":[{"line_number":149,"context_line":"class TestConvertToVersion(db_base.DbTestCase, obj_utils.SchemasTestMixIn):"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _test__convert_to_version_new(self, version, change_fields):"},{"line_number":152,"context_line":"        port \u003d obj_utils.create_test_port(self.context)"},{"line_number":153,"context_line":"        delattr(port, \u0027physical_network\u0027)"},{"line_number":154,"context_line":"        self.assertFalse(port.obj_attr_is_set(\u0027physical_network\u0027))"},{"line_number":155,"context_line":"        self.assertEqual(set(), port.obj_what_changed())"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_0615e4e4","line":152,"in_reply_to":"5f201791_be9d2f0b","updated":"2017-06-28 08:46:37.000000000","message":"I was really talking about case 1a from my previous comment. A port with a physical_network that is not None, converted to a version \u003e\u003d 1.7, then check that the physical_network field is unchanged. I understand that you haven\u0027t designed it to support that case currently.","commit_id":"e16e8555f9fdf664355ebe7620013bdf0e3eab8d"}]}
