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

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