)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"eab7a2a0dcfc9ac5800dd10260dcbe8f6b6a6a80","unresolved":false,"context_lines":[{"line_number":3239,"context_line":""},{"line_number":3240,"context_line":"def _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3241,"context_line":"                        project_usages, user_usages):"},{"line_number":3242,"context_line":"    \"\"\"If overs is not empty, generates and raises an OverQuota exception."},{"line_number":3243,"context_line":""},{"line_number":3244,"context_line":"    :param project_quotas: dict of resource quotas (limits) for the project."},{"line_number":3245,"context_line":"    :param user_quotas:    dict of resource quotas (limits) for the user."}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_38a3ffb2","line":3242,"updated":"2014-09-15 22:36:00.000000000","message":"The function is named to specifically process over quotas. So, why not just assume that the overs parameter always is not empty, and have this\n\n if overs:\n\nblock only in the calling code. That way, this function does what it says (processes over quota) and the if logic is placed only in the caller...","commit_id":"888fb9b863f2d36c26cd4aaeb2b92f7e77405d89"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6ad1bfd7c597a6eebe463a31bb541061644b8dbe","unresolved":false,"context_lines":[{"line_number":3239,"context_line":""},{"line_number":3240,"context_line":"def _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3241,"context_line":"                        project_usages, user_usages):"},{"line_number":3242,"context_line":"    \"\"\"If overs is not empty, generates and raises an OverQuota exception."},{"line_number":3243,"context_line":""},{"line_number":3244,"context_line":"    :param project_quotas: dict of resource quotas (limits) for the project."},{"line_number":3245,"context_line":"    :param user_quotas:    dict of resource quotas (limits) for the user."}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_019a346e","line":3242,"in_reply_to":"fa98f980_38a3ffb2","updated":"2014-09-16 13:22:03.000000000","message":"That\u0027s originally what I was going to do so I\u0027m fine with changing it.","commit_id":"888fb9b863f2d36c26cd4aaeb2b92f7e77405d89"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"eab7a2a0dcfc9ac5800dd10260dcbe8f6b6a6a80","unresolved":false,"context_lines":[{"line_number":3398,"context_line":"        LOG.warning(_(\"Change will make usage less than 0 for the following \""},{"line_number":3399,"context_line":"                      \"resources: %s\"), unders)"},{"line_number":3400,"context_line":""},{"line_number":3401,"context_line":"    _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3402,"context_line":"                        project_usages, user_usages)"},{"line_number":3403,"context_line":""},{"line_number":3404,"context_line":"    return reservations"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_78a9078f","line":3401,"updated":"2014-09-15 22:36:00.000000000","message":"To continue from above, having the\n\n if overs:\n\nblock remain here will make the:\n\n if unders:\n\nblock above make more sense and look more reasonaby placed than inside the _process_over_quotas() function, IMO.","commit_id":"888fb9b863f2d36c26cd4aaeb2b92f7e77405d89"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6ad1bfd7c597a6eebe463a31bb541061644b8dbe","unresolved":false,"context_lines":[{"line_number":3398,"context_line":"        LOG.warning(_(\"Change will make usage less than 0 for the following \""},{"line_number":3399,"context_line":"                      \"resources: %s\"), unders)"},{"line_number":3400,"context_line":""},{"line_number":3401,"context_line":"    _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3402,"context_line":"                        project_usages, user_usages)"},{"line_number":3403,"context_line":""},{"line_number":3404,"context_line":"    return reservations"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_81854409","line":3401,"in_reply_to":"fa98f980_78a9078f","updated":"2014-09-16 13:22:03.000000000","message":"Agreed.","commit_id":"888fb9b863f2d36c26cd4aaeb2b92f7e77405d89"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"8b79d7b5a2428f0b1dee59be7df17acb37517ea3","unresolved":false,"context_lines":[{"line_number":3244,"context_line":""},{"line_number":3245,"context_line":""},{"line_number":3246,"context_line":"def _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3247,"context_line":"                        project_usages, user_usages):"},{"line_number":3248,"context_line":"    \"\"\"Generates and raises an OverQuota exception."},{"line_number":3249,"context_line":""},{"line_number":3250,"context_line":"    :param project_quotas: dict of resource quotas (limits) for the project."}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_f248f95d","line":3247,"updated":"2014-10-06 18:40:17.000000000","message":"nit: might be better to name this method _construct_overquota_exception(). Alternately, change exception.OverQuota\u0027s constructor to do the work this function is doing, and instead of supplying headroom and usages to the OverQuotas constructor, instead just supply the parameters from this function and do the headroom calculation in the exception object\u0027s constructor.","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a5b8260b54498eba42ca2bc6d1894dc0dd81b4c0","unresolved":false,"context_lines":[{"line_number":3244,"context_line":""},{"line_number":3245,"context_line":""},{"line_number":3246,"context_line":"def _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3247,"context_line":"                        project_usages, user_usages):"},{"line_number":3248,"context_line":"    \"\"\"Generates and raises an OverQuota exception."},{"line_number":3249,"context_line":""},{"line_number":3250,"context_line":"    :param project_quotas: dict of resource quotas (limits) for the project."}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_122add8f","line":3247,"in_reply_to":"baa201ad_5289c573","updated":"2014-10-06 19:17:12.000000000","message":"Yeah, I originally did all the computations in here because I was concerned about races, and this was really the only place where I could reasonably hold a lock that I could see at the time.  If I were designing this today, I might see if I could use a technique similar to the one I used for Turnstile, where I atomically append an access to a list of accesses, then load all the data up to the access I added; then I don\u0027t have to hold a lock at all.  Not sure how or if that could realistically be done with a SQL database (Turnstile uses Redis) without a ginormous number of rows, but maybe Jay has some thoughts.  Something for the quota library they\u0027re calling for, maybe?  :)","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ab30dca2a90dfb7c8172ed9cf53d2c624b114c3","unresolved":false,"context_lines":[{"line_number":3244,"context_line":""},{"line_number":3245,"context_line":""},{"line_number":3246,"context_line":"def _process_over_quota(project_quotas, user_quotas, deltas, overs,"},{"line_number":3247,"context_line":"                        project_usages, user_usages):"},{"line_number":3248,"context_line":"    \"\"\"Generates and raises an OverQuota exception."},{"line_number":3249,"context_line":""},{"line_number":3250,"context_line":"    :param project_quotas: dict of resource quotas (limits) for the project."}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_5289c573","line":3247,"in_reply_to":"baa201ad_f248f95d","updated":"2014-10-06 18:43:30.000000000","message":"I\u0027m OK with renaming the method to make it more clear.\n\nAs for moving this into the OverQuota exception constructor, I\u0027d prefer to leave that to another change.\n\nWhen I was talking about this code with comstud we were both agreeing that it\u0027s pretty ugly that all of this calculation is done in here anyway and maybe it should be moved out to the compute API or some other location, so that\u0027s more work than I was planning on doing here.","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":1849,"name":"Joe Gordon","email":"joe.gordon0@gmail.com","username":"jogo"},"change_message_id":"685cb723803f3fd6d4143266e61af34ea278393a","unresolved":false,"context_lines":[{"line_number":3286,"context_line":"            headroom[\u0027ram\u0027] \u003d hr / deltas[\u0027instances\u0027]"},{"line_number":3287,"context_line":"        else:"},{"line_number":3288,"context_line":"            headroom[\u0027ram\u0027] \u003d headroom[\u0027instances\u0027]"},{"line_number":3289,"context_line":"    raise exception.OverQuota(overs\u003dsorted(overs), quotas\u003duser_quotas,"},{"line_number":3290,"context_line":"                              usages\u003dusages, headroom\u003dheadroom)"},{"line_number":3291,"context_line":""},{"line_number":3292,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_df004404","line":3289,"updated":"2014-10-07 17:04:53.000000000","message":"we should be able to figure out from the exception which quota went over (user or project)","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4230474e0fe0b3fa2797192bb56fb13c93ca76e1","unresolved":false,"context_lines":[{"line_number":3286,"context_line":"            headroom[\u0027ram\u0027] \u003d hr / deltas[\u0027instances\u0027]"},{"line_number":3287,"context_line":"        else:"},{"line_number":3288,"context_line":"            headroom[\u0027ram\u0027] \u003d headroom[\u0027instances\u0027]"},{"line_number":3289,"context_line":"    raise exception.OverQuota(overs\u003dsorted(overs), quotas\u003duser_quotas,"},{"line_number":3290,"context_line":"                              usages\u003dusages, headroom\u003dheadroom)"},{"line_number":3291,"context_line":""},{"line_number":3292,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_e2b80f13","line":3289,"in_reply_to":"baa201ad_df004404","updated":"2014-10-07 17:23:41.000000000","message":"Yeah I think this code is biased to instance resource information because it\u0027s really only used in the compute API when an instance create fails:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/compute/api.py?id\u003d2014.2.rc1#n366\n\nSo headroom on line 3270 is using user_quotas but the resource in question might be in PER_PROJECT_QUOTAS, of which fixed_ips is  one, so headroom/usages should probably be calculated on a per-resource basis and whether or not they are in PER_PROJECT_QUOTAS.","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":1849,"name":"Joe Gordon","email":"joe.gordon0@gmail.com","username":"jogo"},"change_message_id":"685cb723803f3fd6d4143266e61af34ea278393a","unresolved":false,"context_lines":[{"line_number":3359,"context_line":"        for key, value in user_usages.items():"},{"line_number":3360,"context_line":"            if key not in project_usages:"},{"line_number":3361,"context_line":"                project_usages[key] \u003d value"},{"line_number":3362,"context_line":"        overs \u003d [res for res, delta in deltas.items()"},{"line_number":3363,"context_line":"                 if user_quotas[res] \u003e\u003d 0 and delta \u003e\u003d 0 and"},{"line_number":3364,"context_line":"                 (project_quotas[res] \u003c delta +"},{"line_number":3365,"context_line":"                  project_usages[res][\u0027total\u0027] or"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_df29249c","line":3362,"updated":"2014-10-07 17:04:53.000000000","message":"does this mean a unlimited user quota overrides a limited project quota?","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4230474e0fe0b3fa2797192bb56fb13c93ca76e1","unresolved":false,"context_lines":[{"line_number":3359,"context_line":"        for key, value in user_usages.items():"},{"line_number":3360,"context_line":"            if key not in project_usages:"},{"line_number":3361,"context_line":"                project_usages[key] \u003d value"},{"line_number":3362,"context_line":"        overs \u003d [res for res, delta in deltas.items()"},{"line_number":3363,"context_line":"                 if user_quotas[res] \u003e\u003d 0 and delta \u003e\u003d 0 and"},{"line_number":3364,"context_line":"                 (project_quotas[res] \u003c delta +"},{"line_number":3365,"context_line":"                  project_usages[res][\u0027total\u0027] or"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_e2148fea","line":3362,"in_reply_to":"baa201ad_df29249c","updated":"2014-10-07 17:23:41.000000000","message":"So deltas is the set of resources that are changing, e.g. fixed_ips.  On line 3350 it\u0027s using deltas to see if we are going to go under-quota (less than 0), it\u0027s not clear to me how that works with project quotas and user quotas, especially with a per-project quota resource like fixed_ips.","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":1849,"name":"Joe Gordon","email":"joe.gordon0@gmail.com","username":"jogo"},"change_message_id":"685cb723803f3fd6d4143266e61af34ea278393a","unresolved":false,"context_lines":[{"line_number":3362,"context_line":"        overs \u003d [res for res, delta in deltas.items()"},{"line_number":3363,"context_line":"                 if user_quotas[res] \u003e\u003d 0 and delta \u003e\u003d 0 and"},{"line_number":3364,"context_line":"                 (project_quotas[res] \u003c delta +"},{"line_number":3365,"context_line":"                  project_usages[res][\u0027total\u0027] or"},{"line_number":3366,"context_line":"                  user_quotas[res] \u003c delta +"},{"line_number":3367,"context_line":"                  user_usages[res].total)]"},{"line_number":3368,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_3f123062","line":3365,"updated":"2014-10-07 17:04:53.000000000","message":"overs doesn\u0027t say which quota is over. Also not sure how this would handle unlimited project quotas","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4230474e0fe0b3fa2797192bb56fb13c93ca76e1","unresolved":false,"context_lines":[{"line_number":3362,"context_line":"        overs \u003d [res for res, delta in deltas.items()"},{"line_number":3363,"context_line":"                 if user_quotas[res] \u003e\u003d 0 and delta \u003e\u003d 0 and"},{"line_number":3364,"context_line":"                 (project_quotas[res] \u003c delta +"},{"line_number":3365,"context_line":"                  project_usages[res][\u0027total\u0027] or"},{"line_number":3366,"context_line":"                  user_quotas[res] \u003c delta +"},{"line_number":3367,"context_line":"                  user_usages[res].total)]"},{"line_number":3368,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_02bef3d4","line":3365,"in_reply_to":"baa201ad_3f123062","updated":"2014-10-07 17:23:41.000000000","message":"Well overs is the list of resources that are going over-quota due to the request.  And then in the \"if overs\" block below it\u0027s trying to figure out the details on a per-resource basis for the OverQuota exception, but I think that\u0027s probably wrong because it\u0027s treating all resources as having user quotas when some aren\u0027t, the ones in the PER_PROJECT_QUOTAS list, which is all the nova-network stuff:\n\nPER_PROJECT_QUOTAS \u003d [\u0027fixed_ips\u0027, \u0027floating_ips\u0027, \u0027networks\u0027]","commit_id":"7497aca7fe3b1c25db172bae9af829a366b09e26"}]}
