From 31ef7c1e365ec30a26930de9165f7ef87facea56 Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Thu, 26 Mar 2015 14:32:57 +0000 Subject: Add open-iscsi chunk --- openstack-cinder.configure | 3 ++ .../openstack/openstack-cinder-configure-backends | 4 ++ strata/openstack-services.morph | 6 +++ strata/openstack-services/open-iscsi.morph | 49 ++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 strata/openstack-services/open-iscsi.morph 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 -- cgit v1.2.1