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

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