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

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