[sanlock] 02/02: build: Remove python 2 build
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit ada5573f54665d637195e6efb035c3d3eec2a69e
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Thu Dec 10 22:27:46 2020 +0200
build: Remove python 2 build
Python 2 is EOL since Jan 2020, but we kept the option to build for
python2. Remove this option so we can remove the python 2 hacks from the
sanlock C extension module.
Users that want python 2 support should use sanlock <= 3.8.2.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
python/Makefile | 2 +-
sanlock.spec.in | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/python/Makefile b/python/Makefile
index 2caf6a8..9fd2691 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -4,7 +4,7 @@
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
-PYTHON := python$(PY_VERSION)
+PYTHON := python3
all:
$(PYTHON) setup.py build $(BUILDARGS)
diff --git a/sanlock.spec.in b/sanlock.spec.in
index b14da9b..975bd4e 100644
--- a/sanlock.spec.in
+++ b/sanlock.spec.in
@@ -46,7 +46,7 @@ The sanlock daemon manages leases for applications on hosts using shared storage
# upstream does not support _smp_mflags
CFLAGS=$RPM_OPT_FLAGS make -C wdmd
CFLAGS=$RPM_OPT_FLAGS make -C src
-CFLAGS=$RPM_OPT_FLAGS make -C python PY_VERSION=3
+CFLAGS=$RPM_OPT_FLAGS make -C python
CFLAGS=$RPM_OPT_FLAGS make -C reset
%install
@@ -59,8 +59,7 @@ make -C wdmd \
DESTDIR=$RPM_BUILD_ROOT
make -C python \
install LIBDIR=%{_libdir} \
- DESTDIR=$RPM_BUILD_ROOT \
- PY_VERSION=3
+ DESTDIR=$RPM_BUILD_ROOT
make -C reset \
install LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[sanlock] 01/02: tests: Remove six dependency
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 2ff36a7058c2e09280cb0ce226accb757d0e2e27
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Thu Dec 10 22:16:33 2020 +0200
tests: Remove six dependency
The six library was used to test backward compatibility with python 2.
We don't support python 2 now so we don't need the special tests and the
six library.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/python_test.py | 96 ++++++++++++++++++----------------------------------
tox.ini | 1 -
2 files changed, 32 insertions(+), 65 deletions(-)
diff --git a/tests/python_test.py b/tests/python_test.py
index 9eb476f..d86ba50 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -17,7 +17,6 @@ import time
from contextlib import contextmanager
import pytest
-import six
import sanlock
@@ -49,22 +48,7 @@ FILE_NAMES = [
(u"\u05d0", "utf-8"),
]
-LOCKSPACE_OR_RESOURCE_NAMES = [
- # Bytes are supported with python 2 and 3.
- pytest.param(b"\xd7\x90"),
- # Python 2 also supports str.
- pytest.param(
- "\xd7\x90",
- marks=pytest.mark.skipif(
- six.PY3,
- reason="python 3 supports only bytes")),
- # Python 2 also supports unicode with ascii content.
- pytest.param(
- u"ascii",
- marks=pytest.mark.skipif(
- six.PY3,
- reason="python 3 supports only bytes")),
-]
+NAME = b"\xd7\x90" # Unicode Hebrew Alef using utf-8 encoding.
@pytest.mark.parametrize("filename, encoding", FILE_NAMES)
@@ -563,42 +547,36 @@ def raises_sanlock_errno(expected_errno=errno.ECONNREFUSED):
assert e.value.errno == expected_errno
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_rem_lockspace_parse_args(no_sanlock_daemon, name, filename, encoding):
+def test_rem_lockspace_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
with raises_sanlock_errno():
- sanlock.rem_lockspace(name, 1, path, 0, wait=False)
+ sanlock.rem_lockspace(NAME, 1, path, 0, wait=False)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_add_lockspace_parse_args(no_sanlock_daemon, name, filename, encoding):
+def test_add_lockspace_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
with raises_sanlock_errno():
- sanlock.add_lockspace(name, 1, path, 0, wait=False)
+ sanlock.add_lockspace(NAME, 1, path, 0, wait=False)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_write_lockspace_parse_args(
- no_sanlock_daemon, name, filename, encoding):
+def test_write_lockspace_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
with raises_sanlock_errno():
- sanlock.write_lockspace(name, path)
+ sanlock.write_lockspace(NAME, path)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_write_resource_parse_args(
- no_sanlock_daemon, name, filename, encoding):
+def test_write_resource_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
disks = [(path, 0)]
with raises_sanlock_errno():
- sanlock.write_resource(name, b"res_name", disks)
+ sanlock.write_resource(NAME, b"res_name", disks)
with raises_sanlock_errno():
- sanlock.write_resource(b"ls_name", name, disks)
+ sanlock.write_resource(b"ls_name", NAME, disks)
def test_write_resource_path_length(no_sanlock_daemon):
@@ -611,17 +589,15 @@ def test_write_resource_path_length(no_sanlock_daemon):
sanlock.write_resource(b"ls_name", b"res_name", [(path, 0)])
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_release_resource_parse_args(
- no_sanlock_daemon, name, filename, encoding):
+def test_release_resource_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
disks = [(path, 0)]
with raises_sanlock_errno():
- sanlock.release(name, b"res_name", disks)
+ sanlock.release(NAME, b"res_name", disks)
with raises_sanlock_errno():
- sanlock.release(b"ls_name", name, disks)
+ sanlock.release(b"ls_name", NAME, disks)
def test_release_resource_path_length(no_sanlock_daemon):
@@ -634,17 +610,16 @@ def test_release_resource_path_length(no_sanlock_daemon):
sanlock.release(b"ls_name", b"res_name", [(path, 0)])
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
def test_read_resource_owners_parse_args(
- no_sanlock_daemon, name, filename, encoding):
+ no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
disks = [(path, 0)]
with raises_sanlock_errno():
- sanlock.read_resource_owners(name, b"res_name", disks)
+ sanlock.read_resource_owners(NAME, b"res_name", disks)
with raises_sanlock_errno():
- sanlock.read_resource_owners(b"ls_name", name, disks)
+ sanlock.read_resource_owners(b"ls_name", NAME, disks)
def test_read_resource_owners_path_length(no_sanlock_daemon):
@@ -657,36 +632,31 @@ def test_read_resource_owners_path_length(no_sanlock_daemon):
sanlock.read_resource_owners(b"ls_name", b"res_name", [(path, 0)])
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
-def test_get_hosts_parse_args(no_sanlock_daemon, name):
+def test_get_hosts_parse_args(no_sanlock_daemon):
with raises_sanlock_errno():
- sanlock.get_hosts(name, 1)
+ sanlock.get_hosts(NAME, 1)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_inq_lockspace_parse_args(no_sanlock_daemon, name, filename, encoding):
+def test_inq_lockspace_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
with raises_sanlock_errno():
- sanlock.inq_lockspace(name, 1, path, wait=False)
+ sanlock.inq_lockspace(NAME, 1, path, wait=False)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
-def test_reg_event_parse_args(no_sanlock_daemon, name):
+def test_reg_event_parse_args(no_sanlock_daemon):
with raises_sanlock_errno():
- sanlock.reg_event(name)
+ sanlock.reg_event(NAME)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
-def test_end_event_parse_args(no_sanlock_daemon, name):
+def test_end_event_parse_args(no_sanlock_daemon):
with raises_sanlock_errno(errno.EALREADY):
- sanlock.end_event(-1, name)
+ sanlock.end_event(-1, NAME)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
-def test_set_event_parse_args(no_sanlock_daemon, name):
+def test_set_event_parse_args(no_sanlock_daemon):
with raises_sanlock_errno():
- sanlock.set_event(name, 1, 1, 1)
+ sanlock.set_event(NAME, 1, 1, 1)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
@@ -720,17 +690,16 @@ def test_read_resource_path_length(no_sanlock_daemon):
sanlock.read_resource(path)
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_request_parse_args(no_sanlock_daemon, name, filename, encoding):
+def test_request_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
disks = [(path, 0)]
with raises_sanlock_errno():
- sanlock.request(b"ls_name", name, disks)
+ sanlock.request(b"ls_name", NAME, disks)
with raises_sanlock_errno():
- sanlock.request(name, b"res_name", disks)
+ sanlock.request(NAME, b"res_name", disks)
def test_request_path_length(no_sanlock_daemon):
@@ -743,17 +712,16 @@ def test_request_path_length(no_sanlock_daemon):
sanlock.request(b"ls_name", b"res_name", [(path, 0)])
-(a)pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
-def test_acquire_parse_args(no_sanlock_daemon, name, filename, encoding):
+def test_acquire_parse_args(no_sanlock_daemon, filename, encoding):
path = util.generate_path("/tmp/", filename, encoding)
disks = [(path, 0)]
with raises_sanlock_errno():
- sanlock.acquire(b"ls_name", name, disks, pid=os.getpid())
+ sanlock.acquire(b"ls_name", NAME, disks, pid=os.getpid())
with raises_sanlock_errno():
- sanlock.acquire(name, b"res_name", disks, pid=os.getpid())
+ sanlock.acquire(NAME, b"res_name", disks, pid=os.getpid())
def test_acquire_path_length(no_sanlock_daemon):
diff --git a/tox.ini b/tox.ini
index e72937f..ee871ef 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,7 +17,6 @@ setenv =
whitelist_externals = make
deps =
pytest
- six
commands =
py{36,37,38}: make BUILDARGS="--build-lib={envsitepackagesdir}"
pytest {posargs}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[PATCH v2 0/2] Python 2 cleanups
by Nir Soffer
Python 2 is EOL since Jan 2020. It is time to drop the hacks needed to support
it. These patches remove python 2 only tetss and build.
Move work is needed to remove python 2 special code from the C extension modu=
le.
Nir Soffer (2):
tests: Remove six dependency
build: Remove python 2 build
python/Makefile | 2 +-
sanlock.spec.in | 5 +--
tests/python_test.py | 96 +++++++++++++++-----------------------------
tox.ini | 1 -
4 files changed, 35 insertions(+), 69 deletions(-)
--=20
2.26.2
2 years, 9 months
[sanlock] 03/03: python: improve lvb tests
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 2188f359a340690a2ed4f975c6a6703adeafa73b
Author: Benny Zlotnik <bzlotnik(a)redhat.com>
AuthorDate: Wed Dec 9 19:14:36 2020 +0200
python: improve lvb tests
- Remove null byte test, it is now tested in the basic test
- Add test for reading less than sector size
Testing storage with 4k sector size needs more work.
Signed-off-by: Benny Zlotnik <bzlotnik(a)redhat.com>
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/python_test.py | 64 ++++++++++++++++++----------------------------------
1 file changed, 22 insertions(+), 42 deletions(-)
diff --git a/tests/python_test.py b/tests/python_test.py
index 28fd27f..9eb476f 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -769,70 +769,50 @@ def test_acquire_path_length(no_sanlock_daemon):
def test_lvb(tmpdir, sanlock_daemon):
ls_path = str(tmpdir.join("ls_name"))
util.create_file(ls_path, MiB)
-
res_path = str(tmpdir.join("res_name"))
util.create_file(res_path, MiB)
-
sanlock.write_lockspace(b"ls_name", ls_path, offset=0, iotimeout=1)
sanlock.add_lockspace(b"ls_name", 1, ls_path, offset=0, iotimeout=1)
-
disks = [(res_path, 0)]
sanlock.write_resource(b"ls_name", b"res_name", disks)
fd = sanlock.register()
- sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
- sanlock.set_lvb(b"ls_name", b"res_name", disks, b"{gen:0}")
+ lvb_data = b"first\0second"
+ lvb_sector = lvb_data.ljust(512, b"\0")
- result = sanlock.get_lvb(b"ls_name", b"res_name", disks)
+ sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
+ sanlock.set_lvb(b"ls_name", b"res_name", disks, lvb_sector)
sanlock.release(b"ls_name", b"res_name", disks, slkfd=fd)
- assert result == b"{gen:0}"
+ # Test reading complete sector (typical usage).
+ sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
+ result = sanlock.get_lvb(b"ls_name", b"res_name", disks, len(lvb_sector))
+ sanlock.release(b"ls_name", b"res_name", disks, slkfd=fd)
-def test_lvb_value_too_long(tmpdir, sanlock_daemon):
- ls_path = str(tmpdir.join("ls_name"))
- util.create_file(ls_path, MiB)
-
- res_path = str(tmpdir.join("res_name"))
- util.create_file(res_path, MiB)
-
- sanlock.write_lockspace(b"ls_name", ls_path, offset=0, iotimeout=1)
- sanlock.add_lockspace(b"ls_name", 1, ls_path, offset=0, iotimeout=1)
-
- disks = [(res_path, 0)]
- sanlock.write_resource(b"ls_name", b"res_name", disks)
+ assert result == lvb_sector
- fd = sanlock.register()
+ # Test reading less than sector size.
- long_val = b"a" * 513
sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
- with raises_sanlock_errno(errno.E2BIG):
- sanlock.set_lvb(b"ls_name", b"res_name", disks, long_val)
-
+ result = sanlock.get_lvb(b"ls_name", b"res_name", disks, len(lvb_data))
sanlock.release(b"ls_name", b"res_name", disks, slkfd=fd)
+ assert result == lvb_data
-def test_lvb_null_bytes(tmpdir, sanlock_daemon):
- ls_path = str(tmpdir.join("ls_name"))
- util.create_file(ls_path, MiB)
-
- res_path = str(tmpdir.join("res_name"))
- util.create_file(res_path, MiB)
-
- sanlock.write_lockspace(b"ls_name", ls_path, offset=0, iotimeout=1)
- sanlock.add_lockspace(b"ls_name", 1, ls_path, offset=0, iotimeout=1)
+ # Test failure to write more then sector size.
- disks = [(res_path, 0)]
- sanlock.write_resource(b"ls_name", b"res_name", disks)
+ sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
+ with raises_sanlock_errno(errno.E2BIG):
+ sanlock.set_lvb(b"ls_name", b"res_name", disks, lvb_sector + b"x")
- fd = sanlock.register()
- sanlock.acquire(b"ls_name", b"res_name", disks, slkfd=fd, lvb=True)
- sanlock.set_lvb(b"ls_name", b"res_name", disks, b"{ge\x00:0}")
+def test_lvb_invalid_value():
+ disks = [("/no/such/path", 0)]
- result = sanlock.get_lvb(b"ls_name", b"res_name", disks)
- sanlock.release(b"ls_name", b"res_name", disks, slkfd=fd)
+ with pytest.raises(ValueError):
+ sanlock.get_lvb(b"ls_name", b"res_name", disks, 0)
- # Check that the string we passed is terminated by the null-byte
- assert result == b"{ge"
+ with pytest.raises(ValueError):
+ sanlock.get_lvb(b"ls_name", b"res_name", disks, 4097)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[sanlock] 02/03: python: support size in get_lvb
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit ecc9fe644c17d1e6603d76f3a8f99917e00e1073
Author: Benny Zlotnik <bzlotnik(a)redhat.com>
AuthorDate: Wed Dec 9 16:36:09 2020 +0200
python: support size in get_lvb
Add a size parameter to allow the user choose how much data to get back,
the API will now look like this:
sanlock.get_lvb(lockspace, resource, disks, size)
Signed-off-by: Benny Zlotnik <bzlotnik(a)redhat.com>
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
python/sanlock.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index 7c1a13f..67d34fc 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -1653,35 +1653,43 @@ finally:
}
PyDoc_STRVAR(pydoc_get_lvb, "\
-get_lvb(lockspace, resource, disks) -> bytes\n\
+get_lvb(lockspace, resource, disks, size) -> bytes\n\
Read Lock Value Block for a given resource\n\
\n\
Arguments\n\
lockspace lockspace name (str)\n\
resource resource name (int)\n\
disks path and offset (tuple)\n\
+ size amount of data to read (int)\n\
\n\
Returns\n\
data data written with set_lvb\n\
\n\
Notes\n\
The resource must be acquired with lvb=True.\n\
+ size has to be in range 0 < n <= 4096.\n\
");
static PyObject *
py_get_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
uint32_t flags = 0;
+ uint32_t lvb_len = 0;
int rv = -1;
struct sanlk_resource *res = NULL;
PyObject *lockspace = NULL, *resource = NULL;
- PyObject *disks;
- char data[512];
+ PyObject *disks = NULL;
+ PyObject *result = NULL;
- static char *kwlist[] = {"lockspace", "resource", "disks", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, keywds, "O&O&O!", kwlist,
+ static char *kwlist[] = {"lockspace", "resource", "disks", "size", NULL};
+ if (!PyArg_ParseTupleAndKeywords(args, keywds, "O&O&O!I", kwlist,
convert_to_pybytes, &lockspace, convert_to_pybytes, &resource,
- &PyList_Type, &disks)) {
+ &PyList_Type, &disks, &lvb_len)) {
+ goto finally;
+ }
+
+ if (lvb_len < 1 || lvb_len > 4096) {
+ PyErr_Format(PyExc_ValueError, "Invalid size %d, must be in range: 0 < size <= 4096", lvb_len);
goto finally;
}
@@ -1692,8 +1700,15 @@ py_get_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
strncpy(res->lockspace_name, PyBytes_AsString(lockspace), SANLK_NAME_LEN);
strncpy(res->name, PyBytes_AsString(resource), SANLK_NAME_LEN);
+ result = PyBytes_FromStringAndSize(NULL, lvb_len);
+ if (result == NULL) {
+ goto finally;
+ }
+
+ memset(PyBytes_AS_STRING(result), 0, lvb_len);
+
Py_BEGIN_ALLOW_THREADS
- rv = sanlock_get_lvb(flags, res, data, sizeof(data));
+ rv = sanlock_get_lvb(flags, res, PyBytes_AS_STRING(result), lvb_len);
Py_END_ALLOW_THREADS
if (rv < 0) {
@@ -1706,9 +1721,9 @@ finally:
Py_XDECREF(resource);
free(res);
if (rv < 0)
- return NULL;
+ Py_CLEAR(result);
- return Py_BuildValue("y", data);
+ return result;
}
static PyMethodDef
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[sanlock] 01/03: python: improve get/set_lvb documentation
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit cb06607f19920b9f68c0aa81e7533638b25f01b9
Author: Benny Zlotnik <bzlotnik(a)redhat.com>
AuthorDate: Wed Dec 9 09:57:54 2020 +0200
python: improve get/set_lvb documentation
- Specify lvb=True explicitly instead of mentioning the sanlock flag
- Document when data is written and visible
- Unify whitespace in function documentation, consistent with other
functions.
Signed-off-by: Benny Zlotnik <bzlotnik(a)redhat.com>
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
python/sanlock.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index fbcabb1..7c1a13f 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -1606,8 +1606,11 @@ Arguments\n\
data data to write (bytes)\n\
\n\
Notes\n\
-\n\
-The resource must be acquired with the SANLK_ACQUIRE_LVB flag\n");
+ The resource must be acquired with lvb=true.\n\
+ The size of data is limited by the sector size (512/4K).\n\
+ The new data is visible after the resource is released.\n\
+");
+
static PyObject *
py_set_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
@@ -1660,9 +1663,11 @@ Arguments\n\
\n\
Returns\n\
data data written with set_lvb\n\
-Notes\n\
\n\
-The resource must be acquired with the SANLK_ACQUIRE_LVB flag\n");
+Notes\n\
+ The resource must be acquired with lvb=True.\n\
+");
+
static PyObject *
py_get_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[PATCH v2 1/3] python: improve get/set_lvb documentation
by Benny Zlotnik
- Specify lvb=True explicitly instead of mentioning the sanlock flag
- Document when data is written and visible
Signed-off-by: Benny Zlotnik <bzlotnik(a)redhat.com>
---
Changes in v2:
Remove newline and missing newline
python/sanlock.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index fbcabb1..8a45bff 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -1607,7 +1607,9 @@ Arguments\n\
\n\
Notes\n\
\n\
-The resource must be acquired with the SANLK_ACQUIRE_LVB flag\n");
+The resource must be acquired with lvb=true.\n\
+The size of data is limited by the sector size (512/4K).\n\
+The new data is visible after the resource is released\n");
static PyObject *
py_set_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
@@ -1660,9 +1662,9 @@ Arguments\n\
\n\
Returns\n\
data data written with set_lvb\n\
-Notes\n\
\n\
-The resource must be acquired with the SANLK_ACQUIRE_LVB flag\n");
+Notes\n\
+The resource must be acquired with lvb=True\n");
static PyObject *
py_get_lvb(PyObject *self __unused, PyObject *args, PyObject *keywds)
{
--
2.28.0
2 years, 9 months
[sanlock] branch master updated: tox: Remove pytest version
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
The following commit(s) were added to refs/heads/master by this push:
new 2f21820 tox: Remove pytest version
2f21820 is described below
commit 2f21820bef2ddcd818a24ce5879e499a1b93f607
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Thu Dec 10 18:36:41 2020 +0200
tox: Remove pytest version
pytest 4.0 is too old. It was needed when we supported python 2 but we
don't since Jan 2020. Lets use latest pytest.
With newer pytest six is missing. We need to remove usage of six but
lets starts by adding it in the tests.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tox.ini | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tox.ini b/tox.ini
index 487158d..e72937f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,7 +16,8 @@ setenv =
SANLOCK_RUN_DIR=/tmp/sanlock
whitelist_externals = make
deps =
- pytest==4.0
+ pytest
+ six
commands =
py{36,37,38}: make BUILDARGS="--build-lib={envsitepackagesdir}"
pytest {posargs}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 9 months
[PATCH v2 0/4] Add python bindings to set_lvb and get_lvb
by Benny Zlotnik
This patch series adds python bindings to writing (set_lvb) and reading
(get_lvb) data to and from the Lock Value Block of a sanlock resource,
as well as support for an lvb flag in sanlock#acquire.
Github branch: https://github.com/bennyz/sanlock/tree/get_set_lvb
Benny Zlotnik (4):
python: add lvb flag to sanlock.acquire
python: expose set_lvb
python: expose get_lvb
tests: add a test for LVB operation
python/sanlock.c | 138 ++++++++++++++++++++++++++++++++++++++++---
tests/python_test.py | 72 ++++++++++++++++++++++
2 files changed, 203 insertions(+), 7 deletions(-)
--
2.28.0
2 years, 9 months