- Add libiscsi iscsi administartion library and -devel subpackage
This commit is contained in:
parent
d33bf0f27d
commit
7f6313aa75
@ -1,7 +1,9 @@
|
|||||||
|
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||||
|
|
||||||
Summary: iSCSI daemon and utility programs
|
Summary: iSCSI daemon and utility programs
|
||||||
Name: iscsi-initiator-utils
|
Name: iscsi-initiator-utils
|
||||||
Version: 6.2.0.870
|
Version: 6.2.0.870
|
||||||
Release: 1.0%{?dist}
|
Release: 2%{?dist}
|
||||||
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
|
Source0: http://www.open-iscsi.org/bits/open-iscsi-2.0-870.1.tar.gz
|
||||||
Source1: iscsid.init
|
Source1: iscsid.init
|
||||||
Source2: iscsidevs.init
|
Source2: iscsidevs.init
|
||||||
@ -13,12 +15,14 @@ Patch3: iscsi-initiator-utils-ibft-sysfs.patch
|
|||||||
Patch4: iscsi-initiator-utils-print-ibft-net-info.patch
|
Patch4: iscsi-initiator-utils-print-ibft-net-info.patch
|
||||||
Patch5: iscsi-initiator-utils-only-root-use.patch
|
Patch5: iscsi-initiator-utils-only-root-use.patch
|
||||||
Patch6: iscsi-initiator-utils-start-iscsid.patch
|
Patch6: iscsi-initiator-utils-start-iscsid.patch
|
||||||
|
Patch7: open-iscsi-2.0-870.1-add-libiscsi.patch
|
||||||
|
Patch8: open-iscsi-2.0-870.1-no-exit.patch
|
||||||
|
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.open-iscsi.org
|
URL: http://www.open-iscsi.org
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
BuildRequires: openssl-devel flex bison
|
BuildRequires: openssl-devel flex bison python-devel
|
||||||
Requires(post): chkconfig
|
Requires(post): chkconfig
|
||||||
Requires(preun): chkconfig /sbin/service
|
Requires(preun): chkconfig /sbin/service
|
||||||
ExcludeArch: s390 s390x
|
ExcludeArch: s390 s390x
|
||||||
@ -29,6 +33,15 @@ as well as the utility programs used to manage it. iSCSI is a protocol
|
|||||||
for distributed disk access using SCSI commands sent over Internet
|
for distributed disk access using SCSI commands sent over Internet
|
||||||
Protocol networks.
|
Protocol networks.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for %{name}
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
The %{name}-devel package contains libraries and header files for
|
||||||
|
developing applications that use %{name}.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n open-iscsi-2.0-870.1
|
%setup -q -n open-iscsi-2.0-870.1
|
||||||
%patch0 -p1 -b .update-initscripts-and-docs
|
%patch0 -p1 -b .update-initscripts-and-docs
|
||||||
@ -38,12 +51,18 @@ Protocol networks.
|
|||||||
%patch4 -p1 -b .print-ibft-net-info
|
%patch4 -p1 -b .print-ibft-net-info
|
||||||
%patch5 -p1 -b .only-root
|
%patch5 -p1 -b .only-root
|
||||||
%patch6 -p1 -b .start-iscsid
|
%patch6 -p1 -b .start-iscsid
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
|
make OPTFLAGS="%{optflags}" -C utils/fwparam_ibft
|
||||||
make OPTFLAGS="%{optflags}" -C usr
|
make OPTFLAGS="%{optflags}" -C usr
|
||||||
make OPTFLAGS="%{optflags}" -C utils
|
make OPTFLAGS="%{optflags}" -C utils
|
||||||
|
make OPTFLAGS="%{optflags}" -C libiscsi
|
||||||
|
pushd libiscsi
|
||||||
|
python setup.py build
|
||||||
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
@ -60,6 +79,9 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/isns
|
|||||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/slp
|
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/slp
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/ifaces
|
mkdir -p $RPM_BUILD_ROOT/var/lib/iscsi/ifaces
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/lock/iscsi
|
mkdir -p $RPM_BUILD_ROOT/var/lock/iscsi
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_libdir}
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_includedir}
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,11 +94,19 @@ install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/iscsid
|
|||||||
install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/iscsi
|
install -p -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/iscsi
|
||||||
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
|
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d
|
||||||
|
|
||||||
|
install -p -m 755 libiscsi/libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir}
|
||||||
|
ln -s libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir}/libiscsi.so
|
||||||
|
install -p -m 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir}
|
||||||
|
|
||||||
|
install -p -m 755 libiscsi/build/lib.linux-*/libiscsimodule.so \
|
||||||
|
$RPM_BUILD_ROOT%{python_sitearch}
|
||||||
|
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
/sbin/ldconfig
|
||||||
if [ "$1" -eq "1" ]; then
|
if [ "$1" -eq "1" ]; then
|
||||||
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
|
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
|
||||||
echo "InitiatorName=`/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi
|
echo "InitiatorName=`/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi
|
||||||
@ -85,6 +115,8 @@ if [ "$1" -eq "1" ]; then
|
|||||||
/sbin/chkconfig --add iscsi
|
/sbin/chkconfig --add iscsi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ "$1" = "0" ]; then
|
if [ "$1" = "0" ]; then
|
||||||
# stop iscsi
|
# stop iscsi
|
||||||
@ -113,11 +145,21 @@ fi
|
|||||||
%{_sysconfdir}/NetworkManager
|
%{_sysconfdir}/NetworkManager
|
||||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf
|
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf
|
||||||
/sbin/*
|
/sbin/*
|
||||||
|
%{_libdir}/libiscsi.so.0
|
||||||
|
%{python_sitearch}/libiscsimodule.so
|
||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc libiscsi/html
|
||||||
|
%{_libdir}/libiscsi.so
|
||||||
|
%{_includedir}/libiscsi.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Nov 25 2008 Mike Christie <mchrsiti@redhat.com> 6.2.0.870-1.0
|
* Wed Jan 28 2009 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-2
|
||||||
|
- Add libiscsi iscsi administartion library and -devel subpackage
|
||||||
|
|
||||||
|
* Tue Nov 25 2008 Mike Christie <mchristie@redhat.com> 6.2.0.870-1.0
|
||||||
- Rebase to upstream
|
- Rebase to upstream
|
||||||
|
|
||||||
* Thu Nov 6 2008 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-0.2.rc1
|
* Thu Nov 6 2008 Hans de Goede <hdegoede@redhat.com> 6.2.0.870-0.2.rc1
|
||||||
|
3974
open-iscsi-2.0-870.1-add-libiscsi.patch
Normal file
3974
open-iscsi-2.0-870.1-add-libiscsi.patch
Normal file
File diff suppressed because it is too large
Load Diff
221
open-iscsi-2.0-870.1-no-exit.patch
Normal file
221
open-iscsi-2.0-870.1-no-exit.patch
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
--- open-iscsi-2.0-870.1/usr/idbm.c~ 2009-01-28 13:23:47.000000000 +0100
|
||||||
|
+++ open-iscsi-2.0-870.1/usr/idbm.c 2009-01-28 13:25:06.000000000 +0100
|
||||||
|
@@ -843,7 +843,7 @@ int idbm_lock(void)
|
||||||
|
if (access(LOCK_DIR, F_OK) != 0) {
|
||||||
|
if (mkdir(LOCK_DIR, 0660) != 0) {
|
||||||
|
log_error("Could not open %s. Exiting\n", LOCK_DIR);
|
||||||
|
- exit(-1);
|
||||||
|
+ return errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -857,10 +857,10 @@ int idbm_lock(void)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (errno != EEXIST) {
|
||||||
|
+ log_error("Maybe you are not root?");
|
||||||
|
log_error("Could not lock discovery DB: %s: %s",
|
||||||
|
LOCK_WRITE_FILE, strerror(errno));
|
||||||
|
- log_error("Maybe you are not root?");
|
||||||
|
- exit(-1);
|
||||||
|
+ return errno;
|
||||||
|
} else if (i == 0)
|
||||||
|
log_debug(2, "Waiting for discovery DB lock");
|
||||||
|
|
||||||
|
@@ -915,7 +915,10 @@ static int __idbm_rec_read(node_rec_t *o
|
||||||
|
if (!info)
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_info;
|
||||||
|
+
|
||||||
|
f = fopen(conf, "r");
|
||||||
|
if (!f) {
|
||||||
|
log_debug(5, "Could not open %s err %d\n", conf, errno);
|
||||||
|
@@ -931,6 +934,7 @@ static int __idbm_rec_read(node_rec_t *o
|
||||||
|
|
||||||
|
unlock:
|
||||||
|
idbm_unlock();
|
||||||
|
+free_info:
|
||||||
|
free(info);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
@@ -1386,14 +1390,18 @@ idbm_discovery_read(discovery_rec_t *out
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
portal = malloc(PATH_MAX);
|
||||||
|
- if (!portal)
|
||||||
|
+ if (!portal) {
|
||||||
|
+ rc = ENOMEM;
|
||||||
|
goto free_info;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
snprintf(portal, PATH_MAX, "%s/%s,%d", ST_CONFIG_DIR,
|
||||||
|
addr, port);
|
||||||
|
log_debug(5, "Looking for config file %s\n", portal);
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_info;
|
||||||
|
|
||||||
|
f = idbm_open_rec_r(portal, ST_CONFIG_NAME);
|
||||||
|
if (!f) {
|
||||||
|
@@ -1494,7 +1502,9 @@ static int idbm_rec_write(node_rec_t *re
|
||||||
|
rec->name, rec->conn[0].address, rec->conn[0].port);
|
||||||
|
log_debug(5, "Looking for config file %s", portal);
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_portal;
|
||||||
|
|
||||||
|
rc = stat(portal, &statb);
|
||||||
|
if (rc) {
|
||||||
|
@@ -1579,13 +1589,16 @@ idbm_discovery_write(discovery_rec_t *re
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_portal;
|
||||||
|
+
|
||||||
|
snprintf(portal, PATH_MAX, "%s", ST_CONFIG_DIR);
|
||||||
|
if (access(portal, F_OK) != 0) {
|
||||||
|
if (mkdir(portal, 0660) != 0) {
|
||||||
|
log_error("Could not make %s\n", portal);
|
||||||
|
rc = errno;
|
||||||
|
- goto free_portal;
|
||||||
|
+ goto unlock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1596,13 +1609,14 @@ idbm_discovery_write(discovery_rec_t *re
|
||||||
|
if (!f) {
|
||||||
|
log_error("Could not open %s err %d\n", portal, errno);
|
||||||
|
rc = errno;
|
||||||
|
- goto free_portal;
|
||||||
|
+ goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
idbm_print(IDBM_PRINT_TYPE_DISCOVERY, rec, 1, f);
|
||||||
|
fclose(f);
|
||||||
|
-free_portal:
|
||||||
|
+unlock:
|
||||||
|
idbm_unlock();
|
||||||
|
+free_portal:
|
||||||
|
free(portal);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
@@ -1722,7 +1736,10 @@ int idbm_add_node(node_rec_t *newrec, di
|
||||||
|
log_debug(7, "node addition making link from %s to %s", node_portal,
|
||||||
|
disc_portal);
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_portal;
|
||||||
|
+
|
||||||
|
if (symlink(node_portal, disc_portal)) {
|
||||||
|
if (errno == EEXIST)
|
||||||
|
log_debug(7, "link from %s to %s exists", node_portal,
|
||||||
|
@@ -2009,7 +2026,10 @@ static int idbm_remove_disc_to_node_link
|
||||||
|
if (rc)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto done;
|
||||||
|
+
|
||||||
|
if (!stat(portal, &statb)) {
|
||||||
|
if (unlink(portal)) {
|
||||||
|
log_error("Could not remove link %s err %d\n",
|
||||||
|
@@ -2046,7 +2066,10 @@ int idbm_delete_node(node_rec_t *rec)
|
||||||
|
log_debug(5, "Removing config file %s iface id %s\n",
|
||||||
|
portal, rec->iface.name);
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_portal;
|
||||||
|
+
|
||||||
|
if (!stat(portal, &statb))
|
||||||
|
goto rm_conf;
|
||||||
|
|
||||||
|
diff -up open-iscsi-2.0-870.1/usr/iface.c~ open-iscsi-2.0-870.1/usr/iface.c
|
||||||
|
--- open-iscsi-2.0-870.1/usr/iface.c~ 2009-01-28 13:29:31.000000000 +0100
|
||||||
|
+++ open-iscsi-2.0-870.1/usr/iface.c 2009-01-28 13:29:31.000000000 +0100
|
||||||
|
@@ -208,7 +208,10 @@ int iface_conf_read(struct iface_rec *if
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ return rc;
|
||||||
|
+
|
||||||
|
rc = __iface_conf_read(iface);
|
||||||
|
idbm_unlock();
|
||||||
|
return rc;
|
||||||
|
@@ -232,11 +235,15 @@ int iface_conf_delete(struct iface_rec *
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
sprintf(iface_conf, "%s/%s", IFACE_CONFIG_DIR, iface->name);
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto free_conf;
|
||||||
|
+
|
||||||
|
if (unlink(iface_conf))
|
||||||
|
rc = errno;
|
||||||
|
idbm_unlock();
|
||||||
|
|
||||||
|
+free_conf:
|
||||||
|
free(iface_conf);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
@@ -267,10 +274,14 @@ int iface_conf_write(struct iface_rec *i
|
||||||
|
goto free_conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ rc = idbm_lock();
|
||||||
|
+ if (rc)
|
||||||
|
+ goto close_f;
|
||||||
|
+
|
||||||
|
idbm_print(IDBM_PRINT_TYPE_IFACE, iface, 1, f);
|
||||||
|
idbm_unlock();
|
||||||
|
|
||||||
|
+close_f:
|
||||||
|
fclose(f);
|
||||||
|
free_conf:
|
||||||
|
free(iface_conf);
|
||||||
|
@@ -471,7 +482,9 @@ void iface_setup_host_bindings(void)
|
||||||
|
{
|
||||||
|
int nr_found = 0;
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ if (idbm_lock())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (access(IFACE_CONFIG_DIR, F_OK) != 0) {
|
||||||
|
if (mkdir(IFACE_CONFIG_DIR, 0660) != 0) {
|
||||||
|
log_error("Could not make %s. HW/OFFLOAD iscsi "
|
||||||
|
@@ -658,7 +671,12 @@ int iface_for_each_iface(void *data, int
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- idbm_lock();
|
||||||
|
+ err = idbm_lock();
|
||||||
|
+ if (err) {
|
||||||
|
+ free(iface);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
err = __iface_conf_read(iface);
|
||||||
|
idbm_unlock();
|
||||||
|
if (err) {
|
Loading…
Reference in New Issue
Block a user