From 2cccf8d61db948f0dd1b7b5574eb13540a2fad16 Mon Sep 17 00:00:00 2001 From: Brian M Date: Thu, 30 Apr 2026 11:25:45 -0700 Subject: [PATCH 1/2] Add Context.lun_reset() to expose iscsi_task_mgmt_lun_reset_sync --- src/iscsi.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/iscsi.pyx b/src/iscsi.pyx index 4186d98..dbd69ed 100644 --- a/src/iscsi.pyx +++ b/src/iscsi.pyx @@ -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 @@ -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 @@ -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 From ec47f0964651fbccc0fe941d2f5333d8bc10dc72 Mon Sep 17 00:00:00 2001 From: Brian M Date: Thu, 30 Apr 2026 11:40:14 -0700 Subject: [PATCH 2/2] Bump pre-commit hooks for Python 3.12/3.14 compatibility Bump black, flake8 and reuse --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29c1e5b..9388012 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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