)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"d5dd26506ebe9d5f1b13d1fbf3a00123d27ab49a","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Yao wang \u003ca64957782017@163.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-07-30 17:33:51 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Unnecessary error exists while backup restore without specified volume."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, an error was reported while restore a encrypted volume"},{"line_number":10,"context_line":"backup without specified volume because the encrypted volume backup"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9f560f44_c6e61a17","line":7,"updated":"2020-07-30 13:06:48.000000000","message":"Minor nit, but commit messages should state what is being changed, not be a bug report.\n\nhttps://wiki.openstack.org/wiki/GitCommitMessages#Summary_of_Git_commit_message_structure","commit_id":"cfc0206653f269c84c8c7ff12a7c7869333fc520"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"ea928f2e46827b9318de2bd17eb5f91269c7e949","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Yao wang \u003ca64957782017@163.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-07-30 17:33:51 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Unnecessary error exists while backup restore without specified volume."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, an error was reported while restore a encrypted volume"},{"line_number":10,"context_line":"backup without specified volume because the encrypted volume backup"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9f560f44_9ccd6133","line":7,"in_reply_to":"9f560f44_c6e61a17","updated":"2020-08-03 07:16:47.000000000","message":"I get it.","commit_id":"cfc0206653f269c84c8c7ff12a7c7869333fc520"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Yao wang \u003ca64957782017@163.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-08-05 07:36:43 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Preferred to use self volume_type_id while backup restore ."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"if restore without specified volume and the backup\u0027s volume type still"},{"line_number":10,"context_line":"exists, destination volume will be created automatic with it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"9f560f44_5e7433fe","line":7,"updated":"2020-08-05 14:26:12.000000000","message":"Grammar nit: \"Prefer\" (not \"preferred\"), and \" .\" at end of line may be eliminated.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Yao wang \u003ca64957782017@163.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-08-05 07:36:43 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Preferred to use self volume_type_id while backup restore ."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"if restore without specified volume and the backup\u0027s volume type still"},{"line_number":10,"context_line":"exists, destination volume will be created automatic with it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"9f560f44_f816eda7","line":7,"in_reply_to":"9f560f44_5e7433fe","updated":"2020-08-06 11:37:07.000000000","message":"Done","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"9f560f44_3e297f9a","line":14,"updated":"2020-08-05 14:26:12.000000000","message":"I think this also fixes https://bugs.launchpad.net/cinder/+bug/1567263\n\nAt first I thought [2] was relevant, but it\u0027s really a request to enhance the API so that user can specify the destination volume type.\n\n[2] https://bugs.launchpad.net/cinder/+bug/1890043","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"9f560f44_58255908","line":14,"in_reply_to":"9f560f44_3e297f9a","updated":"2020-08-06 11:37:07.000000000","message":"add \u0027Closes-Bug: #1567263\u0027 done.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"}],"cinder/backup/api.py":[{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"d08431f8ef5a978a1cd01f6e2308188229afd0e3","unresolved":false,"context_lines":[{"line_number":361,"context_line":"            if hasattr(backup, \u0027volume_type_id\u0027):"},{"line_number":362,"context_line":"                vol_type_id \u003d backup[\u0027volume_type_id\u0027]"},{"line_number":363,"context_line":"            if vol_type_id:"},{"line_number":364,"context_line":"                vol_type \u003d volume_type.VolumeType.get_by_name_or_id\\"},{"line_number":365,"context_line":"                    (context.elevated(), vol_type_id)"},{"line_number":366,"context_line":""},{"line_number":367,"context_line":"            description \u003d \u0027auto-created_from_restore_from_backup\u0027"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_503abb97","line":364,"updated":"2020-07-30 14:21:45.000000000","message":"pep8: E211 whitespace before \u0027(\u0027","commit_id":"cfc0206653f269c84c8c7ff12a7c7869333fc520"},{"author":{"_account_id":11904,"name":"Sean McGinnis","email":"sean.mcginnis@gmail.com","username":"SeanM"},"change_message_id":"d5dd26506ebe9d5f1b13d1fbf3a00123d27ab49a","unresolved":false,"context_lines":[{"line_number":369,"context_line":"            LOG.info(\"Creating volume of %(size)s GB for restore of \""},{"line_number":370,"context_line":"                     \"backup %(backup_id)s.\","},{"line_number":371,"context_line":"                     {\u0027size\u0027: size, \u0027backup_id\u0027: backup_id})"},{"line_number":372,"context_line":"            if vol_type:"},{"line_number":373,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":374,"context_line":"                                                description,"},{"line_number":375,"context_line":"                                                volume_type\u003dvol_type)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_e64a3eaa","line":372,"updated":"2020-07-30 13:06:48.000000000","message":"+1\n\nWe do need to keep in mind that a backup could be exported from one cinder deployment and imported on another. So this makes sense to check if the volume type still exists and handle it gracefully if it does not.","commit_id":"cfc0206653f269c84c8c7ff12a7c7869333fc520"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"ea928f2e46827b9318de2bd17eb5f91269c7e949","unresolved":false,"context_lines":[{"line_number":369,"context_line":"            LOG.info(\"Creating volume of %(size)s GB for restore of \""},{"line_number":370,"context_line":"                     \"backup %(backup_id)s.\","},{"line_number":371,"context_line":"                     {\u0027size\u0027: size, \u0027backup_id\u0027: backup_id})"},{"line_number":372,"context_line":"            if vol_type:"},{"line_number":373,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":374,"context_line":"                                                description,"},{"line_number":375,"context_line":"                                                volume_type\u003dvol_type)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f560f44_1c54b152","line":372,"in_reply_to":"9f560f44_e64a3eaa","updated":"2020-08-03 07:16:47.000000000","message":"Thank you","commit_id":"cfc0206653f269c84c8c7ff12a7c7869333fc520"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[{"line_number":355,"context_line":"            if name is None:"},{"line_number":356,"context_line":"                name \u003d \u0027restore_backup_%s\u0027 % backup_id"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"            # Use self volume_type to create volume if type still exists"},{"line_number":359,"context_line":"            vol_type_id \u003d None"},{"line_number":360,"context_line":"            vol_type \u003d None"},{"line_number":361,"context_line":"            if hasattr(backup, \u0027volume_type_id\u0027):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_7ed8177a","line":358,"updated":"2020-08-05 14:26:12.000000000","message":"grammar nit: the \"still exists\" phrase suggests it might have existed but was deleted (which is no longer possible because your other patch prevents it from being deleted).\n\nHow about something like, \"If the backup specifies a volume type then use it.\"","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[{"line_number":355,"context_line":"            if name is None:"},{"line_number":356,"context_line":"                name \u003d \u0027restore_backup_%s\u0027 % backup_id"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"            # Use self volume_type to create volume if type still exists"},{"line_number":359,"context_line":"            vol_type_id \u003d None"},{"line_number":360,"context_line":"            vol_type \u003d None"},{"line_number":361,"context_line":"            if hasattr(backup, \u0027volume_type_id\u0027):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_b87595fc","line":358,"in_reply_to":"9f560f44_7ed8177a","updated":"2020-08-06 11:37:07.000000000","message":"Yes,it is more accurate.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[{"line_number":358,"context_line":"            # Use self volume_type to create volume if type still exists"},{"line_number":359,"context_line":"            vol_type_id \u003d None"},{"line_number":360,"context_line":"            vol_type \u003d None"},{"line_number":361,"context_line":"            if hasattr(backup, \u0027volume_type_id\u0027):"},{"line_number":362,"context_line":"                vol_type_id \u003d backup[\u0027volume_type_id\u0027]"},{"line_number":363,"context_line":"            if vol_type_id:"},{"line_number":364,"context_line":"                vol_type \u003d volume_type.VolumeType.get_by_name_or_id("},{"line_number":365,"context_line":"                    context.elevated(), vol_type_id)"},{"line_number":366,"context_line":""},{"line_number":367,"context_line":"            description \u003d \u0027auto-created_from_restore_from_backup\u0027"},{"line_number":368,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_1e23db57","line":365,"range":{"start_line":361,"start_character":0,"end_line":365,"end_character":52},"updated":"2020-08-05 14:26:12.000000000","message":"Is all of this necessary? The \u0027backup\u0027 is an OVO, so there shouldn\u0027t be a need test whether the field exists. Wouldn\u0027t this work?\n\n  vol_type \u003d volume_type.VolumeType.get_by_name_or_id(\n                    context.elevated(), backup.volume_type_id)\n\nIf the field is unset/empty then vol_type will be None.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[{"line_number":358,"context_line":"            # Use self volume_type to create volume if type still exists"},{"line_number":359,"context_line":"            vol_type_id \u003d None"},{"line_number":360,"context_line":"            vol_type \u003d None"},{"line_number":361,"context_line":"            if hasattr(backup, \u0027volume_type_id\u0027):"},{"line_number":362,"context_line":"                vol_type_id \u003d backup[\u0027volume_type_id\u0027]"},{"line_number":363,"context_line":"            if vol_type_id:"},{"line_number":364,"context_line":"                vol_type \u003d volume_type.VolumeType.get_by_name_or_id("},{"line_number":365,"context_line":"                    context.elevated(), vol_type_id)"},{"line_number":366,"context_line":""},{"line_number":367,"context_line":"            description \u003d \u0027auto-created_from_restore_from_backup\u0027"},{"line_number":368,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_58af1929","line":365,"range":{"start_line":361,"start_character":0,"end_line":365,"end_character":52},"in_reply_to":"9f560f44_1e23db57","updated":"2020-08-06 11:37:07.000000000","message":"Yes,the volume_type_id field must exists.I\u0027ve removed the first test whether.\nBut a backup could be exported from one cinder deployment and imported on another,so I kept the second criterion to reduce the number of database queries in some cases.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[{"line_number":369,"context_line":"            LOG.info(\"Creating volume of %(size)s GB for restore of \""},{"line_number":370,"context_line":"                     \"backup %(backup_id)s.\","},{"line_number":371,"context_line":"                     {\u0027size\u0027: size, \u0027backup_id\u0027: backup_id})"},{"line_number":372,"context_line":"            if vol_type:"},{"line_number":373,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":374,"context_line":"                                                description,"},{"line_number":375,"context_line":"                                                volume_type\u003dvol_type)"},{"line_number":376,"context_line":"            else:"},{"line_number":377,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":378,"context_line":"                                                description)"},{"line_number":379,"context_line":"            volume_id \u003d volume[\u0027id\u0027]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"            while True:"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_3ec4df5e","line":378,"range":{"start_line":372,"start_character":0,"end_line":378,"end_character":60},"updated":"2020-08-05 14:26:12.000000000","message":"The conditional at L372 isn\u0027t necessary. You can always pass in the vol_type, even if it\u0027s None.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[{"line_number":369,"context_line":"            LOG.info(\"Creating volume of %(size)s GB for restore of \""},{"line_number":370,"context_line":"                     \"backup %(backup_id)s.\","},{"line_number":371,"context_line":"                     {\u0027size\u0027: size, \u0027backup_id\u0027: backup_id})"},{"line_number":372,"context_line":"            if vol_type:"},{"line_number":373,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":374,"context_line":"                                                description,"},{"line_number":375,"context_line":"                                                volume_type\u003dvol_type)"},{"line_number":376,"context_line":"            else:"},{"line_number":377,"context_line":"                volume \u003d self.volume_api.create(context, size, name,"},{"line_number":378,"context_line":"                                                description)"},{"line_number":379,"context_line":"            volume_id \u003d volume[\u0027id\u0027]"},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"            while True:"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_186f61fc","line":378,"range":{"start_line":372,"start_character":0,"end_line":378,"end_character":60},"in_reply_to":"9f560f44_3ec4df5e","updated":"2020-08-06 11:37:07.000000000","message":"You are right,I have finished.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":31960,"name":"sunhao","email":"suha9102@163.com","username":"sunhao"},"change_message_id":"250d10f6ab595214f46c32cac550dc4ff0dcbdfd","unresolved":false,"context_lines":[{"line_number":359,"context_line":"            vol_type_id \u003d backup[\u0027volume_type_id\u0027]"},{"line_number":360,"context_line":"            vol_type \u003d None"},{"line_number":361,"context_line":"            if vol_type_id:"},{"line_number":362,"context_line":"                vol_type \u003d volume_type.VolumeType. \\"},{"line_number":363,"context_line":"                    get_by_name_or_id(context.elevated(), vol_type_id)"},{"line_number":364,"context_line":""},{"line_number":365,"context_line":"            description \u003d \u0027auto-created_from_restore_from_backup\u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"9f560f44_de58438b","line":362,"range":{"start_line":362,"start_character":0,"end_line":362,"end_character":52},"updated":"2020-08-24 08:51:58.000000000","message":"I think there is another way to wrap a line. For example:\nvol_type \u003d volume_type.VolumeType.get_by_name_or_id(\n    context.elevated(),\n    vol_type_id)\nIt looks more comfortable.","commit_id":"d0351bdc43066d56191dd40f084ead1a0a895c7a"}],"cinder/tests/unit/api/contrib/test_backups.py":[{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f8b8d1f5fc35062c457471e24eb1d35a89bb9080","unresolved":false,"context_lines":[{"line_number":1519,"context_line":""},{"line_number":1520,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":1521,"context_line":"    @mock.patch(\u0027cinder.volume.api.API.create\u0027)"},{"line_number":1522,"context_line":"    def test_restore_backup_volume_unspecified_with_type_exist("},{"line_number":1523,"context_line":"            self, _mock_volume_api_create, _mock_service_get_all):"},{"line_number":1524,"context_line":"        # intercept volume creation to ensure created volume"},{"line_number":1525,"context_line":"        # has status of available"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_fef7078a","line":1522,"updated":"2020-08-05 14:26:12.000000000","message":"Rather than virtually duplicating the test_restore_backup_volume_id_unspecified() code, I recommend using DDT to execute the same test twice, with and without a volume type. See test_create_backup_delta() at L839 for an example. You can add a volume_type_id argument, and use it in the code (\"if volume_type_id:\") to create the type prior to running the restore, and verifying the volume got created with that type.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"8dc26bf825053e4264ae2e241847d9d560f05622","unresolved":false,"context_lines":[{"line_number":1519,"context_line":""},{"line_number":1520,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":1521,"context_line":"    @mock.patch(\u0027cinder.volume.api.API.create\u0027)"},{"line_number":1522,"context_line":"    def test_restore_backup_volume_unspecified_with_type_exist("},{"line_number":1523,"context_line":"            self, _mock_volume_api_create, _mock_service_get_all):"},{"line_number":1524,"context_line":"        # intercept volume creation to ensure created volume"},{"line_number":1525,"context_line":"        # has status of available"}],"source_content_type":"text/x-python","patch_set":6,"id":"9f560f44_9ebfd9a8","line":1522,"in_reply_to":"9f560f44_fef7078a","updated":"2020-08-06 11:37:07.000000000","message":"Thank you so much,it\u0027s really a good idea to me!\nActually, I had wondered if I needed to write two test cases   that feel repetitive.","commit_id":"6582badf077e93deeaa1c995ff662ee79f8975d9"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f46645758954207da3ebbf94f303c3e327340a67","unresolved":false,"context_lines":[{"line_number":1527,"context_line":"        # has status of available"},{"line_number":1528,"context_line":"        def fake_volume_api_create(context, size, name, description,"},{"line_number":1529,"context_line":"                                   volume_type):"},{"line_number":1530,"context_line":"            if volume_type:"},{"line_number":1531,"context_line":"                volume_id \u003d utils.create_volume("},{"line_number":1532,"context_line":"                    self.context, size\u003dsize, volume_type_id\u003dvolume_type.id).id"},{"line_number":1533,"context_line":"            else:"},{"line_number":1534,"context_line":"                volume_id \u003d utils.create_volume(self.context, size\u003dsize).id"},{"line_number":1535,"context_line":"            return db.volume_get(context, volume_id)"},{"line_number":1536,"context_line":""},{"line_number":1537,"context_line":"        _mock_service_get_all.return_value \u003d ["}],"source_content_type":"text/x-python","patch_set":8,"id":"9f560f44_da581dfb","line":1534,"range":{"start_line":1530,"start_character":0,"end_line":1534,"end_character":75},"updated":"2020-08-07 21:15:31.000000000","message":"This is another situation where I don\u0027t think you need two calls to create_volume(). This should work even if volume_type_id is None.\n\n            volume_type_id \u003d volume_type.id if volume_type else None\n            volume_id \u003d utils.create_volume(\n                self.context, size\u003dsize, volume_type_id\u003dvolume_type_id).id","commit_id":"c394422075010231081155cea82208ce2911d841"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"ed878d43e792caa64c1a19eb191ac90269ac55a7","unresolved":false,"context_lines":[{"line_number":1527,"context_line":"        # has status of available"},{"line_number":1528,"context_line":"        def fake_volume_api_create(context, size, name, description,"},{"line_number":1529,"context_line":"                                   volume_type):"},{"line_number":1530,"context_line":"            if volume_type:"},{"line_number":1531,"context_line":"                volume_id \u003d utils.create_volume("},{"line_number":1532,"context_line":"                    self.context, size\u003dsize, volume_type_id\u003dvolume_type.id).id"},{"line_number":1533,"context_line":"            else:"},{"line_number":1534,"context_line":"                volume_id \u003d utils.create_volume(self.context, size\u003dsize).id"},{"line_number":1535,"context_line":"            return db.volume_get(context, volume_id)"},{"line_number":1536,"context_line":""},{"line_number":1537,"context_line":"        _mock_service_get_all.return_value \u003d ["}],"source_content_type":"text/x-python","patch_set":8,"id":"9f560f44_d447511c","line":1534,"range":{"start_line":1530,"start_character":0,"end_line":1534,"end_character":75},"in_reply_to":"9f560f44_da581dfb","updated":"2020-08-08 04:22:36.000000000","message":"Done","commit_id":"c394422075010231081155cea82208ce2911d841"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f46645758954207da3ebbf94f303c3e327340a67","unresolved":false,"context_lines":[{"line_number":1541,"context_line":"        _mock_volume_api_create.side_effect \u003d fake_volume_api_create"},{"line_number":1542,"context_line":""},{"line_number":1543,"context_line":"        if with_volume_type:"},{"line_number":1544,"context_line":"            volume_type_id \u003d utils.create_volume_type(self.context,"},{"line_number":1545,"context_line":"                                                      self, name\u003d\u0027type01\u0027).id"},{"line_number":1546,"context_line":"            backup \u003d utils.create_backup(self.context, size\u003d5,"},{"line_number":1547,"context_line":"                                         status\u003dfields.BackupStatus.AVAILABLE,"},{"line_number":1548,"context_line":"                                         availability_zone\u003d\u0027az1\u0027,"},{"line_number":1549,"context_line":"                                         host\u003d\u0027testhost\u0027,"},{"line_number":1550,"context_line":"                                         volume_type_id\u003dvolume_type_id)"},{"line_number":1551,"context_line":"        else:"},{"line_number":1552,"context_line":"            backup \u003d utils.create_backup(self.context, size\u003d5,"},{"line_number":1553,"context_line":"                                         status\u003dfields.BackupStatus.AVAILABLE,"},{"line_number":1554,"context_line":"                                         availability_zone\u003d\u0027az1\u0027,"},{"line_number":1555,"context_line":"                                         host\u003d\u0027testhost\u0027)"},{"line_number":1556,"context_line":""},{"line_number":1557,"context_line":"        body \u003d {\"restore\": {}}"},{"line_number":1558,"context_line":"        req \u003d webob.Request.blank(\u0027/v2/%s/backups/%s/restore\u0027 % ("}],"source_content_type":"text/x-python","patch_set":8,"id":"9f560f44_5a01adae","line":1555,"range":{"start_line":1544,"start_character":0,"end_line":1555,"end_character":57},"updated":"2020-08-07 21:15:31.000000000","message":"Same here, you don\u0027t need two calls to create_backup(). This also works when volume_type_id is None.\n\n        if with_volume_type:\n            volume_type_id \u003d utils.create_volume_type(self.context,\n                                                      testcase_instance\u003dself,\n                                                      name\u003d\u0027type01\u0027).id\n        else:\n            volume_type_id \u003d None\n\n        backup \u003d utils.create_backup(self.context, size\u003d5,\n                                     testcase_instance\u003dself,\n                                     status\u003dfields.BackupStatus.AVAILABLE,\n                                     availability_zone\u003d\u0027az1\u0027,\n                                     host\u003d\u0027testhost\u0027,\n                                     volume_type_id\u003dvolume_type_id)\n\nAlso note it includes the \"testcase_instance\u003dself\" keyword, which I think helps people reading the code. Otherwise, the \"self\" argument on L1545 looks mysterious.","commit_id":"c394422075010231081155cea82208ce2911d841"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"ed878d43e792caa64c1a19eb191ac90269ac55a7","unresolved":false,"context_lines":[{"line_number":1541,"context_line":"        _mock_volume_api_create.side_effect \u003d fake_volume_api_create"},{"line_number":1542,"context_line":""},{"line_number":1543,"context_line":"        if with_volume_type:"},{"line_number":1544,"context_line":"            volume_type_id \u003d utils.create_volume_type(self.context,"},{"line_number":1545,"context_line":"                                                      self, name\u003d\u0027type01\u0027).id"},{"line_number":1546,"context_line":"            backup \u003d utils.create_backup(self.context, size\u003d5,"},{"line_number":1547,"context_line":"                                         status\u003dfields.BackupStatus.AVAILABLE,"},{"line_number":1548,"context_line":"                                         availability_zone\u003d\u0027az1\u0027,"},{"line_number":1549,"context_line":"                                         host\u003d\u0027testhost\u0027,"},{"line_number":1550,"context_line":"                                         volume_type_id\u003dvolume_type_id)"},{"line_number":1551,"context_line":"        else:"},{"line_number":1552,"context_line":"            backup \u003d utils.create_backup(self.context, size\u003d5,"},{"line_number":1553,"context_line":"                                         status\u003dfields.BackupStatus.AVAILABLE,"},{"line_number":1554,"context_line":"                                         availability_zone\u003d\u0027az1\u0027,"},{"line_number":1555,"context_line":"                                         host\u003d\u0027testhost\u0027)"},{"line_number":1556,"context_line":""},{"line_number":1557,"context_line":"        body \u003d {\"restore\": {}}"},{"line_number":1558,"context_line":"        req \u003d webob.Request.blank(\u0027/v2/%s/backups/%s/restore\u0027 % ("}],"source_content_type":"text/x-python","patch_set":8,"id":"9f560f44_34532de4","line":1555,"range":{"start_line":1544,"start_character":0,"end_line":1555,"end_character":57},"in_reply_to":"9f560f44_5a01adae","updated":"2020-08-08 04:22:36.000000000","message":"Done","commit_id":"c394422075010231081155cea82208ce2911d841"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f46645758954207da3ebbf94f303c3e327340a67","unresolved":false,"context_lines":[{"line_number":1570,"context_line":"        self.assertEqual(backup.id, res_dict[\u0027restore\u0027][\u0027backup_id\u0027])"},{"line_number":1571,"context_line":"        if with_volume_type:"},{"line_number":1572,"context_line":"            self.assertEqual(backup.volume_type_id, des_volume.volume_type_id)"},{"line_number":1573,"context_line":"        db.volume_destroy(self.context, des_volume_id)"},{"line_number":1574,"context_line":"        db.backup_destroy(self.context, backup.id)"},{"line_number":1575,"context_line":""},{"line_number":1576,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":1577,"context_line":"    @mock.patch(\u0027cinder.volume.api.API.create\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"9f560f44_5a9d2d64","line":1574,"range":{"start_line":1573,"start_character":0,"end_line":1574,"end_character":50},"updated":"2020-08-07 21:15:31.000000000","message":"Yes, this is correct. You need to explicitly delete these DB entries *before* the volume_type DB entry can be deleted by the cleanup code. The volume and backup objects must be deleted first, or else the cleanup code would fail when it tries to delete the volume_type.","commit_id":"c394422075010231081155cea82208ce2911d841"}],"releasenotes/notes/prefer-to-use-self-type-while-backup-restore-7b4409034094804c.yaml":[{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"f46645758954207da3ebbf94f303c3e327340a67","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Prefer to use self volume_type_id while backup restore without"},{"line_number":5,"context_line":"    specified volume."},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - |"}],"source_content_type":"text/x-yaml","patch_set":8,"id":"9f560f44_1a79f5c6","line":5,"range":{"start_line":4,"start_character":0,"end_line":5,"end_character":21},"updated":"2020-08-07 21:15:31.000000000","message":"Maybe something like this?\n\n\"Newly created backups now include the source\u0027s volume type. When\nrestoring a backup to a new volume, the destination is created using\nthe source\u0027s volume type. For older backups that do not include the\nsource\u0027s volume type, the default type will be used.\"","commit_id":"c394422075010231081155cea82208ce2911d841"},{"author":{"_account_id":30638,"name":"Yao wang","email":"a64957782017@163.com","username":"wangyao829"},"change_message_id":"ed878d43e792caa64c1a19eb191ac90269ac55a7","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Prefer to use self volume_type_id while backup restore without"},{"line_number":5,"context_line":"    specified volume."},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - |"}],"source_content_type":"text/x-yaml","patch_set":8,"id":"9f560f44_7462c5af","line":5,"range":{"start_line":4,"start_character":0,"end_line":5,"end_character":21},"in_reply_to":"9f560f44_1a79f5c6","updated":"2020-08-08 04:22:36.000000000","message":"I\u0027m not good at English.Thanks for your help.","commit_id":"c394422075010231081155cea82208ce2911d841"}]}
