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

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