Ruediger Oertel 2013-10-10 13:25:24 +00:00 committed by Git OBS Bridge
commit 3aaa216595
14 changed files with 733 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,13 @@
diff --git a/fcnsq.c b/fcnsq.c
index 8722b21..466a85e 100644
--- a/fcnsq.c
+++ b/fcnsq.c
@@ -360,7 +360,7 @@ static void help(int status)
" --gspn <port id>\n"
" --gsnn <world wide node name>\n"
"Options:\n"
- " --quiet print minimal results on success, and no error messages\n"
+ " --quiet|-q print minimal results on success, and no error messages\n"
"\n"
"Port IDs and World Wide Names must be specified in hexadecimal.\n"
);

View File

@ -0,0 +1,118 @@
diff --git a/fcnsq.c b/fcnsq.c
index 45dff40..c5b78b9 100644
--- a/fcnsq.c
+++ b/fcnsq.c
@@ -24,6 +24,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <unistd.h>
+#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
@@ -227,7 +228,7 @@ static int gpn_id(int bsg, u32 fcid)
rjt = gn_id(bsg, fcid, FC_NS_GPN_ID, &wwpn);
if (rjt)
goto fail;
- print_result("Port Name", "%16.16llx\n", wwpn);
+ print_result("Port Name", "%16.16jx\n", (uintmax_t)wwpn);
return 0;
fail:
if (rjt == (u16) ~0)
@@ -248,7 +249,7 @@ static int gnn_id(int bsg, u32 fcid)
rjt = gn_id(bsg, fcid, FC_NS_GNN_ID, &wwnn);
if (rjt)
goto fail;
- print_result("Node Name", "%16.16llx\n", wwnn);
+ print_result("Node Name", "%16.16jx\n", (uintmax_t)wwnn);
return 0;
fail:
if (rjt == (u16) ~0)
@@ -373,11 +374,12 @@ int main(int argc, char *argv[])
{
char *bsg;
int bsg_dev;
- u32 port_id;
- u64 wwnn;
+ u32 port_id = 0;
+ u64 wwnn = 0;
int rc = 0;
enum commands cmd = 0;
char c;
+ uintmax_t wwnn_tmp = 0;
while(1) {
c = getopt_long_only(argc, argv, "", options, NULL);
@@ -402,7 +404,8 @@ int main(int argc, char *argv[])
if (cmd)
help(-1);
cmd = c;
- sscanf(optarg, "%llx", &wwnn);
+ sscanf(optarg, "%jx", &wwnn_tmp);
+ wwnn = (u64)wwnn_tmp;
break;
}
}
diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index e1cbd48..a6cf7a3 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -1426,8 +1426,8 @@ void print_fcoe_fcf_device(void *ep, void *arg)
if (!buf)
buf = temp;
printf(" Connection Mode: %s\n", buf);
- printf(" Fabric Name: 0x%016lx\n", fcf->fabric_name);
- printf(" Switch Name 0x%016lx\n", fcf->switch_name);
+ printf(" Fabric Name: 0x%016" PRIx64 "\n", fcf->fabric_name);
+ printf(" Switch Name 0x%016" PRIx64 "\n", fcf->switch_name);
mac2str(fcf->mac, mac, MAX_STR_LEN);
printf(" MAC Address: %s\n", mac);
printf(" FCF Priority: %u\n", fcf->priority);
diff --git a/fcoemon.c b/fcoemon.c
index 80360fd..23fae9e 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -2640,7 +2640,7 @@ static void fcm_dcbd_get_oper(struct fcm_netif *ff, char *resp, char *cp)
if (ep) {
FCM_LOG_DEV(ff, "Invalid get oper response "
- "parse error byte %ld, resp %s", ep - cp, cp);
+ "parse error byte %td, resp %s", ep - cp, cp);
fcm_dcbd_state_set(ff, FCD_ERROR);
} else {
if (val && fcoe_config.debug)
diff --git a/fcping.c b/fcping.c
index bc51d5f..f92516f 100644
--- a/fcping.c
+++ b/fcping.c
@@ -25,6 +25,7 @@
#include <stddef.h>
#include <stdarg.h>
#include <unistd.h>
+#include <inttypes.h>
#include <errno.h>
#include <string.h>
#include <time.h>
@@ -812,17 +813,17 @@ static void fp_check_data_len()
printf("Maximum ECHO data allowed by the Fabric (0x%06x) : %d bytes.\n"
"Maximum ECHO data allowed by the Source (0x%06x) : %d bytes.\n"
"Maximum ECHO data allowed by the Target (0x%06x) : %d bytes.\n"
- "Maximum ECHO data requested from user input (-s) : %lu "
+ "Maximum ECHO data requested from user input (-s) : %" PRIu32 " "
"(default %d) bytes.\n",
FC_WKA_FABRIC_CONTROLLER, flen, sid, slen, fp_did, dlen,
- fp_len - FP_LEN_ECHO, FP_LEN_DEF);
+ (uint32_t)(fp_len - FP_LEN_ECHO), FP_LEN_DEF);
/* fp_len is the total payload, including 4 bytes for ECHO command */
fp_len = MIN(fp_len, plen + FP_LEN_ECHO);
- printf("Actual FC ELS ECHO data size used : %lu bytes.\n"
+ printf("Actual FC ELS ECHO data size used : %" PRIu32 " bytes.\n"
"Actual FC ELS ECHO payload size used : %d bytes "
- "(including %ld bytes ECHO command).\n",
- fp_len - FP_LEN_ECHO, fp_len, FP_LEN_ECHO);
+ "(including %zu bytes ECHO command).\n",
+ (uint32_t)(fp_len - FP_LEN_ECHO), fp_len, FP_LEN_ECHO);
}
/*

View File

@ -0,0 +1,25 @@
diff --git a/doc/fcoemon.8 b/doc/fcoemon.8
index e9a045b..020394e 100644
--- a/doc/fcoemon.8
+++ b/doc/fcoemon.8
@@ -358,7 +358,7 @@ indicates whether a FIP responder should be activated on this device to support
Note that the attached Ethernet peer device (e\&.g\&. FCoE capable switch port) must have compatible settings For DCB and FCoE to function properly\&.
.SS "/etc/init\&.d/fcoe"
.sp
-This is the \fBfcoe\fR system service script\&. This script is invoked by the init process or by the service command to start and stop the \fBfcoemon\fR\&.
+This is the \fBfcoe\fR system service script\&. This script is invoked by the init process or by the service command to start and stop the \fBfcoemon\fR\&. On systemd-enabled systems, \fBfcoemon\fR is controlled via the \fBfcoe.service\fR unit.
.SH "VLAN NAMING CONVENTIONS"
.sp
If a new VLAN device is created (see the description of the \fIAUTO_VLAN\fR setting above), it will have the name \fIdev\fR\&.\fIvlan\fR\-fcoe; where \fIdev\fR is the name of the Ethernet parent device and \fIvlan\fR is the discovered VLAN ID number\&.
diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
index ec15197..09ee5a2 100644
--- a/doc/fcoemon.txt
+++ b/doc/fcoemon.txt
@@ -214,6 +214,7 @@ must have compatible settings For DCB and FCoE to function properly.
~~~~~~~~~~~~~~~~
This is the *fcoe* system service script. This script is invoked by the
init process or by the service command to start and stop the *fcoemon*.
+On systemd-enabled systems, *fcoemon* is controlled via the *fcoe.service* unit.
VLAN NAMING CONVENTIONS
-----------------------

View File

@ -0,0 +1,22 @@
diff --git a/Makefile.am b/Makefile.am
index 5cbc15f..57bdbdb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@
sbin_PROGRAMS = fcoeadm fcoemon fcping fipvlan fcnsq fcrls
## all targets should look for headers in the include directory
-AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include
+AM_CPPFLAGS = -I${srcdir}/include -I${builddir}/include -I/lib/modules/`rpm -q --list kernel | grep "^/lib/modules/.*/build$$" | cut -f4 -d"/" | sort -r | head -1`/build/include
## pass the sysconfdir into the C proprocessor
AM_CPPFLAGS += -DSYSCONFDIR="\"${sysconfdir}\"" -D_FORTIFY_SOURCE=2
AM_CFLAGS = -Wall -Wformat=2 -Werror -Wmissing-prototypes -Wstrict-prototypes
@@ -67,7 +67,7 @@ init_d_SCRIPTS = etc/initd/fcoe
dist_noinst_DATA = README COPYING INSTALL fcoe-utils.spec etc/config
-BASH_COMPLETION_DIR=/etc/bash_completion.d/
+BASH_COMPLETION_DIR=${DESTDIR}/etc/bash_completion.d/
install-data-hook:
if [ ! -f ${DESTDIR}${fcoe_configdir}/config ] ; then \

