)]}'
{"nova/virt/hardware.py":[{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"1bf1dbb8790a56597628f7511bc93389f5532222","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"2MB\":"},{"line_number":819,"context_line":"            return 2048"},{"line_number":820,"context_line":"        elif request \u003d\u003d \"1GB\":"},{"line_number":821,"context_line":"            return 1024*1024"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_ed416caa","line":821,"updated":"2015-08-05 16:11:49.000000000","message":"If we\u0027re going to allow values to be specified in units other than KB, then we should do that in a general purpose way, not hard-code the 2MB and 1GB values, as this breaks if someone has hardware with eg 4MB page sizes","commit_id":"863ddaa302930a64c8465bf39483bcd4b20a5861"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"bf19924a9dac9cf79235fabbca1af76452db791e","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"2MB\":"},{"line_number":819,"context_line":"            return 2048"},{"line_number":820,"context_line":"        elif request \u003d\u003d \"1GB\":"},{"line_number":821,"context_line":"            return 1024*1024"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_0c659ab3","line":821,"in_reply_to":"1a4dcd0f_48808ef7","updated":"2015-08-06 08:48:31.000000000","message":"The spec which I wrote merely used 2MB and 1GB as *example* sizes - it was never intended that the code would /only/ support those sizes. Any code supporting MB \u0026 GB suffixes should clearly parse any value. It really isn\u0027t that hard to do it right, so I\u0027m not inclined to merge this as it is here.","commit_id":"863ddaa302930a64c8465bf39483bcd4b20a5861"},{"author":{"_account_id":13177,"name":"Emma Foley","email":"efoley@redhat.com","username":"emma-l-foley"},"change_message_id":"f23cd978166729f7c7f0c41427b3ac0694c3300f","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"2MB\":"},{"line_number":819,"context_line":"            return 2048"},{"line_number":820,"context_line":"        elif request \u003d\u003d \"1GB\":"},{"line_number":821,"context_line":"            return 1024*1024"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_48808ef7","line":821,"in_reply_to":"1a4dcd0f_ed416caa","updated":"2015-08-06 08:24:06.000000000","message":"Sean, the spec was updated for Kilo to include the 2MB and 1GB options.\n\nThis implements the options that the spec didn\u0027t. Currently, specifying arbitrary value for page size (in KB) is supported.\n\nDaniel, I agree with adding support for parsing arbitrary sizes with units (e.g. 4MB), but wouldn\u0027t this a separate fix/feature?","commit_id":"863ddaa302930a64c8465bf39483bcd4b20a5861"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"fc971be7920099fcaa12e0814d1fc0693ce0b9d5","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"2MB\":"},{"line_number":819,"context_line":"            return 2048"},{"line_number":820,"context_line":"        elif request \u003d\u003d \"1GB\":"},{"line_number":821,"context_line":"            return 1024*1024"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a4dcd0f_5cca824f","line":821,"in_reply_to":"1a4dcd0f_ed416caa","updated":"2015-08-05 22:30:24.000000000","message":"that is ture but  \"2MB\" and \"1GB\" were chosen as sentinel values in the original spec just like \"small\" \"large\" and \"any\".\n\nprovided  the above syntax is supported i don\u0027t see any reason not to make it more generic and support 4MB by parsing the suffix\n\nalso the following commit to the nova spec repo should be reverted as it is incorrect\n\nhttps://github.com/openstack/nova-specs/commit/6c02eb9b0442630173da8bf5abfa23db442d6894\n\n\nretroactively changing a spec to suit the implementation while relatively benign in this case makes me uncomfortable as it is not transparent. personally i don\u0027t think this should have been merged as it is miss leading.\n\nthe original contents of the file was correct. what should have been done in my opinion is make a copy of specs/juno/approved/virt-driver-large-pages.rst\nin specs/juno/implemented/virt-driver-large-pages.rst with the updated changes\nand a bug raised to capture the implementation defect.\n\nthat way the original spec that was peer reviewed and approved  for juno can be maintained and the deviation from the spec can be captured and amended separately. but i digress +1 to supporting units.","commit_id":"863ddaa302930a64c8465bf39483bcd4b20a5861"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"bb4c63d0eac2eaf4720ba906d04b28d63e6f6711","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"2MB\":"},{"line_number":819,"context_line":"            return 2048"},{"line_number":820,"context_line":"        elif request \u003d\u003d \"1GB\":"},{"line_number":821,"context_line":"            return 1024 * 1024"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a4dcd0f_d898a77a","line":821,"updated":"2015-08-06 21:07:22.000000000","message":"enabling full support for the MB and GB suffix is a trivial change so i don\u0027t think it warrants a separate patch. i would simply implement the support in this patch.","commit_id":"ebe3cf62a27b9bdcdc56d87f9e3fc9d276ab2b25"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"81806505552229a9b782d47436006ed083dc0d17","unresolved":false,"context_lines":[{"line_number":832,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":833,"context_line":"            return MEMPAGES_SMALL"},{"line_number":834,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":835,"context_line":"            return parse_suffix(request)"},{"line_number":836,"context_line":"        else:"},{"line_number":837,"context_line":"            try:"},{"line_number":838,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a4dcd0f_51cd2964","line":835,"updated":"2015-08-07 16:25:03.000000000","message":"Actually you don\u0027t need this parse_suffix method at all.","commit_id":"0d81e5bb2f0af87de46dcc303cf02431c389a20e"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"81806505552229a9b782d47436006ed083dc0d17","unresolved":false,"context_lines":[{"line_number":837,"context_line":"            try:"},{"line_number":838,"context_line":"                request \u003d int(request)"},{"line_number":839,"context_line":"            except ValueError:"},{"line_number":840,"context_line":"                request \u003d 0"},{"line_number":841,"context_line":""},{"line_number":842,"context_line":"        if request \u003c\u003d 0:"},{"line_number":843,"context_line":"            raise exception.MemoryPageSizeInvalid(pagesize\u003drequest)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a4dcd0f_f109d595","line":840,"updated":"2015-08-07 16:25:03.000000000","message":"This exception block can be changed to use the oslo_utils package \u0027strutils\u0027 module.\n\n  request \u003d int(math.ceil(strutil.string_to_bytes(request) / 1024))","commit_id":"0d81e5bb2f0af87de46dcc303cf02431c389a20e"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"cd953d5b66829298a73a771449b11c1a56009dab","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":819,"context_line":"            return MEMPAGES_SMALL"},{"line_number":820,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":821,"context_line":"            request \u003d int(math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_37aa9a71","line":821,"updated":"2015-08-10 09:02:05.000000000","message":"Nope, you can\u0027t simply check \"request[-1] \u003d\u003d \"B\", as the strutils code allows for various different suffixes which don\u0027t all match that.\n\nThis is why I said you should put this code in the except block below at line 825","commit_id":"f40af90bf2c622803c5b05ed9f0a60ac10fb583f"},{"author":{"_account_id":13177,"name":"Emma Foley","email":"efoley@redhat.com","username":"emma-l-foley"},"change_message_id":"58904873235fa4b39921a1c00800e3d62d3ce64b","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":819,"context_line":"            return MEMPAGES_SMALL"},{"line_number":820,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":821,"context_line":"            request \u003d int(math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_6bd83bf0","line":821,"in_reply_to":"1a4dcd0f_37aa9a71","updated":"2015-08-10 10:23:36.000000000","message":"strutils.string_to_bytes does not support unitless values, so  (for example) \"2048\" would have to be checked separately, unless you want to remove the support for specifying the size as it was before (in Bytes without a suffix).","commit_id":"f40af90bf2c622803c5b05ed9f0a60ac10fb583f"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"8b6139956f0d7b986bd0f6a92744ccf1e16b6bfc","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":819,"context_line":"            return MEMPAGES_SMALL"},{"line_number":820,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":821,"context_line":"            request \u003d int(math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_86f25e05","line":821,"in_reply_to":"1a4dcd0f_6bd83bf0","updated":"2015-08-10 10:32:07.000000000","message":"Values without any units will be dealt with just fine by the \u0027int(request)\u0027 statement. Putting this in the \u0027except ValueError\u0027 clause means you only have to handle the case where units suffix is present.","commit_id":"f40af90bf2c622803c5b05ed9f0a60ac10fb583f"},{"author":{"_account_id":13177,"name":"Emma Foley","email":"efoley@redhat.com","username":"emma-l-foley"},"change_message_id":"6294db043533deb19e95f8c5bdfa7c046873d6ee","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":819,"context_line":"            return MEMPAGES_SMALL"},{"line_number":820,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":821,"context_line":"            request \u003d int(math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_fac73262","line":821,"in_reply_to":"1a4dcd0f_86f25e05","updated":"2015-08-10 11:10:42.000000000","message":"Yes, but in this case, a second try/except block will have to be introduced, as both int(request) and str_to_bytes() throw a ValueError when an unsupported value is introduced.","commit_id":"f40af90bf2c622803c5b05ed9f0a60ac10fb583f"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"f0e38a32e18f41f18aff8a944bf86a703c9fb102","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        elif request \u003d\u003d \"small\":"},{"line_number":819,"context_line":"            return MEMPAGES_SMALL"},{"line_number":820,"context_line":"        elif request[-1] \u003d\u003d \"B\":"},{"line_number":821,"context_line":"            request \u003d int(math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":822,"context_line":"        else:"},{"line_number":823,"context_line":"            try:"},{"line_number":824,"context_line":"                request \u003d int(request)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a4dcd0f_9d9dc85b","line":821,"in_reply_to":"1a4dcd0f_fac73262","updated":"2015-08-10 11:13:49.000000000","message":"That\u0027s fine.","commit_id":"f40af90bf2c622803c5b05ed9f0a60ac10fb583f"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"ab325543f00e51e7ec584de2486bf3a442611a75","unresolved":false,"context_lines":[{"line_number":820,"context_line":"        else:"},{"line_number":821,"context_line":"            try:"},{"line_number":822,"context_line":"                request \u003d int("},{"line_number":823,"context_line":"                    math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":824,"context_line":"            except ValueError:"},{"line_number":825,"context_line":"                pass"},{"line_number":826,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a4dcd0f_e933eef4","line":823,"updated":"2015-08-10 12:31:31.000000000","message":"In complementary in you can change s/1024/units.Ki, also we should never require usage of math.ceil since page sizes are multiple of 2.","commit_id":"748c271e749d62ecd7f77bf52c205bb90be7ae92"},{"author":{"_account_id":13177,"name":"Emma Foley","email":"efoley@redhat.com","username":"emma-l-foley"},"change_message_id":"22acb2cfde09a8d569adbcb86de78279edeb95b9","unresolved":false,"context_lines":[{"line_number":820,"context_line":"        else:"},{"line_number":821,"context_line":"            try:"},{"line_number":822,"context_line":"                request \u003d int("},{"line_number":823,"context_line":"                    math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":824,"context_line":"            except ValueError:"},{"line_number":825,"context_line":"                pass"},{"line_number":826,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a4dcd0f_e4579524","line":823,"in_reply_to":"1a4dcd0f_e933eef4","updated":"2015-08-10 13:09:26.000000000","message":"I suppose that strutils.str_to_bytes(request, return_int\u003dtrue) could be used here instead, and an int would be returned, bypassing the need for the int(math.ceil(...)) calls.","commit_id":"748c271e749d62ecd7f77bf52c205bb90be7ae92"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"d9e7955665edacba5ccc97e47cafeaa89fe5d65d","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                request \u003d int("},{"line_number":823,"context_line":"                    math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":824,"context_line":"            except ValueError:"},{"line_number":825,"context_line":"                pass"},{"line_number":826,"context_line":"            try:"},{"line_number":827,"context_line":"                request \u003d int(request)"},{"line_number":828,"context_line":"            except ValueError:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a4dcd0f_8ea3504f","line":825,"updated":"2015-08-10 12:17:31.000000000","message":"I\u0027d prefer it if we tried \u0027int(request)\u0027 first, and string_to_bytes as the fallback. That way if string_to_bytes starts accepting bare integers in future we don\u0027t risk accidental change in semantics.","commit_id":"748c271e749d62ecd7f77bf52c205bb90be7ae92"},{"author":{"_account_id":13177,"name":"Emma Foley","email":"efoley@redhat.com","username":"emma-l-foley"},"change_message_id":"22acb2cfde09a8d569adbcb86de78279edeb95b9","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                request \u003d int("},{"line_number":823,"context_line":"                    math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":824,"context_line":"            except ValueError:"},{"line_number":825,"context_line":"                pass"},{"line_number":826,"context_line":"            try:"},{"line_number":827,"context_line":"                request \u003d int(request)"},{"line_number":828,"context_line":"            except ValueError:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a4dcd0f_df80208e","line":825,"in_reply_to":"1a4dcd0f_8ea3504f","updated":"2015-08-10 13:09:26.000000000","message":"In the case of an int being passed, this would pass through the int() cast, and cause a ValueError with string_to_bytes, which only accepts strings.","commit_id":"748c271e749d62ecd7f77bf52c205bb90be7ae92"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"6d0d2a11727a6ef8944c70a24fc44a85e053f3da","unresolved":false,"context_lines":[{"line_number":822,"context_line":"                request \u003d int("},{"line_number":823,"context_line":"                    math.ceil(strutils.string_to_bytes(request) / 1024))"},{"line_number":824,"context_line":"            except ValueError:"},{"line_number":825,"context_line":"                pass"},{"line_number":826,"context_line":"            try:"},{"line_number":827,"context_line":"                request \u003d int(request)"},{"line_number":828,"context_line":"            except ValueError:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a4dcd0f_f328b835","line":825,"in_reply_to":"1a4dcd0f_df80208e","updated":"2015-08-10 13:17:01.000000000","message":"I\u0027m saying do the following:\n\ntry\n   request \u003d int(request)\nexcept ValueError:\n   try:\n     request \u003d int(strutils.string_to_bytes(request))\n   except ValueError:\n     request \u003d 0","commit_id":"748c271e749d62ecd7f77bf52c205bb90be7ae92"}]}
