)]}'
{"nova/compute/utils.py":[{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"fbd7c80b31db39967e086ae1dfea227cbfda8b37","unresolved":false,"context_lines":[{"line_number":477,"context_line":"    :param instance: The instance object."},{"line_number":478,"context_line":"    \"\"\""},{"line_number":479,"context_line":"    if instance.info_cache is not None:"},{"line_number":480,"context_line":"        # NOTE(toabctl): we may try to refresh the cache on a already deleted"},{"line_number":481,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":482,"context_line":"        # thrown and we catch it here."},{"line_number":483,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_1031b205","line":480,"updated":"2016-11-16 18:06:40.000000000","message":"s/NOTE(toabctl)://","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"bb6518c6963fb4627c00b770eefefb78b54a2ee1","unresolved":false,"context_lines":[{"line_number":477,"context_line":"    :param instance: The instance object."},{"line_number":478,"context_line":"    \"\"\""},{"line_number":479,"context_line":"    if instance.info_cache is not None:"},{"line_number":480,"context_line":"        # NOTE(toabctl): we may try to refresh the cache on a already deleted"},{"line_number":481,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":482,"context_line":"        # thrown and we catch it here."},{"line_number":483,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_b4ad009d","line":480,"in_reply_to":"7a77a97e_1031b205","updated":"2016-11-18 11:05:55.000000000","message":"Done","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d90bc46e2ee3136e74d31b3f2f2be1bb2e7f0862","unresolved":false,"context_lines":[{"line_number":481,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":482,"context_line":"        # thrown and we catch it here."},{"line_number":483,"context_line":"        try:"},{"line_number":484,"context_line":"            instance.info_cache.refresh()"},{"line_number":485,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":486,"context_line":"            LOG.warning(_LW(\"Can not refresh info_cache because instance \""},{"line_number":487,"context_line":"                            \"was not found\"), instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_cfc6a567","line":484,"updated":"2016-11-17 02:38:38.000000000","message":"To unit test this, just mock out the instance.info_cache.refresh() method to raise an InstanceInfoCacheNotFound exception and call this util method to make sure the exception isn\u0027t raised out of it. It\u0027s a pretty simple test.","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"bb6518c6963fb4627c00b770eefefb78b54a2ee1","unresolved":false,"context_lines":[{"line_number":481,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":482,"context_line":"        # thrown and we catch it here."},{"line_number":483,"context_line":"        try:"},{"line_number":484,"context_line":"            instance.info_cache.refresh()"},{"line_number":485,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":486,"context_line":"            LOG.warning(_LW(\"Can not refresh info_cache because instance \""},{"line_number":487,"context_line":"                            \"was not found\"), instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_2eaa7419","line":484,"in_reply_to":"7a77a97e_cfc6a567","updated":"2016-11-18 11:05:55.000000000","message":"Done","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"fbd7c80b31db39967e086ae1dfea227cbfda8b37","unresolved":false,"context_lines":[{"line_number":483,"context_line":"        try:"},{"line_number":484,"context_line":"            instance.info_cache.refresh()"},{"line_number":485,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":486,"context_line":"            LOG.warning(_LW(\"Can not refresh info_cache because instance \""},{"line_number":487,"context_line":"                            \"was not found\"), instance\u003dinstance)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_d0265acd","line":486,"updated":"2016-11-16 18:06:40.000000000","message":"Hum a warning here is probably too much, I\u0027d vote for a debug...","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"bb6518c6963fb4627c00b770eefefb78b54a2ee1","unresolved":false,"context_lines":[{"line_number":483,"context_line":"        try:"},{"line_number":484,"context_line":"            instance.info_cache.refresh()"},{"line_number":485,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":486,"context_line":"            LOG.warning(_LW(\"Can not refresh info_cache because instance \""},{"line_number":487,"context_line":"                            \"was not found\"), instance\u003dinstance)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_d498bc7a","line":486,"in_reply_to":"7a77a97e_d0265acd","updated":"2016-11-18 11:05:55.000000000","message":"Done","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d90bc46e2ee3136e74d31b3f2f2be1bb2e7f0862","unresolved":false,"context_lines":[{"line_number":483,"context_line":"        try:"},{"line_number":484,"context_line":"            instance.info_cache.refresh()"},{"line_number":485,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":486,"context_line":"            LOG.warning(_LW(\"Can not refresh info_cache because instance \""},{"line_number":487,"context_line":"                            \"was not found\"), instance\u003dinstance)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a77a97e_ef1521e5","line":486,"in_reply_to":"7a77a97e_d0265acd","updated":"2016-11-17 02:38:38.000000000","message":"Yeah debug is better.","commit_id":"b41b8d6a85ada0df630dffdc8a1e68d827da3215"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"dd58404730adeb5b9d534d84ce4c60cd3f6c187f","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_3f02d90b","line":489,"updated":"2016-12-05 12:08:44.000000000","message":"I think I preferred the other way [1] because it avoid hitting the database if we know that the instance is deleted but as Matt indicated that value could be obsolete.\n\nI tried to think about how we could be in that situation, so probably because in an other process the instance is deleted so that reference does not have the field set to True.\n\nWe could avoid such situation by doing a refresh on if that field is not False and keep the try.. catch.\n\nSomething like:\n\n  try:\n    if not instance.deleted:\n      instance.info_cache.refresh()\n  except exception.InstanceInfoCacheNotFound:\n    ...\n\nBecause we know that, if instance is set to deleted no need of hitting the database.\n\n[1] https://review.openstack.org/#/c/363585/","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"74598a3175821eb826024fef10c3951d0906a76d","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_67f1466a","line":489,"in_reply_to":"3a71b18c_3f02d90b","updated":"2016-12-09 16:23:38.000000000","message":"@sahid: have you seen my initial patch? https://review.openstack.org/#/c/398308/1/nova/network/neutronv2/api.py . Should I add that again but keep the except block in adition?","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"78cba559a748f1b993b68fc6efd411adffa071fd","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"9f436f4f_153de2ba","line":489,"in_reply_to":"3a71b18c_3f02d90b","updated":"2017-08-08 15:09:32.000000000","message":"Done","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"c952d386e84e9408098634938aa135974d486698","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_d0d39202","line":489,"in_reply_to":"3a71b18c_3f02d90b","updated":"2016-12-05 13:00:52.000000000","message":"I think we should explicit catch InstanceInfoCacheNotFound at https://github.com/openstack/nova/blob/master/nova/network/base_api.py#L51\n\nIf we just mute the exception at here, then later we still send a request to neutron, and a db call, those looks like needless","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"74598a3175821eb826024fef10c3951d0906a76d","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_07ab321e","line":489,"in_reply_to":"3a71b18c_d0d39202","updated":"2016-12-09 16:23:38.000000000","message":"@alex: have you seen the other changeset? I think it is proposing that.\nTbh I don\u0027t care to much which fix we get in but it would be really nice to get *one* in before only security fixes are allowed for Newton...","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"67abe16909bfec4943ea34f5825315b1ce09ffe0","unresolved":false,"context_lines":[{"line_number":486,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":487,"context_line":"        # thrown and we catch it here."},{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_f656c35a","line":489,"in_reply_to":"3a71b18c_d0d39202","updated":"2016-12-05 14:45:19.000000000","message":"I don\u0027t think we want to avoid calling Neutron in such case. In the context of that issue we probably want the process to continue and so release the IP from Neutron.\n\nWith that patch we want that: The impossibility to refresh the cache is not going to block any processes.","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"08998f3410f20c70098466ed4bcf9a38b1a8238c","unresolved":false,"context_lines":[{"line_number":488,"context_line":"        try:"},{"line_number":489,"context_line":"            instance.info_cache.refresh()"},{"line_number":490,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":491,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""},{"line_number":492,"context_line":"                      \"was not found\", instance\u003dinstance)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba5201f7_d12cbe4c","line":491,"range":{"start_line":491,"start_character":58,"end_line":491,"end_character":66},"updated":"2017-01-03 11:55:52.000000000","message":"It looks like the error was actually the instance_info_catch not being found here:\nhttps://github.com/openstack/nova/blob/4f91ed3a547965ed96a22520edcfb783e7936e95/nova/objects/instance_info_cache.py#L110\n\nI presume because it has been deleted, when the instance was deleted, and the current context does now allow you to read soft_deleted items.\n\nI would rather we double check the instance is deleted before we swallow this exception. But maybe I am overthinking that?","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":6167,"name":"Ken\u0027ichi Ohmichi","email":"ken1ohmichi@gmail.com","username":"oomichi"},"change_message_id":"4596cf0c5acc4f5b7a4a81a78927be287aa2f9d6","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."},{"line_number":567,"context_line":"        try:"},{"line_number":568,"context_line":"            if not instance.deleted:"},{"line_number":569,"context_line":"                instance.info_cache.refresh()"},{"line_number":570,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":571,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""}],"source_content_type":"text/x-python","patch_set":10,"id":"9f436f4f_5900d3ab","line":568,"range":{"start_line":563,"start_character":0,"end_line":568,"end_character":36},"updated":"2017-08-11 20:33:11.000000000","message":"How about\n\n if instance.info_cache is not None and not instance.deleted:\n     try:\n         ..\n\nto avoid redundant nest and a little unreadable ?","commit_id":"78aa163c700114e383f1ed2f08ce0a8ed63e69a0"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"d3bbe5e2f3d3707add88f29df9a575ddec73012e","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."},{"line_number":567,"context_line":"        try:"},{"line_number":568,"context_line":"            if not instance.deleted:"},{"line_number":569,"context_line":"                instance.info_cache.refresh()"},{"line_number":570,"context_line":"        except exception.InstanceInfoCacheNotFound:"},{"line_number":571,"context_line":"            LOG.debug(\"Can not refresh info_cache because instance \""}],"source_content_type":"text/x-python","patch_set":10,"id":"9f436f4f_fd4c0043","line":568,"range":{"start_line":563,"start_character":0,"end_line":568,"end_character":36},"in_reply_to":"9f436f4f_5900d3ab","updated":"2017-08-14 05:00:34.000000000","message":"Done","commit_id":"78aa163c700114e383f1ed2f08ce0a8ed63e69a0"},{"author":{"_account_id":6167,"name":"Ken\u0027ichi Ohmichi","email":"ken1ohmichi@gmail.com","username":"oomichi"},"change_message_id":"75ff3f14b5c02cec6f89cb176cb7efd6754e948c","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted::"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."}],"source_content_type":"text/x-python","patch_set":12,"id":"9f436f4f_e9955088","line":563,"range":{"start_line":563,"start_character":63,"end_line":563,"end_character":65},"updated":"2017-08-14 19:55:57.000000000","message":"unnecessary one \":\"..","commit_id":"f621938ca8999cacfcb50c43461aa74eb8e343ab"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"8d45d12db60d46de3c57e778927b2a4858ea2548","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted::"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."}],"source_content_type":"text/x-python","patch_set":12,"id":"9f436f4f_691a80cc","line":563,"range":{"start_line":563,"start_character":63,"end_line":563,"end_character":65},"in_reply_to":"9f436f4f_e9955088","updated":"2017-08-14 20:10:26.000000000","message":"Done","commit_id":"f621938ca8999cacfcb50c43461aa74eb8e343ab"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"016959f0e069cbca8204de5517702d9ab756310d","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."}],"source_content_type":"text/x-python","patch_set":13,"id":"9f436f4f_0f61aad3","line":563,"range":{"start_line":563,"start_character":39,"end_line":563,"end_character":64},"updated":"2017-08-15 07:26:36.000000000","message":"why add this logic? seems this means instance is not deleted\nbut this is inconsistent to the comments below?","commit_id":"6413d2d3a5d86d5b3c1696b2ff092341af671d9c"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"fa8fc13303515de95f47be10c5ef2789cf4acaf7","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."}],"source_content_type":"text/x-python","patch_set":13,"id":"9f436f4f_3a422f10","line":563,"range":{"start_line":563,"start_character":39,"end_line":563,"end_character":64},"in_reply_to":"9f436f4f_0f61aad3","updated":"2017-08-17 06:09:55.000000000","message":"I think there is still the possibility of a race here. So between line 563 and 567, the instance could be deleted or the instance might be in DELETING state. So I think the comment make still sense.","commit_id":"6413d2d3a5d86d5b3c1696b2ff092341af671d9c"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"65ec08a780cf687ea60a1a9f88c901c36216ee84","unresolved":false,"context_lines":[{"line_number":560,"context_line":""},{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."}],"source_content_type":"text/x-python","patch_set":13,"id":"7f287b81_fd39fef1","line":563,"range":{"start_line":563,"start_character":39,"end_line":563,"end_character":64},"in_reply_to":"9f436f4f_3a422f10","updated":"2017-09-04 08:58:33.000000000","message":"@jichenjc, better now?","commit_id":"6413d2d3a5d86d5b3c1696b2ff092341af671d9c"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"016959f0e069cbca8204de5517702d9ab756310d","unresolved":false,"context_lines":[{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."},{"line_number":567,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":13,"id":"9f436f4f_ec49d4b6","line":564,"range":{"start_line":564,"start_character":45,"end_line":564,"end_character":46},"updated":"2017-08-15 07:26:36.000000000","message":"an","commit_id":"6413d2d3a5d86d5b3c1696b2ff092341af671d9c"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"65ec08a780cf687ea60a1a9f88c901c36216ee84","unresolved":false,"context_lines":[{"line_number":561,"context_line":"    :param instance: The instance object."},{"line_number":562,"context_line":"    \"\"\""},{"line_number":563,"context_line":"    if instance.info_cache is not None and not instance.deleted:"},{"line_number":564,"context_line":"        # We may try to refresh the cache on a already deleted"},{"line_number":565,"context_line":"        # instance. In that case the InstanceInfoCacheNotFound exception is"},{"line_number":566,"context_line":"        # thrown and we catch it here."},{"line_number":567,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":13,"id":"7f287b81_3d30a607","line":564,"range":{"start_line":564,"start_character":45,"end_line":564,"end_character":46},"in_reply_to":"9f436f4f_ec49d4b6","updated":"2017-09-04 08:58:33.000000000","message":"Done","commit_id":"6413d2d3a5d86d5b3c1696b2ff092341af671d9c"}],"nova/network/neutronv2/api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c3de7af993f69b2add1b314851d2d9e904f63567","unresolved":false,"context_lines":[{"line_number":1992,"context_line":"                                                   floating_ip):"},{"line_number":1993,"context_line":"            self._release_floating_ip(context, floating_ip[\u0027address\u0027],"},{"line_number":1994,"context_line":"                                      raise_if_associated\u003dFalse)"},{"line_number":1995,"context_line":"        if (instance and instance.task_state not in"},{"line_number":1996,"context_line":"            (compute_task_states.DELETING, compute_task_states.SOFT_DELETING)):"},{"line_number":1997,"context_line":"            _release_floating_ip_and_refresh_cache(self, context, instance,"},{"line_number":1998,"context_line":"                                                   floating_ip)"},{"line_number":1999,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a77a97e_1cb2b994","line":1996,"range":{"start_line":1995,"start_character":8,"end_line":1996,"end_character":79},"updated":"2016-11-16 15:24:16.000000000","message":"Should probably add some comment in the code explaining the logic here.","commit_id":"4494859d97558a270e221058eb2964a1100657ad"}],"nova/tests/unit/compute/test_compute_utils.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"408ade54a2f6b8c68d58493b97b3c830b5a249e5","unresolved":false,"context_lines":[{"line_number":740,"context_line":"        self.assertEqual(jsonutils.dumps([]), result.json())"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":""},{"line_number":743,"context_line":"class ComputeUtilsRefreshInfoCacheForInstance(test.TestCase):"},{"line_number":744,"context_line":"    def setUp(self):"},{"line_number":745,"context_line":"        super(ComputeUtilsRefreshInfoCacheForInstance, self).setUp()"},{"line_number":746,"context_line":"        self.user_id \u003d \u0027fake\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_a6a0e0a6","line":743,"range":{"start_line":743,"start_character":51,"end_line":743,"end_character":59},"updated":"2016-11-22 16:46:21.000000000","message":"You really don\u0027t need the database for this test except for the fact you\u0027re creating an instance in the database via the create_instance helper method. We could also just create a fake instance and use that for the test as you\u0027re mocking out the instance.info_cache.refresh method anyway.\n\nSo this test should extend test.NoDBTestCase instead of TestCase.\n\nAlternatively you don\u0027t mock out instance.info_cache.refresh, actually delete the instance by calling instance.destroy(), and then pass it to compute_utils.refresh_info_cache_for_instance.","commit_id":"5fbcd4f802d6fda021bd5c544615efa61bbd19b6"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"6e295001e9a2341315a7a2fc0885044e349ab9ba","unresolved":false,"context_lines":[{"line_number":740,"context_line":"        self.assertEqual(jsonutils.dumps([]), result.json())"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":""},{"line_number":743,"context_line":"class ComputeUtilsRefreshInfoCacheForInstance(test.TestCase):"},{"line_number":744,"context_line":"    def setUp(self):"},{"line_number":745,"context_line":"        super(ComputeUtilsRefreshInfoCacheForInstance, self).setUp()"},{"line_number":746,"context_line":"        self.user_id \u003d \u0027fake\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_2d866adb","line":743,"in_reply_to":"5a74a57a_9137d9e2","updated":"2016-12-01 06:46:34.000000000","message":"Done","commit_id":"5fbcd4f802d6fda021bd5c544615efa61bbd19b6"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"6e295001e9a2341315a7a2fc0885044e349ab9ba","unresolved":false,"context_lines":[{"line_number":740,"context_line":"        self.assertEqual(jsonutils.dumps([]), result.json())"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":""},{"line_number":743,"context_line":"class ComputeUtilsRefreshInfoCacheForInstance(test.TestCase):"},{"line_number":744,"context_line":"    def setUp(self):"},{"line_number":745,"context_line":"        super(ComputeUtilsRefreshInfoCacheForInstance, self).setUp()"},{"line_number":746,"context_line":"        self.user_id \u003d \u0027fake\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_ad1b5ac9","line":743,"range":{"start_line":743,"start_character":51,"end_line":743,"end_character":59},"in_reply_to":"7a77a97e_a6a0e0a6","updated":"2016-12-01 06:46:34.000000000","message":"Done","commit_id":"5fbcd4f802d6fda021bd5c544615efa61bbd19b6"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"367c236dacd44555f10bb051a30c9b2b678c2cc3","unresolved":false,"context_lines":[{"line_number":740,"context_line":"        self.assertEqual(jsonutils.dumps([]), result.json())"},{"line_number":741,"context_line":""},{"line_number":742,"context_line":""},{"line_number":743,"context_line":"class ComputeUtilsRefreshInfoCacheForInstance(test.TestCase):"},{"line_number":744,"context_line":"    def setUp(self):"},{"line_number":745,"context_line":"        super(ComputeUtilsRefreshInfoCacheForInstance, self).setUp()"},{"line_number":746,"context_line":"        self.user_id \u003d \u0027fake\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_9137d9e2","line":743,"in_reply_to":"7a77a97e_a6a0e0a6","updated":"2016-11-23 13:38:19.000000000","message":"Yes it\u0027s true I did not notice that point, no need of the database here.","commit_id":"5fbcd4f802d6fda021bd5c544615efa61bbd19b6"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"41f1c560eb45825623e81831127507db1c4f2e0b","unresolved":false,"context_lines":[{"line_number":755,"context_line":"                side_effect\u003dexception.InstanceInfoCacheNotFound("},{"line_number":756,"context_line":"                    instance_uuid\u003dinst.uuid)):"},{"line_number":757,"context_line":"            # we expect that the raised exception is ok"},{"line_number":758,"context_line":"            compute_utils.refresh_info_cache_for_instance(self.context, inst)"},{"line_number":759,"context_line":""},{"line_number":760,"context_line":""},{"line_number":761,"context_line":"class ComputeUtilsGetRebootTypes(test.NoDBTestCase):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a77a97e_b6293df5","line":758,"updated":"2016-11-21 11:30:18.000000000","message":"Seems reasonable, an other would be to mock LOG.debug and see if it has well been called but for me that your test is enough. Thanks","commit_id":"5fbcd4f802d6fda021bd5c544615efa61bbd19b6"},{"author":{"_account_id":18602,"name":"Gábor Antal","email":"antal@inf.u-szeged.hu","username":"antal"},"change_message_id":"42fce2ae05a666cf1261825a584b70f82ca45f7e","unresolved":false,"context_lines":[{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("},{"line_number":752,"context_line":"                            instance_uuid\u003dinst.uuid)):"},{"line_number":753,"context_line":"            # we expect that the raised exception is ok"},{"line_number":754,"context_line":"            compute_utils.refresh_info_cache_for_instance(None, inst)"},{"line_number":755,"context_line":""},{"line_number":756,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_fb11e05e","line":753,"range":{"start_line":753,"start_character":7,"end_line":753,"end_character":55},"updated":"2016-12-01 10:26:29.000000000","message":"I think, in this point we could check if LOG.debug was called correctly.","commit_id":"da98545bd7b90f3ffbbd49ca92c88e5760fbebe0"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"7fbdbe3dd99230bf7310da74e527c8a95fbd9ce2","unresolved":false,"context_lines":[{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("},{"line_number":752,"context_line":"                            instance_uuid\u003dinst.uuid)):"},{"line_number":753,"context_line":"            # we expect that the raised exception is ok"},{"line_number":754,"context_line":"            compute_utils.refresh_info_cache_for_instance(None, inst)"},{"line_number":755,"context_line":""},{"line_number":756,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_d804d87f","line":753,"range":{"start_line":753,"start_character":7,"end_line":753,"end_character":55},"in_reply_to":"3a71b18c_fb11e05e","updated":"2016-12-02 15:20:33.000000000","message":"Done","commit_id":"da98545bd7b90f3ffbbd49ca92c88e5760fbebe0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"43169f915d68e09a61e4403c33fa62ef95d13116","unresolved":false,"context_lines":[{"line_number":745,"context_line":"        inst \u003d fake_instance.fake_instance_obj(\u0027fake-context\u0027)"},{"line_number":746,"context_line":"        net_info \u003d model.NetworkInfo([])"},{"line_number":747,"context_line":"        info_cache \u003d objects.InstanceInfoCache(network_info\u003dnet_info)"},{"line_number":748,"context_line":"        setattr(inst, \u0027info_cache\u0027, info_cache)"},{"line_number":749,"context_line":"        self.assertIsNotNone(inst.info_cache)"},{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("}],"source_content_type":"text/x-python","patch_set":8,"id":"3a71b18c_ab5ee80f","line":748,"updated":"2016-12-02 15:32:58.000000000","message":"You can just do inst.info_cache \u003d info_cache\n\nOr pass that in when constructing the fake instance above.","commit_id":"86b491eca466d892cc7238aeaf092ebbcbfe6e5c"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"b6d0839d6a6c8256750dfd25abe47069e6acb0b0","unresolved":false,"context_lines":[{"line_number":745,"context_line":"        inst \u003d fake_instance.fake_instance_obj(\u0027fake-context\u0027)"},{"line_number":746,"context_line":"        net_info \u003d model.NetworkInfo([])"},{"line_number":747,"context_line":"        info_cache \u003d objects.InstanceInfoCache(network_info\u003dnet_info)"},{"line_number":748,"context_line":"        setattr(inst, \u0027info_cache\u0027, info_cache)"},{"line_number":749,"context_line":"        self.assertIsNotNone(inst.info_cache)"},{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("}],"source_content_type":"text/x-python","patch_set":8,"id":"3a71b18c_ab9b4871","line":748,"in_reply_to":"3a71b18c_ab5ee80f","updated":"2016-12-02 15:37:45.000000000","message":"Done","commit_id":"86b491eca466d892cc7238aeaf092ebbcbfe6e5c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"627eb98c2b498530cb1c0ca0ecd908f59ae3f056","unresolved":false,"context_lines":[{"line_number":746,"context_line":"        net_info \u003d model.NetworkInfo([])"},{"line_number":747,"context_line":"        info_cache \u003d objects.InstanceInfoCache(network_info\u003dnet_info)"},{"line_number":748,"context_line":"        inst.info_cache \u003d info_cache"},{"line_number":749,"context_line":"        self.assertIsNotNone(inst.info_cache)"},{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("},{"line_number":752,"context_line":"                            instance_uuid\u003dinst.uuid)):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_cbdde415","line":749,"updated":"2016-12-02 15:40:35.000000000","message":"nit: this seems kind of silly as we just set it above, but meh.","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"},{"author":{"_account_id":7102,"name":"Thomas Bechtold","email":"thomas.bechtold@chainguard.dev","username":"toabctl"},"change_message_id":"78cba559a748f1b993b68fc6efd411adffa071fd","unresolved":false,"context_lines":[{"line_number":746,"context_line":"        net_info \u003d model.NetworkInfo([])"},{"line_number":747,"context_line":"        info_cache \u003d objects.InstanceInfoCache(network_info\u003dnet_info)"},{"line_number":748,"context_line":"        inst.info_cache \u003d info_cache"},{"line_number":749,"context_line":"        self.assertIsNotNone(inst.info_cache)"},{"line_number":750,"context_line":"        with mock.patch.object(inst.info_cache, \u0027refresh\u0027,"},{"line_number":751,"context_line":"                        side_effect\u003dexception.InstanceInfoCacheNotFound("},{"line_number":752,"context_line":"                            instance_uuid\u003dinst.uuid)):"}],"source_content_type":"text/x-python","patch_set":9,"id":"9f436f4f_245c3e4a","line":749,"in_reply_to":"3a71b18c_cbdde415","updated":"2017-08-08 15:09:32.000000000","message":"Done","commit_id":"e6211ba16893ab712e027b9eeb7e4251c3aefaa3"}]}
