Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ repos:
additional_dependencies:
- toml
- repo: https://github.com/python/black
rev: 23.3.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
rev: v4.0.3
hooks:
- id: reuse
7 changes: 7 additions & 0 deletions src/iscsi.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

from cpython.bytes cimport PyBytes_FromStringAndSize
from libc.stdint cimport uint32_t
from libc.stdlib cimport calloc


Expand Down Expand Up @@ -91,6 +92,8 @@ cdef extern from "iscsi/iscsi.h":
cdef iscsi_discovery_address *iscsi_discovery_sync(iscsi_context *iscsi)
cdef void iscsi_free_discovery_data(iscsi_context *iscsi, iscsi_discovery_address *da)

cdef int iscsi_task_mgmt_lun_reset_sync(iscsi_context *iscsi, uint32_t lun)

cdef class Task:
cdef scsi_task *_task

Expand Down Expand Up @@ -147,6 +150,10 @@ cdef class Context:
if iscsi_disconnect(self._ctx) < 0:
raise RuntimeError("Disconnection error.")

def lun_reset(self, int lun):
if iscsi_task_mgmt_lun_reset_sync(self._ctx, lun) < 0:
raise RuntimeError("LUN RESET failed for lun %d" % lun)

def command(self, int lun, Task task, bytearray data_out, bytearray data_in):
# Get the data in/out bytearrays here so that Python can't change them.
cdef unsigned char[:] data_out_view = data_out
Expand Down
Loading