2015-08-04 12:18:41 +02:00
|
|
|
From 1e3d735a5cd1edefaeff75c43aed68661b8cda7e Mon Sep 17 00:00:00 2001
|
2014-04-18 13:42:07 +02:00
|
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
|
|
Date: Fri, 11 Apr 2014 15:38:26 +0200
|
|
|
|
Subject: fcoemon: Correctly handle options in the service file
|
|
|
|
|
|
|
|
When runnig under systemd we can't really modify the arguments
|
|
|
|
to provide an 'FCOEMON_OPTS' variable. Instead we should be
|
|
|
|
modifying fcoemon --debug and --syslog to accept 'yes' or 'no'
|
|
|
|
as parameters; that way we can use the variables directly.
|
|
|
|
|
|
|
|
References: bnc#872732
|
|
|
|
|
|
|
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
|
|
---
|
|
|
|
doc/fcoemon.txt | 6 +++---
|
|
|
|
etc/systemd/fcoe.service | 4 ++--
|
|
|
|
fcoemon.c | 24 +++++++++++++++---------
|
|
|
|
3 files changed, 20 insertions(+), 14 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/doc/fcoemon.txt b/doc/fcoemon.txt
|
|
|
|
index 7ccf892..7449601 100644
|
|
|
|
--- a/doc/fcoemon.txt
|
|
|
|
+++ b/doc/fcoemon.txt
|
|
|
|
@@ -53,13 +53,13 @@ OPTIONS
|
|
|
|
-------
|
|
|
|
*-f*, *--foreground*::
|
|
|
|
Run *fcoemon* in the foreground.
|
|
|
|
-*-d*, *--debug*::
|
|
|
|
- Enable debugging messages.
|
|
|
|
+*-d*, *--debug=yes|no*::
|
|
|
|
+ Enable or disable debugging messages.
|
|
|
|
*-l*, *--legacy*::
|
|
|
|
Force fcoemon to use the legacy /sys/module/libfcoe/parameters/
|
|
|
|
interface. The default is to use the newer /sys/bus/fcoe/ interfaces
|
|
|
|
if they are available.
|
|
|
|
-*-s*, *--syslog*::
|
|
|
|
+*-s*, *--syslog=yes|no*::
|
|
|
|
Use syslogd for logging. The default behavior is to log to stdout
|
|
|
|
and stderr.
|
|
|
|
*-h*, *--help*::
|
|
|
|
diff --git a/etc/systemd/fcoe.service b/etc/systemd/fcoe.service
|
|
|
|
index 5e5c8a2..2e10bcd 100644
|
|
|
|
--- a/etc/systemd/fcoe.service
|
|
|
|
+++ b/etc/systemd/fcoe.service
|
|
|
|
@@ -4,9 +4,9 @@ After=syslog.target network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
|
|
|
-EnvironmentFile=/etc/sysconfig/fcoe
|
|
|
|
+EnvironmentFile=/etc/fcoe/config
|
|
|
|
ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
|
|
|
|
-ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
|
|
|
|
+ExecStart=/usr/sbin/fcoemon --debug=$DEBUG --syslog=$SYSLOG
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
diff --git a/fcoemon.c b/fcoemon.c
|
2015-08-04 12:18:41 +02:00
|
|
|
index c0af99b..3ccdd5f 100644
|
2014-04-18 13:42:07 +02:00
|
|
|
--- a/fcoemon.c
|
|
|
|
+++ b/fcoemon.c
|
|
|
|
@@ -336,9 +336,9 @@ static int fcoe_vid_from_ifname(const char *ifname);
|
|
|
|
* Table for getopt_long(3).
|
|
|
|
*/
|
|
|
|
static struct option fcm_options[] = {
|
|
|
|
- {"debug", 0, NULL, 'd'},
|
|
|
|
+ {"debug", 1, NULL, 'd'},
|
|
|
|
{"legacy", 0, NULL, 'l'},
|
|
|
|
- {"syslog", 0, NULL, 's'},
|
|
|
|
+ {"syslog", 1, NULL, 's'},
|
|
|
|
{"exec", 1, NULL, 'e'},
|
|
|
|
{"foreground", 0, NULL, 'f'},
|
|
|
|
{"version", 0, NULL, 'v'},
|
2015-08-04 12:18:41 +02:00
|
|
|
@@ -3229,9 +3229,9 @@ static void fcm_usage(void)
|
2014-04-18 13:42:07 +02:00
|
|
|
{
|
|
|
|
printf("Usage: %s\n"
|
|
|
|
"\t [-f|--foreground]\n"
|
|
|
|
- "\t [-d|--debug]\n"
|
|
|
|
+ "\t [-d|--debug=yes|no]\n"
|
|
|
|
"\t [-l|--legacy]\n"
|
|
|
|
- "\t [-s|--syslog]\n"
|
|
|
|
+ "\t [-s|--syslog=yes|no]\n"
|
|
|
|
"\t [-v|--version]\n"
|
|
|
|
"\t [-h|--help]\n\n", progname);
|
|
|
|
exit(1);
|
2015-08-04 12:18:41 +02:00
|
|
|
@@ -3685,22 +3685,28 @@ int main(int argc, char **argv)
|
2014-04-18 13:42:07 +02:00
|
|
|
sa_log_flags = 0;
|
|
|
|
openlog(sa_log_prefix, LOG_CONS, LOG_DAEMON);
|
|
|
|
|
|
|
|
- while ((c = getopt_long(argc, argv, "fdhlsv",
|
|
|
|
+ while ((c = getopt_long(argc, argv, "fd:hls:v",
|
|
|
|
fcm_options, NULL)) != -1) {
|
|
|
|
switch (c) {
|
|
|
|
case 'f':
|
|
|
|
fcm_fg = 1;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
- fcoe_config.debug = 1;
|
|
|
|
- enable_debug_log(1);
|
|
|
|
+ if (!strncmp(optarg, "yes", 3) ||
|
|
|
|
+ !strncmp(optarg, "YES", 3)) {
|
|
|
|
+ fcoe_config.debug = 1;
|
|
|
|
+ enable_debug_log(1);
|
|
|
|
+ }
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
force_legacy = true;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
- fcoe_config.use_syslog = 1;
|
|
|
|
- enable_syslog(1);
|
|
|
|
+ if (!strncmp(optarg, "yes", 3) ||
|
|
|
|
+ !strncmp(optarg, "YES", 3)) {
|
|
|
|
+ fcoe_config.use_syslog = 1;
|
|
|
|
+ enable_syslog(1);
|
|
|
|
+ }
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
printf("%s\n", FCOE_UTILS_VERSION);
|
|
|
|
--
|
2015-08-04 12:18:41 +02:00
|
|
|
1.8.4.5
|
2014-04-18 13:42:07 +02:00
|
|
|
|