<commit_before>#!/bin/bash

# If something goes wrong bail, don't continue to the end
set -e
set -o xtrace

# load defaults and functions
source $(dirname $0)/defaults
source $(dirname $0)/common-functions
source $(dirname $0)/functions

IMG_PATH=$DEVSTACK_PATH/files
BM_IMAGE=demo.qcow2

# load images into glance
function populate_glance() {
    # ensure there is a deployment ramdisk.
    if [ ! -e $IMG_PATH/$BM_DEPLOY_RAMDISK ]; then
        ~stack/baremetal-initrd-builder/bin/ramdisk-image-create -o $IMG_PATH/$BM_DEPLOY_RAMDISK -k $KERNEL_VER
        sudo cp /boot/vmlinuz-$KERNEL_VER $IMG_PATH/$BM_DEPLOY_KERNEL
        sudo chmod a+r $IMG_PATH/$BM_DEPLOY_KERNEL
    fi
    aki=$(load_image "aki" "aki-01" $IMG_PATH/$BM_DEPLOY_KERNEL)
    ari=$(load_image "ari" "ari-01" $IMG_PATH/$BM_DEPLOY_RAMDISK)

    # Load a simple single image for now.
    echo "loading demo image to glance"
    ami=$(load_image "ami" demo $IMG_PATH/$BM_IMAGE | head -n1)
    # associate deploy aki and ari to main AMI 
    # XXX: Going when this is moved to flavour.
    $GLANCE image-update --property "deploy_kernel_id=$aki" $ami
    $GLANCE image-update --property "deploy_ramdisk_id=$ari" $ami

    # create instance type (aka flavor)
    # - a 32 bit instance
    $NOVA_MANAGE instance_type create --name=x86_bm --cpu=1 --memory=512 --root_gb=0 --ephemeral_gb=0 --flavor=6 --swap=0 --rxtx_factor=1
    $NOVA_MANAGE instance_type set_key --name=x86_bm --key cpu_arch --value x86
    # - a 64 bit instance
    $NOVA_MANAGE instance_type create --name=x86_64_bm --cpu=1 --memory=512 --root_gb=0 --ephemeral_gb=0 --flavor=7 --swap=0 --rxtx_factor=1<commit_msg>Create a deploy ramdisk.<commit_after>#!/bin/bash

# If something goes wrong bail, don't continue to the end
set -e
set -o xtrace

# load defaults and functions
source $(dirname $0)/defaults
source $(dirname $0)/common-functions
source $(dirname $0)/functions

IMG_PATH=$DEVSTACK_PATH/files
BM_IMAGE=demo.qcow2

# load images into glance
function populate_glance() {
    # ensure there is a deployment ramdisk.
    if [ ! -e $IMG_PATH/$BM_DEPLOY_RAMDISK ]; then
        ~stack/baremetal-initrd-builder/bin/ramdisk-image-create deploy -o $IMG_PATH/$BM_DEPLOY_RAMDISK -k $KERNEL_VER
        sudo cp /boot/vmlinuz-$KERNEL_VER $IMG_PATH/$BM_DEPLOY_KERNEL
        sudo chmod a+r $IMG_PATH/$BM_DEPLOY_KERNEL
    fi
    aki=$(load_image "aki" "aki-01" $IMG_PATH/$BM_DEPLOY_KERNEL)
    ari=$(load_image "ari" "ari-01" $IMG_PATH/$BM_DEPLOY_RAMDISK)

    # Load a simple single image for now.
    echo "loading demo image to glance"
    ami=$(load_image "ami" demo $IMG_PATH/$BM_IMAGE | head -n1)
    # associate deploy aki and ari to main AMI 
    # XXX: Going when this is moved to flavour.
    $GLANCE image-update --property "deploy_kernel_id=$aki" $ami
    $GLANCE image-update --property "deploy_ramdisk_id=$ari" $ami

    # XXX: Crashes if the image is changed (flavour already exists)
    # create instance type (aka flavor)
    # - a 32 bit instance
    $NOVA_MANAGE instance_type create --name=x86_bm --cpu=1 --memory=512 --root_gb=0 --ephemeral_gb=0 --flavor=6 --swap=0 --rxtx_factor=1
    $NOVA_MANAGE instance_type set_key --name=x86_bm --key cpu_arch --value x86
    # - a 64 bit instance
    $NOVA_MANAGE instance_type create --name=x86_64_bm --cpu=1 --memory=512 --root_gb=0 --ephemeral_gb=0 --flavor=7 --swap=0 --rxtx_factor=1
{'fraction_non_alphanumeric': 0.11923076923076924, 'fraction_numerical': 0.0242603550295858, 'mean_word_length': 3.587516960651289, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4290765', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1214, 'n_words': 327}