Blame SOURCES/0006-use-var-for-config.patch

46c2f0
From 9cae86dd15bf78ee9d221f722f723062eb6ad3d8 Mon Sep 17 00:00:00 2001
46c2f0
From: Chris Leech <cleech@redhat.com>
46c2f0
Date: Mon, 19 Nov 2012 16:38:45 -0800
46c2f0
Subject: [PATCH] use var for config
46c2f0
46c2f0
---
46c2f0
 README         | 33 ++++++++++++++++-----------------
46c2f0
 doc/iscsiadm.8 |  8 ++++----
46c2f0
 doc/iscsid.8   |  2 +-
46c2f0
 usr/idbm.c     |  6 +++---
46c2f0
 usr/idbm.h     | 13 +++++++------
46c2f0
 usr/iface.h    |  3 ++-
46c2f0
 6 files changed, 33 insertions(+), 32 deletions(-)
46c2f0
46c2f0
diff --git a/README b/README
46c2f0
index c05814a..326c3b0 100644
46c2f0
--- a/README
46c2f0
+++ b/README
46c2f0
@@ -172,8 +172,7 @@ Usage: iscsid [OPTION]
46c2f0
 
46c2f0
 Open-iSCSI persistent configuration is stored in a number of
46c2f0
 directories under a configuration root directory, using a flat-file
46c2f0
-format. This configuration root directory is /etc/iscsi by default,
46c2f0
-but may also commonly be in /var/lib/iscsi.
46c2f0
+format. This configuration root directory is /var/lib/iscsi by default.
46c2f0
 
46c2f0
 Configuration is contained in directories for:
46c2f0
 
46c2f0
@@ -561,7 +560,7 @@ a scsi_host per HBA port).
46c2f0
 To manage both types of initiator stacks, iscsiadm uses the interface (iface)
46c2f0
 structure. For each HBA port or for software iscsi for each network
46c2f0
 device (ethX) or NIC, that you wish to bind sessions to you must create
46c2f0
-a iface config /etc/iscsi/ifaces.
46c2f0
+a iface config /var/lib/iscsi/ifaces.
46c2f0
 
46c2f0
 Prep
46c2f0
 ----
46c2f0
@@ -594,7 +593,7 @@ Running
46c2f0
 The command
46c2f0
 	iscsiadm -m iface
46c2f0
 
46c2f0
-will report iface configurations that are setup in /etc/iscsi/ifaces:
46c2f0
+will report iface configurations that are setup in /var/lib/iscsi/ifaces:
46c2f0
 
46c2f0
 	iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
46c2f0
 	iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
46c2f0
@@ -604,10 +603,10 @@ The format is:
46c2f0
 
46c2f0
 For software iscsi, you can create the iface configs by hand, but it is
46c2f0
 recommended that you use iscsiadm's iface mode. There is an iface.example in
46c2f0
-/etc/iscsi/ifaces which can be used as a template for the daring.
46c2f0
+/var/lib/iscsi/ifaces which can be used as a template for the daring.
46c2f0
 
46c2f0
 For each network object you wish to bind a session to, you must create
46c2f0
-a separate iface config in /etc/iscsi/ifaces and each iface config file
46c2f0
+a separate iface config in /var/lib/iscsi/ifaces and each iface config file
46c2f0
 must have a unique name which is less than or equal to 64 characters.
46c2f0
 
46c2f0
 Example
46c2f0
@@ -615,12 +614,12 @@ Example
46c2f0
 
46c2f0
 If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
46c2f0
 MAC address 00:C0:DD:08:63:E7, and you wanted to do software iscsi over
46c2f0
-TCP/IP, then in /etc/iscsi/ifaces/iface0 you would enter:
46c2f0
+TCP/IP, then in /var/lib/iscsi/ifaces/iface0 you would enter:
46c2f0
 
46c2f0
 	iface.transport_name = tcp
46c2f0
 	iface.hwaddress = 00:0F:1F:92:6B:BF
46c2f0
 
46c2f0
-and in /etc/iscsi/ifaces/iface1 you would enter:
46c2f0
+and in /var/lib/iscsi/ifaces/iface1 you would enter:
46c2f0
 
46c2f0
 	iface.transport_name = tcp
46c2f0
 	iface.hwaddress = 00:C0:DD:08:63:E7
46c2f0
@@ -662,7 +661,7 @@ port. The iface name will be of the form:
46c2f0
 Running the following command:
46c2f0
 	iscsiadm -m iface
46c2f0
 
46c2f0
-will report iface configurations that are setup in /etc/iscsi/ifaces:
46c2f0
+will report iface configurations that are setup in /var/lib/iscsi/ifaces:
46c2f0
 
46c2f0
 	default tcp,<empty>,<empty>,<empty>,<empty>
46c2f0
 	iser iser,<empty>,<empty>,<empty>,<empty>
46c2f0
@@ -742,7 +741,7 @@ need a separate network connection to the target for discovery purposes.
46c2f0
 *This will be fixed in the next version of open-iscsi*
46c2f0
 
46c2f0
 For compatibility reasons, when you run iscsiadm to do discovery, it
