From 19a40963f724d6b82dac7a95fad2d6ba17690840 Mon Sep 17 00:00:00 2001 From: Vladislav Belogrudov Date: Wed, 10 Aug 2016 16:36:21 +0300 Subject: [PATCH] iscsi initiator names must be unique among hosts Initiator names are generated during image build and therefore are not unique in multi-host environment. Instead the names should be autogenerated during first start of iscsid containers. Change-Id: Ia439b1563c9c9d6c26d8a314fe2817ba493dacb5 Closes-Bug: 1611775 --- docker/iscsid/Dockerfile.j2 | 4 ++++ docker/iscsid/extend_start.sh | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 docker/iscsid/extend_start.sh diff --git a/docker/iscsid/Dockerfile.j2 b/docker/iscsid/Dockerfile.j2 index 3caf0b94eb..9b6e43e251 100644 --- a/docker/iscsid/Dockerfile.j2 +++ b/docker/iscsid/Dockerfile.j2 @@ -21,6 +21,10 @@ MAINTAINER {{ maintainer }} RUN {{ macros.install_packages(iscsid_packages | customizable("packages")) }} +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start \ + && rm /etc/iscsi/initiatorname.iscsi + {% block iscsid_footer %}{% endblock %} {% block footer %}{% endblock %} {{ include_footer }} diff --git a/docker/iscsid/extend_start.sh b/docker/iscsid/extend_start.sh new file mode 100644 index 0000000000..78f2317d28 --- /dev/null +++ b/docker/iscsid/extend_start.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# check if unique iSCSI initiator name already exists +if [[ ! -f /etc/iscsi/initiatorname.iscsi ]]; then + echo "Generating new iSCSI initiator name" + echo InitiatorName=$(/sbin/iscsi-iname) > /etc/iscsi/initiatorname.iscsi +fi