)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"07f2166be21224ca289ea2477ce1a1137a1b4b62","unresolved":false,"context_lines":[{"line_number":19,"context_line":"avoid resource leaking."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":22,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9a0c5dc1_b2d206ff","line":22,"updated":"2015-05-13 09:59:22.000000000","message":"I think you are fixing different issue.\nthe original bug  was for failure when launching vm when all the vf are used.\nmaybe you should open a new bug for this one.","commit_id":"44c9c53b1186091f3e9919c1b9ec25293d1d72a9"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"94546e5fee2348ec56186ac5b64e33eac11a47b9","unresolved":false,"context_lines":[{"line_number":19,"context_line":"avoid resource leaking."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":22,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7a016987_55f656d8","line":22,"in_reply_to":"9a0c5dc1_b2d206ff","updated":"2015-05-14 02:47:38.000000000","message":"Looks like different cases, but I think they have the same root cause, *the host was selected, but it can\u0027t apply the pci request of the instance.* and I had append my case in the bug comments, this patch fix both of them.\n\nNo matter configuration issue (no PciPassthroughFilter) or specified host, the process of scheduling host shouldn\u0027t been broken by a unexpected exception, and even worse it make resource leaking.","commit_id":"44c9c53b1186091f3e9919c1b9ec25293d1d72a9"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"3b476cfd3434b14d23117de10c8d32f28d8d8668","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When we specified a host to boot a instance with"},{"line_number":10,"context_line":"a pci request, all the scheduler filters would been"},{"line_number":11,"context_line":"ignored, include: PciPassthroughFilter. So if the"},{"line_number":12,"context_line":"specified host can\u0027t apply the pci request,"},{"line_number":13,"context_line":"PciDeviceRequestFailed exception would been raised"},{"line_number":14,"context_line":"from HostState.consume_from_instance, at this time"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_10d77cee","line":11,"updated":"2015-06-03 11:23:49.000000000","message":"I don\u0027t see where it\u0027s due ? you mean that if an exception occurs, it just don\u0027t recheck the filters right ?","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"95501ad503558aac1f739ca8dc20288b15854347","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When we specified a host to boot a instance with"},{"line_number":10,"context_line":"a pci request, all the scheduler filters would been"},{"line_number":11,"context_line":"ignored, include: PciPassthroughFilter. So if the"},{"line_number":12,"context_line":"specified host can\u0027t apply the pci request,"},{"line_number":13,"context_line":"PciDeviceRequestFailed exception would been raised"},{"line_number":14,"context_line":"from HostState.consume_from_instance, at this time"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_55513c35","line":11,"in_reply_to":"5afe65bd_10d77cee","updated":"2015-06-04 07:43:23.000000000","message":"Sorry, the commit message make you confused, I means that when we boot instance with force host, nova-scheduler would ignore all of the filters, then directly consume the force host, it maybe trigger a PCI exception.\n\nhttps://github.com/openstack/nova/blob/master/nova/scheduler/host_manager.py#L516-L519\n\nI will update the commit message, make it clear.\n\nThanks.","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"a4534ab68f3d6aec34ef8c0fb6ab2dc379d1b3fb","unresolved":false,"context_lines":[{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we need to set"},{"line_number":17,"context_line":"HostState.updated as None and make the resource of"},{"line_number":18,"context_line":"HostState have chance to been reverted in order to"},{"line_number":19,"context_line":"avoid resource leaking."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":22,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5afe65bd_ed7f30a9","line":19,"updated":"2015-06-04 14:39:29.000000000","message":"So this description is not exactly correct - this is only a temporary resource leak We would just not update the current in memory view of the host state which gets refreshed every minute (by default anyway).","commit_id":"2bd3782843ae830be5c8f9e305b9cfde51cf5c79"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"da7e83b6828e873f090fe27b2493806fae077490","unresolved":false,"context_lines":[{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we need to set"},{"line_number":17,"context_line":"HostState.updated as None and make the resource of"},{"line_number":18,"context_line":"HostState have chance to been reverted in order to"},{"line_number":19,"context_line":"avoid resource leaking."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":22,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"3afb71cf_fff2b86e","line":19,"in_reply_to":"5afe65bd_ed7f30a9","updated":"2015-06-05 02:44:36.000000000","message":"Actually host_manager read all the compute_nodes from DB during every scheduling request, but not all the HostStates have chance to been refreshed because of the below logic.\n\nhttps://github.com/openstack/nova/blob/master/nova/scheduler/host_manager.py#L190-L192\n\nThe updated time of HostState was reset at HostState.consume_from_instance.\n\nhttps://github.com/openstack/nova/blob/master/nova/scheduler/host_manager.py#L259\n\nSo if the exception is raised from pci_stats.apply_requests and the resource of selected_host didn\u0027t change, the HostState.updated always was greater than compute_node.updated_at.\n\nhttps://github.com/openstack/nova/blob/master/nova/compute/resource_tracker.py#L622-L623\n\nThe resource leaking happened, at the worst case, we must restart the nova-scheduler in order to release it.","commit_id":"2bd3782843ae830be5c8f9e305b9cfde51cf5c79"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"ed0150751ed714aa61ee106950aa129302f4b6cd","unresolved":false,"context_lines":[{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"},{"line_number":17,"context_line":"the resource of HostState having chance to been reverted"},{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa32b979_617762a0","line":18,"updated":"2015-06-18 11:31:43.000000000","message":"I\u0027m seriously consider to see force_hosts burn in hell, just because of the UX it has.\n\nMHO is that we should consider that if the operator forces a destination, then he knows what he does and then the scheduler should not be called. That also should be very explicit, like a --force flag, and not only because he provided a destination.\n\nIf a destination is provided, it should anyway call all the filters to verify the destination.\nI tried to draft a proposal for live-migrate and evacuate but I\u0027m also considering to propose a dependent BP for totally getting rid of force_hosts and provide the same consistent API option (force_destination) for the boot command https://review.openstack.org/#/c/179224/11/specs/liberty/approved/check-destination-on-migrations.rst,cm","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"dbaf9c07890221af293850d37bee981ea201968d","unresolved":false,"context_lines":[{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"},{"line_number":17,"context_line":"the resource of HostState having chance to been reverted"},{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa32b979_b8191824","line":18,"in_reply_to":"fa32b979_617762a0","updated":"2015-06-23 14:15:37.000000000","message":"Fair - but this can also happen due to races not only when there is a force host in the mix.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"fda6fdfc35227e918b07fe7137a71ef0754522f4","unresolved":false,"context_lines":[{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"},{"line_number":17,"context_line":"the resource of HostState having chance to been reverted"},{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"fa32b979_976e3695","line":18,"in_reply_to":"fa32b979_617762a0","updated":"2015-06-19 10:50:00.000000000","message":"IMHO, there are too many requirements for operators in nova, NUMA/PCI, etc, and the operators have right to make some mistakes, because they are human, not robot. When the operator do some not right things, like this case, I think nova should handle these gracefully, not resource leaks.\n\nI also don\u0027t like force_host, but my customers had used it and faced this issue, I hope to fix it in the upstream.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"274a7ea916895b8aabf78b496a5f543335b1b830","unresolved":false,"context_lines":[{"line_number":10,"context_line":"request some pci devices, all the scheduler filters"},{"line_number":11,"context_line":"would been ignored, include: PciPassthroughFilter."},{"line_number":12,"context_line":"So if the specified host can\u0027t apply the pci request,"},{"line_number":13,"context_line":"PciDeviceRequestFailed exception would been raised"},{"line_number":14,"context_line":"from HostState.consume_from_instance, at this time"},{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_bda86d8e","line":13,"range":{"start_line":13,"start_character":0,"end_line":13,"end_character":22},"updated":"2015-08-05 17:43:20.000000000","message":"Why aren\u0027t you catching only this then?","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":10,"context_line":"request some pci devices, all the scheduler filters"},{"line_number":11,"context_line":"would been ignored, include: PciPassthroughFilter."},{"line_number":12,"context_line":"So if the specified host can\u0027t apply the pci request,"},{"line_number":13,"context_line":"PciDeviceRequestFailed exception would been raised"},{"line_number":14,"context_line":"from HostState.consume_from_instance, at this time"},{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_2b23aa57","line":13,"in_reply_to":"1a4dcd0f_bda86d8e","updated":"2015-08-06 02:41:00.000000000","message":"please check the review history, I catch the exception in previous patchset, but other reviewers think the current patch is better.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"274a7ea916895b8aabf78b496a5f543335b1b830","unresolved":false,"context_lines":[{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"},{"line_number":17,"context_line":"the resource of HostState having chance to been reverted"},{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_3d7c5d1e","line":18,"updated":"2015-08-05 17:43:20.000000000","message":"I don\u0027t actually understand this. You\u0027re not reverting anything if it fails, right? You\u0027re just not setting the .updated field.\n\nI think this needs quite a bit more (and clearer) explanation, IMHO.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":15,"context_line":"the part of compute resource had been updated,"},{"line_number":16,"context_line":"e.g. vcpus, ram, disk and so on, we should make"},{"line_number":17,"context_line":"the resource of HostState having chance to been reverted"},{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_eb74e236","line":18,"in_reply_to":"1a4dcd0f_3d7c5d1e","updated":"2015-08-06 02:41:00.000000000","message":"Sorry, I will update the commit message to add more explanation.\n\nIf we don\u0027t set the update field, HostState will be synced with db in next scheduling, the resource is reverted at that time.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"30e62fb2a9827f50d0bbf9fd363d8ebdf45091d6","unresolved":false,"context_lines":[{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_e3189820","line":21,"updated":"2015-08-05 18:41:34.000000000","message":"You are not actually fixing the above bug in this patch.\n\nBug 1391816 is about a 500 being returned if the PciPassthroughFilter has not been enabled but a launch request with PCI information was specified.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":18,"context_line":"in order to avoid resource leaking."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I0a87088d56337bcd180606013a5473fa2ec6c608"},{"line_number":21,"context_line":"Closes-Bug: #1391816"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"1a4dcd0f_2fbc1505","line":21,"in_reply_to":"1a4dcd0f_e3189820","updated":"2015-08-06 02:41:00.000000000","message":"I had added the comments in bug 1391816 , but I think if I commit a new bug to describe the resource leaking issue, it can reduce the confusion. The two bugs have same root cause, and this patch impact bug 1391816 by the way, so I will keep it as Related-Bug in commit message.\n\nThank you.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"}],"nova/scheduler/filter_scheduler.py":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"3659c16a63c78be59d7da822a248474bb371c5f6","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            chosen_host \u003d random.choice("},{"line_number":165,"context_line":"                weighed_hosts[0:scheduler_host_subset_size])"},{"line_number":166,"context_line":"            LOG.debug(\"Selected host: %(host)s\", {\u0027host\u0027: chosen_host})"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"            try:"},{"line_number":169,"context_line":"                # Now consume the resources so the filter/weights"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a0c5dc1_6a78052c","line":166,"updated":"2015-05-13 16:22:39.000000000","message":"move this line between 172 and 173 may look better","commit_id":"44c9c53b1186091f3e9919c1b9ec25293d1d72a9"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"d007f61484b6410c87b31630a6a8d577073b152b","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            chosen_host \u003d random.choice("},{"line_number":165,"context_line":"                weighed_hosts[0:scheduler_host_subset_size])"},{"line_number":166,"context_line":"            LOG.debug(\"Selected host: %(host)s\", {\u0027host\u0027: chosen_host})"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"            try:"},{"line_number":169,"context_line":"                # Now consume the resources so the filter/weights"}],"source_content_type":"text/x-python","patch_set":2,"id":"5afe65bd_c06ebb95","line":166,"in_reply_to":"9a0c5dc1_6a78052c","updated":"2015-06-03 07:35:47.000000000","message":"Done","commit_id":"44c9c53b1186091f3e9919c1b9ec25293d1d72a9"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"3b476cfd3434b14d23117de10c8d32f28d8d8668","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                # will change for the next instance."},{"line_number":171,"context_line":"                chosen_host.obj.consume_from_instance(instance_properties)"},{"line_number":172,"context_line":"                selected_hosts.append(chosen_host)"},{"line_number":173,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":174,"context_line":"                # Set the updated time to None so that the HostState is"},{"line_number":175,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":176,"context_line":"                # the resource consumed by instance before the exception was"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_30c5d83b","line":173,"updated":"2015-06-03 11:23:49.000000000","message":"why are you not providing the exception catch just after the consume_from_instance() call since it\u0027s where it\u0027s raising ?","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"1f61350b4030d927c23ed7fb21abef01bf64fdeb","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                # will change for the next instance."},{"line_number":171,"context_line":"                chosen_host.obj.consume_from_instance(instance_properties)"},{"line_number":172,"context_line":"                selected_hosts.append(chosen_host)"},{"line_number":173,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":174,"context_line":"                # Set the updated time to None so that the HostState is"},{"line_number":175,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":176,"context_line":"                # the resource consumed by instance before the exception was"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_4924015f","line":173,"in_reply_to":"5afe65bd_150f4489","updated":"2015-06-04 09:25:21.000000000","message":"Yeah but you should put it out of the exception check ie. at the bottom","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"95501ad503558aac1f739ca8dc20288b15854347","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                # will change for the next instance."},{"line_number":171,"context_line":"                chosen_host.obj.consume_from_instance(instance_properties)"},{"line_number":172,"context_line":"                selected_hosts.append(chosen_host)"},{"line_number":173,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":174,"context_line":"                # Set the updated time to None so that the HostState is"},{"line_number":175,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":176,"context_line":"                # the resource consumed by instance before the exception was"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_150f4489","line":173,"in_reply_to":"5afe65bd_30c5d83b","updated":"2015-06-04 07:43:23.000000000","message":"The host that raise exception is not fulfill for the scheduling request, so we should not add it into \u0027selected_hosts\u0027, it\u0027s why I move the logic \u0027selected_hosts.append(chosen_host)\u0027 after consume_from_instance().","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"ae93faba118e4d49e3d6185cde7b6dac72f5ad02","unresolved":false,"context_lines":[{"line_number":170,"context_line":"                # will change for the next instance."},{"line_number":171,"context_line":"                chosen_host.obj.consume_from_instance(instance_properties)"},{"line_number":172,"context_line":"                selected_hosts.append(chosen_host)"},{"line_number":173,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":174,"context_line":"                # Set the updated time to None so that the HostState is"},{"line_number":175,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":176,"context_line":"                # the resource consumed by instance before the exception was"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_2128b999","line":173,"in_reply_to":"5afe65bd_4924015f","updated":"2015-06-04 12:07:08.000000000","message":"Thanks, I get your point, the logic will be more readable, following your suggestion.","commit_id":"f4e47dabc19a80189b979425c93c1df305768633"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"a4534ab68f3d6aec34ef8c0fb6ab2dc379d1b3fb","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":175,"context_line":"                # the resource consumed by instance before the exception was"},{"line_number":176,"context_line":"                # raised."},{"line_number":177,"context_line":"                chosen_host.obj.updated \u003d None"},{"line_number":178,"context_line":"                LOG.debug(\"Selected host: %(host)s can\u0027t apply pci request\","},{"line_number":179,"context_line":"                          {\u0027host\u0027: chosen_host})"},{"line_number":180,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5afe65bd_8333ec61","line":177,"updated":"2015-06-04 14:39:29.000000000","message":"So I really don\u0027t like that we fiddle with this outside of the HostState object itself - I\u0027d much rather see this being handled more granularly inside the consume_from_intance() method","commit_id":"2bd3782843ae830be5c8f9e305b9cfde51cf5c79"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"2cfa595764fe0ad2d816721e950f5f063372cb6e","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":175,"context_line":"                # the resource consumed by instance before the exception was"},{"line_number":176,"context_line":"                # raised."},{"line_number":177,"context_line":"                chosen_host.obj.updated \u003d None"},{"line_number":178,"context_line":"                LOG.debug(\"Selected host: %(host)s can\u0027t apply pci request\","},{"line_number":179,"context_line":"                          {\u0027host\u0027: chosen_host})"},{"line_number":180,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"5afe65bd_18264315","line":177,"in_reply_to":"5afe65bd_8333ec61","updated":"2015-06-04 16:31:25.000000000","message":"Agreed, it should be catched within consume_from_instance","commit_id":"2bd3782843ae830be5c8f9e305b9cfde51cf5c79"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"da7e83b6828e873f090fe27b2493806fae077490","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                # refreshed according to database in next schedule, and release"},{"line_number":175,"context_line":"                # the resource consumed by instance before the exception was"},{"line_number":176,"context_line":"                # raised."},{"line_number":177,"context_line":"                chosen_host.obj.updated \u003d None"},{"line_number":178,"context_line":"                LOG.debug(\"Selected host: %(host)s can\u0027t apply pci request\","},{"line_number":179,"context_line":"                          {\u0027host\u0027: chosen_host})"},{"line_number":180,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"3afb71cf_5a20baf7","line":177,"in_reply_to":"5afe65bd_8333ec61","updated":"2015-06-05 02:44:36.000000000","message":"ok, I will do some stuff in consume_from_instance().","commit_id":"2bd3782843ae830be5c8f9e305b9cfde51cf5c79"}],"nova/scheduler/host_manager.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"da0a70d4f9ed712f1edc012b172253849fbf5d84","unresolved":false,"context_lines":[{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci\""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self},"},{"line_number":297,"context_line":"                                instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa32b979_4a6315b2","line":294,"updated":"2015-06-14 14:04:32.000000000","message":"missing space at the end of the line","commit_id":"441e0879c43c67f63bc625d4d0643055d4ccdc2e"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"572ab4c4ddb839164090e58c7dc198258113eecd","unresolved":false,"context_lines":[{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci\""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self},"},{"line_number":297,"context_line":"                                instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa32b979_3875bdca","line":294,"in_reply_to":"fa32b979_4a6315b2","updated":"2015-06-15 09:21:49.000000000","message":"Done","commit_id":"441e0879c43c67f63bc625d4d0643055d4ccdc2e"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"da0a70d4f9ed712f1edc012b172253849fbf5d84","unresolved":false,"context_lines":[{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci\""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self},"},{"line_number":297,"context_line":"                                instance\u003dinstance)"},{"line_number":298,"context_line":"                    # Set the updated time to None so that the HostState is"},{"line_number":299,"context_line":"                    # refreshed according to database in next scheduling, and"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa32b979_aa72e17a","line":296,"updated":"2015-06-14 14:04:32.000000000","message":"this should be self.host and not the entire class","commit_id":"441e0879c43c67f63bc625d4d0643055d4ccdc2e"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"572ab4c4ddb839164090e58c7dc198258113eecd","unresolved":false,"context_lines":[{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci\""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self},"},{"line_number":297,"context_line":"                                instance\u003dinstance)"},{"line_number":298,"context_line":"                    # Set the updated time to None so that the HostState is"},{"line_number":299,"context_line":"                    # refreshed according to database in next scheduling, and"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa32b979_d8813191","line":296,"in_reply_to":"fa32b979_aa72e17a","updated":"2015-06-15 09:21:49.000000000","message":"Done","commit_id":"441e0879c43c67f63bc625d4d0643055d4ccdc2e"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"b8ec74ace3841c1c07123bd22313098b9c63194f","unresolved":false,"context_lines":[{"line_number":256,"context_line":"        self.vcpus_used +\u003d vcpus"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        now \u003d timeutils.utcnow()"},{"line_number":259,"context_line":"        # NOTE(sbauza): Objects are UTC tz-aware by default"},{"line_number":260,"context_line":"        self.updated \u003d now.replace(tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"        # Track number of instances on host"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_b2879e0e","line":259,"updated":"2015-06-15 13:59:39.000000000","message":"this should be the last thing we do in this method","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"b8ec74ace3841c1c07123bd22313098b9c63194f","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_b2179e50","line":293,"updated":"2015-06-15 13:59:39.000000000","message":"I am not sure we actually want to raise here because if this failed due to the race on the first retry, the instance would end up being sent to the host and failing a claim there causing a retry. Another retry might actually find the host with a device, so failing here due to raciness might not be the best thing to do.\n\nJust logging might be better.\n\nAlso see this spec: https://review.openstack.org/#/c/191226/ where I propose to fix this in a more robust way.","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"4462293e6fa2ec594448629ae4fba2d04b6caef9","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_9e227c00","line":293,"in_reply_to":"fa32b979_08d15257","updated":"2015-06-16 09:22:31.000000000","message":"Thanks.\n\nI commit a new patch set with decorator, welcome to review it.","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"c677feb46314b19f84c98be9301051c7b2a5c6f1","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_ef38b83f","line":293,"in_reply_to":"fa32b979_b2179e50","updated":"2015-06-16 08:01:08.000000000","message":"Thank you @Nikola for linking your spec, I read it, looks good to me.\n\nI think there are 2 issues we should fix.\n\n#1 race condition, like your spec description.\n\n#2 boot pci instance with force_host that can\u0027t apply the pci request and resource leaking.\n\nThis patch try to fix #2, and I think it should be ok to ignore the exception and make the instance booting failed when nova-compute resource claim.\n\nActually, I think we can catch all the exceptions raised by the consume_from_instance() in the decorator like you say in the following comments and refresh the updated time of HostState as the last thing  after consume_from_instance().","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"360e065a347bd19d58ed1b3f09811c0e076390fd","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_d54a4c83","line":293,"in_reply_to":"fa32b979_b2179e50","updated":"2015-06-15 14:10:29.000000000","message":"There only be failed on boot instance with force host. So there won\u0027t be another retry happened.","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"78d9567fd452dee961e28ffc39185af72dac4dd6","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_143f44d7","line":293,"in_reply_to":"fa32b979_d54a4c83","updated":"2015-06-15 20:40:30.000000000","message":"Not true - see linked blueprint. This has not been tested extensively upstream, but due to lack of any thread sync in the scheduler this could easily fail for concurrent request as well","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"3460a12f94ea6a46f6210fb84f83299779551412","unresolved":false,"context_lines":[{"line_number":290,"context_line":"            try:"},{"line_number":291,"context_line":"                self.pci_stats.apply_requests(pci_requests, instance_cells)"},{"line_number":292,"context_line":"            except exception.PciDeviceRequestFailed:"},{"line_number":293,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":294,"context_line":"                    LOG.warning(_LW(\"Selected host: %(host)s can\u0027t apply pci \""},{"line_number":295,"context_line":"                                    \"request for instance\"),"},{"line_number":296,"context_line":"                                {\u0027host\u0027: self.host},"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_08d15257","line":293,"in_reply_to":"fa32b979_ef38b83f","updated":"2015-06-16 08:32:44.000000000","message":"Thanks!\n\nFWIW - I\u0027d be just as happy with ignoring the exception. The decorator approach is just a nice to have (in case you are up for it), no need to do it as part of this bug fix.\n\nAlso feel free to vote on the spec, as you seem to have quite decent understanding of our scheduler issues","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"b8ec74ace3841c1c07123bd22313098b9c63194f","unresolved":false,"context_lines":[{"line_number":299,"context_line":"                    # refreshed according to database in next scheduling, and"},{"line_number":300,"context_line":"                    # release the resource consumed by instance before the"},{"line_number":301,"context_line":"                    # exception was raised."},{"line_number":302,"context_line":"                    self.updated \u003d None"},{"line_number":303,"context_line":""},{"line_number":304,"context_line":"        self.numa_topology \u003d hardware.get_host_numa_usage_from_instance("},{"line_number":305,"context_line":"                self, instance)"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa32b979_5296524d","line":302,"updated":"2015-06-15 13:59:39.000000000","message":"so while this looks correct - I\u0027d slightly prefer to do this as the last thing in this method. The real bug is that we do this before we do any updates really.\n\nActually it almost seems like a job for a decorator:\n\ntry:\n   self.consume_from_instance(instance)\nexcept:\n #log and re-raise\nelse:\n  self.updated \u003d now","commit_id":"0440583963f1a55641c9ad35ce63fa57a23248b8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"860b9b131f34005ea82b812b42034c00c030ef58","unresolved":false,"context_lines":[{"line_number":113,"context_line":""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"@utils.expects_func_args(\u0027self\u0027, \u0027instance\u0027)"},{"line_number":116,"context_line":"def reset_host_state_updated_time(function):"},{"line_number":117,"context_line":"    \"\"\"Reset updated time of HostState.\"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    @functools.wraps(function)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_f905e2c1","line":116,"updated":"2015-06-16 09:37:35.000000000","message":"I\u0027d just call this: \"set_update_time_on_success\" maybe? it really does not need to reset anything right? that\u0027s the job of update_from_compute_host method.","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"a9461b7008572881cbf6d9f10b425aca4fd1b1a9","unresolved":false,"context_lines":[{"line_number":113,"context_line":""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"@utils.expects_func_args(\u0027self\u0027, \u0027instance\u0027)"},{"line_number":116,"context_line":"def reset_host_state_updated_time(function):"},{"line_number":117,"context_line":"    \"\"\"Reset updated time of HostState.\"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    @functools.wraps(function)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_0508502b","line":116,"in_reply_to":"fa32b979_f905e2c1","updated":"2015-06-16 12:47:37.000000000","message":"Sorry, I means that just reset the updated time of HostState.\n\nLooks like the function name make some confusion, I will update it.","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"860b9b131f34005ea82b812b42034c00c030ef58","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    @functools.wraps(function)"},{"line_number":120,"context_line":"    def decorated_function(self, instance, *args, **kwargs):"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            function(self, instance, *args, **kwargs)"},{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            LOG.warning(_LW(\"Selected host: %(host)s failed to consume from\""},{"line_number":125,"context_line":"                            \"instance. Error: %(error)s\"),"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_59e3ae33","line":122,"updated":"2015-06-16 09:37:35.000000000","message":"Just for the sake of correctness we should return as well - not important for this particular case but if we ever decide to actually return a value from a function we decorate - this is a bug waiting to happen.","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"a9461b7008572881cbf6d9f10b425aca4fd1b1a9","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    @functools.wraps(function)"},{"line_number":120,"context_line":"    def decorated_function(self, instance, *args, **kwargs):"},{"line_number":121,"context_line":"        try:"},{"line_number":122,"context_line":"            function(self, instance, *args, **kwargs)"},{"line_number":123,"context_line":"        except Exception as e:"},{"line_number":124,"context_line":"            LOG.warning(_LW(\"Selected host: %(host)s failed to consume from\""},{"line_number":125,"context_line":"                            \"instance. Error: %(error)s\"),"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_5015b83d","line":122,"in_reply_to":"fa32b979_59e3ae33","updated":"2015-06-16 12:47:37.000000000","message":"Thanks, it make sense.","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"860b9b131f34005ea82b812b42034c00c030ef58","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            # refreshed according to database in next scheduling, and"},{"line_number":130,"context_line":"            # release the resource consumed by instance before the"},{"line_number":131,"context_line":"            # exception was raised."},{"line_number":132,"context_line":"            self.updated \u003d None"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            now \u003d timeutils.utcnow()"},{"line_number":135,"context_line":"            # NOTE(sbauza): Objects are UTC tz-aware by default"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_793b12d2","line":132,"updated":"2015-06-16 09:37:35.000000000","message":"is this necessary now, we failed to update it so we should just leave it as it was, right?","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"a9461b7008572881cbf6d9f10b425aca4fd1b1a9","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            # refreshed according to database in next scheduling, and"},{"line_number":130,"context_line":"            # release the resource consumed by instance before the"},{"line_number":131,"context_line":"            # exception was raised."},{"line_number":132,"context_line":"            self.updated \u003d None"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            now \u003d timeutils.utcnow()"},{"line_number":135,"context_line":"            # NOTE(sbauza): Objects are UTC tz-aware by default"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa32b979_4ba509a0","line":132,"in_reply_to":"fa32b979_793b12d2","updated":"2015-06-16 12:47:37.000000000","message":"you\u0027re right, if the exception was raised, self.updated was not changed, the HostState.updated \u003d\u003d compute.updated_at, the HostState will been refreshed in the next update_from_compute_node().\n\nThank you for reminding it :)","commit_id":"1b446785934f613f983d10d140efbbb207db0cbf"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"81d09b59472843894ca0202c67c62982b3f893ef","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"        now \u003d timeutils.utcnow()"},{"line_number":258,"context_line":"        # NOTE(sbauza): Objects are UTC tz-aware by default"},{"line_number":259,"context_line":"        self.updated \u003d now.replace(tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"        # Track number of instances on host"},{"line_number":262,"context_line":"        self.num_instances +\u003d 1"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_fe260fcd","side":"PARENT","line":259,"updated":"2015-06-16 17:35:51.000000000","message":"We could change this to self.update_in_consume_from_instance \u003d True\n\n\nSo the original idea here is, if we update here, we have a more up to date copy of the information.\n\nBut if its later rejected by the compute node, and the compute node doesn\u0027t update its state, then we start to leak resources.\n\nI think we should actually remove this line all together, so top this little optimisation that can cause resource leaks.","commit_id":"06e83e825f66ddfb9a0a5b1fcad231d6a145b978"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"9cf3e6eaecfaa18799c6cedcd191ccd1d6c46745","unresolved":false,"context_lines":[{"line_number":256,"context_line":""},{"line_number":257,"context_line":"        now \u003d timeutils.utcnow()"},{"line_number":258,"context_line":"        # NOTE(sbauza): Objects are UTC tz-aware by default"},{"line_number":259,"context_line":"        self.updated \u003d now.replace(tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"        # Track number of instances on host"},{"line_number":262,"context_line":"        self.num_instances +\u003d 1"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_52e039fa","side":"PARENT","line":259,"in_reply_to":"fa32b979_fe260fcd","updated":"2015-06-17 03:52:44.000000000","message":"In current patch, we only update the HostState time when consume_from_instance() is successful, not update it when exception is raised.\n\nSo looks like the case (scheduling succeed and booting is rejected by compute node) only happen when we deploy multiple nova-scheduler workers and race condition exist, because independent copy of host state in every worker, and I think the scheduler multiple workers is not recommended currently.\n\nIf we only have one nova-scheduler instance, the general issue of resource leaks you mentions should not happen, right?\n\nMaybe we can let this patch only fix the resource leaks issued by exception raised from consume_from_instance() and resolve the bug we face now, then think about general improvement for nova-scheduler, just my suggestion.","commit_id":"06e83e825f66ddfb9a0a5b1fcad231d6a145b978"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"81d09b59472843894ca0202c67c62982b3f893ef","unresolved":false,"context_lines":[{"line_number":215,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":216,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""},{"line_number":217,"context_line":"        if (self.updated and compute.updated_at"},{"line_number":218,"context_line":"                and self.updated \u003e compute.updated_at):"},{"line_number":219,"context_line":"            return"},{"line_number":220,"context_line":"        all_ram_mb \u003d compute.memory_mb"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_1e7413cd","line":218,"updated":"2015-06-16 17:35:51.000000000","message":"so I guess this is the root cause for the leak, along with the line you moved.\n\nI think we should just keep this check, but only update self.updated in this method, and rename that to updated_at.\n\ninstead we look for self.update_in_consume_from_instance, and we always take the latest DB state if that is true, to stop us ever leaking resources.\n\nI think that leaves us with most of the optimisations we want, but some safer behaviour around resource leaks.\n\nWe could look at the time we updated it in consume from instance, and keep the data alive for 1200 seconds before discarding it at the next DB update, or something like that, but I think thats over complicating things.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"9cf3e6eaecfaa18799c6cedcd191ccd1d6c46745","unresolved":false,"context_lines":[{"line_number":215,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":216,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""},{"line_number":217,"context_line":"        if (self.updated and compute.updated_at"},{"line_number":218,"context_line":"                and self.updated \u003e compute.updated_at):"},{"line_number":219,"context_line":"            return"},{"line_number":220,"context_line":"        all_ram_mb \u003d compute.memory_mb"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_920c81ee","line":218,"in_reply_to":"fa32b979_1e7413cd","updated":"2015-06-17 03:52:44.000000000","message":"sounds like complex and different with current mechanism, I need to think about it carefully, thank for your suggestion.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"dbaf9c07890221af293850d37bee981ea201968d","unresolved":false,"context_lines":[{"line_number":215,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":216,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""},{"line_number":217,"context_line":"        if (self.updated and compute.updated_at"},{"line_number":218,"context_line":"                and self.updated \u003e compute.updated_at):"},{"line_number":219,"context_line":"            return"},{"line_number":220,"context_line":"        all_ram_mb \u003d compute.memory_mb"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_d8665cba","line":218,"in_reply_to":"fa32b979_21f2ba06","updated":"2015-06-23 14:15:37.000000000","message":"@Sylvain - I have no idea what you mean tbh, but if you are implying that the scheduler is racy - we all know this, this will just make sure that it is refreshed from the DB as soon as there is a chance it is getting out of sync.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"ed0150751ed714aa61ee106950aa129302f4b6cd","unresolved":false,"context_lines":[{"line_number":215,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":216,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""},{"line_number":217,"context_line":"        if (self.updated and compute.updated_at"},{"line_number":218,"context_line":"                and self.updated \u003e compute.updated_at):"},{"line_number":219,"context_line":"            return"},{"line_number":220,"context_line":"        all_ram_mb \u003d compute.memory_mb"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_21f2ba06","line":218,"in_reply_to":"fa32b979_4e439442","updated":"2015-06-18 11:31:43.000000000","message":"So, I think that we have a design problem, because there is a global transaction done, and that can\u0027t be fixed by holding a status IMHO","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"680a1affe0f76f8c8e90cc31ff337880e08930b5","unresolved":false,"context_lines":[{"line_number":215,"context_line":"    def update_from_compute_node(self, compute):"},{"line_number":216,"context_line":"        \"\"\"Update information about a host from a ComputeNode object.\"\"\""},{"line_number":217,"context_line":"        if (self.updated and compute.updated_at"},{"line_number":218,"context_line":"                and self.updated \u003e compute.updated_at):"},{"line_number":219,"context_line":"            return"},{"line_number":220,"context_line":"        all_ram_mb \u003d compute.memory_mb"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_4e439442","line":218,"in_reply_to":"fa32b979_920c81ee","updated":"2015-06-17 17:07:15.000000000","message":"@John - so basically update_in_consume_from_instance would mean - \"dirty\" as in needs a refresh.\n\nThis is also a possibility but at that point we are introducing a slightly different trade off where a number of close together requests will not benefit from each other\u0027s in memory updates.\n\nI am unclear as to what would be the benefit of that over the proposed fix.\n\nIt also introduces a bit more complexity in an area that is already provably very difficult to reason about.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"81d09b59472843894ca0202c67c62982b3f893ef","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        self.free_disk_mb \u003d free_disk_mb"},{"line_number":243,"context_line":"        self.vcpus_total \u003d compute.vcpus"},{"line_number":244,"context_line":"        self.vcpus_used \u003d compute.vcpus_used"},{"line_number":245,"context_line":"        self.updated \u003d compute.updated_at"},{"line_number":246,"context_line":"        self.numa_topology \u003d compute.numa_topology"},{"line_number":247,"context_line":"        self.pci_stats \u003d pci_stats.PciDeviceStats("},{"line_number":248,"context_line":"            compute.pci_device_pools)"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_f93b89cf","line":245,"updated":"2015-06-16 17:35:51.000000000","message":"so this is still useful, to stop us updating this when the db didn\u0027t get updated.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"9cf3e6eaecfaa18799c6cedcd191ccd1d6c46745","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        self.free_disk_mb \u003d free_disk_mb"},{"line_number":243,"context_line":"        self.vcpus_total \u003d compute.vcpus"},{"line_number":244,"context_line":"        self.vcpus_used \u003d compute.vcpus_used"},{"line_number":245,"context_line":"        self.updated \u003d compute.updated_at"},{"line_number":246,"context_line":"        self.numa_topology \u003d compute.numa_topology"},{"line_number":247,"context_line":"        self.pci_stats \u003d pci_stats.PciDeviceStats("},{"line_number":248,"context_line":"            compute.pci_device_pools)"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_52011969","line":245,"in_reply_to":"fa32b979_f93b89cf","updated":"2015-06-17 03:52:44.000000000","message":"Agree.","commit_id":"d1121aeaf899c88fd0540c5da5f4f898137a259b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"274a7ea916895b8aabf78b496a5f543335b1b830","unresolved":false,"context_lines":[{"line_number":117,"context_line":"    \"\"\"Set updated time of HostState when consuming succeed.\"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    @functools.wraps(function)"},{"line_number":120,"context_line":"    def decorated_function(self, instance, *args, **kwargs):"},{"line_number":121,"context_line":"        return_value \u003d None"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            return_value \u003d function(self, instance, *args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_fd1595e4","line":120,"updated":"2015-08-05 17:43:20.000000000","message":"This is only to be applied to a single method, right? If so, please remove *args and **kwargs so that this is harder to apply to something else.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":117,"context_line":"    \"\"\"Set updated time of HostState when consuming succeed.\"\"\""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    @functools.wraps(function)"},{"line_number":120,"context_line":"    def decorated_function(self, instance, *args, **kwargs):"},{"line_number":121,"context_line":"        return_value \u003d None"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            return_value \u003d function(self, instance, *args, **kwargs)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_4bd156f9","line":120,"in_reply_to":"1a4dcd0f_fd1595e4","updated":"2015-08-06 02:41:00.000000000","message":"Done","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"274a7ea916895b8aabf78b496a5f543335b1b830","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        return_value \u003d None"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            return_value \u003d function(self, instance, *args, **kwargs)"},{"line_number":124,"context_line":"        except Exception as e:"},{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_bd0ceded","line":124,"updated":"2015-08-05 17:43:20.000000000","message":"So we catch and ignore (but log) any exceptions? Is that actually what we want? Presumably the thing you actually want here is to re-raise that and not update time in that case, is that right?","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        return_value \u003d None"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            return_value \u003d function(self, instance, *args, **kwargs)"},{"line_number":124,"context_line":"        except Exception as e:"},{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_2b572a59","line":124,"in_reply_to":"1a4dcd0f_bd0ceded","updated":"2015-08-06 02:41:00.000000000","message":"Actually, Nikola and I had discussed these in previous patchset.\n\nhttps://review.openstack.org/#/c/182165/6/nova/scheduler/host_manager.py","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"7526ba708537053b136560a89bc7482cda438ede","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."},{"line_number":128,"context_line":"            LOG.warning(_LW(\"Selected host: %(host)s failed to consume from\""},{"line_number":129,"context_line":"                            \"instance. Error: %(error)s\"),"},{"line_number":130,"context_line":"                        {\u0027host\u0027: self.host, \u0027error\u0027: e},"},{"line_number":131,"context_line":"                        instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_9219fc8a","line":128,"updated":"2015-08-05 09:55:04.000000000","message":"missing space at the end of sentence","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."},{"line_number":128,"context_line":"            LOG.warning(_LW(\"Selected host: %(host)s failed to consume from\""},{"line_number":129,"context_line":"                            \"instance. Error: %(error)s\"),"},{"line_number":130,"context_line":"                        {\u0027host\u0027: self.host, \u0027error\u0027: e},"},{"line_number":131,"context_line":"                        instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_ab06da83","line":128,"in_reply_to":"1a4dcd0f_9219fc8a","updated":"2015-08-06 02:41:00.000000000","message":"Done","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"30e62fb2a9827f50d0bbf9fd363d8ebdf45091d6","unresolved":false,"context_lines":[{"line_number":135,"context_line":"            self.updated \u003d now.replace(tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":136,"context_line":"        return return_value"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":"    return decorated_function"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"class HostState(object):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_83eaf4aa","line":138,"updated":"2015-08-05 18:41:34.000000000","message":"I actually don\u0027t see the need to use a decorator here at all. Just put the try: except: else: block in consume_from_instance() in here and the IronicHostManager.consume_from_instance() method...","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":135,"context_line":"            self.updated \u003d now.replace(tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":136,"context_line":"        return return_value"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":"    return decorated_function"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"class HostState(object):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_0f54b9fc","line":138,"in_reply_to":"1a4dcd0f_83eaf4aa","updated":"2015-08-06 02:41:00.000000000","message":"But I think using decorator make consume_from_instance() function more clean.","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"dc454a422ab56f20bf117cc345b8b8afb2c42795","unresolved":false,"context_lines":[{"line_number":121,"context_line":"        return_value \u003d None"},{"line_number":122,"context_line":"        try:"},{"line_number":123,"context_line":"            return_value \u003d function(self, instance)"},{"line_number":124,"context_line":"        except Exception as e:"},{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_8c7b05f5","line":124,"updated":"2015-08-19 21:44:39.000000000","message":"I\u0027m always having some problems with having a big catch-all exception that way, because it obfuscates why we need such exception but we can fix that in a later change.","commit_id":"26a4f430d1ec45f7b9a61b69f009a705d2d3cd52"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"5f203cc24a79ca4a81ee10d121dab29658ba4110","unresolved":false,"context_lines":[{"line_number":124,"context_line":"        except Exception as e:"},{"line_number":125,"context_line":"            # Ignores exception raised from consume_from_instance() so that"},{"line_number":126,"context_line":"            # booting instance would fail in the resource claim of compute"},{"line_number":127,"context_line":"            # node, other suitable node may be chosen during scheduling retry."},{"line_number":128,"context_line":"            LOG.warning(_LW(\"Selected host: %(host)s failed to consume from \""},{"line_number":129,"context_line":"                            \"instance. Error: %(error)s\"),"},{"line_number":130,"context_line":"                        {\u0027host\u0027: self.host, \u0027error\u0027: e},"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a4dcd0f_0a125009","line":127,"updated":"2015-08-06 12:55:02.000000000","message":"This can also happen due to races in the scheduler. We can add that comment later though.","commit_id":"26a4f430d1ec45f7b9a61b69f009a705d2d3cd52"}],"nova/tests/unit/scheduler/test_host_manager.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"30e62fb2a9827f50d0bbf9fd363d8ebdf45091d6","unresolved":false,"context_lines":[{"line_number":997,"context_line":"                                      [objects.PciDevicePool(vendor_id\u003d\u00278086\u0027,"},{"line_number":998,"context_line":"                                                             product_id\u003d\u002715ed\u0027,"},{"line_number":999,"context_line":"                                                             numa_node\u003d1,"},{"line_number":1000,"context_line":"                                                             count\u003d1)])"},{"line_number":1001,"context_line":"        host.numa_topology \u003d fakes.NUMA_TOPOLOGY"},{"line_number":1002,"context_line":""},{"line_number":1003,"context_line":"        host.consume_from_instance(req_spec[\u0027instance_properties\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_26168e4c","line":1000,"updated":"2015-08-05 18:41:34.000000000","message":"There is no need to construct PCIDevicePool object or the InstanceNUMATopology object above. Just mock out host.pci_stats.apply_requests() method to raise an exception:\n\n with mock.patch.object(host.pci_stats, \u0027apply_requests\u0027,\n               side_effect\u003dexceptions.PciDeviceRequestFailed):\n     host.consume_from_instance(...)","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"},{"author":{"_account_id":8276,"name":"kiwik","email":"chenrui.momo@gmail.com","username":"kiwik"},"change_message_id":"5a85e1a5bccded03fbddfae383c542e97a3d2425","unresolved":false,"context_lines":[{"line_number":997,"context_line":"                                      [objects.PciDevicePool(vendor_id\u003d\u00278086\u0027,"},{"line_number":998,"context_line":"                                                             product_id\u003d\u002715ed\u0027,"},{"line_number":999,"context_line":"                                                             numa_node\u003d1,"},{"line_number":1000,"context_line":"                                                             count\u003d1)])"},{"line_number":1001,"context_line":"        host.numa_topology \u003d fakes.NUMA_TOPOLOGY"},{"line_number":1002,"context_line":""},{"line_number":1003,"context_line":"        host.consume_from_instance(req_spec[\u0027instance_properties\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a4dcd0f_cfdfb138","line":1000,"in_reply_to":"1a4dcd0f_26168e4c","updated":"2015-08-06 02:41:00.000000000","message":"Done","commit_id":"55be19d42ad8e6e80f055c2ec7aafee45fa01ddd"}]}
