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

d087b3
From 64f14715ed2fc4f54f8fad3bcada35ce8ff29b43 Mon Sep 17 00:00:00 2001
6c64be
From: Chris Leech <cleech@redhat.com>
6c64be
Date: Mon, 19 Nov 2012 16:38:45 -0800
d087b3
Subject: [PATCH] use var for config
6c64be
6c64be
---
6c64be
 README         | 33 ++++++++++++++++-----------------
6c64be
 doc/iscsiadm.8 |  8 ++++----
6c64be
 usr/idbm.c     |  6 +++---
6c64be
 usr/idbm.h     | 13 +++++++------
6c64be
 usr/iface.h    |  4 +++-
6c64be
 5 files changed, 33 insertions(+), 31 deletions(-)
6c64be
6c64be
diff --git a/README b/README
d087b3
index 8db3013..cfc7f2f 100644
6c64be
--- a/README
6c64be
+++ b/README
d087b3
@@ -170,8 +170,7 @@ Usage: iscsid [OPTION]
6c64be
 
6c64be
 Open-iSCSI persistent configuration is stored in a number of
6c64be
 directories under a configuration root directory, using a flat-file
6c64be
-format. This configuration root directory is /etc/iscsi by default,
6c64be
-but may also commonly be in /var/lib/iscsi.
6c64be
+format. This configuration root directory is /var/lib/iscsi by default.
6c64be
 
6c64be
 Configuration is contained in directories for:
6c64be
 
d087b3
@@ -489,7 +488,7 @@ a scsi_host per HBA port).
6c64be
 To manage both types of initiator stacks, iscsiadm uses the interface (iface)
6c64be
 structure. For each HBA port or for software iscsi for each network
6c64be
 device (ethX) or NIC, that you wish to bind sessions to you must create
6c64be
-a iface config /etc/iscsi/ifaces.
6c64be
+a iface config /var/lib/iscsi/ifaces.
6c64be
 
6c64be
 Prep:
6c64be
 
d087b3
@@ -523,29 +522,29 @@ Running:
6c64be
 iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
6c64be
 iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
6c64be
 
6c64be
-Will report iface configurations that are setup in /etc/iscsi/ifaces.
6c64be
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
6c64be
 The format is:
6c64be
 
6c64be
 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
6c64be
 
6c64be
 For software iscsi, you can create the iface configs by hand, but it is
6c64be
 reccomended that you use iscsiadm's iface mode. There is a iface.example in
6c64be
-/etc/iscsi/ifaces which can be used as a template for the daring.
6c64be
+/var/lib/iscsi/ifaces which can be used as a template for the daring.
6c64be
 
6c64be
 For each network object you wish to bind a session to you must create
6c64be
-a seperate iface config in /etc/iscsi/ifaces and each iface config file
6c64be
+a seperate iface config in /var/lib/iscsi/ifaces and each iface config file
6c64be
 must have a unique name which is less than or equal to 64 characters.
6c64be
 
6c64be
 Example:
6c64be
 
6c64be
 If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with
6c64be
 MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over
6c64be
-TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter:
6c64be
+TCP/IP. Then in /var/lib/iscsi/ifaces/iface0 you would enter:
6c64be
 
6c64be
 iface.transport_name = tcp
6c64be
 iface.hwaddress = 00:0F:1F:92:6B:BF
6c64be
 
6c64be
-and in /etc/iscsi/ifaces/iface1 you would enter:
6c64be
+and in /var/lib/iscsi/ifaces/iface1 you would enter:
6c64be
 
6c64be
 iface.transport_name = tcp
6c64be
 iface.hwaddress = 00:C0:DD:08:63:E7
d087b3
@@ -595,7 +594,7 @@ cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
6c64be
 qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty>
6c64be
 
6c64be
 
6c64be
-Will report iface configurations that are setup in /etc/iscsi/ifaces.
6c64be
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces.
6c64be
 The format is:
6c64be
 
6c64be
 iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
d087b3
@@ -681,7 +680,7 @@ need a seperate network connection to the target for discovery purposes.
6c64be
 *This will be fixed in the next version of open-iscsi*
6c64be
 
6c64be
 For compatibility reasons, when you run iscsiadm to do discovery, it
6c64be
-will check for interfaces in /etc/iscsi/iscsi/ifaces that are using
6c64be
+will check for interfaces in /var/lib/iscsi/ifaces that are using
6c64be
 tcp for the iface.transport and it will bind the portals that are discovered
