Skip to content

Instantly share code, notes, and snippets.

@max-lobur
Last active November 5, 2015 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-lobur/aafd84e48f637cda016b to your computer and use it in GitHub Desktop.
Save max-lobur/aafd84e48f637cda016b to your computer and use it in GitHub Desktop.
Ironic devstack
IMAGE=trusty-server-cloudimg-amd64
wget https://cloud-images.ubuntu.com/trusty/current/$IMAGE.tar.gz
tar -xzvf $IMAGE.tar.gz
glance image-create --name ubuntu-root --is-public True --disk-format raw --container-format bare --progress < $(IMAGE).img
if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
NODE=$1
echo 'update nodes set instance_uuid=NULL, instance_info=NULL, target_provision_state=NULL, provision_state="available" where name="'$NODE'";' | mysql ironic
ironic node-set-maintenance $NODE False
ironic node-set-power-state $NODE off
ironic node-list | grep $NODE
[[post-config|$NOVA_CONF]]
[DEFAULT]
remove_unused_base_images = True
mage_cache_manager_interval = 0
novncproxy_base_url = http://172.18.92.225:6080/vnc_auto.html # Your IP
[[local|localrc]]
#RECLONE=yes # For subsequent Devstack rebuilds
HOST_IP=172.18.92.225 # Your IP
# Enable Neutron
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service tempest
enable_service n-api-meta
enable_service n-novnc
enable_service heat h-api h-api-cfn h-api-cw h-eng
#enable_service ceilometer-acompute ceilometer-acentral ceilometer-collector ceilometer-api
enable_service cinder c-api c-vol c-sch c-bak
# You can replace password with your own one.
ADMIN_PASSWORD=111
MYSQL_PASSWORD=111
RABBIT_PASSWORD=111
SERVICE_PASSWORD=111
SERVICE_TOKEN=111
# Logging
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
LOGFILE=$HOME/devstack.log
LOGDIR=$HOME/logs
IRONIC_VM_LOG_DIR=$HOME/ironic-bm-logs
# Enable Ironic API and Ironic Conductor
enable_service ironic
enable_service ir-api
enable_service ir-cond
# switch nova virt driver
VIRT_DRIVER=ironic
# Enable agent driver
IRONIC_ENABLED_DRIVERS=fake,agent_ssh,agent_ipmitool
IRONIC_DEPLOY_DRIVER=agent_ssh
# Agent driver requires swift with tempurls
# Enable swift services
enable_service s-proxy
enable_service s-object
enable_service s-container
enable_service s-account
# Enable tempurls and set credentials
SWIFT_HASH=111
SWIFT_TEMPURL_KEY=111
SWIFT_ENABLE_TEMPURLS=True
# Create 3 virtual machines to pose as Ironic's baremetal nodes.
IRONIC_VM_COUNT=2
IRONIC_VM_SSH_PORT=22
IRONIC_BAREMETAL_BASIC_OPS=True
# The parameters below represent the minimum possible values to create
# functional nodes.
IRONIC_VM_SPECS_CPU=2
IRONIC_VM_SPECS_RAM=1024
IRONIC_VM_SPECS_DISK=10
# Size of the ephemeral partition in GB. Use 0 for no ephemeral partition.
IRONIC_VM_EPHEMERAL_DISK=0
# By default, DevStack creates a 10.0.0.0/24 network for instances.
# If this overlaps with the hosts network, you may adjust with the
# following.
NETWORK_GATEWAY=10.1.0.1
FIXED_RANGE=10.1.0.0/24
FIXED_NETWORK_SIZE=256
# To build your own IPA ramdisk from source, set this to True
IRONIC_BUILD_DEPLOY_RAMDISK=False
if [ -z "$1" ]; then echo NEED VM UUID; exit; fi
NODE=$1
echo 'update instances set task_state=NULL where uuid="'$NODE'";' | mysql nova
nova delete $NODE
if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
NODE=$1
RAMDISK=deploy-centos-min-initrd
KERNEL=deploy-centos-min-kernel
BUILD_PATH=/tmp/fpa_image_build
RAMDISK_NAME=initramfs
KERN_NAME=vmlinuz
ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')
curr_md5=$(md5sum $BUILD_PATH/$RAMDISK_NAME | awk '{print $1}')
glance_md5=$(glance image-show $ramdisk_id | grep checksum | awk '{print $4}')
if [ "$curr_md5" != "$glance_md5" ]
then
echo Reuploading images to glance
glance image-delete $ramdisk_id
glance image-delete $kernel_id
glance image-create --name $RAMDISK --disk-format ari --file $BUILD_PATH/$RAMDISK_NAME --progress --is-public=True
glance image-create --name $KERNEL --disk-format aki --file $BUILD_PATH/$KERN_NAME --progress --is-public=True
ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')
fi
echo Updating node properties
ironic node-update $NODE replace driver_info/deploy_ramdisk=$ramdisk_id driver_info/deploy_kernel=$kernel_id
ironic node-update $NODE remove driver_info/deploy_squashfs
watch -t "nova list | tail -n+1 | head -n-1 | awk '{split(\$0,a,\"|\"); print a[2]a[3]a[4]a[5]a[6]a[7]}' | grep -v '^$'; echo; ironic node-list | tail -n+1 | head -n-1 | awk '{split(\$0,a,\"|\"); print a[2]a[3]a[4]a[5]a[6]a[7]}' | grep -v '^$'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment