)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"03ff8fa38b715b6fa9f46262b4c9c4c31bc2e6e5","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Commit d275831 describes several constraints for volume types,"},{"line_number":10,"context_line":"including the following:"},{"line_number":11,"context_line":"* the name cannot be empty,"},{"line_number":12,"context_line":"* the name should be unique (i.e., cannot rename a volume type to the"},{"line_number":13,"context_line":"  name of another volume type), and"},{"line_number":14,"context_line":"* the name and description cannot both be None (i.e., NULL)."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"9a8ffd7b_2305c213","line":11,"updated":"2015-11-30 14:20:40.000000000","message":"Add a blank space and the formatting will be better :-)","commit_id":"1cbcfc14a30099caf66c4c5f8083ce4b4c2ac5ed"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"03ff8fa38b715b6fa9f46262b4c9c4c31bc2e6e5","unresolved":false,"context_lines":[{"line_number":12,"context_line":"* the name should be unique (i.e., cannot rename a volume type to the"},{"line_number":13,"context_line":"  name of another volume type), and"},{"line_number":14,"context_line":"* the name and description cannot both be None (i.e., NULL)."},{"line_number":15,"context_line":"Unfortunately, the aforementioned commit added checks at the REST API"},{"line_number":16,"context_line":"level rather so it is possible that these constraints are not being"},{"line_number":17,"context_line":"enforced for all changes to volume types."},{"line_number":18,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"9a8ffd7b_4302460d","line":15,"updated":"2015-11-30 14:20:40.000000000","message":"Ditto.","commit_id":"1cbcfc14a30099caf66c4c5f8083ce4b4c2ac5ed"}],"cinder/db/sqlalchemy/api.py":[{"author":{"_account_id":2243,"name":"John Griffith","email":"john.griffith8@gmail.com","username":"john-griffith"},"change_message_id":"597b226e6c715ed0ff650d08275a7b63083e3599","unresolved":false,"context_lines":[{"line_number":2367,"context_line":"    # name and description cannot both be None"},{"line_number":2368,"context_line":"    if (values.get(\u0027name\u0027) is None and values.get(\u0027description\u0027) is None):"},{"line_number":2369,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist\u0027)"},{"line_number":2370,"context_line":"        raise exception.InvalidVolumeType(reason\u003dmsg)"},{"line_number":2371,"context_line":""},{"line_number":2372,"context_line":""},{"line_number":2373,"context_line":"@require_admin_context"}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_c902bdb4","line":2370,"updated":"2015-09-02 03:19:26.000000000","message":"Should this be InvalidParameterValue?  The volume type isn\u0027t really the problem, but the parameters passed in to create the type no?","commit_id":"080b40fe1e10ba6f0a4be573fbdb5af77e80c2db"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"c5d4e0c0b418dabdd49817a1d676c35919a8191f","unresolved":false,"context_lines":[{"line_number":2367,"context_line":"    # name and description cannot both be None"},{"line_number":2368,"context_line":"    if (values.get(\u0027name\u0027) is None and values.get(\u0027description\u0027) is None):"},{"line_number":2369,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist\u0027)"},{"line_number":2370,"context_line":"        raise exception.InvalidVolumeType(reason\u003dmsg)"},{"line_number":2371,"context_line":""},{"line_number":2372,"context_line":""},{"line_number":2373,"context_line":"@require_admin_context"}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_76b337ea","line":2370,"in_reply_to":"da20952f_c902bdb4","updated":"2015-09-09 13:58:55.000000000","message":"Done, but moved to cinder/volume/volume_types.py:create.","commit_id":"080b40fe1e10ba6f0a4be573fbdb5af77e80c2db"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"03ff8fa38b715b6fa9f46262b4c9c4c31bc2e6e5","unresolved":false,"context_lines":[{"line_number":2388,"context_line":"    session \u003d get_session()"},{"line_number":2389,"context_line":"    with session.begin():"},{"line_number":2390,"context_line":"        try:"},{"line_number":2391,"context_line":"            if \u0027name\u0027 in values:"},{"line_number":2392,"context_line":"                _volume_type_get_by_name(context, values[\u0027name\u0027], session)"},{"line_number":2393,"context_line":"                raise exception.VolumeTypeExists(id\u003dvalues[\u0027name\u0027])"},{"line_number":2394,"context_line":"        except exception.VolumeTypeNotFoundByName:"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a8ffd7b_7e783d2c","line":2391,"updated":"2015-11-30 14:20:40.000000000","message":"What if \u0027name\u0027 not in values? The code would do nothing. I think there should at least be an exception or warning.","commit_id":"1cbcfc14a30099caf66c4c5f8083ce4b4c2ac5ed"}],"cinder/tests/unit/test_db_api.py":[{"author":{"_account_id":2861,"name":"Vincent Hou","email":"shou@us.ibm.com","username":"houshengbo"},"change_message_id":"ab22094116918cf0e3e493d8cac26c81bbe49908","unresolved":false,"context_lines":[{"line_number":1318,"context_line":"        super(DBAPIVolumeTypeTestCase, self).setUp()"},{"line_number":1319,"context_line":""},{"line_number":1320,"context_line":"    def test_volume_type_create_no_name(self):"},{"line_number":1321,"context_line":"        db.volume_type_create(self.ctxt, {\u0027description\u0027: \u0027fake-description\u0027})"},{"line_number":1322,"context_line":""},{"line_number":1323,"context_line":"    def test_volume_type_create_exists(self):"},{"line_number":1324,"context_line":"        vt \u003d db.volume_type_create(self.ctxt, {\u0027name\u0027: \u0027n1\u0027})"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_c2b49d83","line":1321,"updated":"2015-09-10 06:59:57.000000000","message":"No check after the creation?\nSince the name is empty, at least you need to check if it is empty.","commit_id":"0bb6f9979345d039491b260310ab3e88ba988d2f"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"79c1885ebc2decce2d06571b5c45a3675fb04ea2","unresolved":false,"context_lines":[{"line_number":1318,"context_line":"        super(DBAPIVolumeTypeTestCase, self).setUp()"},{"line_number":1319,"context_line":""},{"line_number":1320,"context_line":"    def test_volume_type_create_no_name(self):"},{"line_number":1321,"context_line":"        db.volume_type_create(self.ctxt, {\u0027description\u0027: \u0027fake-description\u0027})"},{"line_number":1322,"context_line":""},{"line_number":1323,"context_line":"    def test_volume_type_create_exists(self):"},{"line_number":1324,"context_line":"        vt \u003d db.volume_type_create(self.ctxt, {\u0027name\u0027: \u0027n1\u0027})"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_fa805c8d","line":1321,"in_reply_to":"da20952f_c2b49d83","updated":"2015-09-10 13:21:07.000000000","message":"Done","commit_id":"0bb6f9979345d039491b260310ab3e88ba988d2f"}],"cinder/volume/volume_types.py":[{"author":{"_account_id":2861,"name":"Vincent Hou","email":"shou@us.ibm.com","username":"houshengbo"},"change_message_id":"d059a931b11cc5f59804bb201a757093e8b228ee","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    # name cannot be empty"},{"line_number":41,"context_line":"    if name is not None and len(name.strip()) \u003d\u003d 0:"},{"line_number":42,"context_line":"        msg \u003d _(\u0027Volume type name cannot be empty\u0027)"},{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba15a1d1_3405b079","line":42,"updated":"2015-09-15 07:47:34.000000000","message":"Please add a stop in the end.","commit_id":"122d3ca194327ab6566bb8af71e3fff35c4cf72b"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"1af07d85897c72e02d66290a7aee677433ece4f4","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    # name cannot be empty"},{"line_number":41,"context_line":"    if name is not None and len(name.strip()) \u003d\u003d 0:"},{"line_number":42,"context_line":"        msg \u003d _(\u0027Volume type name cannot be empty\u0027)"},{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba15a1d1_b9fe8636","line":42,"in_reply_to":"ba15a1d1_3405b079","updated":"2015-09-15 14:34:38.000000000","message":"Done","commit_id":"122d3ca194327ab6566bb8af71e3fff35c4cf72b"},{"author":{"_account_id":2861,"name":"Vincent Hou","email":"shou@us.ibm.com","username":"houshengbo"},"change_message_id":"d059a931b11cc5f59804bb201a757093e8b228ee","unresolved":false,"context_lines":[{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"},{"line_number":46,"context_line":"    if name is None and description is None:"},{"line_number":47,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist\u0027)"},{"line_number":48,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"ba15a1d1_94d7dcec","line":47,"updated":"2015-09-15 07:47:34.000000000","message":"Please add a stop in the end.","commit_id":"122d3ca194327ab6566bb8af71e3fff35c4cf72b"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"1af07d85897c72e02d66290a7aee677433ece4f4","unresolved":false,"context_lines":[{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"},{"line_number":46,"context_line":"    if name is None and description is None:"},{"line_number":47,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist\u0027)"},{"line_number":48,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"ba15a1d1_59fdea38","line":47,"in_reply_to":"ba15a1d1_94d7dcec","updated":"2015-09-15 14:34:38.000000000","message":"Done","commit_id":"122d3ca194327ab6566bb8af71e3fff35c4cf72b"},{"author":{"_account_id":2243,"name":"John Griffith","email":"john.griffith8@gmail.com","username":"john-griffith"},"change_message_id":"95dc3fadf2522a5c3da7b941ef71de8cc513ddce","unresolved":false,"context_lines":[{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"},{"line_number":46,"context_line":"    if name is None and description is None:"},{"line_number":47,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist.\u0027)"},{"line_number":48,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":49,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa80f949_8ead8c8a","line":46,"updated":"2015-11-04 06:18:29.000000000","message":"Sorry, I\u0027m sort of confused by this.  I was good with the changes til I arrived here.  IIRC we NEVER allow name to be empty, only description is optional.  That also applies in the case of a description, one must provide a name for the type.  Unless something has changed that I\u0027m unaware of?","commit_id":"8ed0660da1c420edce5f0060a5e7607e6397ebf7"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"bf47607049b7fb64e2bb47c8f38797028301f4ee","unresolved":false,"context_lines":[{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    # name and description cannot both be None"},{"line_number":46,"context_line":"    if name is None and description is None:"},{"line_number":47,"context_line":"        msg \u003d _(\u0027Either volume type name or description must exist.\u0027)"},{"line_number":48,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":49,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"fa80f949_4809c62b","line":46,"in_reply_to":"fa80f949_8ead8c8a","updated":"2015-11-04 15:35:37.000000000","message":"That\u0027s okay -- I was confused by the current code and tried to make a best guess. I\u0027d appreciate your direction regarding how to proceed.\n\nThe current change is based on the following implementation details:\n1) there is not a non-null database constraint on the name [1];\n2) the name cannot be an empty string (i.e., \"\") [2]; and\n3) the name, description, and is_public attributes cannot all be None (i.e., NULL) [3].\nIt should also be noted that updating an existing type differs from creating a new type: the name cannot be None when creating a new type [4].\n\nBased on the comment, it sounds like the name should never be None (i.e., NULL). The existence of a description or is_public attribute makes no difference -- the name just shouldn\u0027t be None. If that\u0027s correct, I\u0027d recommend also adding an explicit non-null constraint to the database. Do you concur, or is there a compelling reason to enforce the check only at the API level instead of both here and by the database?\n\n\nReferences\n\n[1] http://git.openstack.org/cgit/openstack/cinder/tree/cinder/db/sqlalchemy/migrate_repo/versions/001_cinder_init.py#n122\n\n[2] http://git.openstack.org/cgit/openstack/cinder/tree/cinder/api/contrib/types_manage.py#n119\n\n[3] http://git.openstack.org/cgit/openstack/cinder/tree/cinder/api/contrib/types_manage.py#n123\n\n[4] http://git.openstack.org/cgit/openstack/cinder/tree/cinder/api/contrib/types_manage.py#n65","commit_id":"8ed0660da1c420edce5f0060a5e7607e6397ebf7"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"03ff8fa38b715b6fa9f46262b4c9c4c31bc2e6e5","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    # name cannot be empty"},{"line_number":41,"context_line":"    if name is None:"},{"line_number":42,"context_line":"        msg \u003d (\u0027Volume type name must exist\u0027)"},{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":"    elif len(name.strip()) \u003d\u003d 0:"},{"line_number":45,"context_line":"        msg \u003d _(\u0027Volume type name cannot be empty.\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a8ffd7b_9e3f2187","line":42,"updated":"2015-11-30 14:20:40.000000000","message":"You forget a `_` before `(`?","commit_id":"1cbcfc14a30099caf66c4c5f8083ce4b4c2ac5ed"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"03ff8fa38b715b6fa9f46262b4c9c4c31bc2e6e5","unresolved":false,"context_lines":[{"line_number":42,"context_line":"        msg \u003d (\u0027Volume type name must exist\u0027)"},{"line_number":43,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":44,"context_line":"    elif len(name.strip()) \u003d\u003d 0:"},{"line_number":45,"context_line":"        msg \u003d _(\u0027Volume type name cannot be empty.\u0027)"},{"line_number":46,"context_line":"        raise exception.InvalidParameterValue(err\u003dmsg)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9a8ffd7b_5e1f7909","line":45,"updated":"2015-11-30 14:20:40.000000000","message":"The error message will be easier for debugging if you managed to add volume type id to it.","commit_id":"1cbcfc14a30099caf66c4c5f8083ce4b4c2ac5ed"}]}
