diff options
8 files changed, 216 insertions, 0 deletions
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/initiatorname.iscsi b/meta-openstack/recipes-connectivity/open-iscsi/files/initiatorname.iscsi new file mode 100644 index 0000000..842c2ab --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/initiatorname.iscsi | |||
@@ -0,0 +1 @@ | |||
InitiatorName=HidaV | |||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator new file mode 100644 index 0000000..7fa49a2 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator | |||
@@ -0,0 +1,4 @@ | |||
1 | # default command line settings for open-iscsi's iscsid | ||
2 | |||
3 | OPTS_ISCSID="" | ||
4 | OPTS_ISCSIADM="" | ||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator-targets.service b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator-targets.service new file mode 100644 index 0000000..564b2d2 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator-targets.service | |||
@@ -0,0 +1,15 @@ | |||
1 | [Unit] | ||
2 | Description=Open-iSCSI initiator (i.e. client) target bindings | ||
3 | After=iscsi-initiator.service | ||
4 | Requires=iscsi-initiator.service | ||
5 | |||
6 | [Service] | ||
7 | Type=oneshot | ||
8 | EnvironmentFile=/etc/default/iscsi-initiator | ||
9 | ExecStart=/usr/sbin/iscsiadm -m node --loginall=automatic $OPTS_ISCSIADM | ||
10 | ExecStop=/usr/sbin/iscsiadm -m node --logoutall=all $OPTS_ISCSIADM | ||
11 | RemainAfterExit=yes | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
15 | |||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator.service b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator.service new file mode 100644 index 0000000..b139751 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/iscsi-initiator.service | |||
@@ -0,0 +1,12 @@ | |||
1 | [Unit] | ||
2 | Description=Open-iSCSI initiator (i.e. client) service | ||
3 | After=syslog.target | ||
4 | |||
5 | [Service] | ||
6 | EnvironmentFile=/etc/default/iscsi-initiator | ||
7 | ExecStartPre=/sbin/modprobe iscsi_tcp | ||
8 | ExecStart=/usr/sbin/iscsid -f $OPTS_ISCSID | ||
9 | |||
10 | [Install] | ||
11 | WantedBy=multi-user.target | ||
12 | |||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/open-iscsi b/meta-openstack/recipes-connectivity/open-iscsi/files/open-iscsi new file mode 100755 index 0000000..58d8ae1 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/open-iscsi | |||
@@ -0,0 +1,94 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: | ||
4 | # Required-Start: | ||
5 | # Required-Stop: | ||
6 | # Default-Start: | ||
7 | # Default-Stop: | ||
8 | # Short-Description: Starts and stops the iSCSI initiator services and logins to default targets | ||
9 | ### END INIT INFO | ||
10 | set -x | ||
11 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
12 | DAEMON=/usr/sbin/iscsid | ||
13 | ADM=/usr/sbin/iscsiadm | ||
14 | PIDFILE=/var/run/iscsid.pid | ||
15 | |||
16 | [ -x "$DAEMON" ] || exit 0 | ||
17 | |||
18 | if [ ! -d /sys/class/ ]; then | ||
19 | logger -t iscsi-initiator "iSCSI requires a mounted sysfs, not started." | ||
20 | exit 1 | ||
21 | fi | ||
22 | |||
23 | nodestartup_re='s/^node\.conn\[0]\.startup[ ]*=[ ]*//p' | ||
24 | |||
25 | RETVAL=0 | ||
26 | |||
27 | start() { | ||
28 | logger -t iscsi-initiator "Starting iSCSI initiator service" "iscsid" | ||
29 | modprobe -q iscsi_tcp 2>/dev/null || : | ||
30 | modprobe -q ib_iser 2>/dev/null || : | ||
31 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON | ||
32 | RETVAL=$? | ||
33 | logger -t iscsi-initiator "Command returned $RETVAL" | ||
34 | starttargets | ||
35 | } | ||
36 | |||
37 | starttargets() { | ||
38 | logger -t iscsi-initiator "Setting up iSCSI targets" | ||
39 | $ADM -m node --loginall=automatic | ||
40 | logger -t iscsi-initiator OK | ||
41 | } | ||
42 | |||
43 | stoptargets() { | ||
44 | logger -t iscsi-initiator "Disconnecting iSCSI targets" | ||
45 | sync | ||
46 | $ADM -m node --logoutall=all | ||
47 | logger -t iscsi-initiator OK | ||
48 | } | ||
49 | |||
50 | stop() { | ||
51 | stoptargets | ||
52 | logger -t iscsi-initiator "Stopping iSCSI initiator service" | ||
53 | start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON | ||
54 | rm -f $PIDFILE | ||
55 | status=0 | ||
56 | modprobe -r ib_iser 2>/dev/null | ||
57 | if [ "$?" -ne "0" -a "$?" -ne "1" ]; then | ||
58 | status=1 | ||
59 | fi | ||
60 | modprobe -r iscsi_tcp 2>/dev/null | ||
61 | if [ "$?" -ne "0" -a "$?" -ne "1" ]; then | ||
62 | status=1 | ||
63 | fi | ||
64 | logger -t iscsi-initiator "Command returned $status" | ||
65 | } | ||
66 | |||
67 | restart() { | ||
68 | stop | ||
69 | start | ||
70 | } | ||
71 | |||
72 | restarttargets() { | ||
73 | stoptargets | ||
74 | starttargets | ||
75 | } | ||
76 | |||
77 | status() { | ||
78 | #XXX FIXME: what to do here? | ||
79 | #status iscsid | ||
80 | # list active sessions | ||
81 | echo Current active iSCSI sessions: | ||
82 | $ADM -m session | ||
83 | } | ||
84 | |||
85 | case "$1" in | ||
86 | start|starttargets|stop|stoptargets|restart|restarttargets|status) | ||
87 | $1 | ||
88 | ;; | ||
89 | *) | ||
90 | echo "Usage: $0 {start|stop|restart|status}" | ||
91 | exit 1 | ||
92 | ;; | ||
93 | esac | ||
94 | exit $RETVAL | ||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/files/user.patch b/meta-openstack/recipes-connectivity/open-iscsi/files/user.patch new file mode 100644 index 0000000..767c508 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/files/user.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | diff -Nurd a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c | ||
2 | --- a/usr/iscsi_sysfs.c 2012-08-06 12:32:21.098233792 +0200 | ||
3 | +++ b/usr/iscsi_sysfs.c 2012-08-06 12:33:09.534233952 +0200 | ||
4 | @@ -22,6 +22,7 @@ | ||
5 | #include <string.h> | ||
6 | #include <errno.h> | ||
7 | #include <dirent.h> | ||
8 | +#include <sys/stat.h> | ||
9 | |||
10 | #include "log.h" | ||
11 | #include "initiator.h" | ||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-kernel_2.0-873.bb b/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-kernel_2.0-873.bb new file mode 100644 index 0000000..8d51460 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-kernel_2.0-873.bb | |||
@@ -0,0 +1,27 @@ | |||
1 | DESCRIPTION = "Open-iSCSI project is a high performance, transport independent, multi-platform implementation of RFC3720." | ||
2 | HOMEPAGE = "http://www.open-iscsi.org/" | ||
3 | LICENSE = "GPL" | ||
4 | MACHINE_KERNEL_PR_append = "a" | ||
5 | PR = "r2" | ||
6 | |||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | ||
8 | |||
9 | SRC_URI = " http://www.open-iscsi.org/bits/open-iscsi-${PV}.tar.gz " | ||
10 | |||
11 | |||
12 | S = "${WORKDIR}/open-iscsi-${PV}" | ||
13 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
14 | |||
15 | inherit module | ||
16 | |||
17 | do_compile () { | ||
18 | oe_runmake 'KSRC=${STAGING_KERNEL_DIR}' LDFLAGS="" kernel | ||
19 | } | ||
20 | |||
21 | do_install() { | ||
22 | oe_runmake 'KSRC=${STAGING_KERNEL_DIR}' LDFLAGS="" DESTDIR="${D}" install_kernel | ||
23 | } | ||
24 | |||
25 | |||
26 | SRC_URI[md5sum] = "8b8316d7c9469149a6cc6234478347f7" | ||
27 | SRC_URI[sha256sum] = "7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9" | ||
diff --git a/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-user_2.0-871.bb b/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-user_2.0-871.bb new file mode 100644 index 0000000..593d791 --- /dev/null +++ b/meta-openstack/recipes-connectivity/open-iscsi/open-iscsi-user_2.0-871.bb | |||
@@ -0,0 +1,52 @@ | |||
1 | DESCRIPTION = "Open-iSCSI project is a high performance, transport independent, multi-platform implementation of RFC3720." | ||
2 | HOMEPAGE = "http://www.open-iscsi.org/" | ||
3 | LICENSE = "GPL" | ||
4 | PR = "r1" | ||
5 | |||
6 | inherit systemd | ||
7 | |||
8 | LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" | ||
9 | |||
10 | SRC_URI = "http://www.open-iscsi.org/bits/open-iscsi-${PV}.tar.gz \ | ||
11 | file://user.patch \ | ||
12 | file://open-iscsi \ | ||
13 | file://initiatorname.iscsi \ | ||
14 | " | ||
15 | |||
16 | |||
17 | S = "${WORKDIR}/open-iscsi-${PV}" | ||
18 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
19 | |||
20 | |||
21 | do_compile () { | ||
22 | oe_runmake user | ||
23 | } | ||
24 | |||
25 | do_install () { | ||
26 | oe_runmake DESTDIR="${D}" install_user | ||
27 | cp -f "${WORKDIR}/open-iscsi" "${D}/etc/init.d/" | ||
28 | install -m 0644 ${WORKDIR}/initiatorname.iscsi ${D}/etc/iscsi/initiatorname.iscsi | ||
29 | } | ||
30 | |||
31 | |||
32 | SRC_URI[md5sum] = "0c403e8c9ad41607571ba0e6e8ff196e" | ||
33 | SRC_URI[sha256sum] = "bcea8746ae82f2ada7bc05d2aa59bcda1ca0d5197f05f2e16744aae59f0a7dcb" | ||
34 | |||
35 | # systemd support | ||
36 | PACKAGES =+ "${PN}-systemd" | ||
37 | SRC_URI_append = " file://iscsi-initiator \ | ||
38 | file://iscsi-initiator.service \ | ||
39 | file://iscsi-initiator-targets.service \ | ||
40 | " | ||
41 | RDEPENDS_${PN}-systemd += "${PN}" | ||
42 | FILES_${PN}-systemd += " ${base_libdir}/systemd \ | ||
43 | ${sysconfdir}/default/iscsi-initiator \ | ||
44 | " | ||
45 | SYSTEMD_PACKAGES = "${PN}-systemd" | ||
46 | SYSTEMD_SERVICE = " iscsi-initiator.service iscsi-initiator-targets.service " | ||
47 | |||
48 | |||
49 | do_install_append () { | ||
50 | install -d ${D}${sysconfdir}/default/ | ||
51 | install -m 0644 ${WORKDIR}/iscsi-initiator ${D}${sysconfdir}/default/ | ||
52 | } | ||