)]}'
{"nova/api/openstack/placement/handlers/allocation.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"1978e31b15bf4e18712bd78559e3feee4cdd666d","unresolved":false,"context_lines":[{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":90,"context_line":"        context, rp)"},{"line_number":91,"context_line":"    debug_str \u003d \"\""},{"line_number":92,"context_line":"    for usage in usage_list:"},{"line_number":93,"context_line":"        debug_str +\u003d \"%s, \" % usage"},{"line_number":94,"context_line":"    LOG.debug(\"Current Usages for %s: %s\" % (rp, debug_str))"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9a89bdaa_dab70ed6","line":93,"range":{"start_line":91,"start_character":0,"end_line":93,"end_character":35},"updated":"2016-09-07 18:59:32.000000000","message":"More efficient to write this as:\n\n    debug_str \u003d \", \".join([\"%s\" % usage for usage in usage_list])\n\nYour code also leaves a trailing \u0027, \u0027 at the end.","commit_id":"91106ddceb1f211ac31782683b90be338b8f1bc5"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"cc9cbf47be9571b416d28cd9a4e9b99deafbd10d","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":"def audit_usage(context, rp):"},{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":90,"context_line":"        context, rp)"},{"line_number":91,"context_line":"    LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a89bdaa_8c028ab2","line":89,"updated":"2016-09-08 13:28:45.000000000","message":"Long term perhaps this should guard such that it doesn\u0027t create the list if log debug  isn\u0027t enabled? Otherwise we\u0027re making the request and the associated objects but maybe not using it.","commit_id":"306434eb5862e260fc7deb9495785464e69a6996"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"cc9cbf47be9571b416d28cd9a4e9b99deafbd10d","unresolved":false,"context_lines":[{"line_number":132,"context_line":"    allocations \u003d objects.AllocationList(context, objects\u003dallocation_objects)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    try:"},{"line_number":135,"context_line":"        audit_usage(context, resource_provider_uuid)"},{"line_number":136,"context_line":"        allocations.create_all()"},{"line_number":137,"context_line":"        LOG.debug(\"Successfully wrote allocations %s\" % allocations)"},{"line_number":138,"context_line":"    # InvalidInventory is a parent for several exceptions that"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a89bdaa_4c988278","line":135,"updated":"2016-09-08 13:28:45.000000000","message":"An allocation from a consumer_id can have multiple resource providers in it: one has the vcpu, one has the shared disk. See the loop starting at line 105.\n\nSo if the goal is to get an audit of all the allocations of the resource providers you can assemble a list of those used in the allocation and call audit_usage as written multiple times.\n\nOr you can change audit_usage to use get_all_by_consumer_id to get the allocations that are associated with the current allocation.\n\nI think it\u0027s probably the former that\u0027s desired? In the sense that you want to see how things changed globally as a result of this allocaiton?","commit_id":"306434eb5862e260fc7deb9495785464e69a6996"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"b0265facfdac3e455cfdd9bb7a031eaac7c1f63b","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":"def audit_usage(context, allocations):"},{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    if logging.getLogger().isEnabledFor(logging.DEBUG):"},{"line_number":90,"context_line":"        rplist \u003d set()"},{"line_number":91,"context_line":"        for allocation in allocations:"},{"line_number":92,"context_line":"            rplist.add(allocation.resource_provider.uuid)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_8f596191","line":89,"updated":"2016-09-09 11:43:51.000000000","message":"This ensures that this code is only run if our logging level is  \u003c logging.DEBUG. You can verify this by changing the below log message to LOG.error, and setting debug \u003d False in your nova.conf.\n\nYou will then see no messages.","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"666cc8584949d2318f2b797825073aa09c815d51","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":"def audit_usage(context, allocations):"},{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    if logging.getLogger().isEnabledFor(logging.DEBUG):"},{"line_number":90,"context_line":"        rplist \u003d set()"},{"line_number":91,"context_line":"        for allocation in allocations:"},{"line_number":92,"context_line":"            rplist.add(allocation.resource_provider.uuid)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_e754d1cb","line":89,"in_reply_to":"9a89bdaa_8f596191","updated":"2016-09-09 12:54:45.000000000","message":"Yup I totally missed this.","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"d4f8a36bca2bb570fdbaf1ef3e1c52a82d76c619","unresolved":false,"context_lines":[{"line_number":87,"context_line":"def audit_usage(context, allocations):"},{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    if logging.getLogger().isEnabledFor(logging.DEBUG):"},{"line_number":90,"context_line":"        rplist \u003d set()"},{"line_number":91,"context_line":"        for allocation in allocations:"},{"line_number":92,"context_line":"            rplist.add(allocation.resource_provider.uuid)"},{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_781fb7b6","line":92,"range":{"start_line":90,"start_character":0,"end_line":92,"end_character":57},"updated":"2016-09-08 15:25:49.000000000","message":"More efficient:\n\n    rplist \u003d set([alloc.resource_provider.uuid for alloc in allocations])","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d0f1cdae46ce5b36c0b2019cde7a3de1f5fc65dd","unresolved":false,"context_lines":[{"line_number":87,"context_line":"def audit_usage(context, allocations):"},{"line_number":88,"context_line":"    \"\"\"Debug log the current usages\"\"\""},{"line_number":89,"context_line":"    if logging.getLogger().isEnabledFor(logging.DEBUG):"},{"line_number":90,"context_line":"        rplist \u003d set()"},{"line_number":91,"context_line":"        for allocation in allocations:"},{"line_number":92,"context_line":"            rplist.add(allocation.resource_provider.uuid)"},{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_6a4d19c3","line":92,"range":{"start_line":90,"start_character":0,"end_line":92,"end_character":57},"in_reply_to":"9a89bdaa_781fb7b6","updated":"2016-09-08 17:03:06.000000000","message":"Definitely more efficient, but what he\u0027s doing below is extremely heavyweight, so.. :/","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d0f1cdae46ce5b36c0b2019cde7a3de1f5fc65dd","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"},{"line_number":96,"context_line":"            LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"@webob.dec.wsgify"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_ca9aa513","line":96,"updated":"2016-09-08 17:03:06.000000000","message":"I\u0027m a little worried about how painful this is likely to be, to the point of being so heavy that nobody can turn on debug mode in a real deployment because of this loop.\n\nOne of the points of the placement usage api is to let people query this and build tools (us or them) to get this kind of audit information. I kinda think we should avoid doing things like this...","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4e4a6a901936a08d0762851bc096397c1d211002","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"},{"line_number":96,"context_line":"            LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"@webob.dec.wsgify"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_93d7ecec","line":96,"in_reply_to":"9a89bdaa_6d8a8e65","updated":"2016-09-08 21:45:29.000000000","message":"To reiterate some discussion from IRC, could we do a query to the usages API from the RT (or whatever client code) when we hit a failure and need more failure data capture? And then only do that if configured for debug or trace BEFORE doing the DB queries, e.g. we could do something like:\n\n  if CONF.trace:\n    # do query\n\nOnce https://review.openstack.org/#/c/366422/ lands, but that won\u0027t be until Ocata.\n\nWe could at least avoid doing the DB query if debug logging isn\u0027t enabled by checking CONF.debug first. I\u0027m -1 on that for sure since we won\u0027t log anything if CONF.debug is False but we\u0027ll have still done the expensive work of querying the database.\n\nWe\u0027re struggling with similar things here:\n\nhttps://review.openstack.org/#/c/366283/\n\nAlthough that one is a bit more cut and dried, we already have the data, it\u0027s just the LOG.debug calls that are slowing down the scheduler, but it\u0027s a significant slowdown at scale (~400 computes).","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"05b5856674875f10fdf30be91f5019c74fd27d48","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"},{"line_number":96,"context_line":"            LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"@webob.dec.wsgify"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_ef92ed9e","line":96,"in_reply_to":"9a89bdaa_93d7ecec","updated":"2016-09-09 11:31:28.000000000","message":"It\u0027s already behing the CONF.debug flag, logging.getLogger().isEnabledFor(logging.DEBUG) means this won\u0027t trigger unless we\u0027re at debug log level.\n\nIt\u0027s the volume of them that are impacting the current scheduler because of the filter model.\n\nWhen we started down the placement-api rush the entire point was to get it reliable enough for having something that looks like accurate usage for Newton. We currently have no inline mechanism to see if the usage is accurate. Yes, we could write another audit tool. And have people cron hit their environment every 10 minutes with it, but that is likely more heavy weight than this.\n\nAnd it means that any placement bugs in the gate are entirely non debugable. Because we\u0027ll just never have any information about what\u0027s going on. With 3 resources, maybe we don\u0027t care, but the moment these resources get complicated, and we start doing shared disk resource providers, I really think we need to be able to see the increment/decrements in real time to figure out where we loose stuff in the logic.","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"0123dcf068431ae84c209fea3d37d8cdcae030ba","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"},{"line_number":96,"context_line":"            LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"@webob.dec.wsgify"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_6d8a8e65","line":96,"in_reply_to":"9a89bdaa_ca9aa513","updated":"2016-09-08 19:01:31.000000000","message":"I think that once we\u0027re confident in the system, we can disable this, or even stick it behind trace or something. However, right now this kind of inline audit is really needed to keep an eye on what is going on. We would never have figured out the other bug without it.\n\nThis looks like it\u0027s about 10 - 15ms long query in the gate right now. And it only happens when we change the allocations. So I\u0027d like to get this in for Newton and consider downgrading it in Ocata when if it starts to be a perf issue.","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"666cc8584949d2318f2b797825073aa09c815d51","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        for rp in rplist:"},{"line_number":94,"context_line":"            usage_list \u003d objects.UsageList.get_all_by_resource_provider_uuid("},{"line_number":95,"context_line":"                context, rp)"},{"line_number":96,"context_line":"            LOG.debug(\"Current Usages for %s: %s\" % (rp, usage_list))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"@webob.dec.wsgify"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a89bdaa_a7948944","line":96,"in_reply_to":"9a89bdaa_ef92ed9e","updated":"2016-09-09 12:54:45.000000000","message":"I think I\u0027d be fine with this if we were logging at TRACE level instead of DEBUG, because enabling TRACE logging should be a known performance hit in order to get fine grained detail of what\u0027s going on.\n\nTo turn that on you\u0027ll need one of the oslo.log patches, either mine or harlowja\u0027s, but we can certainly turn one of those on in the gate if needed before they land in a released oslo.log.","commit_id":"ca0a78d92060465bda8c579621d73b6297e8756e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c6ed6069d46dde69ef42bf23ebfbf253e68166e4","unresolved":false,"context_lines":[{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    try:"},{"line_number":257,"context_line":"        allocations.create_all()"},{"line_number":258,"context_line":"        LOG.debug(\"Successfully wrote allocations %s\" % allocations)"},{"line_number":259,"context_line":"    # InvalidInventory is a parent for several exceptions that"},{"line_number":260,"context_line":"    # indicate either that Inventory is not present, or that"},{"line_number":261,"context_line":"    # capacity limits have been exceeded."}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_fd84475e","line":258,"updated":"2016-09-09 20:35:39.000000000","message":"Pass allocations as an arg so it\u0027s not formatted if you\u0027re not running debug.","commit_id":"82423f733b445639ff8dc4479f0e5b181c5e4e51"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c6ed6069d46dde69ef42bf23ebfbf253e68166e4","unresolved":false,"context_lines":[{"line_number":287,"context_line":"            \"No allocations for consumer \u0027%s\u0027\" % consumer_uuid,"},{"line_number":288,"context_line":"            json_formatter\u003dutil.json_error_formatter)"},{"line_number":289,"context_line":"    allocations.delete_all()"},{"line_number":290,"context_line":"    LOG.debug(\"Successfully deleted allocations %s\" % allocations)"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"    req.response.status \u003d 204"},{"line_number":293,"context_line":"    req.response.content_type \u003d None"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_3d7f8f67","line":290,"updated":"2016-09-09 20:35:39.000000000","message":"same here.","commit_id":"82423f733b445639ff8dc4479f0e5b181c5e4e51"}],"nova/objects/resource_provider.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"cc9cbf47be9571b416d28cd9a4e9b99deafbd10d","unresolved":false,"context_lines":[{"line_number":855,"context_line":""},{"line_number":856,"context_line":"    def __repr__(self):"},{"line_number":857,"context_line":"        strings \u003d [repr(x) for x in self.objects]"},{"line_number":858,"context_line":"        return \"AllocationList[\" + \", \".join(strings) + \"]\""},{"line_number":859,"context_line":""},{"line_number":860,"context_line":""},{"line_number":861,"context_line":"@base.NovaObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a89bdaa_aca74ea5","line":858,"updated":"2016-09-08 13:28:45.000000000","message":"nice","commit_id":"306434eb5862e260fc7deb9495785464e69a6996"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"cc9cbf47be9571b416d28cd9a4e9b99deafbd10d","unresolved":false,"context_lines":[{"line_number":919,"context_line":""},{"line_number":920,"context_line":"    def __repr__(self):"},{"line_number":921,"context_line":"        strings \u003d [repr(x) for x in self.objects]"},{"line_number":922,"context_line":"        return \"UsageList[\" + \", \".join(strings) + \"]\""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a89bdaa_ecbb16c2","line":922,"updated":"2016-09-08 13:28:45.000000000","message":"ditto","commit_id":"306434eb5862e260fc7deb9495785464e69a6996"}]}