View File

@ -0,0 +1,22 @@
diff --git a/Makefile.am b/Makefile.am
index 5cbc15f..1e8d1cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,7 @@ AM_CFLAGS = -Wall -Wformat=2 -Werror -Wmissing-prototypes -Wstrict-prototypes
fcoeadm_SOURCES = fcoeadm.c fcoeadm_display.c
fcoeadm_LDADD = lib/libutil.a libopenfcoe.a
fcoeadm_CFLAGS = $(AM_CFLAGS) $(HBAAPI_CFLAGS)
-fcoeadm_LDFLAGS = $(AM_LDFLAGS) $(HBAAPI_LIBS)
+fcoeadm_LDFLAGS = $(AM_LDFLAGS) -Wl,--no-as-needed $(HBAAPI_LIBS)
## rules for building fcoemon
fcoemon_SOURCES = fcoemon.c
@@ -23,7 +23,7 @@ fcoemon_LDFLAGS = $(AM_LDFLAGS) -lrt
fcping_SOURCES = fcping.c
fcping_LDADD = lib/libutil.a
fcping_CFLAGS = $(AM_CFLAGS) $(HBAAPI_CFLAGS)
-fcping_LDFLAGS = $(AM_LDFLAGS) $(HBAAPI_LIBS) -lrt
+fcping_LDFLAGS = $(AM_LDFLAGS) -Wl,--no-as-needed $(HBAAPI_LIBS) -lrt
## rules for building fipvlan
fipvlan_SOURCES = fipvlan.c

