diff options
author | Tim Rozet <trozet@redhat.com> | 2016-01-05 23:40:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-05 23:40:00 +0000 |
commit | d71330a6abf114050893d52497a5de05c19d70e1 (patch) | |
tree | 4c7e356457fc33f3f018d3eee079b07ff207323d | |
parent | d440624d1965100d8c68c3da1466b40b3e4d8f6d (diff) | |
parent | c475784616c60546f228fbdd75f3fe547f5079ac (diff) |
Merge "Image fix to force flavor to be 39GB"
-rwxr-xr-x | build/instack.sh | 16 | ||||
-rwxr-xr-x | ci/deploy.sh | 16 |
2 files changed, 29 insertions, 3 deletions
diff --git a/build/instack.sh b/build/instack.sh index 57af7f96..e52e3e55 100755 --- a/build/instack.sh +++ b/build/instack.sh @@ -254,6 +254,22 @@ LIBGUESTFS_BACKEND=direct virt-customize --upload ../opendaylight-puppet-neutron ## END WORK AROUND popd +# resize instack machine +echo "Checking if instack needs to be resized..." +instack_size=$(LIBGUESTFS_BACKEND=direct virt-filesystems --long -h --all -a stack/instack.qcow2 |grep device | grep -Eo "[0-9\.]+G" | sed -n 's/\([0-9][0-9]*\).*/\1/p') +if [ "$instack_size" -lt 30 ]; then + qemu-img create -f qcow2 -o preallocation=metadata newinstack.qcow2 30G + LIBGUESTFS_BACKEND=direct virt-resize --expand /dev/sda1 stack/instack.qcow2 newinstack.qcow2; + LIBGUESTFS_BACKEND=direct virt-customize -a newinstack.qcow2 --run-command 'xfs_growfs -d /dev/sda1 || true' + LIBGUESTFS_BACKEND=direct virt-sparsify newinstack.qcow2 stack/instack.qcow2 + new_size=$(LIBGUESTFS_BACKEND=direct virt-filesystems --long -h --all -a stack/instack.qcow2 |grep device | grep -Eo "[0-9\.]+G" | sed -n 's/\([0-9][0-9]*\).*/\1/p') + if [ "$new_size" -lt 30 ]; then + echo "Error resizing instack machine, disk size is ${new_size}" + exit 1 + else + echo "instack successfully resized" + fi +fi # move and Sanitize private keys from instack.json file mv stack/instackenv.json instackenv-virt.json sed -i '/pm_password/c\ "pm_password": "INSERT_STACK_USER_PRIV_KEY",' instackenv-virt.json diff --git a/ci/deploy.sh b/ci/deploy.sh index 47b82353..8b5fa539 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -458,6 +458,9 @@ EOI # copy stack's ssh key to this users authorized keys ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys + # disable requiretty for sudo + ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "sed -i 's/Defaults\s*requiretty//'" /etc/sudoers + # configure undercloud on Undercloud VM echo "Running undercloud configuration." echo "Logging undercloud configuration to instack:/home/stack/apex-undercloud-install.log" @@ -537,9 +540,16 @@ openstack baremetal import --json instackenv.json openstack baremetal configure boot openstack baremetal introspection bulk start echo "Configuring flavors" -openstack flavor list | grep baremetal || openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 baremetal -openstack flavor list | grep control || openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 control -openstack flavor list | grep compute || openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 compute +for flavor in baremetal control compute; do + echo -e "${blue}INFO: Updating flavor: \${flavor}${reset}" + if openstack flavor list | grep \${flavor}; then + openstack flavor delete \${flavor} + fi + openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 \${flavor} + if ! openstack flavor list | grep \${flavor}; then + echo -e "${red}ERROR: Unable to create flavor \${flavor}${reset}" + fi +done openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" baremetal openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="control" control openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="compute" compute |