split out session logout on shutdown to a separate service
roll up libiscsi patches, update python bindings to support python3
This commit is contained in:
Chris Leech 2015-01-28 12:00:53 -08:00
parent c30d436535
commit 27894807b7
5 changed files with 223 additions and 270 deletions

View File

@ -1,15 +1,16 @@
From de47306137006436c6bc71a9a60c27287dd1a9e4 Mon Sep 17 00:00:00 2001 From 793dbd33535efd3ef1170487624f2b95168a0ec7 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com> From: rpm-build <rpm-build>
Date: Mon, 19 Nov 2012 16:43:15 -0800 Date: Mon, 26 Jan 2015 12:57:11 -0800
Subject: add libiscsi Subject: [PATCH] libiscsi
--- ---
Makefile | 2 + Makefile | 2 +
libiscsi/Makefile | 61 ++ libiscsi/Makefile | 61 ++
libiscsi/libiscsi.c | 620 +++++++++++ libiscsi/libiscsi.c | 617 +++++++++++
libiscsi/libiscsi.doxy | 1473 +++++++++++++++++++++++++++ libiscsi/libiscsi.doxy | 1473 +++++++++++++++++++++++++++
libiscsi/libiscsi.h | 344 +++++++ libiscsi/libiscsi.h | 344 +++++++
libiscsi/pylibiscsi.c | 638 ++++++++++++ libiscsi/no_date_footer.html | 6 +
libiscsi/pylibiscsi.c | 709 +++++++++++++
libiscsi/setup.py | 9 + libiscsi/setup.py | 9 +
libiscsi/tests/test_discovery_firmware.c | 53 + libiscsi/tests/test_discovery_firmware.c | 53 +
libiscsi/tests/test_discovery_sendtargets.c | 60 ++ libiscsi/tests/test_discovery_sendtargets.c | 60 ++
@ -25,11 +26,12 @@ Subject: add libiscsi
usr/idbm.c | 6 +- usr/idbm.c | 6 +-
usr/idbm.h | 3 + usr/idbm.h | 3 +
usr/iscsi_ipc.h | 2 + usr/iscsi_ipc.h | 2 +
21 files changed, 3691 insertions(+), 4 deletions(-) 22 files changed, 3765 insertions(+), 4 deletions(-)
create mode 100644 libiscsi/Makefile create mode 100644 libiscsi/Makefile
create mode 100644 libiscsi/libiscsi.c create mode 100644 libiscsi/libiscsi.c
create mode 100644 libiscsi/libiscsi.doxy create mode 100644 libiscsi/libiscsi.doxy
create mode 100644 libiscsi/libiscsi.h create mode 100644 libiscsi/libiscsi.h
create mode 100644 libiscsi/no_date_footer.html
create mode 100644 libiscsi/pylibiscsi.c create mode 100644 libiscsi/pylibiscsi.c
create mode 100644 libiscsi/setup.py create mode 100644 libiscsi/setup.py
create mode 100644 libiscsi/tests/test_discovery_firmware.c create mode 100644 libiscsi/tests/test_discovery_firmware.c
@ -43,7 +45,7 @@ Subject: add libiscsi
create mode 100644 libiscsi/tests/test_set_auth.c create mode 100644 libiscsi/tests/test_set_auth.c
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
index 93dcbbf..5e80db9 100644 index f8a393b..05411e1 100644
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -33,6 +33,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile @@ -33,6 +33,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile
@ -131,10 +133,10 @@ index 0000000..317a7ec
+-include .depend ../usr/.depend +-include .depend ../usr/.depend
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
new file mode 100644 new file mode 100644
index 0000000..6e6846a index 0000000..064e4b5
--- /dev/null --- /dev/null
+++ b/libiscsi/libiscsi.c +++ b/libiscsi/libiscsi.c
@@ -0,0 +1,620 @@ @@ -0,0 +1,617 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
+ * + *
@ -724,15 +726,13 @@ index 0000000..6e6846a
+ return ENODEV; + return ENODEV;
+ +
+ config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0; + config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0;
+ strncpy(config->iface_name, fw_entry.iface, sizeof fw_entry.iface); + strlcpy(config->iface_name, fw_entry.iface, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->mac_address, fw_entry.mac, sizeof fw_entry.mac); + strlcpy(config->mac_address, fw_entry.mac, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->ip_address, fw_entry.ipaddr, sizeof fw_entry.ipaddr); + strlcpy(config->ip_address, fw_entry.ipaddr, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->netmask, fw_entry.mask, sizeof fw_entry.mask); + strlcpy(config->netmask, fw_entry.mask, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->gateway, fw_entry.gateway, sizeof fw_entry.gateway); + strlcpy(config->gateway, fw_entry.gateway, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->primary_dns, fw_entry.primary_dns, + strlcpy(config->primary_dns, fw_entry.primary_dns, LIBISCSI_VALUE_MAXLEN);
+ sizeof fw_entry.primary_dns); + strlcpy(config->secondary_dns, fw_entry.secondary_dns, LIBISCSI_VALUE_MAXLEN);
+ strncpy(config->secondary_dns, fw_entry.secondary_dns,
+ sizeof fw_entry.secondary_dns);
+ return 0; + return 0;
+} +}
+ +
@ -750,14 +750,13 @@ index 0000000..6e6846a
+ if (fw_get_entry(&fw_entry)) + if (fw_get_entry(&fw_entry))
+ return ENODEV; + return ENODEV;
+ +
+ strncpy(initiatorname, fw_entry.initiatorname, + strlcpy(initiatorname, fw_entry.initiatorname, LIBISCSI_VALUE_MAXLEN);
+ sizeof fw_entry.initiatorname);
+ +
+ return 0; + return 0;
+} +}
diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy
new file mode 100644 new file mode 100644
index 0000000..663770f index 0000000..7a5ff7f
--- /dev/null --- /dev/null
+++ b/libiscsi/libiscsi.doxy +++ b/libiscsi/libiscsi.doxy
@@ -0,0 +1,1473 @@ @@ -0,0 +1,1473 @@
@ -1528,7 +1527,7 @@ index 0000000..663770f
+# each generated HTML page. If it is left blank doxygen will generate a +# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer. +# standard footer.
+ +
+HTML_FOOTER = +HTML_FOOTER = no_date_footer.html
+ +
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to +# style sheet that is used by each HTML page. It can be used to
@ -2584,12 +2583,24 @@ index 0000000..756590e
+#endif /* __cplusplus */ +#endif /* __cplusplus */
+ +
+#endif +#endif
diff --git a/libiscsi/no_date_footer.html b/libiscsi/no_date_footer.html
new file mode 100644
index 0000000..1e0c6c4
--- /dev/null
+++ b/libiscsi/no_date_footer.html
@@ -0,0 +1,6 @@
+<hr size="1"><address style="text-align: right;"><small>
+Generated for $projectname by <a href="http://www.doxygen.org/
+index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>
+$doxygenversion</small></address>
+</body>
+</html>
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
new file mode 100644 new file mode 100644
index 0000000..4b09aa7 index 0000000..8800853
--- /dev/null --- /dev/null
+++ b/libiscsi/pylibiscsi.c +++ b/libiscsi/pylibiscsi.c
@@ -0,0 +1,638 @@ @@ -0,0 +1,709 @@
+/* +/*
+ * iSCSI Administration library + * iSCSI Administration library
+ * + *
@ -2613,6 +2624,35 @@ index 0000000..4b09aa7
+#include <Python.h> +#include <Python.h>
+#include "libiscsi.h" +#include "libiscsi.h"
+ +
+#if PY_MAJOR_VERSION >= 3
+#define IS_PY3K
+#define MODINITERROR return NULL
+#define PYNUM_FROMLONG PyLong_FromLong
+#define PYSTR_FROMSTRING PyUnicode_FromString
+#else
+#define MODINITERROR return
+#define PYNUM_FROMLONG PyInt_FromLong
+#define PYSTR_FROMSTRING PyString_FromString
+#endif
+
+#define RET_TRUE_ELSE_FALSE { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; }
+#define CMP_TO_RICHCMP(cmpfunc) \
+ int comp_res = cmpfunc(self, other); \
+ switch (op) { \
+ case Py_LT: \
+ if (comp_res < 0) RET_TRUE_ELSE_FALSE \
+ case Py_LE: \
+ if (comp_res <= 0) RET_TRUE_ELSE_FALSE \
+ case Py_EQ: \
+ if (comp_res == 0) RET_TRUE_ELSE_FALSE \
+ case Py_NE: \
+ if (comp_res != 0) RET_TRUE_ELSE_FALSE \
+ case Py_GT: \
+ if (comp_res > 0) RET_TRUE_ELSE_FALSE \
+ default: \
+ if (comp_res >= 0) RET_TRUE_ELSE_FALSE \
+ }
+
+static struct libiscsi_context *context = NULL; +static struct libiscsi_context *context = NULL;
+ +
+/****************************** helpers ***********************************/ +/****************************** helpers ***********************************/
@ -2677,13 +2717,13 @@ index 0000000..4b09aa7
+ const char *attr = (const char *)data; + const char *attr = (const char *)data;
+ +
+ if (!strcmp(attr, "username")) { + if (!strcmp(attr, "username")) {
+ return PyString_FromString(chap->info.chap.username); + return PYSTR_FROMSTRING(chap->info.chap.username);
+ } else if (!strcmp(attr, "password")) { + } else if (!strcmp(attr, "password")) {
+ return PyString_FromString(chap->info.chap.password); + return PYSTR_FROMSTRING(chap->info.chap.password);
+ } else if (!strcmp(attr, "reverse_username")) { + } else if (!strcmp(attr, "reverse_username")) {
+ return PyString_FromString(chap->info.chap.reverse_username); + return PYSTR_FROMSTRING(chap->info.chap.reverse_username);
+ } else if (!strcmp(attr, "reverse_password")) { + } else if (!strcmp(attr, "reverse_password")) {
+ return PyString_FromString(chap->info.chap.reverse_password); + return PYSTR_FROMSTRING(chap->info.chap.reverse_password);
+ } + }
+ return NULL; + return NULL;
+} +}
@ -2733,6 +2773,13 @@ index 0000000..4b09aa7
+ return r; + return r;
+} +}
+ +
+PyObject *PyIscsiChapAuthInfo_richcompare(PyIscsiChapAuthInfo *self,
+ PyIscsiChapAuthInfo *other,
+ int op)
+{
+ CMP_TO_RICHCMP(PyIscsiChapAuthInfo_compare)
+}
+
+static PyObject *PyIscsiChapAuthInfo_str(PyObject *self) +static PyObject *PyIscsiChapAuthInfo_str(PyObject *self)
+{ +{
+ PyIscsiChapAuthInfo *chap = (PyIscsiChapAuthInfo *)self; + PyIscsiChapAuthInfo *chap = (PyIscsiChapAuthInfo *)self;
@ -2746,7 +2793,7 @@ index 0000000..4b09aa7
+ snprintf(s, sizeof(s), "%s:%s%s", chap->info.chap.username, + snprintf(s, sizeof(s), "%s:%s%s", chap->info.chap.username,
+ chap->info.chap.password, reverse); + chap->info.chap.password, reverse);
+ +
+ return PyString_FromString(s); + return PYSTR_FROMSTRING(s);
+} +}
+ +
+static struct PyGetSetDef PyIscsiChapAuthInfo_getseters[] = { +static struct PyGetSetDef PyIscsiChapAuthInfo_getseters[] = {
@ -2766,13 +2813,17 @@ index 0000000..4b09aa7
+}; +};
+ +
+PyTypeObject PyIscsiChapAuthInfo_Type = { +PyTypeObject PyIscsiChapAuthInfo_Type = {
+ PyObject_HEAD_INIT(NULL) + PyVarObject_HEAD_INIT(NULL, 0)
+ .tp_name = "libiscsi.chapAuthInfo", + .tp_name = "libiscsi.chapAuthInfo",
+ .tp_basicsize = sizeof (PyIscsiChapAuthInfo), + .tp_basicsize = sizeof (PyIscsiChapAuthInfo),
+ .tp_getset = PyIscsiChapAuthInfo_getseters, + .tp_getset = PyIscsiChapAuthInfo_getseters,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
+ Py_TPFLAGS_BASETYPE, +#ifndef IS_PY3K
+ .tp_compare = (cmpfunc)PyIscsiChapAuthInfo_compare, + // Py_TPFLAGS_CHECKTYPES is only needed on Python 2
+ | Py_TPFLAGS_CHECKTYPES
+#endif
+ ,
+ .tp_richcompare = (richcmpfunc)PyIscsiChapAuthInfo_compare,
+ .tp_init = PyIscsiChapAuthInfo_init, + .tp_init = PyIscsiChapAuthInfo_init,
+ .tp_str = PyIscsiChapAuthInfo_str, + .tp_str = PyIscsiChapAuthInfo_str,
+ .tp_new = PyType_GenericNew, + .tp_new = PyType_GenericNew,
@ -2820,15 +2871,15 @@ index 0000000..4b09aa7
+ const char *attr = (const char *)data; + const char *attr = (const char *)data;
+ +
+ if (!strcmp(attr, "name")) { + if (!strcmp(attr, "name")) {
+ return PyString_FromString(node->node.name); + return PYSTR_FROMSTRING(node->node.name);
+ } else if (!strcmp(attr, "tpgt")) { + } else if (!strcmp(attr, "tpgt")) {
+ return PyInt_FromLong(node->node.tpgt); + return PYNUM_FROMLONG(node->node.tpgt);
+ } else if (!strcmp(attr, "address")) { + } else if (!strcmp(attr, "address")) {
+ return PyString_FromString(node->node.address); + return PYSTR_FROMSTRING(node->node.address);
+ } else if (!strcmp(attr, "port")) { + } else if (!strcmp(attr, "port")) {
+ return PyInt_FromLong(node->node.port); + return PYNUM_FROMLONG(node->node.port);
+ } else if (!strcmp(attr, "iface")) { + } else if (!strcmp(attr, "iface")) {
+ return PyString_FromString(node->node.iface); + return PYSTR_FROMSTRING(node->node.iface);
+ } + }
+ return NULL; + return NULL;
+} +}
@ -2894,6 +2945,11 @@ index 0000000..4b09aa7
+ return 0; + return 0;
+} +}
+ +
+PyObject *PyIscsiNode_richcompare(PyIscsiNode *self, PyIscsiNode *other, int op)
+{
+ CMP_TO_RICHCMP(PyIscsiNode_compare)
+}
+
+static PyObject *PyIscsiNode_str(PyObject *self) +static PyObject *PyIscsiNode_str(PyObject *self)
+{ +{
+ PyIscsiNode *node = (PyIscsiNode *)self; + PyIscsiNode *node = (PyIscsiNode *)self;
@ -2905,7 +2961,7 @@ index 0000000..4b09aa7
+ snprintf(s, sizeof(s), "%s:%d%s %s", node->node.address, + snprintf(s, sizeof(s), "%s:%d%s %s", node->node.address,
+ node->node.port, tpgt, node->node.name); + node->node.port, tpgt, node->node.name);
+ +
+ return PyString_FromString(s); + return PYSTR_FROMSTRING(s);
+} +}
+ +
+static PyObject *PyIscsiNode_login(PyObject *self) +static PyObject *PyIscsiNode_login(PyObject *self)
@ -3069,14 +3125,17 @@ index 0000000..4b09aa7
+}; +};
+ +
+PyTypeObject PyIscsiNode_Type = { +PyTypeObject PyIscsiNode_Type = {
+ PyObject_HEAD_INIT(NULL) + PyVarObject_HEAD_INIT(NULL, 0)
+ .tp_name = "libiscsi.node", + .tp_name = "libiscsi.node",
+ .tp_basicsize = sizeof (PyIscsiNode), + .tp_basicsize = sizeof (PyIscsiNode),
+ .tp_getset = PyIscsiNode_getseters, + .tp_getset = PyIscsiNode_getseters,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
+ Py_TPFLAGS_BASETYPE, +#ifndef IS_PY3K
+ | Py_TPFLAGS_CHECKTYPES
+#endif
+ ,
+ .tp_methods = PyIscsiNode_methods, + .tp_methods = PyIscsiNode_methods,
+ .tp_compare = (cmpfunc)PyIscsiNode_compare, + .tp_richcompare = (richcmpfunc)PyIscsiNode_richcompare,
+ .tp_init = PyIscsiNode_init, + .tp_init = PyIscsiNode_init,
+ .tp_str = PyIscsiNode_str, + .tp_str = PyIscsiNode_str,
+ .tp_new = PyType_GenericNew, + .tp_new = PyType_GenericNew,
@ -3189,7 +3248,7 @@ index 0000000..4b09aa7
+ return NULL; + return NULL;
+ } + }
+ +
+ return PyString_FromString(initiatorname); + return PYSTR_FROMSTRING(initiatorname);
+} +}
+ +
+static PyMethodDef pylibiscsi_functions[] = { +static PyMethodDef pylibiscsi_functions[] = {
@ -3207,36 +3266,59 @@ index 0000000..4b09aa7
+ {NULL, NULL} + {NULL, NULL}
+}; +};
+ +
+#ifdef IS_PY3K
+static struct PyModuleDef libiscsi_def = {
+ PyModuleDef_HEAD_INIT,
+ "libiscsi",
+ NULL,
+ -1,
+ pylibiscsi_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC PyInit_libiscsi(void)
+#else
+PyMODINIT_FUNC initlibiscsi(void) +PyMODINIT_FUNC initlibiscsi(void)
+#endif
+{ +{
+ PyObject *m; + PyObject *m;
+ +
+ if (!context) /* We may be called more then once */ + if (!context) /* We may be called more then once */
+ context = libiscsi_init(); + context = libiscsi_init();
+ if (!context) + if (!context)
+ return; + MODINITERROR;
+ +
+ if (PyType_Ready(&PyIscsiChapAuthInfo_Type) < 0) + if (PyType_Ready(&PyIscsiChapAuthInfo_Type) < 0)
+ return; + MODINITERROR;
+ +
+ if (PyType_Ready(&PyIscsiNode_Type) < 0) + if (PyType_Ready(&PyIscsiNode_Type) < 0)
+ return; + MODINITERROR;
+ +
+#ifdef IS_PY3K
+ m = PyModule_Create(&libiscsi_def);
+#else
+ m = Py_InitModule("libiscsi", pylibiscsi_functions); + m = Py_InitModule("libiscsi", pylibiscsi_functions);
+#endif
+ Py_INCREF(&PyIscsiChapAuthInfo_Type); + Py_INCREF(&PyIscsiChapAuthInfo_Type);
+ PyModule_AddObject(m, "chapAuthInfo", (PyObject *) &PyIscsiChapAuthInfo_Type); + PyModule_AddObject(m, "chapAuthInfo", (PyObject *) &PyIscsiChapAuthInfo_Type);
+ Py_INCREF(&PyIscsiNode_Type); + Py_INCREF(&PyIscsiNode_Type);
+ PyModule_AddObject(m, "node", (PyObject *) &PyIscsiNode_Type); + PyModule_AddObject(m, "node", (PyObject *) &PyIscsiNode_Type);
+#ifdef IS_PY3K
+ return m;
+#endif
+} +}
diff --git a/libiscsi/setup.py b/libiscsi/setup.py diff --git a/libiscsi/setup.py b/libiscsi/setup.py
new file mode 100644 new file mode 100644
index 0000000..bb4329b index 0000000..caa4e66
--- /dev/null --- /dev/null
+++ b/libiscsi/setup.py +++ b/libiscsi/setup.py
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+from distutils.core import setup, Extension +from distutils.core import setup, Extension
+ +
+module1 = Extension('libiscsimodule', +module1 = Extension('libiscsi',
+ sources = ['pylibiscsi.c'], + sources = ['pylibiscsi.c'],
+ libraries = ['iscsi'], + libraries = ['iscsi'],
+ library_dirs = ['.']) + library_dirs = ['.'])
@ -3841,7 +3923,7 @@ index 3d8ee22..e731545 100644
# libc compat files # libc compat files
diff --git a/usr/discovery.c b/usr/discovery.c diff --git a/usr/discovery.c b/usr/discovery.c
index afce6c0..0c93749 100644 index 635ec8d..df6d3f1 100644
--- a/usr/discovery.c --- a/usr/discovery.c
+++ b/usr/discovery.c +++ b/usr/discovery.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
@ -3881,10 +3963,10 @@ index afce6c0..0c93749 100644
int discovery_fw(void *data, struct iface_rec *iface, int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list) struct list_head *rec_list)
diff --git a/usr/idbm.c b/usr/idbm.c diff --git a/usr/idbm.c b/usr/idbm.c
index 81bce9e..bda31e2 100644 index c3c8de5..ff39438 100644
--- a/usr/idbm.c --- a/usr/idbm.c
+++ b/usr/idbm.c +++ b/usr/idbm.c
@@ -1709,9 +1709,9 @@ int idbm_print_all_discovery(int info_level) @@ -1711,9 +1711,9 @@ int idbm_print_all_discovery(int info_level)
* fn should return -1 if it skipped the rec, a ISCSI_ERR error code if * fn should return -1 if it skipped the rec, a ISCSI_ERR error code if
* the operation failed or 0 if fn was run successfully. * the operation failed or 0 if fn was run successfully.
*/ */
@ -3912,10 +3994,10 @@ index b89ddff..3631262 100644
idbm_portal_op_fn *fn, char *targetname); idbm_portal_op_fn *fn, char *targetname);
extern int idbm_for_each_node(int *found, void *data, extern int idbm_for_each_node(int *found, void *data,
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index 9d26d54..d23754d 100644 index 5087b5c..a6dc40a 100644
--- a/usr/iscsi_ipc.h --- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h +++ b/usr/iscsi_ipc.h
@@ -165,4 +165,6 @@ struct iscsi_ipc { @@ -166,4 +166,6 @@ struct iscsi_ipc {
char *host_stats); char *host_stats);
}; };
@ -3923,5 +4005,5 @@ index 9d26d54..d23754d 100644
+ +
#endif /* ISCSI_IPC_H */ #endif /* ISCSI_IPC_H */
-- --
1.8.3.1 2.1.0