46c2f0
-will check for interfaces in /etc/iscsi/iscsi/ifaces that are using
46c2f0
+will check for interfaces in /var/lib/iscsi/iscsi/ifaces that are using
46c2f0
 tcp for the iface.transport, and it will bind the portals that are discovered
46c2f0
 so that they will be logged in through those ifaces. This behavior can also
46c2f0
 be overridden by passing in the interfaces you want to use. For the case
46c2f0
@@ -757,7 +756,7 @@ If you had defined interfaces but wanted the old behavior, where we do not
46c2f0
 bind a session to an iface, then you can use the special iface "default":
46c2f0
 	iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
46c2f0
 
46c2f0
-And if you did not define any interfaces in /etc/iscsi/ifaces and do
46c2f0
+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
46c2f0
 not pass anything into iscsiadm, running iscsiadm will do the default
46c2f0
 behavior, allowing the network subsystem to decide which device to use.
46c2f0
 
46c2f0
@@ -793,7 +792,7 @@ Discovery mode
46c2f0
 		ID [192.168.1.1:3260]:
46c2f0
 	iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
46c2f0
 
46c2f0
-	This will search /etc/iscsi/send_targets for a record with the
46c2f0
+	This will search /var/lib/iscsi/send_targets for a record with the
46c2f0
 	ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
46c2f0
 	will perform discovery using the settings stored in the record.
46c2f0
 	If a record does not exist, it will be created using the iscsid.conf
46c2f0
@@ -802,7 +801,7 @@ Discovery mode
46c2f0
 	The argument to -p may also be a hostname instead of an address:
46c2f0
 		iscsiadm -m discoverydb -t st -p somehost --discover
46c2f0
 
46c2f0
-	For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
46c2f0
+	For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
46c2f0
 	interfaces using software iscsi. If any are found then nodes found
46c2f0
 	during discovery will be setup so that they can logged in through
46c2f0
 	those interfaces. To specify a specific iface, pass the
46c2f0
@@ -853,7 +852,7 @@ Discovery mode
46c2f0
 
46c2f0
 - SendTargets iSCSI Discovery with a specific interface.
46c2f0
 		If you wish to only use a subset of the interfaces in
46c2f0
-		/etc/iscsi/ifaces, then you can pass them in during discovery:
46c2f0
+		/var/lib/iscsi/ifaces, then you can pass them in during discovery:
46c2f0
 	iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
46c2f0
 		--interface=iface0 --interface=iface1 --discover
46c2f0
 
46c2f0
@@ -1223,8 +1222,8 @@ where targetname is the name of the target and ip_address:port is the address
46c2f0
 and port of the portal. tpgt is the Target Portal Group Tag of
46c2f0
 the portal, and is not used in iscsiadm commands except for static
46c2f0
 record creation. ifacename is the name of the iscsi interface
46c2f0
-defined in /etc/iscsi/ifaces. If no interface was defined in
46c2f0
-/etc/iscsi/ifaces or passed in, the default behavior is used.
46c2f0
+defined in /var/lib/iscsi/ifaces. If no interface was defined in
46c2f0
+/var/lib/iscsi/ifaces or passed in, the default behavior is used.
46c2f0
 Default here is iscsi_tcp/tcp to be used over whichever NIC the
46c2f0
 network layer decides is best.
46c2f0
 
46c2f0
@@ -1336,7 +1335,7 @@ If set, iscsid will perform discovery to the address every
46c2f0
 discovery.isns.discoveryd_poll_inval or
46c2f0
 discovery.sendtargets.discoveryd_poll_inval seconds,
46c2f0
 and it will log into any portals found from the discovery source using
46c2f0
-the ifaces in /etc/iscsi/ifaces.
46c2f0
+the ifaces in /var/lib/iscsi/ifaces.
46c2f0
 
46c2f0
 Note that for iSNS the poll_interval does not have to be set. If not set,
46c2f0
 iscsid will only perform rediscovery when it gets a SCN from the server.
46c2f0
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
46c2f0
index bf23dd2..9cfce16 100644
46c2f0
--- a/doc/iscsiadm.8
46c2f0
+++ b/doc/iscsiadm.8
46c2f0
@@ -228,7 +228,7 @@ This option is only valid for ping submode.
46c2f0
 .TP
46c2f0
 \fB\-I\fR, \fB\-\-interface=\fI[iface]\fR
46c2f0
 The interface argument specifies the iSCSI interface to use for the operation.
46c2f0
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
46c2f0
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
46c2f0
 iSCSI (qla4xxx) the iface config must have the hardware address
