Skip to content

Instantly share code, notes, and snippets.

@max-lobur
Last active November 5, 2015 16:06
Show Gist options
  • 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.

Revisions

  1. max-lobur revised this gist Nov 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion watch_ironic.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    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]}' | 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]}' | grep -v '^$'"
    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 '^$'"
  2. max-lobur revised this gist Nov 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion watch_ironic.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    watch "nova list | tail -n+1 | head -n-1 | awk '{split(\$0,a,\"|\"); print a[2]a[3]a[4]a[5]a[6]}' | 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]}' | grep -v '^$'"
    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]}' | 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]}' | grep -v '^$'"
  3. max-lobur revised this gist Nov 5, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions watch_ironic.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    watch "nova list | tail -n+1 | head -n-1 | awk '{split(\$0,a,\"|\"); print a[2]a[3]a[4]a[5]a[6]}' | 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]}' | grep -v '^$'"
  4. max-lobur revised this gist Oct 9, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    RAMDISK=centos-min-initrd
    KERNEL=centos-min-kernel
    RAMDISK=deploy-centos-min-initrd
    KERNEL=deploy-centos-min-kernel

    BUILD_PATH=/tmp/fpa_image_build
    RAMDISK_NAME=initramfs
  5. max-lobur revised this gist Sep 23, 2015. 1 changed file with 20 additions and 11 deletions.
    31 changes: 20 additions & 11 deletions update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,33 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    RAMDISK_GLANCE=centos-min-initrd
    KERNEL_GLANCE=centos-min-kernel
    RAMDISK=centos-min-initrd
    KERNEL=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}')

    RAMDISK_NAME=$RAMDISK_GLANCE
    KERN_NAME=$KERNEL_GLANCE
    curr_md5=$(md5sum $BUILD_PATH/$RAMDISK_NAME | awk '{print $1}')
    glance_md5=$(glance image-show $ramdisk_id | grep checksum | awk '{print $4}')

    ramdisk_id=$(glance image-list | grep $RAMDISK_GLANCE | awk '{print $2}')
    kernel_id=$(glance image-list | grep $KERNEL_GLANCE | awk '{print $2}')
    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_GLANCE --disk-format ari --file $BUILD_PATH/$RAMDISK_NAME --progress --is-public=True
    glance image-create --name $KERNEL_GLANCE --disk-format aki --file $BUILD_PATH/$KERN_NAME --progress --is-public=True
    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

    new_ramdisk_id=$(glance image-list | grep $RAMDISK_GLANCE | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL_GLANCE | awk '{print $2}')
    ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
    kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')
    fi

    ironic node-update $NODE replace driver_info/deploy_ramdisk=$new_ramdisk_id driver_info/deploy_kernel=$new_kernel_id
    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
  6. max-lobur revised this gist Sep 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -20,4 +20,5 @@ glance image-create --name $KERNEL_GLANCE --disk-format aki --file $BUILD_PATH/$
    new_ramdisk_id=$(glance image-list | grep $RAMDISK_GLANCE | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL_GLANCE | awk '{print $2}')

    ironic node-update $NODE replace driver_info/deploy_ramdisk=$new_ramdisk_id driver_info/deploy_kernel=$new_kernel_id
    ironic node-update $NODE replace driver_info/deploy_ramdisk=$new_ramdisk_id driver_info/deploy_kernel=$new_kernel_id
    ironic node-update $NODE remove driver_info/deploy_squashfs
  7. max-lobur revised this gist Sep 18, 2015. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,23 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    RAMDISK=centos-min-initrd
    KERNEL=centos-min-kernel

    RAMDISK_GLANCE=centos-min-initrd
    KERNEL_GLANCE=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}')
    RAMDISK_NAME=$RAMDISK_GLANCE
    KERN_NAME=$KERNEL_GLANCE

    ramdisk_id=$(glance image-list | grep $RAMDISK_GLANCE | awk '{print $2}')
    kernel_id=$(glance image-list | grep $KERNEL_GLANCE | awk '{print $2}')

    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
    glance image-create --name $RAMDISK_GLANCE --disk-format ari --file $BUILD_PATH/$RAMDISK_NAME --progress --is-public=True
    glance image-create --name $KERNEL_GLANCE --disk-format aki --file $BUILD_PATH/$KERN_NAME --progress --is-public=True

    new_ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')
    new_ramdisk_id=$(glance image-list | grep $RAMDISK_GLANCE | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL_GLANCE | awk '{print $2}')

    ironic node-update $NODE replace driver_info/deploy_ramdisk=$new_ramdisk_id driver_info/deploy_kernel=$new_kernel_id
  8. max-lobur revised this gist Sep 17, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions nova_force_delete_vm.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    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
  9. max-lobur revised this gist Sep 16, 2015. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -4,14 +4,18 @@ NODE=$1
    RAMDISK=centos-min-initrd
    KERNEL=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}')

    glance image-delete $ramdisk_id
    glance image-delete $kernel_id

    glance image-create --name $RAMDISK --disk-format ari --file /tmp/fpa_image_build/initramfs --progress --is-public=True
    glance image-create --name $KERNEL --disk-format aki --file /tmp/fpa_image_build/vmlinuz --progress --is-public=True
    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

    new_ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')
  10. max-lobur revised this gist Sep 15, 2015. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions update_node_ramdisk.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    RAMDISK=centos-min-initrd
    KERNEL=centos-min-kernel

    ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
    kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')

    glance image-delete $ramdisk_id
    glance image-delete $kernel_id

    glance image-create --name $RAMDISK --disk-format ari --file /tmp/fpa_image_build/initramfs --progress --is-public=True
    glance image-create --name $KERNEL --disk-format aki --file /tmp/fpa_image_build/vmlinuz --progress --is-public=True

    new_ramdisk_id=$(glance image-list | grep $RAMDISK | awk '{print $2}')
    new_kernel_id=$(glance image-list | grep $KERNEL | awk '{print $2}')

    ironic node-update $NODE replace driver_info/deploy_ramdisk=$new_ramdisk_id driver_info/deploy_kernel=$new_kernel_id
  11. max-lobur revised this gist Sep 14, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hard_reset_node.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    mysql ironic -e 'update nodes set instance_uuid=NULL, instance_info=NULL, target_provision_state=NULL, provision_state=NULL where name="$NODE";'
    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
  12. max-lobur revised this gist Sep 14, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions hard_reset_node.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    if [ -z "$1" ]; then echo NEED NODE NAME; exit; fi
    NODE=$1

    mysql ironic -e 'update nodes set instance_uuid=NULL, instance_info=NULL, target_provision_state=NULL, provision_state=NULL where name="$NODE";'
    ironic node-set-maintenance $NODE False
    ironic node-set-power-state $NODE off
    ironic node-list | grep $NODE
  13. max-lobur revised this gist Jul 24, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions get_ubuntu_root.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    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
  14. max-lobur revised this gist Jul 24, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion local.conf
    Original file line number Diff line number Diff line change
    @@ -64,12 +64,13 @@ SWIFT_TEMPURL_KEY=111
    SWIFT_ENABLE_TEMPURLS=True

    # Create 3 virtual machines to pose as Ironic's baremetal nodes.
    IRONIC_VM_COUNT=3
    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

  15. max-lobur revised this gist Jul 24, 2015. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions local.conf
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,11 @@
    [DEFAULT]
    remove_unused_base_images = True
    mage_cache_manager_interval = 0
    novncproxy_base_url = http://172.18.92.224:6080/vnc_auto.html
    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.224
    HOST_IP=172.18.92.225 # Your IP

    # Enable Neutron
    disable_service n-net
    @@ -64,9 +64,9 @@ SWIFT_TEMPURL_KEY=111
    SWIFT_ENABLE_TEMPURLS=True

    # Create 3 virtual machines to pose as Ironic's baremetal nodes.
    #IRONIC_VM_COUNT=3
    #IRONIC_VM_SSH_PORT=22
    #IRONIC_BAREMETAL_BASIC_OPS=True
    IRONIC_VM_COUNT=3
    IRONIC_VM_SSH_PORT=22
    IRONIC_BAREMETAL_BASIC_OPS=True

    # The parameters below represent the minimum possible values to create
    # functional nodes.
  16. max-lobur revised this gist Jul 7, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions local.conf
    Original file line number Diff line number Diff line change
    @@ -64,9 +64,9 @@ SWIFT_TEMPURL_KEY=111
    SWIFT_ENABLE_TEMPURLS=True

    # Create 3 virtual machines to pose as Ironic's baremetal nodes.
    IRONIC_VM_COUNT=3
    IRONIC_VM_SSH_PORT=22
    IRONIC_BAREMETAL_BASIC_OPS=True
    #IRONIC_VM_COUNT=3
    #IRONIC_VM_SSH_PORT=22
    #IRONIC_BAREMETAL_BASIC_OPS=True

    # The parameters below represent the minimum possible values to create
    # functional nodes.
  17. max-lobur revised this gist Jul 7, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions local.conf
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,7 @@ 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
  18. max-lobur created this gist Jul 7, 2015.
    86 changes: 86 additions & 0 deletions local.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,86 @@
    [[post-config|$NOVA_CONF]]
    [DEFAULT]
    remove_unused_base_images = True
    mage_cache_manager_interval = 0
    novncproxy_base_url = http://172.18.92.224:6080/vnc_auto.html

    [[local|localrc]]
    #RECLONE=yes # For subsequent Devstack rebuilds
    HOST_IP=172.18.92.224

    # 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 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=3
    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_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