Hello community, here is the log from the commit of package open-iscsi for openSUSE:13.1 checked in at 2013-10-22 10:30:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:13.1/open-iscsi (Old) and /work/SRC/openSUSE:13.1/.open-iscsi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "open-iscsi" Changes: -------- --- /work/SRC/openSUSE:13.1/open-iscsi/open-iscsi.changes 2013-09-23 11:02:03.000000000 +0200 +++ /work/SRC/openSUSE:13.1/.open-iscsi.new/open-iscsi.changes 2013-10-22 10:30:42.000000000 +0200 @@ -1,0 +2,13 @@ +Fri Oct 4 16:07:47 CEST 2013 - oher...@suse.de + +- Remove usage of iscsiuio from mkinitrd scripts +- Add programs tags to mkinitrd scripts + open-iscsi-2.0-873.patch + +------------------------------------------------------------------- +Fri Sep 27 14:23:10 PDT 2013 - ldun...@suse.com + +- add support for systemd integration (bnc#827654) + open-iscsi-openSUSE-Factory-first-merge.diff.bz2 + +------------------------------------------------------------------- Old: ---- Week New: ---- open-iscsi-2.0-873.patch open-iscsi-openSUSE-Factory-first-merge.diff.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.r2bEou/_old 2013-10-22 10:30:42.000000000 +0200 +++ /var/tmp/diff_new_pack.r2bEou/_new 2013-10-22 10:30:42.000000000 +0200 @@ -21,10 +21,14 @@ BuildRequires: db-devel BuildRequires: flex BuildRequires: openssl-devel +%if 0%{?suse_version} >= 1230 +BuildRequires: systemd +%endif Url: http://www.open-iscsi.org PreReq: %fillup_prereq %insserv_prereq Version: 2.0.873 Release: 0 +%{?systemd_requires} Provides: linux-iscsi Obsoletes: linux-iscsi %define iscsi_release 873 @@ -38,6 +42,8 @@ Patch4: %{name}-sles11-sp3-flash-update.diff.bz2 Patch5: %{name}-sles11-sp3-general-updates-1.diff.bz2 Patch6: %{name}-openSUSE-12.3-first-merge.diff.bz2 +Patch7: %{name}-openSUSE-Factory-first-merge.diff.bz2 +Patch10: open-iscsi-2.0-873.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -73,12 +79,19 @@ %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch10 -p1 %build %{__make} OPTFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -DLOCK_DIR=\\\"/etc/iscsi\\\"" user %install make DESTDIR=${RPM_BUILD_ROOT} install_user +make DESTDIR=${RPM_BUILD_ROOT} install_mkinitrd_suse +# install service files +%if 0%{?suse_version} >= 1230 +make DESTDIR=${RPM_BUILD_ROOT} install_service_suse +%else make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse # rename open-iscsi service to iscsid for openSUSE mv ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi \ @@ -88,6 +101,7 @@ # create rc shortcut [ -d ${RPM_BUILD_ROOT}/usr/sbin ] || mkdir -p ${RPM_BUILD_ROOT}/usr/sbin ln -sf ../../etc/init.d/iscsid ${RPM_BUILD_ROOT}/usr/sbin/rciscsid +%endif (cd ${RPM_BUILD_ROOT}/etc; ln -sf iscsi/iscsid.conf iscsid.conf) touch ${RPM_BUILD_ROOT}/etc/iscsi/initiatorname.iscsi @@ -96,17 +110,33 @@ %post [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup -%{fillup_and_insserv -y boot.iscsid-early} if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then /sbin/iscsi-gen-initiatorname fi +%if 0%{?suse_version} >= 1230 +%{service_add_post iscsid.socket iscsid.service iscsi.service} +%else +%{fillup_and_insserv -Y boot.iscsid-early} +%endif %postun [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup +%if 0%{?suse_version} >= 1230 +%{service_del_postun iscsid.socket iscsid.service iscsi.service} +%else %{insserv_cleanup} +%endif + +%pre +%if 0%{?suse_version} >= 1230 +%{service_add_pre iscsid.socket iscsid.service iscsi.service} +%endif %preun %{stop_on_removal iscsid} +%if 0%{?suse_version} >= 1230 +%{service_del_preun iscsid.socket iscsid.service iscsi.service} +%endif %files %defattr(-,root,root) @@ -116,10 +146,16 @@ %dir /etc/iscsi/ifaces %config /etc/iscsi/ifaces/iface.example /etc/iscsid.conf +%if 0%{?suse_version} >= 1230 +%config %{_unitdir}/iscsid.service +%{_unitdir}/iscsid.socket +%config %{_unitdir}/iscsi.service +%else %config /etc/init.d/iscsid %config /etc/init.d/boot.iscsid-early -/sbin/* /usr/sbin/rciscsid +%endif +/sbin/* %dir /lib/mkinitrd %dir /lib/mkinitrd/scripts /lib/mkinitrd/scripts/setup-iscsi.sh ++++++ open-iscsi-2.0-873.patch ++++++ --- etc/mkinitrd/mkinitrd-boot.sh | 6 ++++-- etc/mkinitrd/mkinitrd-stop.sh | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) Index: open-iscsi-2.0-873/etc/mkinitrd/mkinitrd-boot.sh =================================================================== --- open-iscsi-2.0-873.orig/etc/mkinitrd/mkinitrd-boot.sh +++ open-iscsi-2.0-873/etc/mkinitrd/mkinitrd-boot.sh @@ -1,7 +1,10 @@ #!/bin/bash #%stage: device #%depends: network -#%programs: /sbin/iscsid /sbin/iscsiadm /sbin/iscsiuio +#%programs: mkdir +#%programs: rm +#%programs: /sbin/iscsid +#%programs: /sbin/iscsiadm #%modules: iscsi_tcp crc32c scsi_transport_iscsi iscsi_ibft bnx2i #%if: "$root_iscsi" -o "$TargetAddress" # @@ -87,7 +90,6 @@ echo "InitiatorName=$InitiatorName" > /e unset iSCSI_warning_InitiatorName echo "Starting iSCSI daemon" -/sbin/iscsiuio /sbin/iscsid -n if [ -d /sys/firmware/ibft/initiator ] ; then Index: open-iscsi-2.0-873/etc/mkinitrd/mkinitrd-stop.sh =================================================================== --- open-iscsi-2.0-873.orig/etc/mkinitrd/mkinitrd-stop.sh +++ open-iscsi-2.0-873/etc/mkinitrd/mkinitrd-stop.sh @@ -2,6 +2,8 @@ # #%stage: setup #%provides: killprogs +#%programs: kill +#%programs: pidof # #%if: "$root_iscsi" #%dontshow @@ -19,6 +21,4 @@ # kill iscsid, will be restarted from the real root iscsi_pid=$(pidof iscsid) [ "$iscsi_pid" ] && kill -TERM $iscsi_pid -# Same goes for iscsiuio -iscsiuio_pid=$(pidof iscsiuio) [ "$iscsiuio_pid" ] && kill -TERM $iscsiuio_pid ++++++ open-iscsi-openSUSE-Factory-first-merge.diff.bz2 ++++++ diff --git a/Makefile b/Makefile index c0fe0da..634aece 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ mandir = $(prefix)/share/man etcdir = /etc initddir = $(etcdir)/init.d mkinitrd = $(exec_prefix)/lib/mkinitrd/scripts +systemddir = /usr/lib/systemd/system MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8 PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname @@ -93,6 +94,7 @@ install_initd: $(MAKE) install_initd_redhat ; \ elif [ -f /etc/SuSE-release ]; then \ $(MAKE) install_initd_suse ; \ + $(MAKE) install_mkinitrd_suse ; \ fi # these are external targets to allow bypassing distribution detection @@ -102,6 +104,8 @@ install_initd_suse: $(DESTDIR)$(initddir)/open-iscsi $(INSTALL) -m 755 etc/initd/boot.suse \ $(DESTDIR)$(initddir)/boot.open-iscsi + +install_mkinitrd_suse: $(INSTALL) -d $(DESTDIR)$(mkinitrd) $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-boot.sh \ $(DESTDIR)$(mkinitrd)/boot-iscsi.sh @@ -120,6 +124,16 @@ install_initd_debian: $(INSTALL) -m 755 etc/initd/initd.debian \ $(DESTDIR)$(initddir)/open-iscsi +# install systemd service files for openSUSE +install_service_suse: + $(INSTALL) -d $(DESTDIR)$(systemddir) + $(INSTALL) -m 644 etc/systemd/iscsid.service \ + $(DESTDIR)$(systemddir) + $(INSTALL) -m 644 etc/systemd/iscsid.socket \ + $(DESTDIR)$(systemddir) + $(INSTALL) -m 644 etc/systemd/iscsi.service \ + $(DESTDIR)$(systemddir) + install_iface: $(IFACEFILES) $(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi/ifaces $(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces diff --git a/etc/iscsid.conf b/etc/iscsid.conf index 1ae9091..5ee596d 100644 --- a/etc/iscsid.conf +++ b/etc/iscsid.conf @@ -14,13 +14,13 @@ # needs to access it, instead of starting it when the init # scripts run, set the iscsid startup command here. This # should normally only need to be done by distro package -# maintainers. +# maintainers. -- Do not use with systemd # # Default for Fedora and RHEL. (uncomment to activate). # iscsid.startup = /etc/rc.d/init.d/iscsid force-start # # Default for upstream open-iscsi scripts (uncomment to activate). -iscsid.startup = /usr/sbin/rcopen-iscsi start +# iscsid.startup = /usr/sbin/rcopen-iscsi start ############################# # NIC/HBA and driver settings diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service new file mode 100644 index 0000000..664d3aa --- /dev/null +++ b/etc/systemd/iscsi.service @@ -0,0 +1,16 @@ +[Unit] +Description=Login and scanning of iSCSI devices +Documentation=man:iscsiadm(8) man:iscsid(8) +After=network.target NetworkManager-wait-online.service iscsid.service +ConditionPathExists=/etc/iscsi/initiatorname.iscsi + +[Service] +Type=oneshot +ExecStart=/sbin/iscsiadm -m node --loginall=automatic +ExecStop=/bin/sync +ExecStop=/sbin/iscsiadm -m session --logout +SuccessExitStatus=21 +RemainAfterExit=true + +[Install] +WantedBy=remote-fs.target diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service new file mode 100644 index 0000000..127e56a --- /dev/null +++ b/etc/systemd/iscsid.service @@ -0,0 +1,12 @@ +[Unit] +Description=Open-iSCSI +Documentation=man:iscsid(8) man:iscsiadm(8) +After=network.target NetworkManager-wait-online.service tgtd.service targetcli.service + +[Service] +Type=forking +PIDFile=/var/run/iscsid.pid +ExecStart=/sbin/iscsid + +[Install] +WantedBy=multi-user.target diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket new file mode 100644 index 0000000..58a8d12 --- /dev/null +++ b/etc/systemd/iscsid.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Open-iSCSI iscsid Socket +Documentation=man:iscsid(8) man:iscsiadm(8) + +[Socket] +ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE + +[Install] +WantedBy=sockets.target diff --git a/rpm/build_rpm b/rpm/build_rpm index 773f00e..3e920be 100755 --- a/rpm/build_rpm +++ b/rpm/build_rpm @@ -9,14 +9,15 @@ # RPM="open-iscsi" -BRANCH="openSUSE-12.3" +BRANCH="openSUSE-Factory" VERSION="2.0-873" BRANCH_TAG="sles11-sp2-update" PATCH2_END_TAG="sles11-sp2-update2" PATCH3_END_TAG="sles11-sp3-update-iscsiuio" PATCH4_END_TAG="sles11-sp3-update-flash" PATCH5_END_TAG="openSUSE-12.3-branch" -PATCH6_END_TAG="HEAD" +PATCH6_END_TAG="openSUSE-12.3-update" +PATCH7_END_TAG="HEAD" NUM_PATCHES=6 let NEXT_PATCH=$NUM_PATCHES+1 DESTDIR= @@ -154,14 +155,18 @@ git diff $PATCH2_END_TAG..$PATCH3_END_TAG rpm | \ git diff $PATCH3_END_TAG..$PATCH4_END_TAG | \ bzip2 > $DESTDIR/$RPM-sles11-sp3-flash-update.diff.bz2 -# patch5: changes since patch4 +# patch5: changes since patch4 -- to openSUSE 12.3 git diff $PATCH4_END_TAG..$PATCH5_END_TAG | \ bzip2 > $DESTDIR/$RPM-sles11-sp3-general-updates-1.diff.bz2 -# patch6: changes since branching SP3 to openSUSE 12.3 +# patch6: changes since branching openSUSE 12.3 to Factory git diff $PATCH5_END_TAG..$PATCH6_END_TAG | \ bzip2 > $DESTDIR/$RPM-openSUSE-12.3-first-merge.diff.bz2 +# patch7: changes since branching openSUSE Factory to now +git diff $PATCH6_END_TAG..$PATCH7_END_TAG | \ + bzip2 > $DESTDIR/$RPM-openSUSE-Factory-first-merge.diff.bz2 + # if the user specified this then get all changes not even checked in # and patch them into the spec file as "Patch$NEXT_PATCH" if (( $uncommitted_changes )) ; then diff --git a/rpm/open-iscsi.changes b/rpm/open-iscsi.changes index 35da303..1434616 100644 --- a/rpm/open-iscsi.changes +++ b/rpm/open-iscsi.changes @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Sep 27 14:23:10 PDT 2013 - ldun...@suse.com + +- add support for systemd integration (bnc#827654) + +------------------------------------------------------------------- Wed Jun 5 15:53:34 PDT 2013 - ldun...@suse.com - check return from nice() correctly (bnc#807936) diff --git a/rpm/open-iscsi.spec b/rpm/open-iscsi.spec index b08b688..f0dfcb8 100644 --- a/rpm/open-iscsi.spec +++ b/rpm/open-iscsi.spec @@ -21,12 +21,16 @@ BuildRequires: bison BuildRequires: db-devel BuildRequires: flex BuildRequires: openssl-devel +%if 0%{?suse_version} >= 1230 +BuildRequires: systemd +%endif Url: http://www.open-iscsi.org License: GPL-2.0+ Group: Productivity/Networking/Other PreReq: %fillup_prereq %insserv_prereq Version: 2.0.873 Release: 0 +%{?systemd_requires} Provides: linux-iscsi Obsoletes: linux-iscsi %define iscsi_release 873 @@ -38,6 +42,7 @@ Patch3: %{name}-sles11-sp3-iscsiuio-update.diff.bz2 Patch4: %{name}-sles11-sp3-flash-update.diff.bz2 Patch5: %{name}-sles11-sp3-general-updates-1.diff.bz2 Patch6: %{name}-openSUSE-12.3-first-merge.diff.bz2 +Patch7: %{name}-openSUSE-Factory-first-merge.diff.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -73,12 +78,18 @@ Authors: %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %build %{__make} OPTFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -DLOCK_DIR=\\\"/etc/iscsi\\\"" user %install make DESTDIR=${RPM_BUILD_ROOT} install_user +make DESTDIR=${RPM_BUILD_ROOT} install_mkinitrd_suse +# install service files +%if 0%{?suse_version} >= 1230 +make DESTDIR=${RPM_BUILD_ROOT} install_service_suse +%else make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse # rename open-iscsi service to iscsid for openSUSE mv ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi \ @@ -88,6 +99,7 @@ mv ${RPM_BUILD_ROOT}/etc/init.d/open-iscsi \ # create rc shortcut [ -d ${RPM_BUILD_ROOT}/usr/sbin ] || mkdir -p ${RPM_BUILD_ROOT}/usr/sbin ln -sf ../../etc/init.d/iscsid ${RPM_BUILD_ROOT}/usr/sbin/rciscsid +%endif (cd ${RPM_BUILD_ROOT}/etc; ln -sf iscsi/iscsid.conf iscsid.conf) touch ${RPM_BUILD_ROOT}/etc/iscsi/initiatorname.iscsi @@ -96,17 +108,33 @@ touch ${RPM_BUILD_ROOT}/etc/iscsi/initiatorname.iscsi %post [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup -%{fillup_and_insserv -Y boot.iscsid-early} if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then /sbin/iscsi-gen-initiatorname fi +%if 0%{?suse_version} >= 1230 +%{service_add_post iscsid.socket iscsid.service iscsi.service} +%else +%{fillup_and_insserv -Y boot.iscsid-early} +%endif %postun [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup +%if 0%{?suse_version} >= 1230 +%{service_del_postun iscsid.socket iscsid.service iscsi.service} +%else %{insserv_cleanup} +%endif + +%pre +%if 0%{?suse_version} >= 1230 +%{service_add_pre iscsid.socket iscsid.service iscsi.service} +%endif %preun %{stop_on_removal iscsid} +%if 0%{?suse_version} >= 1230 +%{service_del_preun iscsid.socket iscsid.service iscsi.service} +%endif %files %defattr(-,root,root) @@ -116,10 +144,16 @@ fi %dir /etc/iscsi/ifaces %config /etc/iscsi/ifaces/iface.example /etc/iscsid.conf +%if 0%{?suse_version} >= 1230 +%config %{_unitdir}/iscsid.service +%{_unitdir}/iscsid.socket +%config %{_unitdir}/iscsi.service +%else %config /etc/init.d/iscsid %config /etc/init.d/boot.iscsid-early -/sbin/* /usr/sbin/rciscsid +%endif +/sbin/* %dir /lib/mkinitrd %dir /lib/mkinitrd/scripts /lib/mkinitrd/scripts/setup-iscsi.sh diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c index 5a4a645..a91efe4 100644 --- a/usr/iscsid_req.c +++ b/usr/iscsid_req.c @@ -118,7 +118,7 @@ static int ipc_connect(int *fd, char *unix_sock_name) static int iscsid_connect(int *fd, int start_iscsid) { - int nsec; + int nsec, addr_len; struct sockaddr_un addr; *fd = socket(AF_LOCAL, SOCK_STREAM, 0); @@ -127,15 +127,17 @@ static int iscsid_connect(int *fd, int start_iscsid) return ISCSI_ERR_ISCSID_NOTCONN; } + addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1; + memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_LOCAL; - memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, - strlen(ISCSIADM_NAMESPACE)); + memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len); + /* * Trying to connect with exponential backoff */ for (nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) { - if (connect(*fd, (struct sockaddr *) &addr, sizeof(addr)) == 0) + if (connect(*fd, (struct sockaddr *) &addr, addr_len) == 0) /* Connection established */ return ISCSI_SUCCESS; diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c index 5c39c2e..87bd346 100644 --- a/usr/mgmt_ipc.c +++ b/usr/mgmt_ipc.c @@ -39,25 +39,33 @@ #define PEERUSER_MAX 64 #define EXTMSG_MAX (64 * 1024) +#define SD_SOCKET_FDS_START 3 int mgmt_ipc_listen(void) { - int fd, err; + int fd, err, addr_len; struct sockaddr_un addr; + /* first check if we have fd handled by systemd */ + fd = mgmt_ipc_systemd(); + if (fd >= 0) + return fd; + + /* manually establish a socket */ fd = socket(AF_LOCAL, SOCK_STREAM, 0); if (fd < 0) { log_error("Can not create IPC socket"); return fd; } + addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1; + memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_LOCAL; - memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, - strlen(ISCSIADM_NAMESPACE)); + memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len); - if ((err = bind(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) { + if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) { log_error("Can not bind IPC socket"); close(fd); return err; @@ -72,6 +80,28 @@ mgmt_ipc_listen(void) return fd; } +int mgmt_ipc_systemd(void) +{ + const char *env; + + env = getenv("LISTEN_PID"); + + if (!env || (strtoul(env, NULL, 10) != getpid())) + return -EINVAL; + + env = getenv("LISTEN_FDS"); + + if (!env) + return -EINVAL; + + if (strtoul(env, NULL, 10) != 1) { + log_error("Did not receive exactly one IPC socket from systemd"); + return -EINVAL; + } + + return SD_SOCKET_FDS_START; +} + void mgmt_ipc_close(int fd) { diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h index 7d8ce72..55972ed 100644 --- a/usr/mgmt_ipc.h +++ b/usr/mgmt_ipc.h @@ -112,6 +112,7 @@ typedef int mgmt_ipc_fn_t(struct queue_task *); struct queue_task; void mgmt_ipc_write_rsp(struct queue_task *qtask, int err); int mgmt_ipc_listen(void); +int mgmt_ipc_systemd(void); void mgmt_ipc_close(int fd); void mgmt_ipc_handle(int accept_fd); -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org