46c2f0
 (iface.hwaddress = port's MAC address)
46c2f0
 and the driver/transport_name (iface.transport_name). The iface's name is
46c2f0
@@ -301,7 +301,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and
46c2f0
 \fInode\fR, all of their respective records are displayed; for \fIsession\fR,
46c2f0
 all active sessions and connections are displayed; for \fIfw\fR, all boot
46c2f0
 firmware values are displayed; for \fIhost\fR, all iSCSI hosts are displayed;
46c2f0
-and for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed.
46c2f0
+and for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed.
46c2f0
 .TP
46c2f0
 \fB\-n\fR, \fB\-\-name=\fIname\fR
46c2f0
 In node mode, specify a field \fIname\fR in a record. In flashnode submode
46c2f0
@@ -640,10 +640,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
46c2f0
 The file containing the iSCSI InitiatorName and InitiatorAlias read by
46c2f0
 \fBiscsid\fR and \fBiscsiadm\fR on startup.
46c2f0
 .TP
46c2f0
-/etc/iscsi/nodes/
46c2f0
+/var/lib/iscsi/nodes/
46c2f0
 This directory contains the nodes with their targets.
46c2f0
 .TP
46c2f0
-/etc/iscsi/send_targets
46c2f0
+/var/lib/iscsi/send_targets
46c2f0
 This directory contains the portals.
46c2f0
 .SH "SEE ALSO"
46c2f0
 .BR iscsid (8)
46c2f0
diff --git a/doc/iscsid.8 b/doc/iscsid.8
46c2f0
index 6f9218f..0da0551 100644
46c2f0
--- a/doc/iscsid.8
46c2f0
+++ b/doc/iscsid.8
46c2f0
@@ -65,7 +65,7 @@ and
46c2f0
 .B iscsiadm
46c2f0
 on startup.
46c2f0
 .TP
46c2f0
-/etc/iscsi/nodes
46c2f0
+/var/lib/iscsi/nodes
46c2f0
 Open-iSCSI persistent configuration database
46c2f0
 
46c2f0
 .SH "SEE ALSO"
46c2f0
diff --git a/usr/idbm.c b/usr/idbm.c
46c2f0
index aed08f2..15802c3 100644
46c2f0
--- a/usr/idbm.c
46c2f0
+++ b/usr/idbm.c
46c2f0
@@ -2968,9 +2968,9 @@ free_info:
46c2f0
 int idbm_init(idbm_get_config_file_fn *fn)
46c2f0
 {
46c2f0
 	/* make sure root db dir is there */
46c2f0
-	if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
46c2f0
-		if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
46c2f0
-			log_error("Could not make %s %d", ISCSI_CONFIG_ROOT,
46c2f0
+	if (access(ISCSIVAR, F_OK) != 0) {
46c2f0
+		if (mkdir(ISCSIVAR, 0660) != 0) {
46c2f0
+			log_error("Could not make %s %d", ISCSIVAR,
46c2f0
 				   errno);
46c2f0
 			return errno;
46c2f0
 		}
46c2f0
diff --git a/usr/idbm.h b/usr/idbm.h
46c2f0
index 18c5025..6bdfd60 100644
46c2f0
--- a/usr/idbm.h
46c2f0
+++ b/usr/idbm.h
46c2f0
@@ -30,12 +30,13 @@
46c2f0
 #include "list.h"
46c2f0
 #include "flashnode.h"
46c2f0
 
46c2f0
-#define NODE_CONFIG_DIR		ISCSI_CONFIG_ROOT"nodes"
46c2f0
-#define SLP_CONFIG_DIR		ISCSI_CONFIG_ROOT"slp"
46c2f0
-#define ISNS_CONFIG_DIR		ISCSI_CONFIG_ROOT"isns"
46c2f0
-#define STATIC_CONFIG_DIR	ISCSI_CONFIG_ROOT"static"
46c2f0
-#define FW_CONFIG_DIR		ISCSI_CONFIG_ROOT"fw"
46c2f0
-#define ST_CONFIG_DIR		ISCSI_CONFIG_ROOT"send_targets"
46c2f0
+#define ISCSIVAR		"/var/lib/iscsi/"
46c2f0
+#define NODE_CONFIG_DIR		ISCSIVAR"nodes"
46c2f0
+#define SLP_CONFIG_DIR		ISCSIVAR"slp"
46c2f0
+#define ISNS_CONFIG_DIR		ISCSIVAR"isns"
46c2f0
+#define STATIC_CONFIG_DIR	ISCSIVAR"static"
46c2f0
+#define FW_CONFIG_DIR		ISCSIVAR"fw"
46c2f0
+#define ST_CONFIG_DIR		ISCSIVAR"send_targets"
46c2f0
 #define ST_CONFIG_NAME		"st_config"
46c2f0
 #define ISNS_CONFIG_NAME	"isns_config"
46c2f0
 
46c2f0
diff --git a/usr/iface.h b/usr/iface.h
46c2f0
index 6c06f7f..c8b9de9 100644
46c2f0
--- a/usr/iface.h
46c2f0
+++ b/usr/iface.h
46c2f0
@@ -21,8 +21,9 @@
46c2f0
 #define ISCSI_IFACE_H
46c2f0
 
46c2f0
 #include <libopeniscsiusr/libopeniscsiusr.h>
46c2f0
+#include "idbm.h"
46c2f0
 
46c2f0
-#define IFACE_CONFIG_DIR	ISCSI_CONFIG_ROOT"ifaces"
46c2f0
+#define IFACE_CONFIG_DIR	ISCSIVAR"ifaces"
46c2f0
 
46c2f0
 struct iface_rec;
46c2f0
 struct list_head;
46c2f0
-- 
46c2f0
2.21.0
46c2f0