)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9dcb38dbb759de1687fcb92a12d0709d97c44aef","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Ankit Agrawal \u003cankit11.agrawal@nttdata.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-04-21 09:01:19 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Detach volume after deleting the instance"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"If an instance is booted from volume and goes in to error state due to"},{"line_number":10,"context_line":"some reason. Volume from which instance is booted, remains in-use state"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"1aca2d91_000d0b3e","line":7,"updated":"2015-05-06 19:26:11.000000000","message":"might want to put \"with no host\" at the end of this.","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"1a2764067a34568cf5971cdf32392bd2039ad953","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Ankit Agrawal \u003cankit11.agrawal@nttdata.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-04-21 09:01:19 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Detach volume after deleting the instance"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"If an instance is booted from volume and goes in to error state due to"},{"line_number":10,"context_line":"some reason. Volume from which instance is booted, remains in-use state"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"1aca2d91_ab098697","line":7,"in_reply_to":"1aca2d91_000d0b3e","updated":"2015-05-07 07:51:49.000000000","message":"Done","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9dcb38dbb759de1687fcb92a12d0709d97c44aef","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Detach volume after deleting the instance"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"If an instance is booted from volume and goes in to error state due to"},{"line_number":10,"context_line":"some reason. Volume from which instance is booted, remains in-use state"},{"line_number":11,"context_line":"even the instance is deleted because instance has no host associated"},{"line_number":12,"context_line":"with it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"1aca2d91_033bd5d2","line":9,"updated":"2015-05-06 19:26:11.000000000","message":"This is addressing a bug with shelving/unshelving but it\u0027s barely mentioned in the commit message.  You could modify this to be \"If an instance is booted from a volume, shelved, and goes into an error...\"","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"1a2764067a34568cf5971cdf32392bd2039ad953","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Detach volume after deleting the instance"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"If an instance is booted from volume and goes in to error state due to"},{"line_number":10,"context_line":"some reason. Volume from which instance is booted, remains in-use state"},{"line_number":11,"context_line":"even the instance is deleted because instance has no host associated"},{"line_number":12,"context_line":"with it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"1aca2d91_8bfeca69","line":9,"in_reply_to":"1aca2d91_033bd5d2","updated":"2015-05-07 07:51:49.000000000","message":"Done","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"}],"nova/compute/api.py":[{"author":{"_account_id":8213,"name":"Claudiu Belu","email":"cbelu@cloudbasesolutions.com","username":"claudiub"},"change_message_id":"b7e3a3d742e871cf43550f7b7966ba3aa2a741e9","unresolved":false,"context_lines":[{"line_number":1586,"context_line":""},{"line_number":1587,"context_line":"            is_local_delete \u003d True"},{"line_number":1588,"context_line":"            try:"},{"line_number":1589,"context_line":"                if (not instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED"},{"line_number":1590,"context_line":"                    and instance.host):"},{"line_number":1591,"context_line":"                    service \u003d objects.Service.get_by_compute_host("},{"line_number":1592,"context_line":"                        context.elevated(), instance.host)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_859fd1b3","line":1589,"updated":"2015-01-22 15:49:46.000000000","message":"i think instance.vm_state !\u003d vm_states... looks more reasonable","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"153f9bcb31c38ad792d9b80564c8170c13429bd6","unresolved":false,"context_lines":[{"line_number":1586,"context_line":""},{"line_number":1587,"context_line":"            is_local_delete \u003d True"},{"line_number":1588,"context_line":"            try:"},{"line_number":1589,"context_line":"                if (not instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED"},{"line_number":1590,"context_line":"                    and instance.host):"},{"line_number":1591,"context_line":"                    service \u003d objects.Service.get_by_compute_host("},{"line_number":1592,"context_line":"                        context.elevated(), instance.host)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_01bc9adb","line":1589,"in_reply_to":"1a930d6b_859fd1b3","updated":"2015-01-23 08:29:56.000000000","message":"Done","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":8213,"name":"Claudiu Belu","email":"cbelu@cloudbasesolutions.com","username":"claudiub"},"change_message_id":"b7e3a3d742e871cf43550f7b7966ba3aa2a741e9","unresolved":false,"context_lines":[{"line_number":1587,"context_line":"            is_local_delete \u003d True"},{"line_number":1588,"context_line":"            try:"},{"line_number":1589,"context_line":"                if (not instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED"},{"line_number":1590,"context_line":"                    and instance.host):"},{"line_number":1591,"context_line":"                    service \u003d objects.Service.get_by_compute_host("},{"line_number":1592,"context_line":"                        context.elevated(), instance.host)"},{"line_number":1593,"context_line":"                    is_local_delete \u003d not self.servicegroup_api.service_is_up("}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_e53a55cc","line":1590,"updated":"2015-01-22 15:49:46.000000000","message":"you could indent this line once, so it is distinguishable from the next line.","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"153f9bcb31c38ad792d9b80564c8170c13429bd6","unresolved":false,"context_lines":[{"line_number":1587,"context_line":"            is_local_delete \u003d True"},{"line_number":1588,"context_line":"            try:"},{"line_number":1589,"context_line":"                if (not instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED"},{"line_number":1590,"context_line":"                    and instance.host):"},{"line_number":1591,"context_line":"                    service \u003d objects.Service.get_by_compute_host("},{"line_number":1592,"context_line":"                        context.elevated(), instance.host)"},{"line_number":1593,"context_line":"                    is_local_delete \u003d not self.servicegroup_api.service_is_up("}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_21bfd6d1","line":1590,"in_reply_to":"1a930d6b_e53a55cc","updated":"2015-01-23 08:29:56.000000000","message":"Done","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"570aaf67c6f5048d3e8ffd0888e5d2ad935d9b34","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                                 \u003d\u003d vm_states.SHELVED_OFFLOADED)"},{"line_number":1585,"context_line":"            if not instance.host and not shelved_offloaded:"},{"line_number":1586,"context_line":"                try:"},{"line_number":1587,"context_line":"                    compute_utils.notify_about_instance_usage("},{"line_number":1588,"context_line":"                            self.notifier, context, instance,"},{"line_number":1589,"context_line":"                            \"%s.start\" % delete_type)"},{"line_number":1590,"context_line":"                    instance.destroy()"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba7be1f8_b1acbbee","side":"PARENT","line":1587,"updated":"2015-03-03 14:42:52.000000000","message":"it\u0027s extremely non obvious to me why this is safe to delete.","commit_id":"516c4c875c35938ba8340472edb242053f695d8c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"258a6c3472aa4f1ec4537d8e64a28a3e2761f539","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                                 \u003d\u003d vm_states.SHELVED_OFFLOADED)"},{"line_number":1585,"context_line":"            if not instance.host and not shelved_offloaded:"},{"line_number":1586,"context_line":"                try:"},{"line_number":1587,"context_line":"                    compute_utils.notify_about_instance_usage("},{"line_number":1588,"context_line":"                            self.notifier, context, instance,"},{"line_number":1589,"context_line":"                            \"%s.start\" % delete_type)"},{"line_number":1590,"context_line":"                    instance.destroy()"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_d802ab0a","side":"PARENT","line":1587,"in_reply_to":"ba7be1f8_00b8cf0f","updated":"2015-03-11 12:26:04.000000000","message":"Sean,\n\nThe effect of this patch is that we will call _local_delete() on the instance instead of running this block. If you compare this block to _local_delete(), you will see that it does everything this block does, including the exact same notifications. It additionally cleans up networking and volumes, which is the primary purpose of this patch.","commit_id":"516c4c875c35938ba8340472edb242053f695d8c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"2350c98d43917223e50eb448c16fd9125c30abdb","unresolved":false,"context_lines":[{"line_number":1584,"context_line":"                                 \u003d\u003d vm_states.SHELVED_OFFLOADED)"},{"line_number":1585,"context_line":"            if not instance.host and not shelved_offloaded:"},{"line_number":1586,"context_line":"                try:"},{"line_number":1587,"context_line":"                    compute_utils.notify_about_instance_usage("},{"line_number":1588,"context_line":"                            self.notifier, context, instance,"},{"line_number":1589,"context_line":"                            \"%s.start\" % delete_type)"},{"line_number":1590,"context_line":"                    instance.destroy()"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba7be1f8_00b8cf0f","side":"PARENT","line":1587,"in_reply_to":"ba7be1f8_b1acbbee","updated":"2015-03-03 16:02:44.000000000","message":"I have added an extra check at line #1589 in PS #4 to check instance.host, so in case of \"not instance.host and not shelved_offloaded\" i.e. instance.host is None and \"vm_state\" is not SHELVED_OFFLOADED, is_local_delete is set to True.\n\nAs is_local_delete remains True, it will call self._local_delete, which handles the code deleted from this block along with cleaning up the bdms and updating the database.","commit_id":"516c4c875c35938ba8340472edb242053f695d8c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"1ae93de8a7679b0b25edd878d367927e5441ee19","unresolved":false,"context_lines":[{"line_number":1621,"context_line":""},{"line_number":1622,"context_line":"            if is_local_delete:"},{"line_number":1623,"context_line":"                # If instance is in shelved_offloaded state or compute node"},{"line_number":1624,"context_line":"                # isn\u0027t up or if instance\u0027s vm_state is \u0027error\u0027 and"},{"line_number":1625,"context_line":"                # instance.host is None, delete instance from db and clean"},{"line_number":1626,"context_line":"                # bdms info and network info"},{"line_number":1627,"context_line":"                self._local_delete(context, instance, bdms, delete_type, cb)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a6ced46_5060fd00","line":1624,"updated":"2015-03-25 15:45:46.000000000","message":"I don\u0027t see any checking for (instance.vm_state \u003d\u003d vm_states.ERROR and instance.host is None) here or in _local_delete, so it seems you\u0027re making some assumptions which given the messy state of this code with the bazillion conditions will just come back to bite us at some point.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"aba53c96376437ca0c2cc39a3d298648fd60ae47","unresolved":false,"context_lines":[{"line_number":1621,"context_line":""},{"line_number":1622,"context_line":"            if is_local_delete:"},{"line_number":1623,"context_line":"                # If instance is in shelved_offloaded state or compute node"},{"line_number":1624,"context_line":"                # isn\u0027t up or if instance\u0027s vm_state is \u0027error\u0027 and"},{"line_number":1625,"context_line":"                # instance.host is None, delete instance from db and clean"},{"line_number":1626,"context_line":"                # bdms info and network info"},{"line_number":1627,"context_line":"                self._local_delete(context, instance, bdms, delete_type, cb)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1a6ced46_663e232a","line":1624,"in_reply_to":"1a6ced46_5060fd00","updated":"2015-03-25 16:19:48.000000000","message":"We do not need to check this condition here because we need to call \"_local_delete\" even when (instance.vm_state \u003d\u003d vm_states.ERROR and instance.host is None).\n\nWith current(base) code it is not calling \"self._local_delete\" method because it enters in to the check (if not instance.host and not shelved_offloaded: line #1588) and returns from that block only.\n\nSo I have removed that unnecessary check from line #1588 which will allow to call \"_local_delete\" from here and will cleanup the network and bdms.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":1621,"context_line":""},{"line_number":1622,"context_line":"            if is_local_delete:"},{"line_number":1623,"context_line":"                # If instance is in shelved_offloaded state or compute node"},{"line_number":1624,"context_line":"                # isn\u0027t up or if instance\u0027s vm_state is \u0027error\u0027 and"},{"line_number":1625,"context_line":"                # instance.host is None, delete instance from db and clean"},{"line_number":1626,"context_line":"                # bdms info and network info"},{"line_number":1627,"context_line":"                self._local_delete(context, instance, bdms, delete_type, cb)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_b078b3c5","line":1624,"in_reply_to":"1a6ced46_663e232a","updated":"2015-03-31 14:34:37.000000000","message":"OK, but the confusion for me is the comment and commit message and unit test explicitly call out the vm_state being \u0027ERROR\u0027 but that\u0027s not checked anywhere in here, so I had expected that to be checked. I guess it\u0027s not needed since it\u0027s assumed to be the case.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":1621,"context_line":""},{"line_number":1622,"context_line":"            if is_local_delete:"},{"line_number":1623,"context_line":"                # If instance is in shelved_offloaded state or compute node"},{"line_number":1624,"context_line":"                # isn\u0027t up or if instance\u0027s vm_state is \u0027error\u0027 and"},{"line_number":1625,"context_line":"                # instance.host is None, delete instance from db and clean"},{"line_number":1626,"context_line":"                # bdms info and network info"},{"line_number":1627,"context_line":"                self._local_delete(context, instance, bdms, delete_type, cb)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_ce6ab41a","line":1624,"in_reply_to":"da9b358b_b078b3c5","updated":"2015-05-06 13:57:10.000000000","message":"I have reformatted the code blocks for better readability.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"779174b26abfc97b3a4fb831158b57dfbfed91a6","unresolved":false,"context_lines":[{"line_number":1729,"context_line":"        if instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED:"},{"line_number":1730,"context_line":"            LOG.info(_LI(\"instance is in SHELVED_OFFLOADED state, cleanup\""},{"line_number":1731,"context_line":"                         \" the instance\u0027s info from database.\"),"},{"line_number":1732,"context_line":"                     instance\u003dinstance)"},{"line_number":1733,"context_line":"        else:"},{"line_number":1734,"context_line":"            LOG.warning(_LW(\"instance\u0027s host %s is down, deleting from \""},{"line_number":1735,"context_line":"                            \"database\"), instance.host, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_7c27a712","line":1732,"updated":"2015-03-31 13:46:21.000000000","message":"The logging here is at least possibly wrong with your change since there are other ways/conditions to get to this method now.\n\nIn general it seems gross to be making the logic assumptions between _delete and _local_delete because changing one possibly breaks assumptions in the other.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":1729,"context_line":"        if instance.vm_state \u003d\u003d vm_states.SHELVED_OFFLOADED:"},{"line_number":1730,"context_line":"            LOG.info(_LI(\"instance is in SHELVED_OFFLOADED state, cleanup\""},{"line_number":1731,"context_line":"                         \" the instance\u0027s info from database.\"),"},{"line_number":1732,"context_line":"                     instance\u003dinstance)"},{"line_number":1733,"context_line":"        else:"},{"line_number":1734,"context_line":"            LOG.warning(_LW(\"instance\u0027s host %s is down, deleting from \""},{"line_number":1735,"context_line":"                            \"database\"), instance.host, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_915f3d0e","line":1732,"in_reply_to":"da9b358b_7c27a712","updated":"2015-05-06 13:57:10.000000000","message":"Above log message is only for the if condition when instance is in shelved offloaded state. For the other conditions it will log the error message from below else block.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"21650facfe62526f43f4bbdc074af7048f9a3ddf","unresolved":false,"context_lines":[{"line_number":1561,"context_line":""},{"line_number":1562,"context_line":"            if instance.vm_state \u003d\u003d vm_states.RESIZED:"},{"line_number":1563,"context_line":"                self._confirm_resize_on_deleting(context, instance)"},{"line_number":1564,"context_line":""},{"line_number":1565,"context_line":"            is_local_delete \u003d True"},{"line_number":1566,"context_line":"            try:"},{"line_number":1567,"context_line":"                if (instance.vm_state !\u003d vm_states.SHELVED_OFFLOADED"}],"source_content_type":"text/x-python","patch_set":8,"id":"7aaa499b_b761b33b","line":1564,"updated":"2015-04-14 21:27:01.000000000","message":"Perhaps this logic will be clearer after a small refactoring. For example:\n\n if (not instance.host or instance.vm_state \u003d\u003d SHELVED_OFFLOADED):\n     is_local_delete \u003d True\n else:\n     try:\n         serivce \u003d ....\n         is_local_delete \u003d ...\n     except exception.ComputeHostNotFound:\n         is_local_delete \u003d True\n if is_local_delete:\n     ...\n else:\n     ... # IIANM no one of used functions does raise ComputeHostNotFound","commit_id":"70af464776ab794c379e1f2d08293c08973c71fc"},{"author":{"_account_id":10224,"name":"Feodor Tersin","email":"ftersin@hotmail.com","username":"ftersin"},"change_message_id":"21650facfe62526f43f4bbdc074af7048f9a3ddf","unresolved":false,"context_lines":[{"line_number":1596,"context_line":""},{"line_number":1597,"context_line":"            if is_local_delete:"},{"line_number":1598,"context_line":"                # If instance is in shelved_offloaded state or compute node"},{"line_number":1599,"context_line":"                # isn\u0027t up or if instance\u0027s vm_state is \u0027error\u0027 and"},{"line_number":1600,"context_line":"                # instance.host is None, delete instance from db and clean"},{"line_number":1601,"context_line":"                # bdms info and network info"},{"line_number":1602,"context_line":"                self._local_delete(context, instance, bdms, delete_type, cb)"}],"source_content_type":"text/x-python","patch_set":8,"id":"7aaa499b_17ce275a","line":1599,"updated":"2015-04-14 21:27:01.000000000","message":"I agree with Matt, the comment isn\u0027t clear. Now there are two cases of local delete usage: SHELVED_OFFLOADED instance state and unreachable (down or unknown) host. There is no explicit dependence on ERROR state.","commit_id":"70af464776ab794c379e1f2d08293c08973c71fc"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9dcb38dbb759de1687fcb92a12d0709d97c44aef","unresolved":false,"context_lines":[{"line_number":1562,"context_line":"                                 \u003d\u003d vm_states.SHELVED_OFFLOADED)"},{"line_number":1563,"context_line":"            if not instance.host and not shelved_offloaded:"},{"line_number":1564,"context_line":"                try:"},{"line_number":1565,"context_line":"                    compute_utils.notify_about_instance_usage("},{"line_number":1566,"context_line":"                            self.notifier, context, instance,"},{"line_number":1567,"context_line":"                            \"%s.start\" % delete_type)"},{"line_number":1568,"context_line":"                    instance.destroy()"}],"source_content_type":"text/x-python","patch_set":11,"id":"1aca2d91_406d4303","side":"PARENT","line":1565,"updated":"2015-05-06 19:26:11.000000000","message":"This logic is in _local_delete() which will now be called for this case.  Just pointing it out for other reviewers who might wonder why it\u0027s being removed here.","commit_id":"45c4fcb095490a3ee397130c449672eaf39a059f"}],"nova/tests/unit/api/openstack/compute/plugins/v3/test_servers.py":[{"author":{"_account_id":8412,"name":"Mike Durnosvistov","email":"glacierr.dev@gmail.com","username":"mdurnosvistov"},"change_message_id":"0e9f2cf9c748492e0a9417f2774ff4f2c614682e","unresolved":false,"context_lines":[{"line_number":1292,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1293,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"},{"line_number":1294,"context_line":"                fakes.fake_instance_get(vm_state\u003dvm_states.ACTIVE))"},{"line_number":1295,"context_line":"        with mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027):"},{"line_number":1296,"context_line":"            self.controller.delete(req, uuid)"},{"line_number":1297,"context_line":""},{"line_number":1298,"context_line":"    def test_delete_server_instance(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_122d8946","line":1295,"updated":"2015-03-13 13:38:57.000000000","message":"I believe if we will use mock-decorator will less changes.","commit_id":"e5651b6538e03577b73c2662a0b093959b08a92d"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"2b233daa7a12325d82831d7c282ad0cbc905e856","unresolved":false,"context_lines":[{"line_number":1292,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1293,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"},{"line_number":1294,"context_line":"                fakes.fake_instance_get(vm_state\u003dvm_states.ACTIVE))"},{"line_number":1295,"context_line":"        with mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027):"},{"line_number":1296,"context_line":"            self.controller.delete(req, uuid)"},{"line_number":1297,"context_line":""},{"line_number":1298,"context_line":"    def test_delete_server_instance(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_44e54836","line":1295,"in_reply_to":"9a80dd14_122d8946","updated":"2015-03-16 06:18:38.000000000","message":"Hi Mike,\n\nAs Matthew explained we can not use mock-decorator here because here I need to mock an object reference as well.\n\nIf you have a solution for the same using mock-decorator please suggest so, or if possible please remove your -1.","commit_id":"e5651b6538e03577b73c2662a0b093959b08a92d"},{"author":{"_account_id":8412,"name":"Mike Durnosvistov","email":"glacierr.dev@gmail.com","username":"mdurnosvistov"},"change_message_id":"22f0ff232e1c72634c1e07f01897dfc52c7c4442","unresolved":false,"context_lines":[{"line_number":1292,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1293,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"},{"line_number":1294,"context_line":"                fakes.fake_instance_get(vm_state\u003dvm_states.ACTIVE))"},{"line_number":1295,"context_line":"        with mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027):"},{"line_number":1296,"context_line":"            self.controller.delete(req, uuid)"},{"line_number":1297,"context_line":""},{"line_number":1298,"context_line":"    def test_delete_server_instance(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_9e0ba97c","line":1295,"in_reply_to":"9a80dd14_44e54836","updated":"2015-03-17 20:15:31.000000000","message":"Here maybe that\u0027s true... but I\u0027d do as I said... And below I think you can use mock-decorator instead `with`.","commit_id":"e5651b6538e03577b73c2662a0b093959b08a92d"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"1044175b666071b46c32747723d6e82b28725087","unresolved":false,"context_lines":[{"line_number":1292,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1293,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"},{"line_number":1294,"context_line":"                fakes.fake_instance_get(vm_state\u003dvm_states.ACTIVE))"},{"line_number":1295,"context_line":"        with mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027):"},{"line_number":1296,"context_line":"            self.controller.delete(req, uuid)"},{"line_number":1297,"context_line":""},{"line_number":1298,"context_line":"    def test_delete_server_instance(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_6aa380b1","line":1295,"in_reply_to":"9a80dd14_9e0ba97c","updated":"2015-03-18 07:01:47.000000000","message":"Done","commit_id":"e5651b6538e03577b73c2662a0b093959b08a92d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":1288,"context_line":"        req.method \u003d \u0027DELETE\u0027"},{"line_number":1289,"context_line":"        return req"},{"line_number":1290,"context_line":""},{"line_number":1291,"context_line":"    @mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027)"},{"line_number":1292,"context_line":"    def _delete_server_instance(self, deallocate_for_instance, uuid\u003dFAKE_UUID):"},{"line_number":1293,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1294,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_734a35c7","line":1291,"updated":"2015-03-31 14:34:37.000000000","message":"I\u0027m not even sure why we are mocking this deep in the server API extension unit tests, these shouldn\u0027t need to know the internals of the compute API\u0027s _local_delete method....","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":1288,"context_line":"        req.method \u003d \u0027DELETE\u0027"},{"line_number":1289,"context_line":"        return req"},{"line_number":1290,"context_line":""},{"line_number":1291,"context_line":"    @mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027)"},{"line_number":1292,"context_line":"    def _delete_server_instance(self, deallocate_for_instance, uuid\u003dFAKE_UUID):"},{"line_number":1293,"context_line":"        req \u003d self._create_delete_request(uuid)"},{"line_number":1294,"context_line":"        self.stubs.Set(db, \u0027instance_get_by_uuid\u0027,"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_b14919d3","line":1291,"in_reply_to":"da9b358b_734a35c7","updated":"2015-05-06 13:57:10.000000000","message":"We need to mock it here, because server api extension\u0027s delete method  calls to compute api\u0027s delete method.\nhttps://github.com/openstack/nova/blob/master/nova/api/openstack/compute/plugins/v3/servers.py#L739","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":1305,"context_line":"                          uuid\u003d\u0027non-existent-uuid\u0027)"},{"line_number":1306,"context_line":""},{"line_number":1307,"context_line":"    @mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027)"},{"line_number":1308,"context_line":"    def test_delete_server_instance_while_building("},{"line_number":1309,"context_line":"            self, deallocate_for_instance):"},{"line_number":1310,"context_line":"        req \u003d self._create_delete_request(FAKE_UUID)"},{"line_number":1311,"context_line":"        self.controller.delete(req, FAKE_UUID)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_704a2bc7","line":1308,"updated":"2015-03-31 14:34:37.000000000","message":"I don\u0027t see how this test is different from test_delete_server_instance.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":1305,"context_line":"                          uuid\u003d\u0027non-existent-uuid\u0027)"},{"line_number":1306,"context_line":""},{"line_number":1307,"context_line":"    @mock.patch.object(network_api.API, \u0027deallocate_for_instance\u0027)"},{"line_number":1308,"context_line":"    def test_delete_server_instance_while_building("},{"line_number":1309,"context_line":"            self, deallocate_for_instance):"},{"line_number":1310,"context_line":"        req \u003d self._create_delete_request(FAKE_UUID)"},{"line_number":1311,"context_line":"        self.controller.delete(req, FAKE_UUID)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_319f4905","line":1308,"in_reply_to":"da9b358b_704a2bc7","updated":"2015-05-06 13:57:10.000000000","message":"This test was similar to test_delete_server_instance, I have made required changes test_delete_server_instance to test an instance which is in active state.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"}],"nova/tests/unit/compute/test_compute.py":[{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"258a6c3472aa4f1ec4537d8e64a28a3e2761f539","unresolved":false,"context_lines":[{"line_number":10252,"context_line":"        self.policy.set_rules(rules)"},{"line_number":10253,"context_line":""},{"line_number":10254,"context_line":"        with mock.patch.object(self.compute_api.network_api,"},{"line_number":10255,"context_line":"                               \u0027deallocate_for_instance\u0027):"},{"line_number":10256,"context_line":"            self.compute_api.delete(self.context, instance)"},{"line_number":10257,"context_line":""},{"line_number":10258,"context_line":"    def test_create_fail(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_fb304909","line":10255,"updated":"2015-03-11 12:26:04.000000000","message":"We\u0027re obviously calling deallocate_for_instance here now, which is good. Should probably describe this in the commit message.","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"91ba285f3b201e92f3631b873ae91cc1e5fc25c3","unresolved":false,"context_lines":[{"line_number":10252,"context_line":"        self.policy.set_rules(rules)"},{"line_number":10253,"context_line":""},{"line_number":10254,"context_line":"        with mock.patch.object(self.compute_api.network_api,"},{"line_number":10255,"context_line":"                               \u0027deallocate_for_instance\u0027):"},{"line_number":10256,"context_line":"            self.compute_api.delete(self.context, instance)"},{"line_number":10257,"context_line":""},{"line_number":10258,"context_line":"    def test_create_fail(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_0a1dc573","line":10255,"in_reply_to":"9a80dd14_fb304909","updated":"2015-03-11 14:04:26.000000000","message":"Done","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"}],"nova/tests/unit/compute/test_compute_api.py":[{"author":{"_account_id":8213,"name":"Claudiu Belu","email":"cbelu@cloudbasesolutions.com","username":"claudiub"},"change_message_id":"b7e3a3d742e871cf43550f7b7966ba3aa2a741e9","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_25fd3d3b","line":1007,"updated":"2015-01-22 15:49:46.000000000","message":"i do not really see the point for this. Apparently, you use it to mock some methods. Why not use contextlib like in L512 or L436(i think)?","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"153f9bcb31c38ad792d9b80564c8170c13429bd6","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_a178262c","line":1007,"in_reply_to":"1a930d6b_25fd3d3b","updated":"2015-01-23 08:29:56.000000000","message":"I\u0027ve used it to mock multiple methods because \"contextlib.nested\" is deprecated since Python 2.7 and to eliminate the redundancy I\u0027ve created a private method here.","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":8213,"name":"Claudiu Belu","email":"cbelu@cloudbasesolutions.com","username":"claudiub"},"change_message_id":"b7e3a3d742e871cf43550f7b7966ba3aa2a741e9","unresolved":false,"context_lines":[{"line_number":1012,"context_line":"            self.compute_api.volume_api, \u0027terminate_connection\u0027)"},{"line_number":1013,"context_line":"        detach \u003d _create_patch(self.compute_api.volume_api, \u0027detach\u0027)"},{"line_number":1014,"context_line":"        self.compute_api.delete(self.context, inst)"},{"line_number":1015,"context_line":"        self.assertEqual(1, deallocate_for_instance.call_count)"},{"line_number":1016,"context_line":"        self.assertEqual(1, detach.call_count)"},{"line_number":1017,"context_line":"        terminate_connection.assert_called_once_with(self.context,"},{"line_number":1018,"context_line":"                                                     volume_id, connector)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_85f2716d","line":1015,"updated":"2015-01-22 15:49:46.000000000","message":"please use deallocate_for_instance.assert_called_once_with instead","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"153f9bcb31c38ad792d9b80564c8170c13429bd6","unresolved":false,"context_lines":[{"line_number":1012,"context_line":"            self.compute_api.volume_api, \u0027terminate_connection\u0027)"},{"line_number":1013,"context_line":"        detach \u003d _create_patch(self.compute_api.volume_api, \u0027detach\u0027)"},{"line_number":1014,"context_line":"        self.compute_api.delete(self.context, inst)"},{"line_number":1015,"context_line":"        self.assertEqual(1, deallocate_for_instance.call_count)"},{"line_number":1016,"context_line":"        self.assertEqual(1, detach.call_count)"},{"line_number":1017,"context_line":"        terminate_connection.assert_called_once_with(self.context,"},{"line_number":1018,"context_line":"                                                     volume_id, connector)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_81cfaa7e","line":1015,"in_reply_to":"1a930d6b_85f2716d","updated":"2015-01-23 08:29:56.000000000","message":"Done","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":8213,"name":"Claudiu Belu","email":"cbelu@cloudbasesolutions.com","username":"claudiub"},"change_message_id":"b7e3a3d742e871cf43550f7b7966ba3aa2a741e9","unresolved":false,"context_lines":[{"line_number":1013,"context_line":"        detach \u003d _create_patch(self.compute_api.volume_api, \u0027detach\u0027)"},{"line_number":1014,"context_line":"        self.compute_api.delete(self.context, inst)"},{"line_number":1015,"context_line":"        self.assertEqual(1, deallocate_for_instance.call_count)"},{"line_number":1016,"context_line":"        self.assertEqual(1, detach.call_count)"},{"line_number":1017,"context_line":"        terminate_connection.assert_called_once_with(self.context,"},{"line_number":1018,"context_line":"                                                     volume_id, connector)"},{"line_number":1019,"context_line":"        bdm_destroy.assert_called_once_with()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_05fe8138","line":1016,"updated":"2015-01-22 15:49:46.000000000","message":"ditto","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"153f9bcb31c38ad792d9b80564c8170c13429bd6","unresolved":false,"context_lines":[{"line_number":1013,"context_line":"        detach \u003d _create_patch(self.compute_api.volume_api, \u0027detach\u0027)"},{"line_number":1014,"context_line":"        self.compute_api.delete(self.context, inst)"},{"line_number":1015,"context_line":"        self.assertEqual(1, deallocate_for_instance.call_count)"},{"line_number":1016,"context_line":"        self.assertEqual(1, detach.call_count)"},{"line_number":1017,"context_line":"        terminate_connection.assert_called_once_with(self.context,"},{"line_number":1018,"context_line":"                                                     volume_id, connector)"},{"line_number":1019,"context_line":"        bdm_destroy.assert_called_once_with()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_a1cae66b","line":1016,"in_reply_to":"1a930d6b_05fe8138","updated":"2015-01-23 08:29:56.000000000","message":"Done","commit_id":"3246048080f62e92b75a7fac2e0790819c88141f"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"258a6c3472aa4f1ec4537d8e64a28a3e2761f539","unresolved":false,"context_lines":[{"line_number":966,"context_line":"    @mock.patch.object(objects.InstanceInfoCache, \u0027delete\u0027)"},{"line_number":967,"context_line":"    @mock.patch.object(compute_utils, \u0027notify_about_instance_usage\u0027)"},{"line_number":968,"context_line":"    @mock.patch.object(objects.BlockDeviceMapping, \u0027destroy\u0027)"},{"line_number":969,"context_line":"    @mock.patch.object(db, \u0027instance_destroy\u0027)"},{"line_number":970,"context_line":"    def test_delete_volume_backed_instance_in_error_state("},{"line_number":971,"context_line":"            self, mock_instance_destroy,"},{"line_number":972,"context_line":"            bdm_destroy, notify_about_instance_usage,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_db1c65c4","line":969,"updated":"2015-03-11 12:26:04.000000000","message":"That\u0027s a lot of mocks :( It\u0027s a pretty messy function, though, so I can believe they\u0027re required.","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"258a6c3472aa4f1ec4537d8e64a28a3e2761f539","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_3be741e6","line":1007,"updated":"2015-03-11 12:26:04.000000000","message":"You should use mock.patch.object as a context manager below instead of this function.","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"e13292f618e96642859ac29a96815ed7ddf10709","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_71260c18","line":1007,"in_reply_to":"9a80dd14_34b58bcd","updated":"2015-03-12 08:27:00.000000000","message":"Done.\n\nHowever, it is preferred to wrap long lines in parentheses and not a backslash for line continuation, but it was giving syntax errors in this case of long with statement.\n\nI also found in pep8 standards that backslashes are appropriate in case of long/multiple with -statements. Thank you.\n\nhttps://www.python.org/dev/peps/pep-0008/#maximum-line-length","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"91ba285f3b201e92f3631b873ae91cc1e5fc25c3","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_4a497d8a","line":1007,"in_reply_to":"9a80dd14_3be741e6","updated":"2015-03-11 14:04:26.000000000","message":"I\u0027ve used it to mock multiple methods because \"contextlib.nested\" is deprecated since Python 2.7 and to eliminate the redundancy I\u0027ve created a private method here.\n\nAlternatively I would have to use nested with statements here, but I did not see such occurrences in this module.","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"1e4524f224308402b5dae9248f4958c97d09ffce","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            patcher \u003d mock.patch.object(name, attr)"},{"line_number":1005,"context_line":"            mocked_obj \u003d patcher.start()"},{"line_number":1006,"context_line":"            self.addCleanup(patcher.stop)"},{"line_number":1007,"context_line":"            return mocked_obj"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        deallocate_for_instance \u003d _create_patch("},{"line_number":1010,"context_line":"            self.compute_api.network_api, \u0027deallocate_for_instance\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_34b58bcd","line":1007,"in_reply_to":"9a80dd14_4a497d8a","updated":"2015-03-11 14:39:50.000000000","message":"contextlib.nested is deprecated because the syntax is now part of the language in 2.7:\n\n  with mock.patch.object(self.compute_api.network_api,\n                         \u0027deallocate_for_instance) as dfi,\\\n       mock.patch.object(self.compute_api.volume_api,\n                         \u0027terminate_connection\u0027) as tc,\\\n       mock.patch.object(self.compute_api.volume_api,\n                         \u0027detach\u0027) as d:\n    self.compute_api.delete(self.context, inst)\n\n  dfi.assert...","commit_id":"af1c9ae095e7250d86e634c1994b01ef39293b6a"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"8df18103a1ecec258b4f83638c1cbe0e0bd1af8b","unresolved":false,"context_lines":[{"line_number":993,"context_line":""},{"line_number":994,"context_line":"        with mock.patch.object(self.compute_api.network_api,"},{"line_number":995,"context_line":"                               \u0027deallocate_for_instance\u0027) as mock_deallocate, \\"},{"line_number":996,"context_line":"            mock.patch.object(self.compute_api.volume_api,"},{"line_number":997,"context_line":"                              \u0027terminate_connection\u0027) as mock_terminate_conn, \\"},{"line_number":998,"context_line":"            mock.patch.object(self.compute_api.volume_api,"},{"line_number":999,"context_line":"                              \u0027detach\u0027) as mock_detach:"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_7496fa95","line":996,"updated":"2015-03-12 08:42:58.000000000","message":"Nit: I\u0027d personally indent this to line up with mock above, which would also have the advantage of having different indentation for this block and the block below.","commit_id":"e5651b6538e03577b73c2662a0b093959b08a92d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":957,"context_line":"    @mock.patch.object(objects.InstanceInfoCache, \u0027delete\u0027)"},{"line_number":958,"context_line":"    @mock.patch.object(compute_utils, \u0027notify_about_instance_usage\u0027)"},{"line_number":959,"context_line":"    @mock.patch.object(objects.BlockDeviceMapping, \u0027destroy\u0027)"},{"line_number":960,"context_line":"    @mock.patch.object(db, \u0027instance_destroy\u0027)"},{"line_number":961,"context_line":"    def test_delete_volume_backed_instance_in_error_state("},{"line_number":962,"context_line":"            self, mock_instance_destroy,"},{"line_number":963,"context_line":"            bdm_destroy, notify_about_instance_usage,"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_f3e8857e","line":960,"updated":"2015-03-31 14:34:37.000000000","message":"We shouldn\u0027t be mocking the DB API in tests when we\u0027re using nova.objects.Instance.destroy() in the code, just mock out the calls to the nova object\u0027s destroy method.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":957,"context_line":"    @mock.patch.object(objects.InstanceInfoCache, \u0027delete\u0027)"},{"line_number":958,"context_line":"    @mock.patch.object(compute_utils, \u0027notify_about_instance_usage\u0027)"},{"line_number":959,"context_line":"    @mock.patch.object(objects.BlockDeviceMapping, \u0027destroy\u0027)"},{"line_number":960,"context_line":"    @mock.patch.object(db, \u0027instance_destroy\u0027)"},{"line_number":961,"context_line":"    def test_delete_volume_backed_instance_in_error_state("},{"line_number":962,"context_line":"            self, mock_instance_destroy,"},{"line_number":963,"context_line":"            bdm_destroy, notify_about_instance_usage,"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_b1aa3918","line":960,"in_reply_to":"da9b358b_f3e8857e","updated":"2015-05-06 13:57:10.000000000","message":"Done","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":981,"context_line":"                                        tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":982,"context_line":"        updates \u003d {\u0027deleted_at\u0027: delete_time,"},{"line_number":983,"context_line":"                   \u0027deleted\u0027: True}"},{"line_number":984,"context_line":"        fake_inst \u003d fake_instance.fake_db_instance(**updates)"},{"line_number":985,"context_line":"        mock_instance_destroy.return_value \u003d fake_inst"},{"line_number":986,"context_line":"        bdm_get_by_instance_uuid.return_value \u003d bdms"},{"line_number":987,"context_line":"        mock_reserve.return_value \u003d reservations"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_b3031d42","line":984,"updated":"2015-03-31 14:34:37.000000000","message":"This should be a nova instance object.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":981,"context_line":"                                        tzinfo\u003diso8601.iso8601.Utc())"},{"line_number":982,"context_line":"        updates \u003d {\u0027deleted_at\u0027: delete_time,"},{"line_number":983,"context_line":"                   \u0027deleted\u0027: True}"},{"line_number":984,"context_line":"        fake_inst \u003d fake_instance.fake_db_instance(**updates)"},{"line_number":985,"context_line":"        mock_instance_destroy.return_value \u003d fake_inst"},{"line_number":986,"context_line":"        bdm_get_by_instance_uuid.return_value \u003d bdms"},{"line_number":987,"context_line":"        mock_reserve.return_value \u003d reservations"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_516885f5","line":984,"in_reply_to":"da9b358b_b3031d42","updated":"2015-05-06 13:57:10.000000000","message":"Done","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5a9bba26ae0f67e8e3c4e89dea96988b6c6bf13a","unresolved":false,"context_lines":[{"line_number":999,"context_line":"                              \u0027detach\u0027) as mock_detach:"},{"line_number":1000,"context_line":"            self.compute_api.delete(self.context, inst)"},{"line_number":1001,"context_line":""},{"line_number":1002,"context_line":"        mock_deallocate.assert_called_once_with(mock.ANY, inst)"},{"line_number":1003,"context_line":"        mock_detach.assert_called_once_with(mock.ANY, volume_id)"},{"line_number":1004,"context_line":"        mock_terminate_conn.assert_called_once_with(self.context,"},{"line_number":1005,"context_line":"                                                    volume_id, connector)"}],"source_content_type":"text/x-python","patch_set":7,"id":"da9b358b_f39f6501","line":1002,"updated":"2015-03-31 14:34:37.000000000","message":"Should be testing the proper contexts.","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"71737403c27b4e666931288ec94b4db86ed7a681","unresolved":false,"context_lines":[{"line_number":999,"context_line":"                              \u0027detach\u0027) as mock_detach:"},{"line_number":1000,"context_line":"            self.compute_api.delete(self.context, inst)"},{"line_number":1001,"context_line":""},{"line_number":1002,"context_line":"        mock_deallocate.assert_called_once_with(mock.ANY, inst)"},{"line_number":1003,"context_line":"        mock_detach.assert_called_once_with(mock.ANY, volume_id)"},{"line_number":1004,"context_line":"        mock_terminate_conn.assert_called_once_with(self.context,"},{"line_number":1005,"context_line":"                                                    volume_id, connector)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1aca2d91_316d0905","line":1002,"in_reply_to":"da9b358b_f39f6501","updated":"2015-05-06 13:57:10.000000000","message":"Done","commit_id":"d2cfa2fe52339b4eda66b6e5d097b7b221091c7c"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9dcb38dbb759de1687fcb92a12d0709d97c44aef","unresolved":false,"context_lines":[{"line_number":963,"context_line":"            notify_about_instance_usage, mock_delete,"},{"line_number":964,"context_line":"            mock_reserve, mock_save, mock_elevated,"},{"line_number":965,"context_line":"            bdm_get_by_instance_uuid):"},{"line_number":966,"context_line":"        if self.cell_type \u003d\u003d \u0027api\u0027:"},{"line_number":967,"context_line":"            # In \u0027api\u0027 cell, the callback terminate_instance will"},{"line_number":968,"context_line":"            # get called, and quota will be committed before returning."},{"line_number":969,"context_line":"            # It doesn\u0027t check for below condition, hence skipping the test."}],"source_content_type":"text/x-python","patch_set":11,"id":"1aca2d91_03975591","line":966,"updated":"2015-05-06 19:26:11.000000000","message":"This won\u0027t ever be true here, or at least shouldn\u0027t be, so you can leave it out.  Unless the test class or method explicitly turns on cell options you can ignore them.  And most of those tests are in the cells test directory.","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"1a2764067a34568cf5971cdf32392bd2039ad953","unresolved":false,"context_lines":[{"line_number":963,"context_line":"            notify_about_instance_usage, mock_delete,"},{"line_number":964,"context_line":"            mock_reserve, mock_save, mock_elevated,"},{"line_number":965,"context_line":"            bdm_get_by_instance_uuid):"},{"line_number":966,"context_line":"        if self.cell_type \u003d\u003d \u0027api\u0027:"},{"line_number":967,"context_line":"            # In \u0027api\u0027 cell, the callback terminate_instance will"},{"line_number":968,"context_line":"            # get called, and quota will be committed before returning."},{"line_number":969,"context_line":"            # It doesn\u0027t check for below condition, hence skipping the test."}],"source_content_type":"text/x-python","patch_set":11,"id":"1aca2d91_6bd6cec6","line":966,"in_reply_to":"1aca2d91_03975591","updated":"2015-05-07 07:51:49.000000000","message":"If we remove this condition then following  unit test case fails:\n\"tests.unit.compute.test_compute_api.ComputeAPIAPICellUnitTestCase.test_delete_volume_backed_instance_in_error_state\"\n\nThis is because ComputeAPIAPICellUnitTestCase test class setup method explicitly turns on cell options at line #2860.","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"e6ef8db271118a6e3858add92088fa95572c5f06","unresolved":false,"context_lines":[{"line_number":963,"context_line":"            notify_about_instance_usage, mock_delete,"},{"line_number":964,"context_line":"            mock_reserve, mock_save, mock_elevated,"},{"line_number":965,"context_line":"            bdm_get_by_instance_uuid):"},{"line_number":966,"context_line":"        if self.cell_type \u003d\u003d \u0027api\u0027:"},{"line_number":967,"context_line":"            # In \u0027api\u0027 cell, the callback terminate_instance will"},{"line_number":968,"context_line":"            # get called, and quota will be committed before returning."},{"line_number":969,"context_line":"            # It doesn\u0027t check for below condition, hence skipping the test."}],"source_content_type":"text/x-python","patch_set":11,"id":"1aca2d91_fd15b73f","line":966,"in_reply_to":"1aca2d91_6bd6cec6","updated":"2015-05-08 20:52:17.000000000","message":"Okay.  I forgot that there were cell tests here too.","commit_id":"a34fd26866de4463752b87da41f7f8cb72985cd4"}]}