6c64be
 so that they will be logged in through those ifaces. This behavior can also
6c64be
 be overriden by passing in the interfaces you want to use. For the case
d087b3
@@ -699,7 +698,7 @@ we do not bind a session to a iface, then you can use the special iface
6c64be
 
6c64be
 iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
6c64be
 
6c64be
-And if you did not define any interfaces in /etc/iscsi/ifaces and do
6c64be
+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
6c64be
 not pass anything into iscsiadm, running iscsiadm will do the default
6c64be
 behavior, where we allow the network subsystem to decide which
6c64be
 device to use.
d087b3
@@ -741,7 +740,7 @@ To now log into targets it is the same as with sofware iscsi. See section
6c64be
 
6c64be
 	    ./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
6c64be
 
6c64be
-	This will search /etc/iscsi/send_targets for a record with the
6c64be
+	This will search /var/lib/iscsi/send_targets for a record with the
6c64be
 	ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
6c64be
 	will perform discovery using the settings stored in the record.
6c64be
 	If a record does not exist, it will be created using the iscsid.conf
d087b3
@@ -750,7 +749,7 @@ To now log into targets it is the same as with sofware iscsi. See section
6c64be
 	The argument to -p may also be a hostname instead of an address.
6c64be
 	    ./iscsiadm -m discoverydb -t st -p smoehost --discover
6c64be
 
6c64be
-	For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
6c64be
+	For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
6c64be
 	interfaces using software iscsi. If any are found then nodes found
6c64be
 	during discovery will be setup so that they can logged in through
6c64be
 	those interfaces. To specify a specific iface, pass the
d087b3
@@ -806,7 +805,7 @@ To now log into targets it is the same as with sofware iscsi. See section
6c64be
 	This command will perform discovery, but not manipulate the node DB.
6c64be
 
6c64be
   - SendTargets iSCSI Discovery with a specific interface. If you
6c64be
-	wish to only use a subset of the interfaces in /etc/iscsi/ifaces
6c64be
+	wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces
6c64be
 	then you can pass them in during discovery:
6c64be
 
6c64be
 	     ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
d087b3
@@ -1207,8 +1206,8 @@ where targetname is the name of the target and ip_address:port is the address
6c64be
 and port of the portal. tpgt, is the portal group tag of
6c64be
 the portal, and is not used in iscsiadm commands except for static
6c64be
 record creation. And iface name is the name of the iscsi interface
6c64be
-defined in /etc/iscsi/ifaces. If no interface was defined in
6c64be
-/etc/iscsi/ifaces or passed in, the default behavior is used.
6c64be
+defined in /var/lib/iscsi/ifaces. If no interface was defined in
6c64be
+/var/lib/iscsi/ifaces or passed in, the default behavior is used.
6c64be
 Default here is iscsi_tcp/tcp to be used over which ever NIC the
6c64be
 network layer decides is best.
6c64be
 
d087b3
@@ -1323,7 +1322,7 @@ If set, iscsid will perform discovery to the address every
6c64be
 discovery.isns.discoveryd_poll_inval or
6c64be
 discovery.sendtargets.discoveryd_poll_inval seconds,
6c64be
 and it will log into any portals found from the discovery source using
6c64be
-the ifaces in /etc/iscsi/ifaces.
6c64be
+the ifaces in /var/lib/iscsi/ifaces.
6c64be
 
6c64be
 Note that for iSNS the poll_interval does not have to be set. If not set,
6c64be
 iscsid will only perform rediscovery when it gets a SCN from the server.
6c64be
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
d087b3
index c7d8c92..3f33f6c 100644
6c64be
--- a/doc/iscsiadm.8
6c64be
+++ b/doc/iscsiadm.8
d087b3
@@ -241,7 +241,7 @@ This option is only valid for ping submode.
6c64be
 .TP
6c64be
 \fB\-I\fR, \fB\-\-interface=\fI[iface]\fR
6c64be
 The interface argument specifies the iSCSI interface to use for the operation.
6c64be
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
6c64be
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
6c64be
 iSCSI (qla4xxx) the iface config must have the hardware address
