<commit_before>#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/openstack"
source "$LIB_DIR/functions.guest"

exec_logfile

indicate_current_auto

# Download CirrOS image
function get_cirros {
    local file_name=$(basename $CIRROS_URL)
    local remote_dir=$(dirname $CIRROS_URL)
    local md5_f=$file_name.md5sum

    mkdir -p "$IMG_DIR"

    # Download to IMG_DIR to cache the data if the directory is shared
    # with the host computer.
    if [ ! -f "$IMG_DIR/$md5_f" ]; then
        wget -O - "$remote_dir/MD5SUMS"|grep "$file_name" > "$IMG_DIR/$md5_f"
    fi

    if [ ! -f "$IMG_DIR/$file_name" ]; then
        wget --directory-prefix="$IMG_DIR" "$CIRROS_URL"
    fi

    # Make sure we have image and MD5SUM on the basedisk.
    if [ "$IMG_DIR" != "$HOME/img" ]; then
        mkdir -p "$HOME/img"
        cp -a "$IMG_DIR/$file_name" "$IMG_DIR/$md5_f" "$HOME/img"
    fi

    cd "$HOME/img"
    md5sum -c "$HOME/img/$md5_f"
    cd -
}
get_cirros

function apt_download {

    sudo apt-get install -y --download-only "$@"

}

# Download packages for all nodes

# MySQL, RabbitMQ
apt_download mysql-server python-mysqldb rabbitmq-server

# Keystone
apt_download keystone

# Glance
apt_download glance

# Nova Controller
apt_download nova-api nova-cert nova-conductor nova-consoleauth \
    nova-novncproxy nova-scheduler python-novaclient

# Neutron Controller
apt_download neutron-server neutron-plugin-ml2 neutron-lbaas-agent

# Cinder Controller
apt_download cinder-api cinder-scheduler

# Horizon
apt_download openstack-dashboard memcached

# Cinder Volumes
apt_download lvm2 cinder-volume

# Nova Compute
apt_download nova-compute-qemu python-guestfs libguestfs-tools

# Neutron Compute
apt_download neutron-common neutron-plugin-ml2 \<commit_msg>labs: update apt pre-download for nova compute<commit_after>#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/openstack"
source "$LIB_DIR/functions.guest"

exec_logfile

indicate_current_auto

# Download CirrOS image
function get_cirros {
    local file_name=$(basename $CIRROS_URL)
    local remote_dir=$(dirname $CIRROS_URL)
    local md5_f=$file_name.md5sum

    mkdir -p "$IMG_DIR"

    # Download to IMG_DIR to cache the data if the directory is shared
    # with the host computer.
    if [ ! -f "$IMG_DIR/$md5_f" ]; then
        wget -O - "$remote_dir/MD5SUMS"|grep "$file_name" > "$IMG_DIR/$md5_f"
    fi

    if [ ! -f "$IMG_DIR/$file_name" ]; then
        wget --directory-prefix="$IMG_DIR" "$CIRROS_URL"
    fi

    # Make sure we have image and MD5SUM on the basedisk.
    if [ "$IMG_DIR" != "$HOME/img" ]; then
        mkdir -p "$HOME/img"
        cp -a "$IMG_DIR/$file_name" "$IMG_DIR/$md5_f" "$HOME/img"
    fi

    cd "$HOME/img"
    md5sum -c "$HOME/img/$md5_f"
    cd -
}
get_cirros

function apt_download {

    sudo apt-get install -y --download-only "$@"

}

# Download packages for all nodes

# MySQL, RabbitMQ
apt_download mysql-server python-mysqldb rabbitmq-server

# Keystone
apt_download keystone

# Glance
apt_download glance

# Nova Controller
apt_download nova-api nova-cert nova-conductor nova-consoleauth \
    nova-novncproxy nova-scheduler python-novaclient

# Neutron Controller
apt_download neutron-server neutron-plugin-ml2 neutron-lbaas-agent

# Cinder Controller
apt_download cinder-api cinder-scheduler

# Horizon
apt_download openstack-dashboard memcached

# Cinder Volumes
apt_download lvm2 cinder-volume

# Nova Compute
apt_download nova-compute-qemu sysfsutils

# Neutron Compute
apt_download neutron-common neutron-plugin-ml2 \
{'fraction_non_alphanumeric': 0.11159029649595688, 'fraction_numerical': 0.007008086253369272, 'mean_word_length': 3.6445556946182727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '650784', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1310, 'n_words': 333}