3
fcoe-utils-1.0.29.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d13fe5d755258109812751aa8788087d33a5cc54f4f43a50b93664dad38968af
size 120340

235
fcoe-utils.changes Normal file
View File

@ -0,0 +1,235 @@
-------------------------------------------------------------------
Thu Oct 10 13:34:08 CEST 2013 - hare@suse.de
- Disable --as-needed to fix build failures
- Use %fillup for sysconfig file
- Fixup build dependencies
-------------------------------------------------------------------
Wed Oct 9 14:04:35 UTC 2013 - tchvatal@suse.com
- Bump to 1.0.29 removing all our suse stuff.
* Still does not build, requires packaging of other deps they
provide in git repo to clone.
-------------------------------------------------------------------
Tue Jul 23 14:38:15 CEST 2013 - ohering@suse.de
- Remove usage of absolute paths in initrd
- List all used binaries in programs tag
- Use new emergency function, related to other bug (bnc#809812)
- Remove unneeded mkdir in setup script, mkinitrd does it now
-------------------------------------------------------------------
Tue May 29 13:08:21 UTC 2012 - puzel@suse.com
- fix build with automake-1.12
- add: automake-1.12.patch
-------------------------------------------------------------------
Fri Dec 2 16:25:04 UTC 2011 - coolo@suse.com
- add automake as buildrequire to avoid implicit dependency
-------------------------------------------------------------------
Tue Jul 6 13:20:52 CEST 2010 - hare@suse.de
- Fix build on Factory.
-------------------------------------------------------------------
Tue Jul 6 11:20:52 CEST 2010 - hare@suse.de
- Refresh patches.
-------------------------------------------------------------------
Tue Jul 6 10:56:33 CEST 2010 - hare@suse.de
- Port from SLES11 SP1.
-------------------------------------------------------------------
Mon May 10 18:02:18 CEST 2010 - hare@suse.de
- Fix EMC SAN MAC issue (bnc#603964)
-------------------------------------------------------------------
Mon Apr 26 14:12:43 CEST 2010 - hare@suse.de
- fixes no lun display issue due to wrong check for target role
(bnc#599421)
-------------------------------------------------------------------
Thu Apr 8 10:36:53 CEST 2010 - hare@suse.de
- Resync with open-fcoe for RC3 (bnc#594212)
-------------------------------------------------------------------
Thu Mar 25 13:36:12 CET 2010 - hare@suse.de
- More fipvlan fixes for RC2 (bnc#590324)
- Update mkinitrd script to actually boot the system (bnc#590868)
-------------------------------------------------------------------
Tue Mar 23 14:12:30 CET 2010 - hare@suse.de
- Sync-up package with git tree for RC2 (bnc#590324)
- Compile against lldpad (bnc#590487)
-------------------------------------------------------------------
Mon Mar 15 13:50:54 CET 2010 - hare@suse.de
- Sync-up package with commit id
9403c2aaac0b79d0d236ef9413cc88b7d6f7f04e (bnc#588150)
-------------------------------------------------------------------
Sun Mar 14 11:59:25 CET 2010 - ro@suse.de
- finally fix build
-------------------------------------------------------------------
Sat Mar 13 17:31:15 CET 2010 - ro@suse.de
- fix typo in specfile
-------------------------------------------------------------------
Fri Mar 5 10:47:03 CET 2010 - hare@suse.de
- Add option '-i' to fipvlan (bnc#585045)
- Add setup script /sbin/fcoe-setup (bnc#585045)
-------------------------------------------------------------------
Mon Feb 22 15:25:30 CET 2010 - hare@suse.de
- Fixup mkinitrd scripts (bnc#570643)
-------------------------------------------------------------------
Mon Feb 22 12:12:58 CET 2010 - hare@suse.de
- Sync-up package with git tree (bnc#581550)
-------------------------------------------------------------------
Fri Jan 22 08:56:46 CET 2010 - hare@suse.de
- Sync-up package with git commit id
3f25915a92c308c5db352a7fe24092350498f179 (bnc#572686)
- fcoemon uses memcpy when copying path name (bnc#572893)
-------------------------------------------------------------------
Thu Jan 14 14:23:54 CET 2010 - hare@suse.de
- Reverse mkinitrd script naming (bnc#570643)
-------------------------------------------------------------------
Mon Jan 11 13:11:25 CET 2010 - hare@suse.de
- Sync-up package for git tree (bnc#569508)
-------------------------------------------------------------------
Thu Dec 17 14:09:42 CET 2009 - hare@suse.de
- Add commands to issue create,destroy,reset from fcoeadm
through fcoemon (bnc#557495)
-------------------------------------------------------------------
Fri Dec 4 12:15:21 CET 2009 - hare@suse.de
- Update utilities with latest bugfixes (bnc#557495)
- Requires dcbd and libhbalinux2 for correct operation.
-------------------------------------------------------------------
Mon Nov 23 00:59:42 CET 2009 - ro@suse.de
- change buildreq to dcbd to fix build
-------------------------------------------------------------------
Mon Nov 16 14:00:57 CET 2009 - hare@suse.de
- Update to version 1.0.8 (FATE#306854)
-------------------------------------------------------------------
Wed Nov 11 09:36:28 CET 2009 - mcihar@suse.cz
- added mkinitrd support for booting FCoE (FATE#307444)
-------------------------------------------------------------------
Mon Feb 23 11:27:04 CET 2009 - sf@suse.de
- added Quickstart.SLES (bnc #478582)
to document SLES specifics
-------------------------------------------------------------------
Wed Feb 11 10:49:19 CET 2009 - sf@suse.de
- corrected open-fcoe-bug-473116-fix-library-path.diff
wrong library in /etc/hba.conf (bnc #473116)
-------------------------------------------------------------------
Mon Feb 9 14:56:21 CET 2009 - sf@suse.de
- add bug-473627_0001-fcoemon-service-fcoe-status-display-is-incorrect.patch
(bnc #473627)
- add bug-473628_0002-fcoeadm-Incorrectly-checking-return-value-of-strstr.patch
(bnc #473628)
- add open-fcoe-bug-473116-fix-library-path.diff
(bnc #473116)
- add bug-473630_0003-fcoemon-Incorrectly-calling-SA_LOG_ERR.patch
(bnc #473630)
- add bug-473127_0004-fcoemon-dcbd-starts-after-fcoe-starts-fcoemon-will.patch
(bnc #473127)
- add bug-473631_0005-fcoemon-Put-back-the-FCD_SEND_CONF-state.patch
(bnc #473631)
-------------------------------------------------------------------
Sat Jan 24 17:11:37 CET 2009 - sf@suse.de
- rediffed open-fcoe-update-1.0.4.diff
- rediffed open-fcoe-multi-arch.diff
due to not matching later patches:
- open-fcoe-update-1.0.6.diff
(bnc #459142)
- 0001-fcoemon-Ensure-pfc-advertise-on-and-pg-advertise-of.patch
(bnc #468457)
- 0002-fcoemon-Remove-the-FCD_SEND_CONF-state.patch
(bnc # 468459)
- 0003-fcoemon-Verify-link-flow-control-if-DCB-is-not-requ.patch
(bnc #468463)
- 0004-fcoemon-Don-t-check-errors-when-modprobe-fcoe.patch
(bnc #468466)
- 0005-fcoemon-Fix-errors-in-configure_dcb_interface-of.patch
(bnc # 468467)
- 0006-fcoemon-GET_PFC_CONFIG-command-is-not-issued-when-s.patch
(bnc #468468)
- open-fcoe-fixes.diff
(bnc #465598)
- open-fcoe-config.diff
move device configuration from Makefile to initscript
- open-fcoe-multi-arch2.diff
remove arch-check from Makefile
-------------------------------------------------------------------
Mon Jan 12 17:34:04 CET 2009 - sf@suse.de
- fixes for initscript (bnc #460021) and
configuration paths (bnc #460022)
-------------------------------------------------------------------
Mon Dec 1 17:53:17 CET 2008 - sf@suse.de
- update to 10.4 (bnc #438954)
- new patch from Intel
- Makefile fixes
- removed unneeded files from tarball
-------------------------------------------------------------------
Mon Nov 24 17:30:11 CET 2008 - sf@suse.de
- new version 1.0.3 (bnc #438954)
- add working tools
- add required libraries
- add hbaapi
- add required headers from dcbd
-------------------------------------------------------------------
Wed Sep 24 10:09:35 CEST 2008 - hare@suse.de
- Initial package (FATE#303914)

128
fcoe-utils.spec Normal file
View File

@ -0,0 +1,128 @@
#
# spec file for package fcoe-utils
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: fcoe-utils
Url: http://www.open-fcoe.org
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libHBAAPI2-devel
BuildRequires: libhbalinux2-devel
BuildRequires: libtool
BuildRequires: open-lldp-devel
Requires: device-mapper-multipath
Requires: iproute
BuildRequires: systemd
%systemd_requires
Version: 1.0.29
Release: 0
Summary: FCoE userspace management tools
License: GPL-2.0
Group: System/Daemons
# git://open-fcoe.org/fcoe/fcoe-utils.git
Source0: %{name}-%{version}.tar.xz
Source1: fcoe.service
Source2: fcoe.config
Source20: mkinitrd-boot.sh
Source22: mkinitrd-setup.sh
# Patches from Fedora
Patch1: fcoe-utils-1.0.29-make.patch
Patch2: fcoe-utils-1.0.18-help.patch
Patch3: fcoe-utils-1.0.28-format-strings.patch
Patch4: fcoe-utils-1.0.28-systemd-doc.patch
Patch5: fcoe-utils-1.0.29-no-as-needed.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Userspace tools to manage FibreChannel over Ethernet (FCoE)
connections.
%prep
%setup -q
%patch1 -p1 -b .make
%patch2 -p1 -b .help
%patch3 -p1 -b .format-strings
%patch4 -p1 -b .systemd-doc
%patch5 -p1 -b .no-as-needed
%build
autoreconf -vi
%configure
make %{?_smp_mflags}
%install
%make_install
# old init script
rm -rf %{buildroot}/etc/init.d
# mkinitrd script
install -d ${RPM_BUILD_ROOT}/lib/mkinitrd/scripts/
install -m 755 %{S:20} ${RPM_BUILD_ROOT}/lib/mkinitrd/scripts/boot-fcoe.sh
install -m 755 %{S:22} ${RPM_BUILD_ROOT}/lib/mkinitrd/scripts/setup-fcoe.sh
# unitfile
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcfcoe
# config
mkdir -p %{buildroot}/var/adm/fillup-templates
install -m 644 %{SOURCE2} %{buildroot}/var/adm/fillup-templates/sysconfig.fcoe
# contrib files
mkdir -p %{buildroot}%{_libexecdir}/fcoe
for file in \
contrib/*.sh \
debug/*sh
do install -m 755 ${file} %{buildroot}%{_libexecdir}/fcoe/
done
%pre
%service_add_pre fcoe.service
exit 0
%post
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%service_add_post fcoe.service
%fillup_only -n fcoe
exit 0
%preun
%service_del_preun fcoe.service
exit 0
%postun
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%service_del_preun fcoe.service
exit 0
%files
%defattr(-,root,root,-)
%doc README COPYING QUICKSTART
%{_sbindir}/*
%{_mandir}/man8/*
%{_unitdir}/fcoe.service
%{_sysconfdir}/fcoe/
%config(noreplace) %{_sysconfdir}/fcoe/config
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
%{_sysconfdir}/bash_completion.d/
/var/adm/fillup-templates/sysconfig.fcoe
%{_libexecdir}/fcoe/
/lib/mkinitrd
%changelog

5
fcoe.config Normal file
View File

@ -0,0 +1,5 @@
# All supported drivers listed here are loaded when service starts
SUPPORTED_DRIVERS="libfc fcoe"
# Add --debug to enable debug messages
FCOEMON_OPTS="--syslog"

12
fcoe.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Open-FCoE Inititator.
After=syslog.target network.target lldpad.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/fcoe
ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
[Install]
WantedBy=multi-user.target

57
mkinitrd-boot.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/bash
#%stage: device
#%depends: network lldpad
#%programs: fcoeadm
#%programs: fipvlan
#%programs: ip
#%programs: sed
#%programs: sleep
#%programs: vconfig
#%modules: fcoe 8021q
#%if: "$root_fcoe"
#
##### FCoE initialization
##
## This script initializes FCoE (FC over Ethernet).
load_modules
create_fcoe_vlan()
{
local if=$1
local vlan=$2
local vif=$3
vconfig add $if $vlan
tmp_vif=$(sed -n "s/\([^ ]*\).*${vlan}.*${if}/\1/p" /proc/net/vlan/config)
if [ "$vif" ] && [ "$tmp_vif" != "$vif" ] ; then
ip link set dev $tmp_vif name $vif
fi
wait_for_events
ip link set $if up
ip link set $vif up
}
wait_for_fcoe_if()
{
local ifname=$1
local retry_count=$udev_timeout
echo -n "Wait for FCoE link on $ifname: "
while [ $retry_count -gt 0 ] ; do
status=$(fcoeadm -i $ifname 2> /dev/null | sed -n "s/.*State: *\(.*\)/\1/p")
if [ "$status" = "Online" ] ; then
echo "Ok"
return 0
fi
echo -n "."
retry_count=$(($retry_count-1))
sleep 2
done
emergency "Failed!"
}
create_fcoe_vlan $fcoe_if $fcoe_vlan $fcoe_vif
fipvlan -s $fcoe_if
wait_for_fcoe_if $fcoe_vif

69
mkinitrd-setup.sh Normal file
View File

@ -0,0 +1,69 @@
#!/bin/bash
#
#%stage: device
#
check_fcoe_root() {
local devname=${1##/dev/}
local sysfs_path
if [ -d /sys/block/$devname/device ] ; then
sysfs_path=$(cd -P /sys/block/$devname/device 2> /dev/null; echo $PWD)
fi
if [ -z "$sysfs_path" ] ; then
return;
fi
case "$sysfs_path" in
*rport-*)
shost_path=${sysfs_path%%/rport-*}
shost=${shost_path##*/}
;;
esac
if [ -n "$shost_path" ] && [ -d "${shost_path}/fc_host/$shost" ] ; then
if grep -q fcoe $shost_path/fc_host/$shost/symbolic_name ; then
ifpath=${shost_path%/host*}
ifname=${ifpath##*/}
echo "$ifname"
fi
fi
}
for bd in $blockdev; do
update_blockdev $bd
ifname="$(check_fcoe_root $bd)"
if [ "$ifname" ]; then
if [ -f /proc/net/vlan/$ifname ] ; then
fcoe_vif=$ifname
fcoe_if=$(sed -n 's/Device: \(.*\)/\1/p' /proc/net/vlan/$ifname)
fcoe_vlan=$(sed -n 's/.*VID: \([0-9]*\).*/\1/p' /proc/net/vlan/$ifname)
else
fcoe_if=$ifname
fcoe_vif=$ifname
fi
root_fcoe=1
# This can break, but network does not support more interfaces for now
if [ -z "$interface" ] ; then
interface="$fcoe_if"
fi
fi
done
save_var root_fcoe
save_var fcoe_if
save_var fcoe_vif
save_var fcoe_vlan
if [ "${root_fcoe}" ] ; then
cp /etc/hba.conf ${tmp_mnt}/etc
libhbalinux=$(sed -n 's/org.open-fcoe.libhbalinux *\(.*\)/\1/p' /etc/hba.conf)
if [ "$libhbalinux" ] ; then
cp $libhbalinux ${tmp_mnt}$libhbalinux
fi
if [ -f "/etc/fcoe/cfg-${fcoe_vif}" ] ; then
# copy the fcoe configuration
mkdir $tmp_mnt/etc/fcoe
cp /etc/fcoe/cfg-${fcoe_vif} ${tmp_mnt}/etc/fcoe
fi
fi