6c64be
 (iface.hwaddress = port's MAC address)
6c64be
 and the driver/transport_name (iface.transport_name). The iface's name is
d087b3
@@ -318,7 +318,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and
d94dff
 \fInode\fR, all of their respective records are displayed; for \fIsession\fR,
d94dff
 all active sessions and connections are displayed; for \fIfw\fR, all boot
d94dff
 firmware values are displayed; for \fIhost\fR, all iSCSI hosts are displayed;
d94dff
-and for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed.
d94dff
+and for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed.
6c64be
 
6c64be
 .TP
6c64be
 \fB\-n\fR, \fB\-\-name=\fIname\fR
d087b3
@@ -703,10 +703,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
6c64be
 The file containing the iSCSI InitiatorName and InitiatorAlias read by
6c64be
 \fBiscsid\fR and \fBiscsiadm\fR on startup.
6c64be
 .TP
6c64be
-/etc/iscsi/nodes/
6c64be
+/var/lib/iscsi/nodes/
6c64be
 This directory contains the nodes with their targets.
6c64be
 .TP
6c64be
-/etc/iscsi/send_targets
6c64be
+/var/lib/iscsi/send_targets
6c64be
 This directory contains the portals.
6c64be
 
6c64be
 .SH "SEE ALSO"
6c64be
diff --git a/usr/idbm.c b/usr/idbm.c
d087b3
index 2d64172..0cffaff 100644
6c64be
--- a/usr/idbm.c
6c64be
+++ b/usr/idbm.c
d087b3
@@ -2843,9 +2843,9 @@ free_info:
6c64be
 int idbm_init(idbm_get_config_file_fn *fn)
6c64be
 {
6c64be
 	/* make sure root db dir is there */
6c64be
-	if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
6c64be
-		if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
d087b3
-			log_error("Could not make %s %d", ISCSI_CONFIG_ROOT,
6c64be
+	if (access(ISCSIVAR, F_OK) != 0) {
6c64be
+		if (mkdir(ISCSIVAR, 0660) != 0) {
d087b3
+			log_error("Could not make %s %d", ISCSIVAR,
6c64be
 				   errno);
6c64be
 			return errno;
6c64be
 		}
6c64be
diff --git a/usr/idbm.h b/usr/idbm.h
d94dff
index b9020fe..b89ddff 100644
6c64be
--- a/usr/idbm.h
6c64be
+++ b/usr/idbm.h
6c64be
@@ -29,12 +29,13 @@
6c64be
 #include "list.h"
6c64be
 #include "flashnode.h"
6c64be
 
6c64be
-#define NODE_CONFIG_DIR		ISCSI_CONFIG_ROOT"nodes"
6c64be
-#define SLP_CONFIG_DIR		ISCSI_CONFIG_ROOT"slp"
6c64be
-#define ISNS_CONFIG_DIR		ISCSI_CONFIG_ROOT"isns"
6c64be
-#define STATIC_CONFIG_DIR	ISCSI_CONFIG_ROOT"static"
6c64be
-#define FW_CONFIG_DIR		ISCSI_CONFIG_ROOT"fw"
6c64be
-#define ST_CONFIG_DIR		ISCSI_CONFIG_ROOT"send_targets"
6c64be
+#define ISCSIVAR		"/var/lib/iscsi/"
6c64be
+#define NODE_CONFIG_DIR		ISCSIVAR"nodes"
6c64be
+#define SLP_CONFIG_DIR		ISCSIVAR"slp"
6c64be
+#define ISNS_CONFIG_DIR		ISCSIVAR"isns"
6c64be
+#define STATIC_CONFIG_DIR	ISCSIVAR"static"
6c64be
+#define FW_CONFIG_DIR		ISCSIVAR"fw"
6c64be
+#define ST_CONFIG_DIR		ISCSIVAR"send_targets"
6c64be
 #define ST_CONFIG_NAME		"st_config"
6c64be
 #define ISNS_CONFIG_NAME	"isns_config"
6c64be
 
6c64be
diff --git a/usr/iface.h b/usr/iface.h
6c64be
index 01f7074..f396918 100644
6c64be
--- a/usr/iface.h
6c64be
+++ b/usr/iface.h
6c64be
@@ -20,7 +20,9 @@
6c64be
 #ifndef ISCSI_IFACE_H
6c64be
 #define ISCSI_IFACE_H
6c64be
 
6c64be
-#define IFACE_CONFIG_DIR	ISCSI_CONFIG_ROOT"ifaces"
6c64be
+#include "idbm.h"
6c64be
+
6c64be
+#define IFACE_CONFIG_DIR	ISCSIVAR"ifaces"
6c64be
 
6c64be
 struct iface_rec;
6c64be
 struct list_head;
6c64be
-- 
d087b3
2.5.5
6c64be