View File

@ -1,39 +0,0 @@
From bc4cf1487b4d6039de2a082c1786ac83ab148c88 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 22 Jan 2013 15:14:21 -0800
Subject: resolve 565245: multilib issues caused by doxygen
---
libiscsi/libiscsi.doxy | 2 +-
libiscsi/no_date_footer.html | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 libiscsi/no_date_footer.html
diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy
index 663770f..7a5ff7f 100644
--- a/libiscsi/libiscsi.doxy
+++ b/libiscsi/libiscsi.doxy
@@ -765,7 +765,7 @@ HTML_HEADER =
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
-HTML_FOOTER =
+HTML_FOOTER = no_date_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
diff --git a/libiscsi/no_date_footer.html b/libiscsi/no_date_footer.html
new file mode 100644
index 0000000..1e0c6c4
--- /dev/null
+++ b/libiscsi/no_date_footer.html
@@ -0,0 +1,6 @@
+<hr size="1"><address style="text-align: right;"><small>
+Generated for $projectname by <a href="http://www.doxygen.org/
+index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>
+$doxygenversion</small></address>
+</body>
+</html>
--
1.7.11.7

View File

@ -1,52 +0,0 @@
From fcad7de1a8c3d140d1d0eb120727966017d3727b Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Sat, 17 Aug 2013 15:50:45 -0700
Subject: libiscsi: fix incorrect strncpy use
Changes to internal structures make the src and dst buffers of some
copies (potentially) different sizes. Fix strncpy calls that were using
the size of the src argument as the limit.
---
libiscsi/libiscsi.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index 6e6846a..064e4b5 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -587,15 +587,13 @@ int libiscsi_get_firmware_network_config(
return ENODEV;
config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0;
- strncpy(config->iface_name, fw_entry.iface, sizeof fw_entry.iface);
- strncpy(config->mac_address, fw_entry.mac, sizeof fw_entry.mac);
- strncpy(config->ip_address, fw_entry.ipaddr, sizeof fw_entry.ipaddr);
- strncpy(config->netmask, fw_entry.mask, sizeof fw_entry.mask);
- strncpy(config->gateway, fw_entry.gateway, sizeof fw_entry.gateway);
- strncpy(config->primary_dns, fw_entry.primary_dns,
- sizeof fw_entry.primary_dns);
- strncpy(config->secondary_dns, fw_entry.secondary_dns,
- sizeof fw_entry.secondary_dns);
+ strlcpy(config->iface_name, fw_entry.iface, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->mac_address, fw_entry.mac, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->ip_address, fw_entry.ipaddr, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->netmask, fw_entry.mask, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->gateway, fw_entry.gateway, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->primary_dns, fw_entry.primary_dns, LIBISCSI_VALUE_MAXLEN);
+ strlcpy(config->secondary_dns, fw_entry.secondary_dns, LIBISCSI_VALUE_MAXLEN);
return 0;
}
@@ -613,8 +611,7 @@ int libiscsi_get_firmware_initiator_name(char *initiatorname)
if (fw_get_entry(&fw_entry))
return ENODEV;
- strncpy(initiatorname, fw_entry.initiatorname,
- sizeof fw_entry.initiatorname);
+ strlcpy(initiatorname, fw_entry.initiatorname, LIBISCSI_VALUE_MAXLEN);
return 0;
}
--
1.8.1.4

