Setup tgtd configuration files

Setup devstack to use tgtd confiuration files.

Change-Id: Icb2a1a0c5ca517604f9a3930e7c89e3be9a36b0c
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2012-07-28 13:28:33 -05:00
parent 14ab37eb41
commit 3f603d93c8
2 changed files with 14 additions and 0 deletions

View File

@ -142,6 +142,8 @@ function init_cinder() {
if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi
fi fi
mkdir -p $CINDER_DIR/volumes
if sudo vgs $VOLUME_GROUP; then if sudo vgs $VOLUME_GROUP; then
if [[ "$os_PACKAGE" = "rpm" ]]; then if [[ "$os_PACKAGE" = "rpm" ]]; then
# RPM doesn't start the service # RPM doesn't start the service
@ -171,6 +173,9 @@ function install_cinder() {
function start_cinder() { function start_cinder() {
if is_service_enabled c-vol; then if is_service_enabled c-vol; then
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then
echo "include $CINDER_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/cinder.conf
fi
# tgt in oneiric doesn't restart properly if tgtd isn't running # tgt in oneiric doesn't restart properly if tgtd isn't running
# do it in two steps # do it in two steps
sudo stop tgt || true sudo stop tgt || true

View File

@ -1699,6 +1699,9 @@ elif is_service_enabled n-vol; then
start_service tgtd start_service tgtd
fi fi
# Setup tgtd configuration files
mkdir -p $NOVA_DIR/volumes
# Remove nova iscsi targets # Remove nova iscsi targets
sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
# Clean out existing volumes # Clean out existing volumes
@ -1711,6 +1714,12 @@ elif is_service_enabled n-vol; then
fi fi
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
# Setup the tgt configuration file
if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then
echo "include $NOVA_DIR/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf
fi
# tgt in oneiric doesn't restart properly if tgtd isn't running # tgt in oneiric doesn't restart properly if tgtd isn't running
# do it in two steps # do it in two steps
sudo stop tgt || true sudo stop tgt || true