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