View File

@ -0,0 +1,55 @@
From 56d9d1c6a02dcad0915c0673f9cd2e653c86302f Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 13 Jan 2015 16:30:01 -0800
Subject: [PATCH] 0171-make-session-shutdown-a-seperate-service.patch
---
etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++
etc/systemd/iscsi.service | 3 +--
2 files changed, 15 insertions(+), 2 deletions(-)
create mode 100644 etc/systemd/iscsi-shutdown.service
diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service
new file mode 100644
index 0000000..23758e9
--- /dev/null
+++ b/etc/systemd/iscsi-shutdown.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Logout off all iSCSI sessions on shutdown
+Documentation=man:iscsid(8) man:iscsiadm(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStop=-/sbin/iscsiadm -m node --logoutall=all
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index ad7be34..2736956 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,7 +5,7 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target
-Wants=remote-fs-pre.target
+Wants=remote-fs-pre.target iscsi-shutdown.service
ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
@@ -14,7 +14,6 @@ Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/libexec/iscsi-mark-root-nodes
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic
ExecReload=-/sbin/iscsiadm -m node --loginall=automatic
[Install]
--
2.1.0

View File

@ -5,7 +5,7 @@
Summary: iSCSI daemon and utility programs Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build} Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 24.git%{checkout}%{?dist} Release: 25.git%{checkout}%{?dist}
Group: System Environment/Daemons Group: System Environment/Daemons
License: GPLv2+ License: GPLv2+
URL: http://www.open-iscsi.org URL: http://www.open-iscsi.org
@ -107,25 +107,24 @@ Patch150: 0150-iscsi-boot-related-service-file-updates.patch
Patch151: 0151-update-initscripts-and-docs.patch Patch151: 0151-update-initscripts-and-docs.patch
Patch152: 0152-use-var-for-config.patch Patch152: 0152-use-var-for-config.patch
Patch153: 0153-use-red-hat-for-name.patch Patch153: 0153-use-red-hat-for-name.patch
Patch154: 0154-add-libiscsi.patch Patch154: libiscsi.patch
Patch155: 0155-dont-use-static.patch Patch155: 0155-dont-use-static.patch
Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch
Patch159: 0159-iscsiuio-systemd-unit-files.patch Patch159: 0159-iscsiuio-systemd-unit-files.patch
Patch160: 0160-use-systemctl-to-start-iscsid.patch Patch160: 0160-use-systemctl-to-start-iscsid.patch
Patch161: 0161-resolve-565245-multilib-issues-caused-by-doxygen.patch
Patch162: 0162-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch Patch162: 0162-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch
Patch163: 0163-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch Patch163: 0163-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch
Patch164: 0164-libiscsi-fix-incorrect-strncpy-use.patch
Patch165: 0165-fix-hardened-build-of-iscsiuio.patch Patch165: 0165-fix-hardened-build-of-iscsiuio.patch
Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch
Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch
Patch168: 0168-update-handling-of-boot-sessions.patch Patch168: 0168-update-handling-of-boot-sessions.patch
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch
Patch170: 0170-fix-systemd-unit-wants.patch Patch170: 0170-fix-systemd-unit-wants.patch
Patch171: 0171-make-session-shutdown-a-seperate-service.patch
# version string, needs to be updated with each build # version string, needs to be updated with each build
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
BuildRequires: flex bison python-devel doxygen kmod-devel systemd-devel BuildRequires: flex bison python2-devel python3-devel python-setuptools doxygen kmod-devel systemd-devel
# For dir ownership # For dir ownership
Requires: %{name}-iscsiuio >= %{version}-%{release} Requires: %{name}-iscsiuio >= %{version}-%{release}
Requires(post): systemd Requires(post): systemd
@ -133,7 +132,7 @@ Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
%global _hardened_build 1 %global _hardened_build 1
%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$ %global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so|%{python3_sitearch}/.*\\.so)$
%description %description
The iscsi package provides the server daemon for the iSCSI protocol, The iscsi package provides the server daemon for the iSCSI protocol,
@ -161,116 +160,7 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}. developing applications that use %{name}.
%prep %prep
%setup -q -n open-iscsi-%{open_iscsi_version}-%{open_iscsi_build} %autosetup -p1 -n open-iscsi-%{open_iscsi_version}-%{open_iscsi_build}
# upstream patches
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%patch84 -p1
# pending upstream merge
%patch140 -p1
%patch143 -p1
%patch145 -p1
%patch146 -p1
%patch147 -p1
%patch149 -p1
%patch150 -p1
# distro specific modifications
%patch151 -p1
%patch152 -p1
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
%patch164 -p1
%patch165 -p1
%patch166 -p1
%patch167 -p1
%patch168 -p1
%patch169 -p1
%patch170 -p1
# version string
%patch199 -p1
# change exec_prefix, there's no easy way to override # change exec_prefix, there's no easy way to override
%{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile %{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile
@ -289,7 +179,8 @@ cd ../..
%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod" %{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod"
pushd libiscsi pushd libiscsi
python setup.py build %{__python2} setup.py build
%{__python3} setup.py build
touch -r libiscsi.doxy html/* touch -r libiscsi.doxy html/*
popd popd
@ -320,6 +211,7 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_unitdir} %{__install} -d $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir}
@ -340,15 +232,18 @@ touch $RPM_BUILD_ROOT/var/lock/iscsi/lock
%{__install} -d $RPM_BUILD_ROOT%{_includedir} %{__install} -d $RPM_BUILD_ROOT%{_includedir}
%{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir} %{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir}
%{__install} -d $RPM_BUILD_ROOT%{python_sitearch} %{__install} -d $RPM_BUILD_ROOT%{python2_sitearch}
%{__install} -pm 755 libiscsi/build/lib.linux-*/libiscsimodule.so \ %{__install} -d $RPM_BUILD_ROOT%{python3_sitearch}
$RPM_BUILD_ROOT%{python_sitearch} pushd libiscsi
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%post %post
/sbin/ldconfig /sbin/ldconfig
%systemd_post iscsi.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket %systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
@ -361,7 +256,7 @@ if [ $1 -eq 1 ]; then
fi fi
%preun %preun
%systemd_preun iscsi.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket %systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket
%postun %postun
/sbin/ldconfig /sbin/ldconfig
@ -406,6 +301,12 @@ if [ $1 -gt 0 ]; then
fi fi
fi fi
%triggerun -- iscsi-initiator-utils < 6.2.0.873-25
# prior to 6.2.0.873-25 there was no seperate iscsi-shutdown.service
if [ $1 -gt 0 ]; then
systemctl start iscsi-shutdown.service
fi
%files %files
%doc README %doc README
%dir %{_sharedstatedir}/iscsi %dir %{_sharedstatedir}/iscsi
@ -418,6 +319,7 @@ fi
%ghost %{_var}/lock/iscsi %ghost %{_var}/lock/iscsi
%ghost %{_var}/lock/iscsi/lock %ghost %{_var}/lock/iscsi/lock
%{_unitdir}/iscsi.service %{_unitdir}/iscsi.service
%{_unitdir}/iscsi-shutdown.service
%{_unitdir}/iscsid.service %{_unitdir}/iscsid.service
%{_unitdir}/iscsid.socket %{_unitdir}/iscsid.socket
%{_libexecdir}/iscsi-mark-root-nodes %{_libexecdir}/iscsi-mark-root-nodes
@ -430,7 +332,8 @@ fi
%{_sbindir}/iscsid %{_sbindir}/iscsid
%{_sbindir}/iscsistart %{_sbindir}/iscsistart
%{_libdir}/libiscsi.so.0 %{_libdir}/libiscsi.so.0
%{python_sitearch}/libiscsimodule.so %{python2_sitearch}/*
%{python3_sitearch}/*
%{_mandir}/man8/iscsi-iname.8.gz %{_mandir}/man8/iscsi-iname.8.gz
%{_mandir}/man8/iscsiadm.8.gz %{_mandir}/man8/iscsiadm.8.gz
%{_mandir}/man8/iscsid.8.gz %{_mandir}/man8/iscsid.8.gz
@ -449,6 +352,10 @@ fi
%{_includedir}/libiscsi.h %{_includedir}/libiscsi.h
%changelog %changelog
* Wed Jan 28 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-25.gitc9d830b
- split out session logout on shutdown to a separate service
- 985321 roll up libiscsi patches, update python bindings to support python3
* Thu Oct 23 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-24.gitc9d830b * Thu Oct 23 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-24.gitc9d830b
- sync with upstream v2.0.873-84-gc9d830b - sync with upstream v2.0.873-84-gc9d830b
- ignore iscsiadm return in iscsi.service - ignore iscsiadm return in iscsi.service