summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-03-26 14:32:57 +0000
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-03-26 14:32:57 +0000
commit31ef7c1e365ec30a26930de9165f7ef87facea56 (patch)
treecacad3351e559464dbaba4230780dfa0cab0caab
parent0e6b93fe2ae75e1cd6532deb00d92ef8734ff94a (diff)
downloaddefinitions-31ef7c1e365ec30a26930de9165f7ef87facea56.tar.gz
Add open-iscsi chunk
-rw-r--r--openstack-cinder.configure3
-rw-r--r--openstack/usr/share/openstack/openstack-cinder-configure-backends4
-rw-r--r--strata/openstack-services.morph6
-rw-r--r--strata/openstack-services/open-iscsi.morph49
4 files changed, 62 insertions, 0 deletions
diff --git a/openstack-cinder.configure b/openstack-cinder.configure
index 7e252bf7..3def73ac 100644
--- a/openstack-cinder.configure
+++ b/openstack-cinder.configure
@@ -46,6 +46,9 @@ sed -f "$ROOT"/etc/openstack-cinder-setup.sed -i \
ln -sf "/usr/lib/systemd/system/lvm2-lvmetad.service" \
"$ROOT/usr/lib/systemd/system/multi-user.target.wants/lvm2-lvmetad.service"
+ln -sf "/usr/lib/systemd/system/iscsid.service" \
+ "$ROOT/usr/lib/systemd/system/multi-user.target.wants/iscsid.service"
+
ln -sf "/etc/systemd/system/openstack-cinder-setup.service" \
"$ROOT/etc/systemd/system/multi-user.target.wants/openstack-cinder-setup.service"
diff --git a/openstack/usr/share/openstack/openstack-cinder-configure-backends b/openstack/usr/share/openstack/openstack-cinder-configure-backends
index 2ae06092..1f2c3a2a 100644
--- a/openstack/usr/share/openstack/openstack-cinder-configure-backends
+++ b/openstack/usr/share/openstack/openstack-cinder-configure-backends
@@ -30,6 +30,10 @@ export OS_AUTH_URL=http://localhost:35357/v2.0
cinder type-create lvms
cinder type-key lvms set volume_backend_name=LVM_iSCSI
+# Create initiatorname.iscsi file
+mkdir -p "$DESTDIR"/etc/iscsi
+echo "InitiatorName=$(iscsi-iname)" > /etc/iscsi/initiatorname.iscsi
+
# Run the target service required for attaching volumes
depmod -a
systemctl enable target.service
diff --git a/strata/openstack-services.morph b/strata/openstack-services.morph
index f5c16f8e..18885ae3 100644
--- a/strata/openstack-services.morph
+++ b/strata/openstack-services.morph
@@ -692,6 +692,12 @@ chunks:
build-depends:
- configshell-fb
- rtslib-fb
+- name: open-iscsi
+# aka: iscsi-initiator-utils
+ morph: strata/openstack-services/open-iscsi.morph
+ repo: github:mikechristie/open-iscsi
+ ref: dd73b7d12b6bc5f4f4d08c2ac7dcfc5f00f6fd29
+ unpetrify-ref: 2.0.873
- name: nova
morph: strata/openstack-services/nova.morph
repo: upstream:openstack/nova
diff --git a/strata/openstack-services/open-iscsi.morph b/strata/openstack-services/open-iscsi.morph
new file mode 100644
index 00000000..90e09a42
--- /dev/null
+++ b/strata/openstack-services/open-iscsi.morph
@@ -0,0 +1,49 @@
+name: open-iscsi
+kind: chunk
+configure-commands:
+# Non preset prefix to /usr
+- sed -i -e 's|prefix = \/usr|prefix = \$\(PREFIX\)|' Makefile
+# Install binaries depending on PREFIX
+- sed -i -e 's|exec_prefix = \/|exec_prefix = \$\(prefix\)|' Makefile
+# Include iscsistart boot tool
+- sed -i -e '/^PROGRAMS = /s/$/ usr\/iscsistart/' Makefile
+build-commands:
+- make
+install-commands:
+- make DESTDIR="$DESTDIR" install
+post-install-commands:
+# Configure iscsi daemon
+# Point the startup to the installed binary
+- |
+ sed -i -e "s|iscsid.startup = \/sbin\/iscsid|iscsid.startup = "$PREFIX"/sbin/iscsid|" \
+ etc/iscsid.conf
+# Start up a session automatically
+- sed -i -e 's|node.startup = manual|node.startup = automatic|' etc/iscsid.conf
+# Install config file
+- install -D -m 644 etc/iscsid.conf "$DESTDIR"/etc/iscsi
+# Install custom systemd unit file
+- |
+ install -D -m 644 /proc/self/fd/0 << 'EOF' "$DESTDIR$PREFIX"/lib/systemd/system/iscsid.service
+ [Unit]
+ Description=Open iSCSI Daemon
+ After=network.target
+
+ [Service]
+ Type=forking
+ ExecStart=/usr/sbin/iscsid
+
+ [Install]
+ WantedBy=multi-user.target
+ EOF
+# Install iscsi socket unit
+- |
+ install -D -m 644 /proc/self/fd/0 << 'EOF' "$DESTDIR$PREFIX"/lib/systemd/system/iscsid.socket
+ [Unit]
+ Description=Open-iSCSI iscsid Socket
+
+ [Socket]
+ ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
+
+ [Install]
+ WantedBy=sockets.target
+ EOF