Update to sanlock-3.7.3
- Update to sanlock-3.7.3, completing 4K API - Add missing BuildRequires to fix build on Fedora 31. - Add missing Requires to avoid similar issues in the future. - Remove unused patch
This commit is contained in:
parent
c74119db70
commit
8bd28ed519
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@
|
||||
/sanlock-3.6.0.tar.gz
|
||||
/sanlock-3.7.0.tar.gz
|
||||
/sanlock-3.7.1.tar.gz
|
||||
/sanlock-3.7.3.tar.gz
|
||||
|
@ -1,149 +0,0 @@
|
||||
From af126ed0c3d0088344727eb36107c8807aca2129 Mon Sep 17 00:00:00 2001
|
||||
From: Nir Soffer <nirsof@gmail.com>
|
||||
Date: Fri, 12 Apr 2019 05:02:50 +0300
|
||||
Subject: [PATCH] python: Clean up alignment and sector constants
|
||||
|
||||
The constants used SANLK_RES_ prefix, which is not needed, confusing,
|
||||
and make client code uglier.
|
||||
|
||||
- SANLK_ prefix is not needed since all the constants are in the sanlock
|
||||
module namespace (e.g sanlock.ALIGN1M).
|
||||
|
||||
- RES_ prefix is incorrect because the alignment and sector size are
|
||||
used for lockspace, rindex and resources.
|
||||
|
||||
The help for the python functions mentioned the C API constants names
|
||||
(e.g. SANLK_LSF_ALIGN1M). Now we mention the python constant name (e.g
|
||||
ALIGN1M) which is the value the user of this module must use.
|
||||
|
||||
Since this version was not released yet, we still have time to fix this
|
||||
API.
|
||||
|
||||
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
|
||||
---
|
||||
python/example.py | 4 ++--
|
||||
python/sanlock.c | 26 ++++++++++++--------------
|
||||
2 files changed, 14 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/python/example.py b/python/example.py
|
||||
index c0adf54..4fe845d 100644
|
||||
--- a/python/example.py
|
||||
+++ b/python/example.py
|
||||
@@ -27,14 +27,14 @@ def main():
|
||||
|
||||
print "Registering to sanlock"
|
||||
fd = sanlock.register()
|
||||
|
||||
print "Initializing '%s'" % (LOCKSPACE_NAME,)
|
||||
- sanlock.write_lockspace(LOCKSPACE_NAME, disk, max_hosts=0, iotimeout=0, align=sanlock.SANLK_RES_ALIGN1M, sector=sanlock.SANLK_RES_SECTOR512)
|
||||
+ sanlock.write_lockspace(LOCKSPACE_NAME, disk, max_hosts=0, iotimeout=0, align=sanlock.ALIGN1M, sector=sanlock.SECTOR512)
|
||||
|
||||
print "Initializing '%s' on '%s'" % (RESOURCE_NAME, LOCKSPACE_NAME)
|
||||
- sanlock.write_resource(LOCKSPACE_NAME, RESOURCE_NAME, SNLK_DISKS, align=sanlock.SANLK_RES_ALIGN1M, sector=sanlock.SANLK_RES_SECTOR512)
|
||||
+ sanlock.write_resource(LOCKSPACE_NAME, RESOURCE_NAME, SNLK_DISKS, align=sanlock.ALIGN1M, sector=sanlock.SECTOR512)
|
||||
|
||||
print "Acquiring the id '%i' on '%s'" % (HOST_ID, LOCKSPACE_NAME)
|
||||
sanlock.add_lockspace(LOCKSPACE_NAME, HOST_ID, disk)
|
||||
|
||||
try:
|
||||
diff --git a/python/sanlock.c b/python/sanlock.c
|
||||
index 5ddb6d4..b387307 100644
|
||||
--- a/python/sanlock.c
|
||||
+++ b/python/sanlock.c
|
||||
@@ -359,11 +359,11 @@ exit_fail:
|
||||
}
|
||||
|
||||
/* write_lockspace */
|
||||
PyDoc_STRVAR(pydoc_write_lockspace, "\
|
||||
write_lockspace(lockspace, path, offset=0, max_hosts=0, iotimeout=0, \
|
||||
-align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512)\n\
|
||||
+align=ALIGN1M, sector=SECTOR512)\n\
|
||||
Initialize or update a device to be used as sanlock lockspace.");
|
||||
|
||||
static PyObject *
|
||||
py_write_lockspace(PyObject *self __unused, PyObject *args, PyObject *keywds)
|
||||
{
|
||||
@@ -407,12 +407,11 @@ py_write_lockspace(PyObject *self __unused, PyObject *args, PyObject *keywds)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* read_lockspace */
|
||||
PyDoc_STRVAR(pydoc_read_lockspace, "\
|
||||
-read_lockspace(path, offset=0 \
|
||||
-align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512)\n -> dict\n\
|
||||
+read_lockspace(path, offset=0, align=ALIGN1M, sector=SECTOR512)\n -> dict\n\
|
||||
Read the lockspace information from a device at a specific offset.");
|
||||
|
||||
static PyObject *
|
||||
py_read_lockspace(PyObject *self __unused, PyObject *args, PyObject *keywds)
|
||||
{
|
||||
@@ -480,19 +479,18 @@ exit_fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read_resource */
|
||||
PyDoc_STRVAR(pydoc_read_resource, "\
|
||||
-read_resource(path, offset=0, \
|
||||
-align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512) -> dict\n\
|
||||
+read_resource(path, offset=0, align=ALIGN1M, sector=SECTOR512) -> dict\n\
|
||||
Read the resource information from a device at a specific offset.");
|
||||
|
||||
static PyObject *
|
||||
py_read_resource(PyObject *self __unused, PyObject *args, PyObject *keywds)
|
||||
{
|
||||
int rv, rs_len;
|
||||
- uint32_t align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512;
|
||||
+ uint32_t align=SANLK_RES_ALIGN1M, sector=SANLK_RES_SECTOR512;
|
||||
const char *path;
|
||||
struct sanlk_resource *rs;
|
||||
PyObject *rs_info = NULL, *rs_entry = NULL;
|
||||
|
||||
static char *kwlist[] = {"path", "offset", "align", "sector", NULL};
|
||||
@@ -573,21 +571,21 @@ exit_fail:
|
||||
}
|
||||
|
||||
/* write_resource */
|
||||
PyDoc_STRVAR(pydoc_write_resource, "\
|
||||
write_resource(lockspace, resource, disks, max_hosts=0, num_hosts=0, \
|
||||
-clear=False, align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512)\n\
|
||||
+clear=False, align=ALIGN1M, sector=SECTOR512)\n\
|
||||
Initialize a device to be used as sanlock resource.\n\
|
||||
The disks must be in the format: [(path, offset), ... ].\n\
|
||||
If clear is True, the resource is cleared so subsequent read will\n\
|
||||
return an error.");
|
||||
|
||||
static PyObject *
|
||||
py_write_resource(PyObject *self __unused, PyObject *args, PyObject *keywds)
|
||||
{
|
||||
int rv, max_hosts = 0, num_hosts = 0, clear = 0;
|
||||
- uint32_t align=SANLK_LSF_ALIGN1M, sector=SANLK_LSF_SECTOR512;
|
||||
+ uint32_t align=SANLK_RES_ALIGN1M, sector=SANLK_RES_SECTOR512;
|
||||
const char *lockspace, *resource;
|
||||
struct sanlk_resource *rs;
|
||||
PyObject *disks;
|
||||
uint32_t flags = 0;
|
||||
|
||||
@@ -1654,14 +1652,14 @@ initsanlock(void)
|
||||
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_CLEAR_EVENT, "SETEV_CLEAR_EVENT");
|
||||
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_REPLACE_EVENT, "SETEV_REPLACE_EVENT");
|
||||
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_ALL_HOSTS, "SETEV_ALL_HOSTS");
|
||||
|
||||
/* Sector and align size flags */
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR512, "SANLK_RES_SECTOR512");
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR4K, "SANLK_RES_SECTOR4K");
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN1M, "SANLK_RES_ALIGN1M");
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN2M, "SANLK_RES_ALIGN2M");
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN4M, "SANLK_RES_ALIGN4M");
|
||||
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN8M, "SANLK_RES_ALIGN8M");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR512, "SECTOR512");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR4K, "SECTOR4K");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN1M, "ALIGN1M");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN2M, "ALIGN2M");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN4M, "ALIGN4M");
|
||||
+ PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN8M, "ALIGN8M");
|
||||
|
||||
#undef PYSNLK_INIT_ADD_CONSTANT
|
||||
}
|
||||
--
|
||||
2.17.2
|
||||
|
20
sanlock.spec
20
sanlock.spec
@ -1,14 +1,22 @@
|
||||
Name: sanlock
|
||||
Version: 3.7.1
|
||||
Release: 2%{?dist}
|
||||
Version: 3.7.3
|
||||
Release: 1%{?dist}
|
||||
Summary: A shared storage lock manager
|
||||
|
||||
License: GPLv2 and GPLv2+ and LGPLv2+
|
||||
URL: https://pagure.io/sanlock/
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libblkid-devel libaio-devel python2 python2-devel
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: libblkid-devel
|
||||
BuildRequires: libuuid-devel
|
||||
BuildRequires: make
|
||||
BuildRequires: python2
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: systemd-units
|
||||
Requires: %{name}-lib = %{version}-%{release}
|
||||
Requires: libaio
|
||||
Requires: libblkid
|
||||
Requires: libuuid
|
||||
Requires(pre): /usr/sbin/groupadd
|
||||
Requires(pre): /usr/sbin/useradd
|
||||
Requires(post): systemd-units
|
||||
@ -16,14 +24,12 @@ Requires(post): systemd-sysv
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
|
||||
Patch0: 0001-python-Clean-up-alignment-and-sector-constants.patch
|
||||
|
||||
%description
|
||||
The sanlock daemon manages leases for applications on hosts using shared storage.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%set_build_flags
|
||||
@ -178,6 +184,10 @@ common sanlock lockspace.
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 21 2019 Nir Soffer <nsoffer@redhat.com> - 3.7.3-1
|
||||
- Update to sanlock-3.7.3
|
||||
- Add missing BuildRequires and Requires
|
||||
|
||||
* Fri Apr 12 2019 Nir Soffer <nsoffer@redhat.com> - 3.7.1-2
|
||||
- Cleanup up align and sector constants
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (sanlock-3.7.1.tar.gz) = 3d5d0bc8acf8930044ec93df5b108d50d3a62dad5e24f0f3cf8fea111d1a5cf98478a83ba9a8c8079c831960ec5fc621db5be166fa4659f6d7dd0d5ac58bfdb8
|
||||
SHA512 (sanlock-3.7.3.tar.gz) = 0564471310b431acb6ede7f68dc16424c087ae350d62991ea31f8e3ab61f1984c8ffe875d05bde2e058c596a388057539a851e925d3ba0352525e55da92ae933
|
||||
|
Loading…
Reference in New Issue
Block a user