Merge "Ironic: Use HOST_IP instead of SERVICE_HOST"
diff --git a/eucarc b/eucarc
index 3502351..343f4cc 100644
--- a/eucarc
+++ b/eucarc
@@ -22,7 +22,7 @@
export EC2_URL=$(keystone catalog --service ec2 | awk '/ publicURL / { print $4 }')
# Create EC2 credentials for the current user
-CREDS=$(keystone ec2-credentials-create)
+CREDS=$(openstack ec2 credentials create)
export EC2_ACCESS_KEY=$(echo "$CREDS" | awk '/ access / { print $4 }')
export EC2_SECRET_KEY=$(echo "$CREDS" | awk '/ secret / { print $4 }')
diff --git a/lib/baremetal b/lib/baremetal
index eda92f9..adcbe4c 100644
--- a/lib/baremetal
+++ b/lib/baremetal
@@ -129,7 +129,7 @@
# Below this, we set some path and filenames.
# Defaults are probably sufficient.
-BM_IMAGE_BUILD_DIR=${BM_IMAGE_BUILD_DIR:-$DEST/diskimage-builder}
+DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
# Use DIB to create deploy ramdisk and kernel.
BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK`
@@ -165,7 +165,7 @@
# Install diskimage-builder and shell-in-a-box
# so that we can build the deployment kernel & ramdisk
function prepare_baremetal_toolchain {
- git_clone $BM_IMAGE_BUILD_REPO $BM_IMAGE_BUILD_DIR $BM_IMAGE_BUILD_BRANCH
+ git_clone $DIB_REPO $DIB_DIR $DIB_BUILD_BRANCH
local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX)
if [[ ! -e $DEST/$shellinabox_basename ]]; then
@@ -223,7 +223,7 @@
BM_DEPLOY_KERNEL=bm-deploy.kernel
BM_DEPLOY_RAMDISK=bm-deploy.initramfs
if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then
- $BM_IMAGE_BUILD_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR \
+ $DIB_DIR/bin/ramdisk-image-create $BM_DEPLOY_FLAVOR \
-o $TOP_DIR/files/bm-deploy
fi
fi
@@ -271,7 +271,7 @@
image_name=$(basename "$file" ".qcow2")
# this call returns the file names as "$kernel,$ramdisk"
- out=$($BM_IMAGE_BUILD_DIR/bin/disk-image-get-kernel \
+ out=$($DIB_DIR/bin/disk-image-get-kernel \
-x -d $TOP_DIR/files -o bm-deploy -i $file)
if [ $? -ne 0 ]; then
die $LINENO "Failed to get kernel and ramdisk from $file"
diff --git a/lib/heat b/lib/heat
index a79b825..f66f0a8 100644
--- a/lib/heat
+++ b/lib/heat
@@ -39,6 +39,9 @@
HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
HEAT_STACK_DOMAIN=`trueorfalse True $HEAT_STACK_DOMAIN`
+# other default options
+HEAT_DEFERRED_AUTH=${HEAT_DEFERRED_AUTH:-trusts}
+
# Tell Tempest this project is present
TEMPEST_SERVICES+=,heat
@@ -248,18 +251,21 @@
# heat_stack_user role is for users created by Heat
openstack role create heat_stack_user
- # heat_stack_owner role is given to users who create Heat stacks,
- # it's the default role used by heat to delegate to the heat service
- # user (for performing deferred operations via trusts), see heat.conf
- HEAT_OWNER_ROLE=$(openstack role create \
- heat_stack_owner \
- | grep " id " | get_field 2)
+ if [[ $HEAT_DEFERRED_AUTH == trusts ]]; then
+ # heat_stack_owner role is given to users who create Heat stacks,
+ # it's the default role used by heat to delegate to the heat service
+ # user (for performing deferred operations via trusts), see heat.conf
+ HEAT_OWNER_ROLE=$(openstack role create \
+ heat_stack_owner \
+ | grep " id " | get_field 2)
- # Give the role to the demo and admin users so they can create stacks
- # in either of the projects created by devstack
- openstack role add $HEAT_OWNER_ROLE --project demo --user demo
- openstack role add $HEAT_OWNER_ROLE --project demo --user admin
- openstack role add $HEAT_OWNER_ROLE --project admin --user admin
+ # Give the role to the demo and admin users so they can create stacks
+ # in either of the projects created by devstack
+ openstack role add $HEAT_OWNER_ROLE --project demo --user demo
+ openstack role add $HEAT_OWNER_ROLE --project demo --user admin
+ openstack role add $HEAT_OWNER_ROLE --project admin --user admin
+ iniset $HEAT_CONF DEFAULT deferred_auth_method trusts
+ fi
if [[ "$HEAT_STACK_DOMAIN" == "True" ]]; then
# Note we have to pass token/endpoint here because the current endpoint and
diff --git a/lib/ironic b/lib/ironic
index 0fc5664..979420f 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -64,6 +64,19 @@
IRONIC_VM_MACS_CSV_FILE=${IRONIC_VM_MACS_CSV_FILE:-$IRONIC_DATA_DIR/ironic_macs.csv}
IRONIC_AUTHORIZED_KEYS_FILE=${IRONIC_AUTHORIZED_KEYS_FILE:-$HOME/.ssh/authorized_keys}
+DIB_DIR=${DIB_DIR:-$DEST/diskimage-builder}
+
+# Use DIB to create deploy ramdisk and kernel.
+IRONIC_BUILD_DEPLOY_RAMDISK=`trueorfalse True $IRONIC_BUILD_DEPLOY_RAMDISK`
+# If not use DIB, these files are used as deploy ramdisk/kernel.
+# (The value must be a absolute path)
+IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-}
+IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-}
+IRONIC_DEPLOY_ELEMENT=${IRONIC_DEPLOY_ELEMENT:-deploy-ironic}
+
+#TODO(agordeev): replace 'ubuntu' with host distro name getting
+IRONIC_DEPLOY_FLAVOR=${IRONIC_DEPLOY_FLAVOR:-ubuntu $IRONIC_DEPLOY_ELEMENT}
+
# Support entry points installation of console scripts
IRONIC_BIN_DIR=$(get_python_exec_prefix)
@@ -327,7 +340,7 @@
# create the nova flavor
nova flavor-create baremetal auto $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK $IRONIC_VM_SPECS_CPU
- nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$BM_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$BM_DEPLOY_RAMDISK_ID"
+ nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
# intentional sleep to make sure the tag has been set to port
sleep 10
@@ -426,10 +439,55 @@
configure_ironic_sshd
}
+# build deploy kernel+ramdisk, then upload them to glance
+# this function sets IRONIC_DEPLOY_KERNEL_ID and IRONIC_DEPLOY_RAMDISK_ID
+function upload_baremetal_ironic_deploy {
+ token=$1
+
+ if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
+ IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy.kernel
+ IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy.initramfs
+ else
+ IRONIC_DEPLOY_KERNEL_PATH=$IRONIC_DEPLOY_KERNEL
+ IRONIC_DEPLOY_RAMDISK_PATH=$IRONIC_DEPLOY_RAMDISK
+ fi
+
+ if [ ! -e "$IRONIC_DEPLOY_RAMDISK_PATH" -o ! -e "$IRONIC_DEPLOY_KERNEL_PATH" ]; then
+ # files don't exist, need to build them
+ if [ "$IRONIC_BUILD_DEPLOY_RAMDISK" = "True" ]; then
+ # we can build them only if we're not offline
+ if [ "$OFFLINE" != "True" ]; then
+ $DIB_DIR/bin/ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
+ -o $TOP_DIR/files/ir-deploy
+ else
+ die $LINENO "Deploy kernel+ramdisk files don't exist and cannot be build in OFFLINE mode"
+ fi
+ else
+ die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
+ fi
+ fi
+
+ # load them into glance
+ IRONIC_DEPLOY_KERNEL_ID=$(glance \
+ --os-auth-token $token \
+ --os-image-url http://$GLANCE_HOSTPORT \
+ image-create \
+ --name $(basename $IRONIC_DEPLOY_KERNEL_PATH) \
+ --is-public True --disk-format=aki \
+ < $IRONIC_DEPLOY_KERNEL_PATH | grep ' id ' | get_field 2)
+ IRONIC_DEPLOY_RAMDISK_ID=$(glance \
+ --os-auth-token $token \
+ --os-image-url http://$GLANCE_HOSTPORT \
+ image-create \
+ --name $(basename $IRONIC_DEPLOY_RAMDISK_PATH) \
+ --is-public True --disk-format=ari \
+ < $IRONIC_DEPLOY_RAMDISK_PATH | grep ' id ' | get_field 2)
+}
+
function prepare_baremetal_basic_ops {
# install diskimage-builder
- git_clone $BM_IMAGE_BUILD_REPO $BM_IMAGE_BUILD_DIR $BM_IMAGE_BUILD_BRANCH
+ git_clone $DIB_REPO $DIB_DIR $DIB_BRANCH
# make sure all needed service were enabled
for srv in nova glance key neutron; do
@@ -457,7 +515,7 @@
echo_summary "Creating and uploading baremetal images for ironic"
# build and upload separate deploy kernel & ramdisk
- upload_baremetal_deploy $TOKEN
+ upload_baremetal_ironic_deploy $TOKEN
create_bridge_and_vms
enroll_vms
diff --git a/lib/neutron b/lib/neutron
index 84e8277..294ffac 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -762,7 +762,7 @@
done
# Configuration for neutron notifations to nova.
- iniset $NEUTRON_CONF DEFAULT notify_nova_port_status_change $Q_NOTIFY_NOVA_PORT_STATUS_CHANGE
+ iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_change $Q_NOTIFY_NOVA_PORT_STATUS_CHANGE
iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_ON_PORT_DATA_CHANGES
iniset $NEUTRON_CONF DEFAULT nova_url "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2"
iniset $NEUTRON_CONF DEFAULT nova_admin_username nova $NOVA_USER
diff --git a/lib/nova_plugins/hypervisor-vsphere b/lib/nova_plugins/hypervisor-vsphere
index b04aeda..9933a3c 100644
--- a/lib/nova_plugins/hypervisor-vsphere
+++ b/lib/nova_plugins/hypervisor-vsphere
@@ -39,7 +39,7 @@
iniset $NOVA_CONF vmware host_ip "$VMWAREAPI_IP"
iniset $NOVA_CONF vmware host_username "$VMWAREAPI_USER"
iniset $NOVA_CONF vmware host_password "$VMWAREAPI_PASSWORD"
- iniset $NOVA_CONF vmware cluster_name "$VMWAREAPI_CLUSTER"
+ iniset_multiline $NOVA_CONF vmware cluster_name "$VMWAREAPI_CLUSTER"
if is_service_enabled neutron; then
iniset $NOVA_CONF vmware integration_bridge $OVS_BRIDGE
fi
diff --git a/lib/sahara b/lib/sahara
index 7b592b0..1ff0cf9 100644
--- a/lib/sahara
+++ b/lib/sahara
@@ -28,7 +28,6 @@
SAHARA_DIR=$DEST/sahara
SAHARA_CONF_DIR=${SAHARA_CONF_DIR:-/etc/sahara}
SAHARA_CONF_FILE=${SAHARA_CONF_DIR}/sahara.conf
-SAHARA_DEBUG=${SAHARA_DEBUG:-True}
SAHARA_SERVICE_HOST=${SAHARA_SERVICE_HOST:-$SERVICE_HOST}
SAHARA_SERVICE_PORT=${SAHARA_SERVICE_PORT:-8386}
@@ -125,7 +124,8 @@
iniset $SAHARA_CONF_FILE keystone_authtoken signing_dir $SAHARA_AUTH_CACHE_DIR
iniset $SAHARA_CONF_FILE keystone_authtoken cafile $KEYSTONE_SSL_CA
- iniset $SAHARA_CONF_FILE DEFAULT debug $SAHARA_DEBUG
+ iniset $SAHARA_CONF_FILE DEFAULT verbose True
+ iniset $SAHARA_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $SAHARA_CONF_FILE database connection `database_connection_url sahara`
diff --git a/lib/tls b/lib/tls
index 072059d..88e5f60 100644
--- a/lib/tls
+++ b/lib/tls
@@ -348,7 +348,7 @@
local key=${!key_var}
local ca=${!ca_var}
- if [[ !($cert && $key && $ca) ]]; then
+ if [[ -z "$cert" || -z "$key" || -z "$ca" ]]; then
die $LINENO "Missing either the ${cert_var} ${key_var} or ${ca_var}" \
"variable to enable SSL for ${service}"
fi
diff --git a/stackrc b/stackrc
index 4a997bf..2164768 100644
--- a/stackrc
+++ b/stackrc
@@ -226,8 +226,8 @@
# diskimage-builder
-BM_IMAGE_BUILD_REPO=${BM_IMAGE_BUILD_REPO:-${GIT_BASE}/openstack/diskimage-builder.git}
-BM_IMAGE_BUILD_BRANCH=${BM_IMAGE_BUILD_BRANCH:-master}
+DIB_REPO=${DIB_REPO:-${GIT_BASE}/openstack/diskimage-builder.git}
+DIB_BRANCH=${DIB_BRANCH:-master}
# a websockets/html5 or flash powered VNC console for vm instances
NOVNC_REPO=${NOVNC_REPO:-https://github.com/kanaka/noVNC.git}