'Ensure all information about a SnapMirror relationship is removed.
1. Abort SnapMirror
2. Delete the SnapMirror
3. Release SnapMirror to cleanup SnapMirror metadata and snapshots'

def delete_snapmirror(self, src_backend_name, dest_backend_name, src_flexvol_name, dest_flexvol_name, release=True):

    dest_backend_config = config_utils.get_backend_configuration(dest_backend_name)
    dest_vserver = dest_backend_config.netapp_vserver
    dest_client = config_utils.get_client_for_backend(dest_backend_name, vserver_name=dest_vserver)
    source_backend_config = config_utils.get_backend_configuration(src_backend_name)
    src_vserver = source_backend_config.netapp_vserver
    try:
        dest_client.abort_snapmirror(src_vserver, src_flexvol_name, dest_vserver, dest_flexvol_name, clear_checkpoint=False)
    except netapp_api.NaApiError:
        pass
    try:
        dest_client.delete_snapmirror(src_vserver, src_flexvol_name, dest_vserver, dest_flexvol_name)
    except netapp_api.NaApiError as e:
        with excutils.save_and_reraise_exception() as exc_context:
            if ((e.code == netapp_api.EOBJECTNOTFOUND) or (e.code == netapp_api.ESOURCE_IS_DIFFERENT) or (ENTRY_DOES_NOT_EXIST in e.message)):
                LOG.info('No    SnapMirror    relationship    to    delete.')
                exc_context.reraise = False
    if release:
        try:
            src_client = config_utils.get_client_for_backend(src_backend_name, vserver_name=src_vserver)
        except Exception:
            src_client = None
        try:
            if src_client:
                src_client.release_snapmirror(src_vserver, src_flexvol_name, dest_vserver, dest_flexvol_name)
        except netapp_api.NaApiError as e:
            with excutils.save_and_reraise_exception() as exc_context:
                if ((e.code == netapp_api.EOBJECTNOTFOUND) or (e.code == netapp_api.ESOURCE_IS_DIFFERENT) or (ENTRY_DOES_NOT_EXIST in e.message)):
                    exc_context.reraise = False
