)]}'
{"cinder/api/contrib/types_manage.py":[{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a147365bcbeacc300c50ff70ef9417be9e0e3048","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # name and description can not be both None"},{"line_number":106,"context_line":"        # if name specified, name can not be empty"},{"line_number":107,"context_line":"        if name is not None and len(name.strip()) \u003d\u003d 0:"},{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_48e90ee2","line":107,"updated":"2015-01-15 20:07:31.000000000","message":"Could be simplified to:\nif name and not len(name.strip()):\nBut I\u0027m not voting -1 for this","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"da27a2b11e2574917a0778d434d49974c5856338","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # name and description can not be both None"},{"line_number":106,"context_line":"        # if name specified, name can not be empty"},{"line_number":107,"context_line":"        if name is not None and len(name.strip()) \u003d\u003d 0:"},{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_5bfd3308","line":107,"in_reply_to":"3a961159_48e90ee2","updated":"2015-01-16 18:24:37.000000000","message":"ok","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a147365bcbeacc300c50ff70ef9417be9e0e3048","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        try:"},{"line_number":116,"context_line":"            # check it exists"},{"line_number":117,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"},{"line_number":118,"context_line":"            # no name change"},{"line_number":119,"context_line":"            if name is None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_c8b41ef3","line":116,"updated":"2015-01-15 20:07:31.000000000","message":"Please, start comments with upper-case letters","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"da27a2b11e2574917a0778d434d49974c5856338","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"        try:"},{"line_number":116,"context_line":"            # check it exists"},{"line_number":117,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"},{"line_number":118,"context_line":"            # no name change"},{"line_number":119,"context_line":"            if name is None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_9e022907","line":116,"in_reply_to":"3a961159_c8b41ef3","updated":"2015-01-16 18:24:37.000000000","message":"ok","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a147365bcbeacc300c50ff70ef9417be9e0e3048","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            # check it exists"},{"line_number":117,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"},{"line_number":118,"context_line":"            # no name change"},{"line_number":119,"context_line":"            if name is None:"},{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # no description change"},{"line_number":122,"context_line":"            if description is None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_c8825efe","line":119,"updated":"2015-01-15 20:07:31.000000000","message":"Could be changed to:\nname \u003d name or vol_type.get(\u0027name\u0027)","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"da27a2b11e2574917a0778d434d49974c5856338","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            # check it exists"},{"line_number":117,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"},{"line_number":118,"context_line":"            # no name change"},{"line_number":119,"context_line":"            if name is None:"},{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # no description change"},{"line_number":122,"context_line":"            if description is None:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_5e2b617b","line":119,"in_reply_to":"3a961159_c8825efe","updated":"2015-01-16 18:24:37.000000000","message":"I think I leave the way it is for readability","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"a147365bcbeacc300c50ff70ef9417be9e0e3048","unresolved":false,"context_lines":[{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # no description change"},{"line_number":122,"context_line":"            if description is None:"},{"line_number":123,"context_line":"                description \u003d vol_type.get(\u0027description\u0027)"},{"line_number":124,"context_line":"            volume_types.update(context, id, name, description)"},{"line_number":125,"context_line":"            # get the updated"},{"line_number":126,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_28712245","line":123,"updated":"2015-01-15 20:07:31.000000000","message":"Same comment here","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"da27a2b11e2574917a0778d434d49974c5856338","unresolved":false,"context_lines":[{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # no description change"},{"line_number":122,"context_line":"            if description is None:"},{"line_number":123,"context_line":"                description \u003d vol_type.get(\u0027description\u0027)"},{"line_number":124,"context_line":"            volume_types.update(context, id, name, description)"},{"line_number":125,"context_line":"            # get the updated"},{"line_number":126,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_7e4d7d71","line":123,"in_reply_to":"3a961159_28712245","updated":"2015-01-16 18:24:37.000000000","message":"same","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        vol_type \u003d body[\u0027volume_type\u0027]"},{"line_number":102,"context_line":"        description \u003d vol_type.get(\u0027description\u0027, None)"},{"line_number":103,"context_line":"        name \u003d vol_type.get(\u0027name\u0027, None)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # Name and description can not be both None."},{"line_number":106,"context_line":"        # If name specified, name can not be empty."}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_a8fbdd46","line":103,"updated":"2015-01-20 17:23:50.000000000","message":"None is the default and so not required.","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        vol_type \u003d body[\u0027volume_type\u0027]"},{"line_number":102,"context_line":"        description \u003d vol_type.get(\u0027description\u0027, None)"},{"line_number":103,"context_line":"        name \u003d vol_type.get(\u0027name\u0027, None)"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # Name and description can not be both None."},{"line_number":106,"context_line":"        # If name specified, name can not be empty."}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_f7540bcc","line":103,"in_reply_to":"3a961159_a8fbdd46","updated":"2015-01-21 02:52:45.000000000","message":"ok","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # Name and description can not be both None."},{"line_number":106,"context_line":"        # If name specified, name can not be empty."},{"line_number":107,"context_line":"        if name and len(name.strip()) \u003d\u003d 0:"},{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_e8dec5d9","line":107,"updated":"2015-01-20 17:23:50.000000000","message":"This can also be written as:\n\nif name and not name.strip():","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"        # Name and description can not be both None."},{"line_number":106,"context_line":"        # If name specified, name can not be empty."},{"line_number":107,"context_line":"        if name and len(name.strip()) \u003d\u003d 0:"},{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_975d87ec","line":107,"in_reply_to":"3a961159_e8dec5d9","updated":"2015-01-21 02:52:45.000000000","message":"I will leave as it is for readability","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"        if name is None and description is None:"},{"line_number":112,"context_line":"            msg \u003d _(\"Specify either volume type name and/or description.\")"},{"line_number":113,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":114,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_378024bf","line":111,"updated":"2015-01-20 17:23:50.000000000","message":"This can also be written as:\n\nif name is description is None:","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            msg \u003d _(\"Volume type name can not be empty.\")"},{"line_number":109,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"        if name is None and description is None:"},{"line_number":112,"context_line":"            msg \u003d _(\"Specify either volume type name and/or description.\")"},{"line_number":113,"context_line":"            raise webob.exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":114,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_d76e2f96","line":111,"in_reply_to":"3a961159_378024bf","updated":"2015-01-21 02:52:45.000000000","message":"I will leave it as it is for readability","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # No description change"},{"line_number":122,"context_line":"            if description is None:"},{"line_number":123,"context_line":"                description \u003d vol_type.get(\u0027description\u0027)"},{"line_number":124,"context_line":"            volume_types.update(context, id, name, description)"},{"line_number":125,"context_line":"            # Get the updated"},{"line_number":126,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_d7a36041","line":123,"updated":"2015-01-20 17:23:50.000000000","message":"Is there a race here? If another request updates the name/description, between the above get_volume_type and the following update, and that attribute wasn\u0027t explicitly being updated by the user in this request it will be changed back.","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":120,"context_line":"                name \u003d vol_type.get(\u0027name\u0027)"},{"line_number":121,"context_line":"            # No description change"},{"line_number":122,"context_line":"            if description is None:"},{"line_number":123,"context_line":"                description \u003d vol_type.get(\u0027description\u0027)"},{"line_number":124,"context_line":"            volume_types.update(context, id, name, description)"},{"line_number":125,"context_line":"            # Get the updated"},{"line_number":126,"context_line":"            vol_type \u003d volume_types.get_volume_type(context, id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_3705b3c2","line":123,"in_reply_to":"3a961159_d7a36041","updated":"2015-01-21 02:52:45.000000000","message":"changing volume type is not frequently used function, it is possible to have race condition, but should not happen often.  I will move the block into db session to ease the concerns","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"}],"cinder/db/sqlalchemy/api.py":[{"author":{"_account_id":5997,"name":"Walt","display_name":"Hemna","email":"waboring@hemna.com","username":"walter-boring","status":"SAP"},"change_message_id":"3d0b33311bd0edfb2fb01616ee025753ab85fce7","unresolved":false,"context_lines":[{"line_number":1946,"context_line":"            check_vol_type \u003d \\"},{"line_number":1947,"context_line":"                _volume_type_get_by_name(context,"},{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_fca9ce90","line":1949,"updated":"2014-12-11 04:33:31.000000000","message":"Do we not already have a unique constraint on the name column in the DB?   Thus avoiding this call to fetch the possible volume type and all it\u0027s extra_specs, just to test to see if we are trying to change the volume type name to one that already exists?","commit_id":"1d189a69a5308d0ea6febbcfd011b52e0b050d7a"},{"author":{"_account_id":5538,"name":"Rushi Agrawal","email":"rushi.openstack@gmail.com","username":"rushiagr"},"change_message_id":"27220d70bf33f0f66466cb6efe130a463cf94b7a","unresolved":false,"context_lines":[{"line_number":1946,"context_line":"            check_vol_type \u003d \\"},{"line_number":1947,"context_line":"                _volume_type_get_by_name(context,"},{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_21f67ff9","line":1949,"in_reply_to":"3a961159_f7c1e754","updated":"2014-12-13 09:29:29.000000000","message":"Gloria is right. I remember seeing such code (db fetch to check duplicate name) already in code base somewhere I can\u0027t remember now, but it\u0027d be good to implement a unique constraint thing too","commit_id":"1d189a69a5308d0ea6febbcfd011b52e0b050d7a"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"02dfce2ad4989b30720133f10e0f86c14585f186","unresolved":false,"context_lines":[{"line_number":1946,"context_line":"            check_vol_type \u003d \\"},{"line_number":1947,"context_line":"                _volume_type_get_by_name(context,"},{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_f7c1e754","line":1949,"in_reply_to":"3a961159_fca9ce90","updated":"2014-12-11 05:33:57.000000000","message":"we don\u0027t have unique constraint on the column. \n\nmysql\u003e desc volume_types\n    -\u003e ;\n+--------------+--------------+------+-----+---------+-------+\n| Field        | Type         | Null | Key | Default | Extra |\n+--------------+--------------+------+-----+---------+-------+\n| created_at   | datetime     | YES  |     | NULL    |       |\n| updated_at   | datetime     | YES  |     | NULL    |       |\n| deleted_at   | datetime     | YES  |     | NULL    |       |\n| deleted      | tinyint(1)   | YES  |     | NULL    |       |\n| id           | varchar(36)  | NO   | PRI | NULL    |       |\n| name         | varchar(255) | YES  |     | NULL    |       |\n| qos_specs_id | varchar(36)  | YES  | MUL | NULL    |       |\n| is_public    | tinyint(1)   | YES  |     | NULL    |       |\n| description  | varchar(255) | YES  |     | NULL    |       |\n+--------------+--------------+------+-----+---------+-------+","commit_id":"1d189a69a5308d0ea6febbcfd011b52e0b050d7a"},{"author":{"_account_id":2861,"name":"Vincent Hou","email":"shou@us.ibm.com","username":"houshengbo"},"change_message_id":"a6125c75c958609bd7f0f6efb0199d47f0aaed65","unresolved":false,"context_lines":[{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"},{"line_number":1954,"context_line":"            raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_29dd9370","line":1951,"updated":"2015-01-16 10:09:39.000000000","message":"I suggest something meaningful be raised here instead of pass.","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"72b3b501929d3474aab450eb52ac28558a87d41b","unresolved":false,"context_lines":[{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"},{"line_number":1954,"context_line":"            raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_1b200baf","line":1951,"in_reply_to":"3a961159_29dd9370","updated":"2015-01-16 18:20:10.000000000","message":"@Vincent, if it can not be found, it means the name is not there...we can proceed to update the type with that name. This is what we want.","commit_id":"84a0be52c5f7db8b8f05bf63e8269aa7d1b29dcf"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":1947,"context_line":"                _volume_type_get_by_name(context,"},{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_16288e84","line":1950,"updated":"2015-01-20 17:23:50.000000000","message":"The actual exception raised is VolumeTypeNotFoundByName - is there any reason not to catch this one instead of the one it inherits from?","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":1947,"context_line":"                _volume_type_get_by_name(context,"},{"line_number":1948,"context_line":"                                         values[\u0027name\u0027],"},{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_97eca7c9","line":1950,"in_reply_to":"3a961159_16288e84","updated":"2015-01-21 02:52:45.000000000","message":"this is just check if the volume is there. I will change it to VolumeTypeNotFoundByName","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"},{"line_number":1954,"context_line":"            raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])"},{"line_number":1955,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_0b478b7b","line":1952,"updated":"2015-01-20 17:23:50.000000000","message":"If you use try/except/else instead of a separate if block it ties the two pieces of code together and makes their relationship more obvious at a glance, e.g.:\n\nelse:\n    if check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:\n        raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":1949,"context_line":"                                         session\u003dsession)"},{"line_number":1950,"context_line":"        except exception.VolumeTypeNotFound:"},{"line_number":1951,"context_line":"            pass"},{"line_number":1952,"context_line":""},{"line_number":1953,"context_line":"        if check_vol_type and check_vol_type.get(\u0027id\u0027) !\u003d volume_type_id:"},{"line_number":1954,"context_line":"            raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])"},{"line_number":1955,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_77fe5b6d","line":1952,"in_reply_to":"3a961159_0b478b7b","updated":"2015-01-21 02:52:45.000000000","message":"ok, I will update it.","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"560fb001b100c08201bb75d309012de48ada17d6","unresolved":false,"context_lines":[{"line_number":1940,"context_line":"    session \u003d get_session()"},{"line_number":1941,"context_line":"    with session.begin():"},{"line_number":1942,"context_line":"        # Check it exists"},{"line_number":1943,"context_line":"        vol_type \u003d volume_type_get(context, volume_type_id)"},{"line_number":1944,"context_line":"        # No name change"},{"line_number":1945,"context_line":"        if values[\u0027name\u0027] is None:"},{"line_number":1946,"context_line":"            values[\u0027name\u0027] \u003d vol_type.get(\u0027name\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_0e26c216","line":1943,"updated":"2015-01-21 20:26:27.000000000","message":"I don\u0027t think this is necessary. I\u0027m pretty sure you only need to update volume_type_ref with the values that have changed. So instead of updating values that are None with what is currently in the db, remove them.","commit_id":"9973d4953821a85b40cb9b158e168531c5ae0fb1"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"6ec428fa99785ec776c2852b70e03358ad512fce","unresolved":false,"context_lines":[{"line_number":1940,"context_line":"    session \u003d get_session()"},{"line_number":1941,"context_line":"    with session.begin():"},{"line_number":1942,"context_line":"        # Check it exists"},{"line_number":1943,"context_line":"        vol_type \u003d volume_type_get(context, volume_type_id)"},{"line_number":1944,"context_line":"        # No name change"},{"line_number":1945,"context_line":"        if values[\u0027name\u0027] is None:"},{"line_number":1946,"context_line":"            values[\u0027name\u0027] \u003d vol_type.get(\u0027name\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1a930d6b_7d8d367b","line":1943,"in_reply_to":"1a930d6b_0e26c216","updated":"2015-01-21 23:23:51.000000000","message":"I still need to find out if the volume is there. I think I have it down late...yeah, I could re-arrange the code to reduce db call.","commit_id":"9973d4953821a85b40cb9b158e168531c5ae0fb1"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"4fb53b5b8692c4380155dc2bae6d46e49e09b11c","unresolved":false,"context_lines":[{"line_number":1909,"context_line":"            # a different volume_type , it should be prevented."},{"line_number":1910,"context_line":"            check_vol_type \u003d None"},{"line_number":1911,"context_line":"            try:"},{"line_number":1912,"context_line":"                check_vol_type \u003d \\"},{"line_number":1913,"context_line":"                    _volume_type_get_by_name(context,"},{"line_number":1914,"context_line":"                                             values[\u0027name\u0027],"},{"line_number":1915,"context_line":"                                             session\u003dsession)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_09274a13","line":1912,"updated":"2015-02-03 20:56:55.000000000","message":"Could we just try to update volume type and catch DBDuplicateEntry exception? It could give us single DB call instead this try-except-else cunstruction","commit_id":"1a1d189d3e8dcfe9c11d18728cc1a375be053f4d"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"8394dbe1a96c3adc4f5b05e37cc07a5cdbf7d575","unresolved":false,"context_lines":[{"line_number":1909,"context_line":"            # a different volume_type , it should be prevented."},{"line_number":1910,"context_line":"            check_vol_type \u003d None"},{"line_number":1911,"context_line":"            try:"},{"line_number":1912,"context_line":"                check_vol_type \u003d \\"},{"line_number":1913,"context_line":"                    _volume_type_get_by_name(context,"},{"line_number":1914,"context_line":"                                             values[\u0027name\u0027],"},{"line_number":1915,"context_line":"                                             session\u003dsession)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_68a8bb20","line":1912,"in_reply_to":"da86d52c_09274a13","updated":"2015-02-04 00:15:13.000000000","message":"The DBDuplicateEntry only gets thrown when the name column marked unique in the database. We have not ironed out what is the long term strategy of whether we need to enforce the name uniqueness when volume type multi-tenancy is really in place. At this point, I tend to not have unique name column in the database table which requires db change. Since currently existing creation of volume type enforces \"no duplicate names\"...I just follow the pattern for now. Hope it makes sense.","commit_id":"1a1d189d3e8dcfe9c11d18728cc1a375be053f4d"}],"cinder/tests/api/contrib/test_types_manage.py":[{"author":{"_account_id":9171,"name":"Vipin Balachandran","email":"vipin.bl@gmail.com","username":"vbala"},"change_message_id":"88b8cfd3ffea3573d2eb33b6d063524f162119a7","unresolved":false,"context_lines":[{"line_number":294,"context_line":"        self.assertRaises(webob.exc.HTTPBadRequest,"},{"line_number":295,"context_line":"                          self.controller._update, req, \u00271\u0027, body)"},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"    def test_update_empty_name(self):"},{"line_number":298,"context_line":"        body \u003d {\"volume_type\": {\"name\": \"  \","},{"line_number":299,"context_line":"                                \"description\": \"something\"}}"},{"line_number":300,"context_line":"        req \u003d fakes.HTTPRequest.blank(\u0027/v2/fake/types/1\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_e6497c33","line":297,"updated":"2015-02-16 12:28:00.000000000","message":"The above test case is also testing the same code path. Can we remove test_update_empty_spaces method?","commit_id":"4ebbe28b92a65a1c7a799e57036e56bcaaeabcc4"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"8c9d896a29a503ddcf29ab2bb2475f6122553176","unresolved":false,"context_lines":[{"line_number":294,"context_line":"        self.assertRaises(webob.exc.HTTPBadRequest,"},{"line_number":295,"context_line":"                          self.controller._update, req, \u00271\u0027, body)"},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"    def test_update_empty_name(self):"},{"line_number":298,"context_line":"        body \u003d {\"volume_type\": {\"name\": \"  \","},{"line_number":299,"context_line":"                                \"description\": \"something\"}}"},{"line_number":300,"context_line":"        req \u003d fakes.HTTPRequest.blank(\u0027/v2/fake/types/1\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_19f87b7b","line":297,"in_reply_to":"da86d52c_e6497c33","updated":"2015-02-17 19:12:18.000000000","message":"right...it seems to be the same. I will remove the empty_spaces one. Thanks.","commit_id":"4ebbe28b92a65a1c7a799e57036e56bcaaeabcc4"}],"cinder/volume/volume_types.py":[{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"2cf5b345756654c61be2aff4fbe7e5980d4764fc","unresolved":false,"context_lines":[{"line_number":67,"context_line":"        type_updated \u003d db.volume_type_update(context,"},{"line_number":68,"context_line":"                                             id,"},{"line_number":69,"context_line":"                                             dict(name\u003dname,"},{"line_number":70,"context_line":"                                                  description\u003ddescription))"},{"line_number":71,"context_line":"    except db_exc.DBError as e:"},{"line_number":72,"context_line":"        LOG.exception(_LE(\u0027DB error: %s\u0027) % six.text_type(e))"},{"line_number":73,"context_line":"        raise exception.VolumeTypeUpdateFailed(id\u003did)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_eb4ebf37","line":70,"updated":"2015-01-20 17:23:50.000000000","message":"Personally, I tend to favour the dictionary notation - it looks cleaner and I\u0027m pretty sure it\u0027s quicker.\n\n{\u0027name\u0027: name, \u0027description\u0027: description}","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"},{"author":{"_account_id":11880,"name":"Gloria Gu","email":"gloriafanggu@gmail.com","username":"gugl"},"change_message_id":"1fc8db0b0736bdbe75db3c46f604cdae914117cb","unresolved":false,"context_lines":[{"line_number":67,"context_line":"        type_updated \u003d db.volume_type_update(context,"},{"line_number":68,"context_line":"                                             id,"},{"line_number":69,"context_line":"                                             dict(name\u003dname,"},{"line_number":70,"context_line":"                                                  description\u003ddescription))"},{"line_number":71,"context_line":"    except db_exc.DBError as e:"},{"line_number":72,"context_line":"        LOG.exception(_LE(\u0027DB error: %s\u0027) % six.text_type(e))"},{"line_number":73,"context_line":"        raise exception.VolumeTypeUpdateFailed(id\u003did)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a930d6b_77d1fbcc","line":70,"in_reply_to":"3a961159_eb4ebf37","updated":"2015-01-21 02:52:45.000000000","message":"the create uses the dict...just match the pattern. Will leave the way it is.","commit_id":"d50eeeef181ac6851cd9276f0cc4a6dda7f82be8"}]}
