)]}'
{"trove/instance/models.py":[{"author":{"_account_id":14576,"name":"Petr Malik","email":"pmalik@tesora.com","username":"pmalik"},"change_message_id":"e7bf658c329052d1d9534058567539519f8c87ca","unresolved":false,"context_lines":[{"line_number":607,"context_line":""},{"line_number":608,"context_line":"    def delete_async(self):"},{"line_number":609,"context_line":"        deleted_at \u003d datetime.utcnow()"},{"line_number":610,"context_line":"        self._delete_resources(deleted_at)"},{"line_number":611,"context_line":"        LOG.debug(\"Setting instance %s to be deleted.\", self.id)"},{"line_number":612,"context_line":"        self.update_db(deleted\u003dTrue, deleted_at\u003ddeleted_at,"},{"line_number":613,"context_line":"                       task_status\u003dInstanceTasks.NONE)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3aaa91ec_745f3c41","line":610,"updated":"2016-06-30 00:29:19.000000000","message":"I think the reason why the code here does not handle it is here: https://github.com/openstack/trove/blob/master/trove/taskmanager/manager.py#L260\n\nI bet that \u0027FreshInstanceTasks\u0027 is used if the Nova does not exist. \u0027FreshInstanceTasks\u0027 as opposed to \u0027BuiltInstanceTasks\u0027 does not override the above \u0027_delete_resources\u0027. The base (pass) implementation is used.\n\nThe code would probably belong there...","commit_id":"c8124add1175a3c96f19b512062168c4f8fc1ba8"},{"author":{"_account_id":21668,"name":"Ali Asgar Adil","email":"aadil@tesora.com","username":"aliaadil"},"change_message_id":"14843f0a473ac042c99ea6d0e1c88ff09485e7bf","unresolved":false,"context_lines":[{"line_number":607,"context_line":""},{"line_number":608,"context_line":"    def delete_async(self):"},{"line_number":609,"context_line":"        deleted_at \u003d datetime.utcnow()"},{"line_number":610,"context_line":"        self._delete_resources(deleted_at)"},{"line_number":611,"context_line":"        LOG.debug(\"Setting instance %s to be deleted.\", self.id)"},{"line_number":612,"context_line":"        self.update_db(deleted\u003dTrue, deleted_at\u003ddeleted_at,"},{"line_number":613,"context_line":"                       task_status\u003dInstanceTasks.NONE)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3aaa91ec_9e7622a2","line":610,"in_reply_to":"3aaa91ec_745f3c41","updated":"2016-06-30 15:47:56.000000000","message":"Yes, \u0027FreshInstanceTasks\u0027 is used and the base(pass) implementation of _delete_resources is being used. I created a _delete_resources function in \u0027FreshInstanceTasks\u0027 and moved the code there.","commit_id":"c8124add1175a3c96f19b512062168c4f8fc1ba8"},{"author":{"_account_id":19902,"name":"zzxwill","email":"zzxwill@gmail.com","username":"zzxwill"},"change_message_id":"b1f121f6bd04f7ffb42221cb2ae4a31e35e589e7","unresolved":false,"context_lines":[{"line_number":612,"context_line":"        self.update_db(deleted\u003dTrue, deleted_at\u003ddeleted_at,"},{"line_number":613,"context_line":"                       task_status\u003dInstanceTasks.NONE)"},{"line_number":614,"context_line":"        self.set_servicestatus_deleted()"},{"line_number":615,"context_line":"        volume_client \u003d create_cinder_client(self.context)"},{"line_number":616,"context_line":"        volume \u003d volume_client.volumes.get(self.volume_id)"},{"line_number":617,"context_line":"        if volume.status \u003d\u003d \"available\":"},{"line_number":618,"context_line":"            LOG.info(_(\"Deleting volume %(v)s for instance: %(i)s.\")"},{"line_number":619,"context_line":"                     % {\u0027v\u0027: self.volume_id, \u0027i\u0027: self.id})"},{"line_number":620,"context_line":"            volume.delete()"},{"line_number":621,"context_line":"        # Delete associated security group"},{"line_number":622,"context_line":"        if CONF.trove_security_groups_support:"},{"line_number":623,"context_line":"            SecurityGroup.delete_for_instance(self.db_info.id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3aaa91ec_e50e4ee4","line":620,"range":{"start_line":615,"start_character":0,"end_line":620,"end_character":27},"updated":"2016-06-28 06:51:32.000000000","message":"As you mentioned \u0027the nova instance fails to be created\u0027, you might need to check the status of the instance before deleting volumes.","commit_id":"c8124add1175a3c96f19b512062168c4f8fc1ba8"},{"author":{"_account_id":21668,"name":"Ali Asgar Adil","email":"aadil@tesora.com","username":"aliaadil"},"change_message_id":"6445d50064b6f435b24503d58c65b085e4b2f1b6","unresolved":false,"context_lines":[{"line_number":612,"context_line":"        self.update_db(deleted\u003dTrue, deleted_at\u003ddeleted_at,"},{"line_number":613,"context_line":"                       task_status\u003dInstanceTasks.NONE)"},{"line_number":614,"context_line":"        self.set_servicestatus_deleted()"},{"line_number":615,"context_line":"        volume_client \u003d create_cinder_client(self.context)"},{"line_number":616,"context_line":"        volume \u003d volume_client.volumes.get(self.volume_id)"},{"line_number":617,"context_line":"        if volume.status \u003d\u003d \"available\":"},{"line_number":618,"context_line":"            LOG.info(_(\"Deleting volume %(v)s for instance: %(i)s.\")"},{"line_number":619,"context_line":"                     % {\u0027v\u0027: self.volume_id, \u0027i\u0027: self.id})"},{"line_number":620,"context_line":"            volume.delete()"},{"line_number":621,"context_line":"        # Delete associated security group"},{"line_number":622,"context_line":"        if CONF.trove_security_groups_support:"},{"line_number":623,"context_line":"            SecurityGroup.delete_for_instance(self.db_info.id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3aaa91ec_6bc97a79","line":620,"range":{"start_line":615,"start_character":0,"end_line":620,"end_character":27},"in_reply_to":"3aaa91ec_e50e4ee4","updated":"2016-06-28 13:41:57.000000000","message":"If a nova instance is created the volume status when deleting  at this point will be \"deleting\". The status of the volume will only be \"available\" if it is not attached to a nova instance.","commit_id":"c8124add1175a3c96f19b512062168c4f8fc1ba8"}]}
