Merge "Start tgtd in cinder-volume container"

This commit is contained in:
Jenkins 2015-07-17 15:32:42 +00:00 committed by Gerrit Code Review
commit a6ccb90922
6 changed files with 27 additions and 12 deletions

View File

@ -2,17 +2,10 @@ FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages
# https://bugs.launchpad.net/kolla/+bug/1460129
# Iscsi will be removed from cinder-volume in a later patch
# so that we continue to follow the container best practices.
# There will also be other backends for cinder and iscsi should
# not be hardcoded here.
RUN yum install -y lvm2 scsi-target-utils && yum clean all RUN yum install -y lvm2 scsi-target-utils && yum clean all
# Add start scripts # Add start scripts
COPY tgtd.sh volume-group-create.sh config-internal.sh config-external.sh /opt/kolla/
COPY start.sh /start.sh COPY start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
COPY volume-group-create.sh /opt/kolla/volume-group-create.sh
# Start supervisor
CMD ["/start.sh"] CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/cinder-app/cinder-volume/tgtd.sh

View File

View File

@ -74,9 +74,6 @@ sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf
#Adding LVM filter #Adding LVM filter
sed -i 's:filter = \[ "a/.\*/" \]:filter = \[ "a/sda/", "r/.\*/"\]:g' /etc/lvm/lvm.conf sed -i 's:filter = \[ "a/.\*/" \]:filter = \[ "a/sda/", "r/.\*/"\]:g' /etc/lvm/lvm.conf
#Adding cinder volumes to tgtd config
echo "include /etc/cinder/volumes/*" >> /etc/tgt/tgtd.conf
# https://bugs.launchpad.net/kolla/+bug/1461635 # https://bugs.launchpad.net/kolla/+bug/1461635
# Cinder requires mounting /dev in the cinder-volume, nova-compute, # Cinder requires mounting /dev in the cinder-volume, nova-compute,
# and libvirt containers. If /dev/pts/ptmx does not have proper permissions # and libvirt containers. If /dev/pts/ptmx does not have proper permissions
@ -86,5 +83,12 @@ echo "include /etc/cinder/volumes/*" >> /etc/tgt/tgtd.conf
# **Temporary fix** # **Temporary fix**
chmod 666 /dev/pts/ptmx chmod 666 /dev/pts/ptmx
#Adding cinder volumes to tgtd config
echo "include /etc/cinder/volumes/*" >> /etc/tgt/tgtd.conf
echo "include /var/lib/cinder/volumes/*" >> /etc/tgt/targets.conf
echo "Starging iSCSI tgtd"
/opt/kolla/tgtd.sh
echo "Starting cinder-volume" echo "Starting cinder-volume"
exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf

View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
DESC="target framework daemon"
DAEMON=/usr/sbin/tgtd
TGTD_CONFIG=/etc/tgt/targets.conf
echo "Starting tgtd $DESC"
/usr/sbin/tgtd
echo "Set to offline"
tgtadm --op update --mode sys --name State -v offline
echo "Set tgt config"
tgt-admin -e -c $TGTD_CONFIG
echo "Set to ready"
tgtadm --op update --mode sys --name State -v ready

View File

@ -222,7 +222,7 @@ CINDER_BACKUP_NAME_TEMPLATE=backup-%s
CINDER_BACKUP_DRIVER=cinder.backup.drivers.swift CINDER_BACKUP_DRIVER=cinder.backup.drivers.swift
# Cinder Volume # Cinder Volume
ISCSI_HELPER=lioadm ISCSI_HELPER=tgtadm
ISCSI_IP_ADDRESS=$HOST_IP ISCSI_IP_ADDRESS=$HOST_IP
CINDER_LVM_LO_VOLUME_SIZE=4G CINDER_LVM_LO_VOLUME_SIZE=4G
CINDER_VOLUME_API_LISTEN=$HOST_IP CINDER_VOLUME_API_LISTEN=$HOST_IP